NRUNO Trading Automation Wiki · Question 58

What is calc_on_order_fills and when should I use it?

Pine Script & TradingView AlertsLast reviewed: 25 Aug 2026
Short answer

calc_on_order_fills lets a strategy recalculate after an order fill, enabling logic that reacts immediately to simulated position changes. It can also produce unrealistic historical behavior, so it requires careful live-vs-backtest validation.

What this means in practice

calc_on_order_fills lets a strategy recalculate after an order fill, enabling logic that reacts immediately to simulated position changes. It can also produce unrealistic historical behavior, so it requires careful live-vs-backtest validation. This page is specifically about “What is calc_on_order_fills and when should I use it?”, so each scenario below is explained by its own mechanism instead of sharing one generic diagnosis.

Real-world scenarios

Scenario A — Set stop after simulated fill

Inspect the mechanism named by “Scenario A — Set stop after simulated fill” directly. Record its input, the state immediately before it and the first observable output that differs from the intended result. For Scenario A — Set stop after simulated fill on question 58, use that evidence specifically to answer “What is calc_on_order_fills and when should I use it?”; keep it separate from the evidence for the other scenarios on this page.

Scenario B — Pyramiding after fill

Decide whether extra entries are intentional scale-ins or accidental duplicates. Give each intended scale-in its own identity and keep TradingView pyramiding separate from transport or cBot duplicate protection. For Scenario B — Pyramiding after fill on question 58, use that evidence specifically to answer “What is calc_on_order_fills and when should I use it?”; keep it separate from the evidence for the other scenarios on this page.

Scenario C — Historical fills become unrealistic

Inspect the mechanism named by “Scenario C — Historical fills become unrealistic” directly. Record its input, the state immediately before it and the first observable output that differs from the intended result. For Scenario C — Historical fills become unrealistic on question 58, use that evidence specifically to answer “What is calc_on_order_fills and when should I use it?”; keep it separate from the evidence for the other scenarios on this page.

What to check

  • target connector/account identity
  • exact broker symbol
  • normalized order parameters
  • cTrader response and final position/order state

Practical rule

For “What is calc_on_order_fills and when should I use it?”, change only the first layer whose evidence no longer matches the intended action. Preserve signal identity, timestamps and final cTrader state, and reproduce execution-affecting changes on demo before live use.

Decision summary

Direct answer: calc_on_order_fills lets a strategy recalculate after an order fill, enabling logic that reacts immediately to simulated position changes. It can also produce unrealistic historical behavior, so it requires careful live-vs-backtest validation.

Next action: Match the observed evidence to one scenario above, test that mechanism independently on demo and keep the result traceable with one signal ID.

Primary sources

Need a TradingView → cTrader execution route?

NRUNO routes your TradingView instructions to cTrader. Your strategy and signal logic remain yours.