Help with Higher Lows Price sync with Higher Low MACD when candle crosses MA
Forums › ProRealTime English forum › ProBuilder support › Help with Higher Lows Price sync with Higher Low MACD when candle crosses MA
- This topic has 72 replies, 3 voices, and was last updated 5 years ago by GraHal.
-
-
09/10/2019 at 9:00 AM #10703309/10/2019 at 10:08 AM #107038
So…the end result with cycle highs and lows :-).
I tested it and it works for 90%. I just see one more last thing. See the attached image.
I have some parameters which you can fill in yourself. like the MACD, Moving Average, and in the signal in the chart I have chosen to set 2 targets and 1 stoploss. So yo can see of the TA or SL will be reached first.
.
It would be great to have one green arrow up above the bar with the signal when the Target1 has reached first, to have 2 green arrows up when Target2 has been reached, and to have a red arrow down when the Stoploss has been reached first.
.
My gratitude is BIG. Thank you Vonasi1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677DEFPARAM calculateonlastbars = 1000macdl = macdline[ShortTermMA,LongTermMA,Periods]macds = exponentialaverage[Periods](macdl)//start of cycle lowIf macdl =< macds and macdl[1] > macds[1] thenmacdlowest2 = macdlowestlowestprice2 = lowestpriceincyclelow = 1macdlowest = macdlLowestPrice = lowendif//End of cycleIf macdl > macds and macdl[1] < macds[1] thenincyclelow = 0endif//lowest macd and price in cycleif incyclelow thenmacdlowest = min(macdlowest, macdl)lowestPrice = min(lowestprice, low)c1 = open < average[ma]c2 = close > average[ma]c3 = macdlowest > macdlowest2c4 = lowestprice > lowestprice2if c1 and c2 and c3 and c4 thenDRAWSEGMENT (barindex, close+target1, barindex, close+target2)COLOURED(0,250,0)DRAWSEGMENT (barindex, close+target1, barindex+1, close+target1)COLOURED(0,250,0)DRAWTEXT("TA1", barindex-1, close+target1, Dialog, Standard, 10) COLOURED(0,0,0)DRAWSEGMENT (barindex, close+target2, barindex+1, close+target2)COLOURED(0,250,0)DRAWTEXT("TA2", barindex-1, close+target2, Dialog, Standard, 10) COLOURED(0,0,0)DRAWSEGMENT (barindex, close-stoploss, barindex+1, close-stoploss)COLOURED(250,0,100)DRAWSEGMENT (barindex, close-(stoploss-0.25), barindex, close-stoploss)COLOURED(250,0,100)DRAWTEXT("SL", barindex-1, close-stoploss, Dialog, Standard, 10) COLOURED(0,0,0)DRAWTEXT("LH", barindex, close+target2+0.75, Dialog, Standard, 14) COLOURED(0,250,0)endifendif//start of cycle highIf macdl => macds and macdl[1] < macds[1] thenmacdhighest2 = macdhighesthighestprice2 = highestpriceincyclehigh = 1macdhighest = macdlhighestPrice = highendif//End of cycleIf macdl < macds and macdl[1] > macds[1] thenincyclehigh = 0endif//highest macd and price in cycle highif incyclehigh thenmacdhighest = min(macdhighest, macdl)highestPrice = min(highestprice, low)c1a = open > average[ma]c2a = close < average[ma]c3a = macdhighest < macdhighest2c4a = highestprice < highestprice2if c1a and c2a and c3a and c4a thenDRAWSEGMENT (barindex, close-target1, barindex, close-target2)COLOURED(0,250,0)DRAWSEGMENT (barindex, close-target1, barindex+1, close-target1)COLOURED(0,250,0)DRAWTEXT("TA1", barindex-1, close-target1, Dialog, Standard, 10) COLOURED(0,0,0)DRAWSEGMENT (barindex, close-target2, barindex+1, close-target2)COLOURED(0,250,0)DRAWTEXT("TA2", barindex-1, close-target2, Dialog, Standard, 10) COLOURED(0,0,0)DRAWSEGMENT (barindex, close+stoploss, barindex+1, close+stoploss)COLOURED(250,0,100)DRAWSEGMENT (barindex, close+(stoploss-0.25), barindex, close+stoploss)COLOURED(250,0,100)DRAWTEXT("SL", barindex-1, close+stoploss, Dialog, Standard, 10) COLOURED(0,0,0)DRAWTEXT("HL", barindex, close-target2-0.75, Dialog, Standard, 14) COLOURED(250,0,0)endifendifreturn09/10/2019 at 10:20 AM #10704009/10/2019 at 10:25 AM #10704209/10/2019 at 10:32 AM #10704309/10/2019 at 10:48 AM #107044So here the last version.
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677DEFPARAM calculateonlastbars = 1000macdl = macdline[ShortTermMA,LongTermMA,Periods]macds = exponentialaverage[Periods](macdl)//start of cycle lowIf macdl =< macds and macdl[1] > macds[1] thenmacdlowest2 = macdlowestlowestprice2 = lowestpriceincyclelow = 1macdlowest = macdlLowestPrice = lowendif//End of cycleIf macdl > macds and macdl[1] < macds[1] or macdl < macdlowest2 thenincyclelow = 0endif//lowest macd and price in cycleif incyclelow thenmacdlowest = min(macdlowest, macdl)lowestPrice = min(lowestprice, low)c1 = open < average[ma]c2 = close > average[ma]c3 = macdlowest > macdlowest2c4 = lowestprice > lowestprice2if c1 and c2 and c3 and c4 thenDRAWSEGMENT (barindex, close+target1, barindex, close+target2)COLOURED(0,250,0)DRAWSEGMENT (barindex, close+target1, barindex+1, close+target1)COLOURED(0,250,0)DRAWTEXT("TA1", barindex-1, close+target1, Dialog, Standard, 10) COLOURED(0,0,0)DRAWSEGMENT (barindex, close+target2, barindex+1, close+target2)COLOURED(0,250,0)DRAWTEXT("TA2", barindex-1, close+target2, Dialog, Standard, 10) COLOURED(0,0,0)DRAWSEGMENT (barindex, close-stoploss, barindex+1, close-stoploss)COLOURED(250,0,100)DRAWSEGMENT (barindex, close-(stoploss-0.25), barindex, close-stoploss)COLOURED(250,0,100)DRAWTEXT("SL", barindex-1, close-stoploss, Dialog, Standard, 10) COLOURED(0,0,0)DRAWTEXT("LH", barindex, close+target2+0.75, Dialog, Standard, 14) COLOURED(0,250,0)endifendif//start of cycle highIf macdl => macds and macdl[1] < macds[1] thenmacdhighest2 = macdhighesthighestprice2 = highestpriceincyclehigh = 1macdhighest = macdlhighestPrice = highendif//End of cycleIf macdl < macds and macdl[1] > macds[1] or macdl > macdhighest2 thenincyclehigh = 0endif//highest macd and price in cycle highif incyclehigh thenmacdhighest = min(macdhighest, macdl)highestPrice = min(highestprice, low)c1a = open > average[ma]c2a = close < average[ma]c3a = macdhighest < macdhighest2c4a = highestprice < highestprice2if c1a and c2a and c3a and c4a thenDRAWSEGMENT (barindex, close-target1, barindex, close-target2)COLOURED(0,250,0)DRAWSEGMENT (barindex, close-target1, barindex+1, close-target1)COLOURED(0,250,0)DRAWTEXT("TA1", barindex-1, close-target1, Dialog, Standard, 10) COLOURED(0,0,0)DRAWSEGMENT (barindex, close-target2, barindex+1, close-target2)COLOURED(0,250,0)DRAWTEXT("TA2", barindex-1, close-target2, Dialog, Standard, 10) COLOURED(0,0,0)DRAWSEGMENT (barindex, close+stoploss, barindex+1, close+stoploss)COLOURED(250,0,100)DRAWSEGMENT (barindex, close+(stoploss-0.25), barindex, close+stoploss)COLOURED(250,0,100)DRAWTEXT("SL", barindex-1, close+stoploss, Dialog, Standard, 10) COLOURED(0,0,0)DRAWTEXT("HL", barindex, close-target2-0.75, Dialog, Standard, 14) COLOURED(250,0,0)endifendifreturn09/10/2019 at 11:13 AM #10704709/10/2019 at 12:44 PM #10704809/10/2019 at 12:52 PM #10704909/10/2019 at 12:53 PM #10705009/10/2019 at 1:03 PM #107052About the green and red arrows I want to see if it reaches target befor stoploss or stoploss befor target, I made this, but this isn’t right
12345678910111213141516171819if Target1 < close + 10 and SL > close - 5 then // start cycleinposition = 1endifif Target1 => close + 10 or SL =< close - 5 theninposition = 0endifif inposition thenc1 = close => target1c2 = close =< SLif c1 thendrawarrowup(barindex,low)coloured(0,250,0)endifif c2 thendrawarrowdown(barindex,low)coloured(250,0,0)endifendifreturn09/10/2019 at 1:14 PM #10705309/10/2019 at 1:22 PM #10705709/11/2019 at 9:18 PM #107281Hi Vonasi,
I still miss a lot of signals in the cycle high version and I really can’t see what is wrong. The cycle low version works great.
I have checked over and over again, but I can’t see find the error.
See the attachment.123456789101112131415161718192021222324252627282930DEFPARAM calculateonlastbars = 1000macdl = macdline[ShortTermMA,LongTermMA,Periods]macds = exponentialaverage[Periods](macdl)//start of cycle highIf macdl => macds and macdl[1] < macds[1] thenmacdhighest2 = macdhighesthighestprice2 = highestpriceincyclehigh = 1macdhighest = macdlHighestPrice = highendif//End of cycle highIf macdl < macds and macdl[1] > macds[1] thenincyclehigh = 0endif//highest macd and price in cycle highif incyclehigh thenmacdhighest = max(macdhighest, macdl)highestPrice = max(highestprice, high)c1 = open > average[ma]c2 = close < average[ma]c3 = macdhighest < macdhighest2c4 = highestprice < highestprice2if c1 and c2 and c3 and c4 then09/11/2019 at 9:19 PM #107282This is the cycle low verion which works perfect.
123456789101112131415161718192021222324252627282930DEFPARAM calculateonlastbars = 1000macdl = macdline[ShortTermMA,LongTermMA,Periods]macds = exponentialaverage[Periods](macdl)//start of cycle lowIf macdl =< macds and macdl[1] > macds[1] thenmacdlowest2 = macdlowestlowestprice2 = lowestpriceincyclelow = 1macdlowest = macdlLowestPrice = lowendif//End of cycle lowIf macdl > macds and macdl[1] < macds[1] thenincyclelow = 0endif//lowest macd and price in cycleif incyclelow thenmacdlowest = min(macdlowest, macdl)lowestPrice = min(lowestprice, low)c1 = open < average[ma]c2 = close > average[ma]c3 = macdlowest > macdlowest2c4 = lowestprice => lowestprice2if c1 and c2 and c3 and c4 then -
AuthorPosts
Find exclusive trading pro-tools on