OK. Let’s take this simple system that reproduces the whole mess. It runs in the DAX min 1 minute chart, 1 EUR mini contract, :
//Test system with integer position sizes (0 decimals), DAX 1 EUR Mini contract, 1 minute chart
number = 1 + ((strategyprofit + 10000) / 125)
n = round(number)
If n <= 1 then
n = 1
endif
b = 0
If a = 0 and barindex = BIin + 20 then
buy n contracts at market
a = 1
b = 1
BIin = barindex
endif
If a = 1 and b = 0 and barindex = BIin + 20 then
sellshort n contracts at market
a = 0
BIin = barindex
endif
set target pprofit 10
set stop ploss 10
This system alternately buys and sells short a position every 20 bars. No position therefore lasts longer than for 20 bars.
Now, let’s take the same system, but replace integer position sizes by position sizes with 2 decimals only by using n = round(number * 100) / 100 instead of n = round(number).
//Test system with decimal position sizes (2 decimals), DAX 1 EUR Mini contract, 1 minute chart
number = 1 + ((strategyprofit + 10000) / 125)
n = round(number * 100) / 100
If n <= 1 then
n = 1
endif
b = 0
If a = 0 and barindex = BIin + 20 then
buy n contracts at market
a = 1
b = 1
BIin = barindex
endif
If a = 1 and b = 0 and barindex = BIin + 20 then
sellshort n contracts at market
a = 0
BIin = barindex
endif
set target pprofit 10
set stop ploss 10
It should yield exactly the same number of positions, lasting for 20 bars or less, but it DOES NOT.
The backtest curves superficially look quite identical, but in detail, they are not at all. Test done for 10.000 bars.
[attachment file=57396]
Now, let’s compare the backtest reports :
[attachment file=57397]
Both backtests should yield the same number of positions and the same time in the market. However, the system with decimal position sizes has more positions (625 instead of 526 for integer position sizes), and it seems to be much longer in the market, 92.51% instead of 69,87% for integer position sizes.
Now we will see, why this is so :
[attachment file=57398]
As in your system, Vonasi, the test system with decimal position sizes shows positions in the backtest report that do in fact not exist, and they last longer than they could in fact (longer than for 20 bars).
Now let’s take the longest wrong position with decimal position sizes (40 bars on 28.12.2017, 15:02 to 28.12.2017, 15:42) and see what the chart shows during this time :
[attachment file=57399]
Both systems show the same actual positions, the “wrong” position with 40 bars is not there, but instead we see once again these strange “spikes” around the time when the wrong position was reported for decimal position sizes.
So, I conclude that this is a general and reproducible bug for decimal position sizes, and I ask PRT to correct this, please.
I attach .itf files for both systems in the next post (this one is full).