Sorry to say this, @nicolas, but I think I just found another quite serious PRT bug, dealing with the “set target pprofit” commands, when multiple positions are open.
The English manual says on page 12 :
SET TARGET PROFIT x: Set a profit target to close the position x units from the average position price.
So, when multiple positions are open, and we say : “set target pprofit 20”, this should mean that a single average limit 20 points away from the average position price of all positions will be set, not different limits for every position 20 points away from the different position prices.
But : now here comes reality.
Take this little test system (I really do like them, meanwhile) :
// test system for "set target pprofit" bug
// DAX 1 minute chart
defparam cumulateorders = true
ONCE TI = 0
If barindex = TI + 20 then
buy 1 contract at market
TI = barindex
endif
set target pprofit 20
set stop ploss 20
If positionprice <> 0 then
graph positionprice
endif
This system buys a new position every 20 bars, irrespective of what happens. It sets a stop loss of 20 points and a target profit of 20 points, too. Backtest has been done with a spread of 1 point.
According to the manual, this should set at least the target 20 points away from the average position price, when multiple positions are open.
It remains unclear in the manual whether the stop loss will be set 20 points away from each individual position price, or 20 points away from the average position price.
But here, we deal only with the target price, now :
Take the chart and look at the date 01.02.2018, TIME = 8:00. At this time, 19 open positions are closed and their target profit is taken.
According to the manual, this should happen 20 points away from the average position price, which was 13229,7 at this time (for all 19 positions). So, all 19 positions should be closed at the same price of 13249,7
But now look at the chart : It reports that all positions have been closed at 8:00 at different exit prices, all 20 points away from their individual opening price, not 20 points away from the average position price :
[attachment file=61784]
The backtest report tells us the same different exit prices for these 19 positions, 20 points away from their entry price :
[attachment file=61785]
Because all of these positions are reported to have been closed 20 points away from their entry price, their results should be + 20,00 € for all of them.
However, in the list of all closed positions in the same backtest report, all of these 19 positions are shown to have different results, as if they would indeed have been closed at the same price, 20 points away from an average position price !!
[attachment file=61786]
Now, what is true in reality ? The command “set target pprofit x” : does it close multiple positions all at the same target price, x points away from the average position price, or does it close them all at different individual prices, x points away from their individual opening price ?
The backtest report and the chart say all different things together at the same time, unfortunately.