Donchian Channel .. without channel displaying on recent candle
Forums › ProRealTime English forum › ProBuilder support › Donchian Channel .. without channel displaying on recent candle
- This topic has 10 replies, 3 voices, and was last updated 4 years ago by Holy Grail.
-
-
02/13/2020 at 9:29 AM #119525
Hope somebody can help me
How can i display a Donchian Channel with xPeriods that do not print channel on the resent candlestick like in attached example file
How have to change the code?
123Upper = HIGHEST[a](HIGH[1])Lower = LOWEST[a](LOW[1])Middle = (Upper + Lower) / 202/13/2020 at 9:52 AM #119529>> For clarity of messages on ProRealCode’s forums, please use the “insert code PRT” button to separate the text of the code part! Thank you! <<
🙂02/13/2020 at 9:57 AM #119531Your code is fine, but you cannot use RETURN since it will not allow you to skip the current candle.
You’ll have to use DRAWSEGMENT, instead, to plot data between the second last candle and the previous candle.
02/13/2020 at 10:06 AM #119535Try this (not tested):
123456789Upper = HIGHEST[a](HIGH[1])Lower = LOWEST[a](LOW[1])Middle = (Upper + Lower) / 2If barindex > 2 ThenDrawsegment(barindex-2,Upper,barindex-1,Upper) coloured(0,0,255,255)Drawsegment(barindex-2,Lower,barindex-1,Lower) coloured(0,0,255,255)Drawsegment(barindex-2,Middle,barindex-1,Middle) coloured(0,255,0,255)EndifReturnBut you won’t be able to change the style of plotted lines in versions prior to 11.
02/13/2020 at 10:17 AM #119538Thank you very much Robert,
is it possible to draw lines without brakes (like in “original” Donchain)?
02/13/2020 at 10:32 AM #119543Unfortunately segments are straight llines, so it’s not possible.
02/13/2020 at 10:42 AM #119545Ok, thanks
Last Question … how can i print price label of the resent segment?
02/13/2020 at 12:33 PM #119558You cannot, since there’s an instruction to allow drawing object only on the last bar, but then you wouldn’t see the previous bars, only the last one drawn. It is useless in your case.
If we display a price label everytime your chart would become so messy!
Try this modified version:
123456789Upper = HIGHEST[a](HIGH[1])Lower = LOWEST[a](LOW[1])Middle = (Upper + Lower) / 2If barindex > 2 ThenDrawsegment(barindex-2,Upper[1],barindex-1,Upper) coloured(0,0,255,255)Drawsegment(barindex-2,Lower[1],barindex-1,Lower) coloured(0,0,255,255)Drawsegment(barindex-2,Middle[1],barindex-1,Middle) coloured(0,255,0,255)EndifReturn1 user thanked author for this post.
02/13/2020 at 3:27 PM #119572SUPER Roberto … your last version is exactly what i want to use
Thanks a lot !!
02/13/2020 at 4:35 PM #119582You could create a separate indicator that just draws the text of the value you want on the last bar only then apply it as a separate indicator to the price chart as well as Roberto’s last code.
123456789101112131415defparam drawonlastbaronly = trueUpper = HIGHEST[a](HIGH[1])Lower = LOWEST[a](LOW[1])Middle = (Upper + Lower) / 2If barindex > 2 Thenupper1 = upper[1]lower1 = lower[1]middle1 = middle[1]DRAWTEXT(" #Upper1#",barindex,Upper,SansSerif,Bold,11)coloured(0,0,255)DRAWTEXT(" #Lower1#",barindex,Lower,SansSerif,Bold,11)coloured(0,0,255)DRAWTEXT(" #Middle1#",barindex,Middle,SansSerif,Bold,11)coloured(0,255,0)EndifReturn2 users thanked author for this post.
02/13/2020 at 9:14 PM #119609Super idea !
Done! It works.
Thank you Vonasi
-
AuthorPosts
Find exclusive trading pro-tools on