Plotting future and past offsets

Englewood85

New member
I am plotting this:

Code:
plot opening = open [-1];

The thinkScript documentation says that a negative offset refers to future candlesticks and that a positive offset refers to previous candlesticks. However when I run this script, the opening price for any given day is not plotted on the next candlestick forward, but instead it is plotted on the previous candlestick.

I can't make sense out of this. Can somebody explain how this works?
 

rad14733

Well-known member
VIP
@Englewood85 You are correct... TOS won't plot using close[-1] on the current bar but AddChartLabel(yes, open[-1], open) works yet AddChartLabel(yes, open, open[-1) does not... I'm sure there is a reason for this which probably revolves around the logic used for plots... Essentially, you can plot a current value on a previous bar but cannot plot a current value on a future bar... Hope this helps...
 

Englewood85

New member
But why is the script plotting the opening price on the previous candlestick?

I plotted both of these:

Code:
plot openingPriceNext = open [1];                 #prices shift forward by 1 candlestick

plot openPricePrior = open [-1];                                 #prices shift backward by 1 candlestick

The first line shifted the opening prices forward by 1 candlestick (documentation says it should shift backward).
The second line shifted the opening prices backward by 1 candlestick (documentation says it should shift forward).

1. Was thinkScript changed so that the offset now works the way it "should?"
2. If not, they why doesn't the plot for the 1st line shift backward? Why doesn't the plot for the 2nd line shift forward?
 
Last edited:

Similar threads

Top