PeterSt wrote: A Pips/Points based solution is *not* allowed to use CountOfPosition (the number of contracts involved). This is because your whole “regime” will be based on points.Still, would you focus on needing to earn at least the commission (otherwise you can’t make profit), then the system of Spread comes down to the very same : you would need the Spread in points. And so the Money regime may come more handy because you don’t need to deal with these conversions.
You are absolutely right about pips.
As to commission and spread, being fixed costs, they can’t change each bar so their calculations are not of much use.
No, you indeed don’t need to calculate commission / spread each bar (though spread surely can change during the course of time / the trade), but that doesn’t mean you don’t need to calculate it once for the trade – or ProOrder session if you will. Leave it out and you will be blind on the cost.
A few additional caveats here :
PositionPerf will include half of the Commission you entered in the Editor area.
PositionPerf will include half of the Spread you entered in the Editor area.
Both are unrelated to your command to take profit at e.g. 10 Points. Same with take $profit and Money (IIRC the docs tell about this explicitly).
So leave that out in your calculations and you will earn less than your TP denoted. Or you simply lose while you thought to gain some $.
Thus Yes, Commission / Spread need to be calculated only once per trade (but careful with Spread), but in each “gain” calculation it must be incorporated.
Says me. 🙂
PeterSt wrote: No, you indeed don’t need to calculate commission… but in each “gain” calculation it must be incorporated. Says me. 🙂
Why? If your prior gain was 90 and now it’s 105, then the gain on the current bar is 15, adding any further cost to both the prior bar and to the current one will not change the result!
Unless such costs change live, but in case this is true, there’s no way to tell that with code. No info is available, as fas as I know.
If MyProfitMoney - CommissionSingleSide >= 12.50 then // This implies more than one tick
// Exit with profit.
endif
… assumed that MyProfitMoney was calculated from PositionPerf which contains half of the Commission (or Spread) already.
Btw, realistic commission in this consistent case would be USD 2,45 (maximum PRT discount on Commission because of the monthly number of trades).
One tick less of profit in this case would thus yield -2,45 while PositionPerf would say 0,00.
The IG version :
If MyProfitMoney - SpreadSingleSide >= 25.00 then
// Exit with profit.
endif
… is much more tricky because it is not guaranteed at all that IG deducts half the spread at the Entry; it can do that and the other half at the Exit, or it can deduct all at the Entry or all at the Exit. But if we’d skip that extra dimension then :
I deliberately use 25.00 instead of 12.50 because IG (with CFDs) is about twice as expensive on these costs than IB (with Futures). So this too would yield a consistent situation.
Both cases IB and IG would be about the current value of S&P500 eMini (which is consistent with the USD 50.00 per point (12.50 per tick)).
Note : better not try to convert IB to IG or vise versa here, because IG uses a different contract size (IIRC one contract is about half the $ size of IB’s 1 contract).
PS: Might you think this is all nit picking, then I invite you to do some HFT trading (on one instrument only) and try to squeeze out profit in the first place. Your target : a minimum of 100 trades per day. Just in backtest will be fine. Hints :
- In IG you won’t succeed anyway, but if you do let me know how;
- once it looks like you can do it and earn a Vonasi yacht on one day, better do not apply that to Live because you will lose two yachts per day. The reason ? Slippage (and ProRealTime which can’t give you the insight but YMMV on this).
Disclaimer : it is very easy to make a mistake here or there, so I stand corrected where that happened.
Robertogozzi, PeterSt,
Your different feedbacks are very interesting Re understanding of PRT platform behaviors including brokerage specifics (IG, IB ..). Thank s for that.
From my side, I have no issue about the way ProBacktest is calculating & balancing commissions and spreads from first day to last day of the run because I did many tests in the past and was able to exactly replicate it with 2d decimals accuracy.
I started to test your recommandations to get the balance at each day of the run but have still work to do.