Theoretical strategy fills are not necessarily achievable in live trading. For short holding periods, execution costs deserve a separate stress test rather than another round of signal optimization.
Worked example: ten shares
Assume a purchase at $100 and sale at $101.20. Ten shares produce $12 gross profit. With adverse slippage of $0.05 per share on each side, slippage totals $1; another $2 in round-trip fees leaves $9. With $0.40 slippage on each side, slippage totals $8 and the same fees leave only $2.

Model adverse execution prices
This illustrative strategy excerpt uses a 20-period moving-average crossing. AddOrder generates a simulated order for the next bar; open[-1] is used only as the next-bar simulated execution price, not in the signal. Increase the buy price and decrease the sell price by the assumed slippage. This is not a complete position-management system.
input shares = 10;
input slip = 0.05;
def avg = Average(close, 20);
def buySignal = close crosses above avg;
def sellSignal = close crosses below avg;
AddOrder(OrderType.BUY_TO_OPEN, buySignal,
open[-1] + slip, shares);
AddOrder(OrderType.SELL_TO_CLOSE, sellSignal,
open[-1] - slip, shares);
Run separate scenarios with slip set to 0, 0.05 and 0.40 while keeping other inputs unchanged. Account for the $2 fee separately outside the report, avoiding double-counting any existing platform fees. Slippage is expressed in price units, not ticks; check the instrument's minimum price increment.
Validation and limitations
Inspect trade quantities, directions and execution prices; ensure there are no duplicate entries or exits while flat. A fixed adjustment to next-bar open is a stress-test assumption, not a guaranteed executable quote, and can fall outside the bar range. Gaps, liquidity, partial fills and rejected orders require separate analysis. AddOrder is strategy simulation, not unattended live execution.
Official reference: AddOrder. This excerpt has not been compiled or backtested here. Trading involves risk of loss.
To adapt this free strategy idea, contact us about Custom Thinkorswim strategy Development Services.