Home/Execution model

Execution model

Separate strategy calculation from simulated order fills.

Understand when PineScript API evaluates a strategy, how market, stop, and limit orders are simulated, and how warm-up and trade windows work.

Public execution defaults

The close-only model determines when strategy logic runs. It does not mean that every order can only fill at the next bar open.

Strategy calculationOnce per completed chart-timeframe bar
Live tick recalculationDisabled
Recalculation after fillsDisabled
New market-order fillNext available simulated price by default
On-close processingOptional and recorded
Pending stop/limit fillsOHLC broker-emulation rules
Bar MagnifierDisabled
Lower-timeframe reconstructionDisabled
Verify-price limit assumption0
Realtime pre-executionDisabled

Calculation timing

Strategy logic is evaluated once after a chart-timeframe bar is complete. The public mode disables recalculation on live ticks and immediately after simulated fills, so unfinished-bar signals are not presented as confirmed historical decisions.

Fill timing

New market orders

A market order created from a completed-bar calculation fills at the next available simulated price by default.

Pending stop and limit orders

An order placed earlier may fill inside a later bar when that bar's OHLC range reaches the order price.

On-close processing

When supported and enabled, on-close order processing changes the fill timing. The resolved setting is recorded with the run.

No tick sequence

Without Bar Magnifier, the emulator does not know the actual intrabar tick path or whether the high or low happened first.

Trade window and indicator warm-up

The date range controls when new entries are allowed; it does not truncate indicator history. Earlier bars may load for moving-average, ATR, RSI, and other initialization. New entries are blocked before the start and after the end of the window, and an open position may be force-closed immediately after the window ends under the engine policy.

Run the workflow

Test the script with its assumptions attached.

Bring the Pine Script, market, timeframe, costs, and date range into one GPT conversation.

Open PineScript API