Switch indicators on/off
Forums › ProRealTime English forum › ProBuilder support › Switch indicators on/off
- This topic has 9 replies, 3 voices, and was last updated 3 years ago by dave_moz.
-
-
07/03/2021 at 2:13 PM #173047
Could anyone tell me if there is a way to show or hide an indicator based on conditions relating specifically to the current candle only?
e.g.
If low<EMAx and close>EMAx then display EMAx.I did try a custom EMA indicator but the the EMA only displayed on each candle in the past which met the criteria rather than just plotting the EMA on the chart.
Thanks.
07/03/2021 at 2:37 PM #173048Try this one (not tested):
123456MyEma = average[20,1](close)t = 0 //transparency = invisibleIf low < MyEma and close > MyEma thent = 255EndifReturn MyEma coloured(0,255,0,t) as “MyEma”it takes advantage of the optional 4th COLOUR parameter, transparency (0-255), to make ema visible only when conditions are met.
07/03/2021 at 2:57 PM #173049Impressive Wizardry! 🙂
Link to above added as Log 293 here …
1 user thanked author for this post.
07/03/2021 at 3:02 PM #17305107/03/2021 at 3:07 PM #173054Isn’t that what you meant with “If low<EMAx and close>EMAx then display EMAx”?
07/03/2021 at 3:15 PM #173055Sorry, I didn’t make it clear.
I want to be able to display MA[x] on the whole chart but only if the last day’s candle meets the requirements.
So if today meets the conditions then MA[x] is displayed on the whole chart.
Hope that makes sense!
07/03/2021 at 5:17 PM #173065There’s no instruction to achieve that, so it must be coded.
I’ll make it asap.
07/03/2021 at 5:36 PM #17306607/04/2021 at 9:39 AM #173077Bob’s your uncle:
1234567891011DEFPARAM DrawOnLastBarOnly = TruePeriods = 20 //Ema periodsLookBack = 200 //plot Ema on the last 200 barsMyEma = average[Periods,1](close)If low < MyEma and close > MyEma thenFOR i = (LookBack - 1) DownTo 0j = i + 1DrawSegment(BarIndex[j],MyEma[j],BarIndex[i],MyEma[i]) coloured(0,255,0,255) style(Line,3)NEXTEndifReturnLine 2 are the Ema periods and Line 3 are the number of bars you want the Ema to be plotted when conditions are met.
1 user thanked author for this post.
07/04/2021 at 10:29 AM #173085 -
AuthorPosts
Find exclusive trading pro-tools on