Avoid return of a value when “0”
Forums › ProRealTime English forum › ProRealTime platform support › Avoid return of a value when “0”
- This topic has 7 replies, 3 voices, and was last updated 9 months ago by liorp.
-
-
02/16/2024 at 12:44 PM #228285
Hello
I had a custom indicator that worked in the past –
The idea was when the value of a variable was “0” the value was not to be returned. something like:
if (close > open)
v = close
else
v= 0
return v AS “MY”this worked well , but now I see that the chart plots a transition from “0”
Is there a way to still not distort the chart by values of “0” ?Thanks
02/16/2024 at 12:56 PM #228286There you go:
123456t = 0v = closeif (close > open)thent = 255endifreturn v AS "MY" coloured(255,0,0,t) style(line,4)02/17/2024 at 10:25 AM #228325Hi,
Thanks a lot for you answer !
it helped , but problem is still not resolved –
The way that is is drawn now is you see a line connected between a candle that had “t=0” and a candle with “t=255” .
As you can see in your drawing a transition is plotted (marked in yellow) on the graph .
is there a way to avoid drawing this transition and actually start the drawing from the candle that has “t=255” ?
Thanks,
Lior02/17/2024 at 11:15 AM #228335I can’t see any yellow line.
02/17/2024 at 1:47 PM #22834102/17/2024 at 1:52 PM #228342if you look at the picture you sent out –
there is a transition shown between the candle at 14:00 and the one at 15:00
the candle at 14:00 has t=0 and the one at 15:00 has t=255, so I would expect the drawing to start for the candle at 15:00
why is there a connecting line before the candle at 15:00 (the one joining the candle at 14:00 with the one at 15:00) and is there a way to avoid this ?
Thanks02/17/2024 at 3:43 PM #228346It’s just a simple change in the formula…
Avoid Value Zero123456t = 0v = closeif (close > open) and (Close[1]>Open[1]) and Close>Close[1] thent = 255endifreturn v AS "MY" coloured(255,0,0,t) style(line,4)1 user thanked author for this post.
02/17/2024 at 5:20 PM #228352 -
AuthorPosts