Is there any predefined variable for current drawdown?

 

Hi friends,
Hope you are doing well.

I want to tell my EA if Current drawdown<-500$, Remove the expert.

But I don't know how can I calculate current drawdown or if there is any predefined variable for this.

Your advice is appreciated!

 
HosseinKOGO: I want to tell my EA if Current drawdown<-500$, Remove the expert. But I don't know how can I calculate current drawdown or if there is any predefined variable for this.

No, there is no predefined variable. You have to calculate it!

  1. Monitor the current balance and/or equity.
  2. Every time it is higher than previously recorded, then record the current value in the variable used to record the maximum.
  3. When the current values are below the maximum, then the difference is your current drawdown.
  4. When the current drawdown is beyond your limit that you have established, then remove the expert.