From 3d5fc5586ed4d1179a4f9136115d17b31f56b957 Mon Sep 17 00:00:00 2001 From: Sewmina Date: Tue, 18 Mar 2025 15:17:52 +0530 Subject: [PATCH] vwap long signal --- CoinWatch.cs | 10 ++++++--- Patterns.cs | 63 ++++++++++++++++++++++++++++++++++++++++++++++++++-- Picasso.cs | 13 +++++++++-- TAReport.cs | 4 +++- 4 files changed, 82 insertions(+), 8 deletions(-) diff --git a/CoinWatch.cs b/CoinWatch.cs index 8390920..dfd6eff 100644 --- a/CoinWatch.cs +++ b/CoinWatch.cs @@ -154,7 +154,8 @@ namespace SignalsTest reports[i].isBullFlag = Confirmations.IsBullFlag(reports, i); reports[i].RelativeVolumeIndex = Confirmations.GetRelativeVolumeIndex(reports,i); - reports[i].isVwapSignal = Patterns.isVwapThing1(reports, i); + reports[i].isVwapShort = Patterns.isVwapShort(reports, i); + reports[i].isVwapLong = Patterns.isVwapLong(reports,i); } Console.WriteLine($"Drawing chart for {reports.Count} candles, Coin: {symbol}, ceil:{max}, floor:{min}"); @@ -205,8 +206,11 @@ namespace SignalsTest // triggers+=$"Possible Bull Flag\n"; // } - if(reports[reports.Count-1].isVwapSignal){ - triggers+=$"VWAP Signal\n"; + if(reports[reports.Count-1].isVwapShort){ + triggers+=$"VWAP Short Signal\n"; + } + if(reports[reports.Count-1].isVwapLong){ + triggers+=$"VWAP Long Signal\n"; } if (triggers != "") { diff --git a/Patterns.cs b/Patterns.cs index d5d2cf5..47abbfe 100644 --- a/Patterns.cs +++ b/Patterns.cs @@ -204,7 +204,7 @@ public static class Patterns{ } - public static bool isVwapThing1(List responses, int index, int length = 10){ + public static bool isVwapShort(List responses, int index, int length = 10){ if(index < length * 2){ return false; } @@ -259,7 +259,66 @@ public static class Patterns{ bool final = isRed && isSolid && isBelowVwap && beenAcrossVwap && mostlyGreen; if(final){ - Console.WriteLine($"Vwap signal on {curReport.pair}({curReport.interval}m) : {highCount} / {lowCount} = {highCount/lowCount} , {candlesSinceLastHigh} last High"); + Console.WriteLine($"Vwap(S) signal on {curReport.pair}({curReport.interval}m) : {highCount} / {lowCount} = {highCount/lowCount} , {candlesSinceLastHigh} last High"); + } + return final; + } + + public static bool isVwapLong (List responses, int index, int length = 10){ + if(index < length * 2){ + return false; + } + + float lowCount =0; + float highCount =0; + decimal hh= 0; + decimal ll = 10000000000; + + float avgSize = 0; + int candlesSinceLastHigh = 0; + int greenCandlesAmount =0; + for(int i=index; i > index-length; i--){ + candlesSinceLastHigh++; + + if(responses[i].RSI50 > 50){ + greenCandlesAmount++; + } + if(responses[i].candle.High > responses[i].VwapWeekly){ + candlesSinceLastHigh=0; + highCount++; + + if(hh < responses[i].High){ + hh = responses[i].High; + } + }else if(responses[i].candle.Low < responses[i].VwapWeekly){ + lowCount++; + + if(ll > responses[i].Low){ + ll = responses[i].Low; + } + } + + avgSize += responses[i].candle.getCandleLength(); + } + avgSize /= length; + + TAReport curReport = responses[index]; + bool isAboveVwap = curReport.Open > curReport.VwapWeekly || curReport.Close > curReport.VwapWeekly; + bool isSolid = IsSolid(curReport.candle) ; + bool isGreen = curReport.RSI50 >= 50; + bool beenAcrossVwap = (highCount / lowCount) > 0; + bool mostylRed = greenCandlesAmount < length /3f; + + //These did not matter + bool closeToVwap = curReport.Open < hh && curReport.Open > ll; + bool mostlyBelowVwap = (highCount / lowCount) < 0.3f; + bool crossedRecently = candlesSinceLastHigh < (length/3); + bool isLarge = curReport.candle.getCandleLength() > avgSize; + + bool final = isGreen && isSolid && isAboveVwap && beenAcrossVwap && mostylRed; + + if(final){ + Console.WriteLine($"Vwap(L) signal on {curReport.pair}({curReport.interval}m) : {highCount} / {lowCount} = {highCount/lowCount} , {candlesSinceLastHigh} last High"); } return final; } diff --git a/Picasso.cs b/Picasso.cs index 38b507f..30e6421 100644 --- a/Picasso.cs +++ b/Picasso.cs @@ -123,9 +123,9 @@ public class Picasso{ #endregion #region VWAP - if(reports[i].isVwapSignal){ + if(reports[i].isVwapShort){ - string text = $"VWAP"; + string text = $"VW(S)"; // Position text below the candle PointF textPosition = new PointF(i * widthMultiplier - 15, lowVal + 20); @@ -133,6 +133,15 @@ public class Picasso{ img.Mutate(ctx => ctx.DrawText(text, indicatorFont, Color.Green, textPosition)); img.Mutate(ctx=>ctx.DrawLine(Color.DarkRed, 0.5f, [new PointF(i * widthMultiplier, 0), new PointF(i * widthMultiplier, height)])); //Draw Vertical guide } + if(reports[i].isVwapLong){ + string text = $"VW(L)"; + + // Position text below the candle + PointF textPosition = new PointF(i * widthMultiplier - 15, lowVal + 20); + + img.Mutate(ctx => ctx.DrawText(text, indicatorFont, Color.Green, textPosition)); + img.Mutate(ctx=>ctx.DrawLine(Color.DarkGreen, 0.5f, [new PointF(i * widthMultiplier, 0), new PointF(i * widthMultiplier, height)])); + } #endregion #region TBC diff --git a/TAReport.cs b/TAReport.cs index c2b4e95..2af918e 100644 --- a/TAReport.cs +++ b/TAReport.cs @@ -54,7 +54,9 @@ namespace SignalsTest public decimal Stochastic = 0; public decimal StochasticK3 = 0; public float RelativeVolumeIndex = 0; - public bool isVwapSignal = false; + public bool isVwapShort = false; + public bool isVwapLong = false; + public bool STUp = false; public bool TGOR=false; public static TAReport Generate(string _pair, int _interval, List response, int index, List history)