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/06/2019 at 2:12 PM #106711
Hello all,
What I want to see is this:A Cycle Low is the period when the MACD < Signal line. It starts when the MACD crosses under the Signal line and ends when the MACD crosses over the Signal line. The MACD Cycle Lowest is the Lowest MACD during that Cycle Low, measured after the Cycle has finished,
I want a Signal when:
– a bullish candle crosses over the bullish SMA50at the close of the candle and
– the MACD at that > previous MACD Cycle Lowest and
– the MACD at that moment =< Signal line and
– the price low at that moment > price low at the previous MACD Cycle Lowest.Where I fail is how to describe the period of the cycle low from the MACD, the start and the end and how to define the lowest MACD and the the lowes price in that MACD-period.
I only have the long version here to keep it readable. When it works I will complete it with the short version included.Thanks a lot,
Marc12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152// Higher Lows Price in sync with Higher Low MACD//indicators SMA50 and MACDMA = Average[50]LM = MACDline[12,26,9]//CCL = CONDITIONS CANDLES IN RELATION TO AVERAGE FOR LONG POSITION//bullish candle crosses over bullish Average.C1 = ma[1] =< ma and open < m50 and close > m50// The body of the previous candle needs to be below the AverageC2 = open[1] < m50 and close[1] < m50CCL = c1 and c2// CYCLE LOW MACD (MCL), the lowest MACD in the period when MACD < Signalline// Comparing MACD in a next running CYCLE LOW at a close of a bar with the previous CYCLE LOW.// START MCLMD1 = LM(close) =< Signalline and LM[1] > LM(close)If MD1 then MCL = 1//END OF CYCLE LOW MACDMD2 = LM(close) => Signalline and LM[1] < LM(close)If MD2 then MCL = 0//DEFINING MACD CYLCE LOWEST, MDLSTMCLST = MCL [lowest]//MACD higher lowMHL = [MCLST][1] < MCL//PRICE, PHL is PRICE LOW > PRICE LOW AT THE PREVIOUS,PHL = low > low [MCLST]// SIGNAL LONGIf CCA and MHL and PHL thenDRAWSEGMENT (barindex, close+1.7, barindex, close+2.2)COLOURED(0,250,0)DRAWSEGMENT (barindex, close+1.7, barindex+1, close+1.7)COLOURED(0,250,0)DRAWTEXT("1.7", barindex-1, close+1.7, Dialog, Standard, 10) COLOURED(0,0,0)DRAWSEGMENT (barindex, close+2.2, barindex+1, close+2.2)COLOURED(0,250,0)DRAWTEXT("2.2", barindex-1, close+2.2, Dialog, Standard, 10) COLOURED(0,0,0)DRAWSEGMENT (barindex, close+1, barindex+1, close+1)COLOURED(100,100,100)DRAWSEGMENT (barindex, close+1.7, barindex, close+1)COLOURED(100,100,100)DRAWTEXT("1.0", barindex-1, close+1, Dialog, Standard, 10) COLOURED(100,100,100)DRAWTEXT("F1", barindex, close+2.8, Dialog, Standard, 14) COLOURED(0,250,0)DRAWSEGMENT (barindex, close-sl, barindex+1, close-sl)COLOURED(250,0,100)DRAWSEGMENT (barindex, close-(sl-0.25), barindex, close-sl)COLOURED(250,0,100)endifendifendifreturn09/06/2019 at 2:15 PM #10671209/07/2019 at 2:01 PM #10677909/07/2019 at 3:08 PM #106786I find your use of variable names very challenging! Not sure I am 100% on top of your code but perhaps you mean something like this?
123456789101112131415161718192021//start of cycleMD1 = LM(close) <= Signalline and LM[1] > LM(close)If MD1 thenMCL = 1mclst = LMendif//END OF CYCLE LOW MACDMD2 = LM(close) => Signalline and LM[1] < LM(close)If MD2 thenMCL = 0endif//lowest LM in cycleif mcl thenmclst = min(mclst, LM)endif<br>Not tested.
09/08/2019 at 1:32 PM #106832Hi Vonasi,
Thanks a lot for your response. I am still looking for a better and clearer way of naming the parameters. I can imagine it is challenging, sorry for that.
I have added your lines ( see attachment), but I get a syntax error in your line 9 ( I know I coded that one :-). So something isn’t right in that line.How can I copy and paste the coding including the line numbers on the left? When I copy and paste it doesn’t iclude the lines.
1234567891011121314151617181920212223242526272829303132333435363738394041// Higher Lows Price in sync with Higher Low MACD//indicators SMA50 and MACDMA = Average[50]LM = MACDline[12,26,9]//CCL = CONDITIONS CANDLES IN RELATION TO AVERAGE FOR LONG POSITION//bullish candle crosses over bullish Average.C1 = ma[1] =< ma and open < m50 and close > m50// The body of the previous candle needs to be below the AverageC2 = open[1] < m50 and close[1] < m50CCL = c1 and c2// CYCLE LOW MACD (MCL), the lowest MACD in the period when MACD < Signalline// Comparing MACD in a next running CYCLE LOW at a close of a bar with the previous CYCLE LOW.// START MCLMD1 = LM(close) <= Signalline and LM[1] > LM(close)If MD1 thenMCL = 1mclst = LMendif//END OF CYCLE LOW MACDMD2 = LM(close) => Signalline and LM[1] < LM(close)If MD2 thenMCL = 0endif//lowest LM in cycleif mcl thenmclst = min(mclst, LM)endif// SIGNAL LONGIf CCA and MHL and PHL then09/08/2019 at 2:04 PM #10683309/08/2019 at 2:12 PM #106834How can I copy and paste the coding including the line numbers on the left? When I copy and paste it doesn’t iclude the lines.
You can’t.
09/08/2019 at 2:53 PM #106837I simplified the whole thing. I hope these variables are better readable. I stille get a syntax error at line 19.
And… I see the line numbers in the left show up after I submitted.1234567891011121314151617181920212223242526272829//--- Higher Lows Price in sync with Higher Low MACD//---settingsMA = Average[ma]Mline = MACDline[12,26,9]SLine = ExponentialAverage[9]once lastpoint = 0//MACDline Cycle Lowif (MLine crosses under Sline and Mline =< Sline) then //MACDline Cycle LowMCL = 1PriceLow = lowest[mcl](low)Macdlow = lowest [mcl](Sline)endifPricelow[1] =< Pricelow and MACDlow[1] =< MACDlow thenDRAWTEXT("■",TOPx,TOPy,Dialog,Bold,20) coloured(0,200,0,255)lastpoint = -1lastX = BOTxlastY = BOTyendifreturn09/08/2019 at 3:00 PM #10683809/08/2019 at 3:26 PM #106842I stille get a syntax error at line 19.
Haven’t you missed an If at the beginning of Line 19 or is it a copy and paste error?
09/08/2019 at 3:38 PM #10684809/08/2019 at 3:58 PM #10685309/08/2019 at 4:03 PM #10685512PriceLow = lowest[mcl](low)Macdlow = lowest [mcl](Sline)This does not do what you are trying to do. With mcl = 1 it just tells you what the lowest low of the current bar is – which is always going to be the low! Same for the signal line. If the next low is higher then it will just change to that value.
You need to go back to how I showed you and use the MIN instruction to store the lowest value while a flag to say you are in your low cycle is set.
09/08/2019 at 5:18 PM #106864I have now the MACD Cycle Low and MACD Cycle High and the crossings from the close over and under the SMA. I don’t get a Syntax Error anymore, but I also don’t get any Signal in my chart.
AND…. I really appreciate all your help as I started from scratch with coding a few weeks ago.1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253//--- Higher Lows Price in sync with Higher Low MACDonce lastpoint = 0//---settingsMA = Average[ave]Mline = MACDline[12,26,9]SLine = ExponentialAverage[9]//---candle crosses Moving AverageXH = close crosses over maXL = close crosses under MA//MACDline Cycle Lowif (MLine crosses under Sline and Mline =< Sline) then //---MACDline Cycle LowMCL = -1elseMCL = 0endifif (MLine crosses over Sline and Mline => Sline) then //---MACDline Cycle HighMCH = 1elseMCh = 0endifif MCL = -1 thenBOTy = lowest[mcl](low)BOTx = barindex[mcl]endifif MCL = 1 thenTOPy = highest [mcl](high)TOPx = barindex[mcl]endifif XH and MCL>0 and (lastpoint=1 or lastpoint=0) thenDRAWSEGMENT(lastX,lastY,TOPx,TOPy) COLOURED(0,0,0)DRAWTEXT("■",TOPx,TOPy,Dialog,Bold,20) coloured(0,0,0)lastpoint = 1lastX = TOPxlastY = TOPyendifif XL and MCH<0 and (lastpoint=-1 or lastpoint=0) thenDRAWSEGMENT(lastX,lastY,BOTx,BOTy) COLOURED(0,0,0)DRAWTEXT("■",BOTx,BOTy,Dialog,Bold,20) coloured(0,0,0)lastpoint = -1lastX = BOTxendifreturn09/08/2019 at 5:41 PM #106871 -
AuthorPosts
Find exclusive trading pro-tools on