CKWParticipant
Veteran
Hi all,
I modified Nicholas code post-16281 that could probably help to verify the potential highest Paper Gain/Loss in ProbackTest. This is usually used for optimization purpose. Please help to correct my code if wrong.
if Not ONmarket then
PotentialProfit = PotentialProfit + HighestProfit
PotentialLoss = LowestProfit + PotentialLoss
floatingprofit = 0
HighestProfit = 0
LowestProfit = 0
endif
If OnMarket then
floatingprofit = (((close - positionprice) * pointvalue) * countofposition) / pipsize
Highestprofit = Max(highestprofit,floatingprofit)
LowestProfit = Min(LowestProfit, Floatingprofit)
endif
Graph PotentialProfit coloured (255,0,0)
Graph PotentialLoss coloured (255,0,0)
Br,
CKW
Congratulations, you have successfully calculated the Max Favourable Excursion and the Max Adverse Excursion (MFE/MAE). Which are very important when you plan to improve an already made strategy (calculate the right stoploss for tall trades for example) and/or make optimization.
I didn’t test it, but it seems correct at a first glance.