My question is rather simple : Does the instruction STRATEGYPROFIT include brokerage fees in its calculation?
I know that PositionPerf does not include brokerage fees, but it seems to me that STRATEGYPROFIT = Tradeprice (of the close of the trade) – Tradeprice (of the entry of the trade) and therefore includes the spreads at the entry and at the close of the trade, as Tradeprice includes also the spreads…
For example, Tradeprice is equal to the true entryprice + half of the spread (in backtest, Tradeprice is equal to the price of the Open of the bar + half of the spread of the asset).
At the close, if you close the trade with Target Price, the Tradeprice will be equal to the Target Price, but the price must reach that target price + half of the spread for it to close (otherwise the trade will not close).
Am i wrong?
If STRATEGYPROFIT does include the spreads, does it include also the cost of the stop ?
Yes, STRATEGYPROFIT includes the spread. Here’s why:
STRATEGYPROFIT is computed from the actual execution prices of closed trades — which are the same prices returned by TRADEPRICE. And TRADEPRICE, as you correctly described, already embeds the spread at execution time:
- BUY entry at market → filled at ask = mid + ½ spread → TRADEPRICE reflects this
- SELL exit at market → filled at bid = mid − ½ spread → TRADEPRICE reflects this
So the spread cost is implicitly baked in at both legs of the trade. STRATEGYPROFIT = Σ (exit TRADEPRICE − entry TRADEPRICE) × size × point value, with spread already absorbed into each TRADEPRICE. This is exactly what gets reported in the backtest equity curve.
This is the fundamental difference with POSITIONPERF, which the docs explicitly state “does not include brokerage fees” — meaning it works off clean mid/reference prices, not actual fills.
The cost of the stop, which is a fee paid to your broker, is not included in STRATEGYPROFIT.