Skip to main content
ATK Pine Script®

Execution Realism

Strategy declaration properties for slippage, commission, margin, pyramiding, and limit-fill assumptions — how to model realistic backtest execution.

Execution Realism#

The example suite includes dedicated strategies for slippage, commission, margin, pyramiding, and limit-fill assumptions. These properties should be treated as first-class authoring surfaces, not obscure extras added after the trade-frame discussion.

Property reference#

PropertyWhat it changesExample file
slippageBacktest fill realism.pynescript_slippage_strategy.py
commission_type, commission_valueFee modeling.pynescript_commission_strategy.py
default_qty_type, default_qty_value, margin_long, margin_shortPercent sizing and margin assumptions.pynescript_margin_strategy.py
pyramidingAdd-on entries in the same direction.pynescript_pyramiding_strategy.py
backtest_fill_limits_assumptionHow strict limit fills should be in backtest.pynescript_limit_fill_assumption_strategy.py

Usage#

Set these properties as kwargs on the strategy(...) declaration:

from source import strategy, input, build_mapped_trade_frame

strategy(
    "Realistic Execution Strategy",
    overlay=True,
    process_orders_on_close=True,
    slippage=2,
    commission_type="percent",
    commission_value=0.1,
    default_qty_type="percent_of_equity",
    default_qty_value=10,
    pyramiding=1,
    backtest_fill_limits_assumption="worse_case",
)