Steve Nison method indicator
Forums › ProRealTime English forum › ProBuilder support › Steve Nison method indicator
- This topic has 6 replies, 2 voices, and was last updated 3 years ago by robertogozzi.
-
-
09/18/2021 at 1:36 PM #177841
I would like to exchange ideas on how to program Steve Nison’s candlestick pattern.
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394// YS-CandlesPatternV1.0//(choose 0=No Trend check, 1=MACD, 2=SAR, 3=Directional Movement, 4=Moving Averages crossing [default], 5=Stochastic)TDS=4//text color// white = 255,255,255 ; black = 0,0,0r = 0g = 0b = 0atr = averagetruerange[10](close)*0.5body=close-openabody=abs(body)if range>0 thenratio=abody/rangeelseratio=0endifmiddle=(open+close)/2if body>0 thenbodytop=closebodybottom=openelsebodytop=openbodybottom=closeendifshadowtop=high-bodytopshadowbottom=bodybottom-lowlongcandle= (ratio>0.6)DojiSize = 0.05data=(abs(open - close) <= (high - low) * DojiSize)if data thenDRAWTEXT("Dji", barindex, high+atr*dis1, Dialog, Standard, 12) COLOURED(R,G,B, fade1)endifif close[1]<close and close<open[1] and close[1]<open and open<open[1] thenHara=3elseNohara=4endif//Trend Detectionif TDS=0 thenTrendUp=1TrendDown=1elseif TDS=1 thenTrendUp=(MACDline[12,26,9](close)>0 AND MACD[12,26,9](close)>0)TrendDown=(MACDline[12,26,9](close)<0 AND MACD[12,26,9](close)<0)elseif TDS=2 thenTrendUp=(SAR[0.02,0.02,0.2]<low)TrendDown=(SAR[0.02,0.02,0.2]>high)elseif TDS=3 thenTrendUp=(ADX[14]>23 AND DI[14](close)>0)TrendDown=(ADX[14]>23 AND DI[14](close)<0)elseif TDS=4 thenTrendUp=(ExponentialAverage[2](close)>ExponentialAverage[4](close))TrendDown=(ExponentialAverage[2](close)<ExponentialAverage[4](close))elseif TDS=5 thenTrendUp=(Stochastic[14,3](close)>Average[5](Stochastic[14,3](close)))TrendDown=(Stochastic[14,3](close)<Average[5](Stochastic[14,3](close)))endifendifendifendifendifendifsize1=10y=20size3=30fade1=10fade2=100fade3=200dis1=1dis15=1.5dis2=2dis3=5dis4=10////Bearish Signal Falling3Method2 p142if (open[5]>close[5] AND close[5]<open[4] and open[4]<open[3] and open[3]<open[2] and open[2]<open[1] and close[1]<open AND open>close) or (open[4]>close[4] AND close[4]<open[3] and open[3]>open[2] and open[2]>open[1] and close[1]<open AND open>close) or (open[3]>close[3] AND close[3]<open[2] and open[2]>open[1] and close[1]<open AND open>close)thenDRAWTEXT("Falling3Method1",barindex,high[1]+atr*dis1, Dialog, Standard, 10) COLOURED(255,0,0,fade2)DRAWARROWdown(barindex,high[1]) COLOURED(255,0,0,fade3)endifReturnThe those three middle white candles (open[3]<close[3] AND close[3]>open[2] and open[2]<open[1] and close[1]>open AND open<close) can possibly continue not only 3 but also 7, 8, 9… middle candles. Then, the code will be too long to express it.
Alternatively, I have re-coded it using the while loop as the below.
1234567//Bearish Signal Falling3Method2 p126//////////////////////////////////////////////////////////////////////i=1while (open[i+4]>close[i+3] AND close[i+3]<open[i+2] and open[i+2]>open[i+1] and close[i+1]<open AND open>close) and i < 30 DOi=i+1DRAWTEXT("Falling3Method2", barindex,low[1]-atr*dis2, Dialog, Standard, 10) COLOURED(0,155,10,fade2)DRAWARROWUP(barindex,low[1]-atr*dis1) COLOURED(0,155,10,fade2)WendBut it has been unsuccessful. I would appreciate it very much if there is any advice to make it shorter code. Thank you.
09/18/2021 at 4:17 PM #177851This is the “Rising Three”. I added a minimum BODY size for the first and last candles. If you don’t want to apply it then uncomment line 5:
123456789101112131415161718192021222324252627282930313233343536373839404142Bullish = close > openBearish = close < openBody = abs(close - open)MinSize = average[100](Body)//MinSize = 0BarID = 0//detect the BULLISH candle prior to the current oneFOR i = 1 TO BarIndex//if found, then all other canndles in between the two bullish ones can be checkedIF Bullish[i] THENBarID = i //ID of the leftmost bullish candle and...hh = high[i] //... its datall = low[i]Size = range[i]IF Size < MinSize THEN //check if its size is large enough...BarID = 0 //... or exitBreakENDIFIF BarID >= 3 THEN //now check the 2+ candles in betweeen...FOR j = (BarID - 1) DOWNTO 1 //... which must ALL be within the range of the leftmost Bullish candle...IF not ((high[j] <= hh) AND (low[j] >= ll)) THENBarID = 0 //... or exitbreakENDIFNEXTELSEBarID = 0 //no pattern found if there are lesss than 2 Bearish candles in betweenENDIFBreakENDIFNEXTIF BarID >= 3 THENL1 = (close > close[BarID])L2 = (open > close[1])IF Body < MinSize THEN //no pattern found if also the current (rightmost) Bullish bar is < to the minimum SizeL1 = 0ENDIFCond = L1 AND L2ELSECond = 0ENDIFRETURN Cond AS "Three Rising"09/19/2021 at 8:13 AM #177884Thank you very much for your advice. It looks great idea. I will have a look into it.
However, for others, here is a more clear picture of what I am trying to do. The challenge is that how can we express the possibly large number of white candle bars (not only 3 bars) as code, using while or for a loop.
09/19/2021 at 8:37 AM #17788709/19/2021 at 12:52 PM #17790709/19/2021 at 2:27 PM #177915My code can find any number of inside candles, from 2 on…
You code seems not to be correct, as the rule says that ALL inside candles must be within the RANGE of the leftmost candle in the pattern.
09/22/2021 at 10:37 AM #178094I have coded a version detecting both the FALLING and the RISING method, any candle in between from 2 to… N.
I have attached 3 pics of the indicator as it shows on charts and the two ITF files (screener + indicator).
1 user thanked author for this post.
-
AuthorPosts
Find exclusive trading pro-tools on