Pine Script Offset: Plot Position vs Historical Signal Timing
The offset parameter changes where a plot appears on the chart. It does not change the calculated series, delay an order, or make future prices available. Historical indexing is a separate operation.

Move a plot without moving its calculation
A positive offset draws a value to the right of its calculation bar; a negative offset draws it to the left. This example calculates a 14-bar SMA on each chart bar and displays it three positions to the right:
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © Pineify
//======================================================================//
// ____ _ _ __ //
// | _ \(_)_ __ ___(_)/ _|_ _ //
// | |_) | | '_ \ / _ \ | |_| | | | //
// | __/| | | | | __/ | _| |_| | //
// |_| |_|_| |_|\___|_|_| \__, | //
// |___/ //
//======================================================================//
//@version=6
indicator("[Pineify - Best Pine Script Generator] Simple MA with Offset", overlay=true)
length = input(14, "MA Length")
offset = input(3, "Offset")
ma = ta.sma(close, length)
plot(ma, color=color.blue, linewidth=2, offset=offset)
The value displayed three bars ahead is still based on data available at the calculation bar. It is not a forecast. Changing the plot offset leaves a crossover calculated from the original series unchanged.
Compare multiple plotted series carefully
This existing example offsets only the middle moving average:
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © Pineify
//======================================================================//
// ____ _ _ __ //
// | _ \(_)_ __ ___(_)/ _|_ _ //
// | |_) | | '_ \ / _ \ | |_| | | | //
// | __/| | | | | __/ | _| |_| | //
// |_| |_|_| |_|\___|_|_| \__, | //
// |___/ //
//======================================================================//
//@version=6
indicator("[Pineify - Best Pine Script Generator] Multiple MAs with Offset", overlay=true)
ma1 = ta.sma(close, 5)
ma2 = ta.sma(close, 14)
ma3 = ta.sma(close, 200)
plot(ma1, color=color.red, linewidth=2)
plot(ma2, color=color.blue, linewidth=2, offset=3)
plot(ma3, color=color.green, linewidth=2)
An intersection on the screen can therefore join values calculated on different bars. Do not assume it is the same event as a crossover between the unshifted series. Negative offsets are particularly easy to misread: a marker drawn on an earlier candle was not necessarily known then.
Delay a condition with history indexing
A three-bar delay requires testing the condition from three bars ago with [3]. The earlier [^3] expression was invalid Pine syntax. This corrected complete example submits an entry when a crossover occurred three chart bars earlier:
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © Pineify
//======================================================================//
// ____ _ _ __ //
// | _ \(_)_ __ ___(_)/ _|_ _ //
// | |_) | | '_ \ / _ \ | |_| | | | //
// | __/| | | | | __/ | _| |_| | //
// |_| |_|_| |_|\___|_|_| \__, | //
// |___/ //
//======================================================================//
//@version=6
strategy("[Pineify - Best Pine Script Generator] Offset Entry Strategy", overlay=true)
ma_fast = ta.sma(close, 10)
ma_slow = ta.sma(close, 20)
crossover = ta.crossover(ma_fast, ma_slow)
if (crossover[3]) // Check for crossover 3 bars ago
strategy.entry("Long", strategy.long)
Under the default strategy execution model, the condition is evaluated at bar close and a market order normally fills on the next available tick, typically the next bar’s open in historical testing. Thus the order submission delay and fill time are distinct. This demonstration has no exit rule and is not a complete trading system. It also does not require the fast average to remain above the slow one during the waiting period.
Offset restrictions and testing
plot() requires an offset that is fixed during script execution, such as an input integer. A bar-varying series derived from ATR is not a valid dynamic plot offset in v6. An input can be changed in Settings, which recalculates the script.
Test plotting and strategy timing separately: inspect when a value was calculated, where it was drawn, when a condition became true and when an order filled. Moving a plot alone does not alter Strategy Tester results. Changing entry logic can, but it needs its own evaluation with costs and out-of-sample data.
The former AAPL, TSLA and SPY claims about earlier breakouts or a 40% reduction in false signals had no reproducible evidence. Visual displacement cannot establish that benefit.
Sources checked October 20, 2026: Pine plot documentation and strategy execution.

