macd entry arrows indicator
Forums › ProRealTime English forum › ProBuilder support › macd entry arrows indicator
- This topic has 7 replies, 4 voices, and was last updated 2 years ago by datageek.
-
-
09/07/2020 at 3:05 PM #143551
Hello everyone
my purpose was to create an indicator that displays an arrow on the macd when the histogram crosses the zero line.
Here’s my code:
macd arrows1234567891011121314151617181920212223242526272829303132333435363738394041MMC = exponentialAverage[C](close)MML = exponentialAverage[L](close)MACDL = MMC - MMLSignal = Average[S](MACDL)MACDH = MACDL - Signalfast = MACDHslow = 0//first arrow is blueishCrossOver = fast crosses over slowIF CrossOver THENCrossUnder = 0//cross = slow[1]DRAWARROWUP(barindex,0) COLOURED(0,255,10)endifIF CrossOver[5] THENIF summation[4](CrossOver OR CrossUnder) = 0 THENTopLine = highest[5](high) + (5 * pipsize)DRAWTEXT("---#TopLine#---",barindex-3,TopLine,SansSerif,Bold,16)coloured(153,0,0)ENDIFENDIFCrossUnder = fast crosses under slowif CrossUnder thenCrossOver = 0DRAWARROWDOWN(barindex,0) COLOURED(255,0,10)endifIF CrossUnder[5] THENIF summation[4](CrossOver OR CrossUnder) = 0 THENBottomLine = lowest[5](low) - (5 * pipsize)DRAWTEXT("---#BottomLine#---",barindex-3,BottomLine,SansSerif,Bold,16)coloured(153,0,0)ENDIFENDIFRETURN MACDH as "MACD Histogramme", Signal as "Signal", MACDL as "MACD Ligne"Sadly the arrows are very often one candle too early, (as you can see in the screenshot)
does anyone have a clue on why this is?
thanks in advance!
09/07/2020 at 7:18 PM #143562Hi I’m not sure what it is exactly that you are trying to achieve but this is my go to code for whenever I want to use arrows:
Remove lines 11-39 and add the following:
(make a duplicate of your code first just incase this wasn’t what you were after.)
12345if MACDH crosses over 0 thendrawarrowup(barindex,0 -5*pipsize)coloured(0,255,0)elsif MACDH crosses under 0 thendrawarrowdown(barindex,0 +5*pipsize)coloured(255,0,0)endif1 user thanked author for this post.
09/08/2020 at 10:41 AM #143588The Arrows on the graph
MACD-Arrows123456if macd crosses over 0 thenDRAWARROWUP(barindex, low-AverageTrueRange[14](close))coloured(0,150,155,255)elsif macd crosses under 0 thenDRAWARROWDOWN(barindex, high +AverageTrueRange[14](close))coloured(225,15,55,255)endifreturn1 user thanked author for this post.
09/08/2020 at 10:58 AM #143592With background color123456789101112if macd crosses over 0 thenDRAWARROWUP(barindex, low-AverageTrueRange[14](close))coloured(0,150,155,255)endifif macd > 0 thenBACKGROUNDCOLOR(255,255,255,55)elsif macd crosses under 0 thenDRAWARROWDOWN(barindex, high +AverageTrueRange[14](close))coloured(225,15,55,255)endifif macd <0 thenBACKGROUNDCOLOR(255,255,255,75)endifreturn09/09/2020 at 11:18 AM #143710Thanks for your help! I’ve tried your code and the arrows are still missplaced, so i guess the problem is probably coming from the software configuration and not the code.
09/09/2020 at 11:22 AM #143712Update, it works well on the 1 hour time frame, so the problem is coming from the daily i guess
09/09/2020 at 11:41 AM #143715So i unactivated this feature (also apply these settings on the daily and higher timeframes),
and now the arrows are placed correctly on the daily timeframe. Problem is solved.
03/08/2022 at 9:28 AM #189587 -
AuthorPosts
Find exclusive trading pro-tools on