Potential highest Paper Gain/Loss in Automated Strategy

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #19771 quote
    CKW
    Participant
    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

    #19789 quote
    Nicolas
    Keymaster
    Master

    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.

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.

Potential highest Paper Gain/Loss in Automated Strategy


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
CKW @ckw Participant
Summary

This topic contains 1 reply,
has 2 voices, and was last updated by Nicolas
9 years, 2 months ago.

Topic Details
Forum: ProOrder: Automated Strategies & Backtesting
Language: English
Started: 01/04/2017
Status: Active
Attachments: No files
Logo Logo
Loading...