I'm getting significantly different backtest results between two backtests where the only difference is how I'm coding amount invested per trade. For both tests I'm saying to invest $50,000 per trade. The only difference are the functions I'm using to specify amount per trade.
The first test uses the PositionSize function:
PositionSize = 50000;
The second test uses the SetPositionSize function:
The trades lists are significantly different. Both trades lists contain trades that follow the system's rules. I don't know why this one difference is causing completely different (yet correct) trades to be taken.
This is a very simple strategy that only has two parameters for entry and exit. All backtest settings are exactly the same between the two tests. Beginning equity is $100,000. Even if I only trade $1,000 per trade, allowing many open trades at once, results are different, albeit not as significantly different as the tests that invest $50,000 per trade.
Results should be the same but they are not. Something between these two methods of specifying trade size is causing very different results as that's the only difference. Does anyone know why the results are different?
Third method is completely different. It is unclear what method you actually used because you wrote about 3 methods, yet there are only two screenshots.
Doing so you would be getting different results because: a) you may be using different price than close for entries, b) you are not applying proper FX rate, c) roundlotsize and other things differ, d) you are calculating shares out of "gross" value (not after commissions) and more... Generally do NOT use this kind of code.
I am the same problem as parisk described it. I am using the 6.35 version.
When I use 'PositionSize = 5000', I would expect to see 'Initial capital' to be 5000 in the report?
The backtest is done with 5000 position size (see red marker on the right) but in the report the it shows 20000 as set in the settings (blue).
The problem is that the values in the report are therefore incorrect because the report takes the correct netprofit of 4187.00 (black) but divides this by 20000 instead of 5000.
"Position size" and "Initial capital" are two different concepts:
Initial capital represents the money you have to invert initially. As buy and sell operations are generated this quantity changes: It grows up when operations ends with profit, and gets lower when you have losses.
Position size is the quantity you want to invert when the system generates a new Buy signal. If you don't set the "Position size" value, the system will use all of the avaliable capital in every operation.
BTW, to set the "Initial Capital" value to 5.000 you can use: