I have the following script. Not really much to it to be honest, just 2 lines. Define a moving average variable and then plot that variable indexed to the prior bar. Moves the plot forward in time instead of actually rendering the plot on the current candle.
This plot shifts forward one candle into the future instead of stopping on the current candle. Bizarre.
Any ideas why that is happening?
screen shot of the result shows the purple plot has jumped ahead of the current candle.
Here is a TOS link to a chart with the code:
http://tos.mx/f3iZRUZ
Code:
def avg = SimpleMovingAvg(close, 20);
def avgHist = avg[1];
plot Data = avg;
plot Data2 = avgHist;
This plot shifts forward one candle into the future instead of stopping on the current candle. Bizarre.
Any ideas why that is happening?
screen shot of the result shows the purple plot has jumped ahead of the current candle.
Here is a TOS link to a chart with the code:
http://tos.mx/f3iZRUZ
Last edited by a moderator: