• Home
  • Forums
  • Trades
  • News
  • Calendar
  • Market
  • Brokers
  • Login
  • Join
  • User/Email: Password:
  • 3:10am
Menu
  • Forums
  • Trades
  • News
  • Calendar
  • Market
  • Brokers
  • Login
  • Join
  • 3:10am
Sister Sites
  • Metals Mine
  • Energy EXCH
  • Crypto Craft

Options

Bookmark Thread

First Page First Unread Last Page Last Post

Print Thread

Similar Threads

Calculate max allowable drawdown 0 replies

function to calculate stoploss for all open orders based X% DrawDown 0 replies

MQL4 Language Most Recent Version is it updated beyond the tutorial on the mql4 websi 6 replies

Calculate the right lot size MQL4/MT4 3 replies

  • Platform Tech
  • /
  • Reply to Thread
  • Subscribe

MQL4 Calculate Profit (gain) from Highest Drawdown

  • Post #1
  • Quote
  • First Post: Apr 2, 2017 6:19am Apr 2, 2017 6:19am
  •  MikeFT
  • | Joined Dec 2009 | Status: Member | 177 Posts
Hello Folks,

I am stuck with something which seems to be a very simple task - who can help me out?

Let's assume multiple positions will be opened with an Account Starting Balance of 1000:

  1. The drawdonwn of the open trades reduces balance to 100 (Drawdown of 900) before the
  2. Account balance again rises to 600 ("profit" from Highest Drawdown = 500).

How do I code to get the above mentioned 500 Profit (gain) from Highest Drawdown)?

What I did so far:

Inserted Code
if(AccoutEquityPriorCurrentRound>AccountEquity())
      {
      if(MaxDDCurrentRound < AccoutEquityPriorCurrentRound-AccountEquity())
         {
         MaxDDCurrentRound = AccoutEquityPriorCurrentRound-AccountEquity(); //MaxDDCurrentRound is always zero or higher (positive number).
         }

With the "knowledge from the above "MaxDDCurrentRound" I want to get "MaxGainFromHighestDDthisRd". This is where I am stuck.

Inserted Code
  if(MaxGainFromHighestDDthisRd < TheValueWhichNeedsToBeCalculatedHere))
       {
       MaxGainFromHighestDDthisRd = TheValueWhichWasCalculatedRightAboveFromHere);
       }
  • Platform Tech
  • /
  • MQL4 Calculate Profit (gain) from Highest Drawdown
  • Reply to Thread
0 traders viewing now
Top of Page
  • Facebook
  • Twitter
About FF
  • Mission
  • Products
  • User Guide
  • Media Kit
  • Blog
  • Contact
FF Products
  • Forums
  • Trades
  • Calendar
  • News
  • Market
  • Brokers
  • Trade Explorer
FF Website
  • Homepage
  • Search
  • Members
  • Report a Bug
Follow FF
  • Facebook
  • Twitter

FF Sister Sites:

  • Metals Mine
  • Energy EXCH
  • Crypto Craft

Forex Factory® is a brand of Fair Economy, Inc.

Terms of Service / ©2022