I attach an image of an indicator I've written. The indicator panel should be coloured red for instance if the curve is between the two dashed horizontal lines. However you can see that it draws the colour one bar early everywhere.
The colour is chosen after the indicator is set by testing on its value. In rough pseudocode:
Set value of indicator using Close[0] and SMA(50)[0]
If the set value is between -0.01 and -0.02 then set background color as red
What is my obvious error here?
Thanks,
darmbk.
Comment