TradingView fills: next bar open by default, bar close with process_orders_on_close
Posted: Thu Oct 29, 2026 11:14 am
TradingView fills: next bar open by default, bar close with process_orders_on_close
Before trusting a TradingView backtest, check when it assumes your orders fill. The setting is in the strategy declaration.
By default, the script calculates when a bar closes, creates the order then, and the order is filled at the next bar's open. With process_orders_on_close=true the market order is filled at the close of the bar that produced the signal. In a historical test that looks fine, but in live trading the close isn't known until the bar is finished, so the real order would go out afterwards at a different price. The TradingView documentation mentions that this can be unrealistic.
Commission and slippage both default to zero. The slippage argument is in ticks, so on a 5 digit EURUSD feed 3 means 3 points, or 0.3 pips.
A test to run: use the same script with the setting off and on, and compare the net result and number of trades. If the profit mostly disappears when the fills move to the next open, the system is relying on the close price it couldn't get.
Then put your real costs into the declaration and run again.
Before trusting a TradingView backtest, check when it assumes your orders fill. The setting is in the strategy declaration.
Code: Select all
//@version=5
strategy("Cross test", overlay=true, process_orders_on_close=false,
commission_type=strategy.commission.percent, commission_value=0.0,
slippage=0)
fast = ta.ema(close, 9)
slow = ta.ema(close, 21)
if ta.crossover(fast, slow)
strategy.entry("L", strategy.long)
Commission and slippage both default to zero. The slippage argument is in ticks, so on a 5 digit EURUSD feed 3 means 3 points, or 0.3 pips.
A test to run: use the same script with the setting off and on, and compare the net result and number of trades. If the profit mostly disappears when the fills move to the next open, the system is relying on the close price it couldn't get.
Then put your real costs into the declaration and run again.