Potential highest Paper Gain/Loss in Automated Strategy

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #19771 quote
    CKWCKW
    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
    NicolasNicolas
    Keymaster
    Legend

    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.
ProRealAI ProRealAI New

Stuck on this ProBuilder code?

Describe what this topic is trying to build, in plain English, and ProRealAI writes the ProRealTime™ indicator, screener or system for you.

Available in 7 languages
Try ProRealAI

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 NicolasNicolas
9 years, 8 months ago.

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