cTrader calculate wrong Max equity drawdown

Created at 06 Aug 2023, 16:03
How’s your experience with the cTrader Platform?
Your feedback is crucial to cTrader's development. Please take a few seconds to share your opinion and help us improve your trading experience. Thanks!
CH

chatcpe

Joined 13.07.2015

cTrader calculate wrong Max equity drawdown
06 Aug 2023, 16:03


 

 

Wrong Max  equity drawdown (Maybe max balance drawdown too)

 

I have a bot that can manage risk from SL( in the picture I choose risk at 10% & SL=120pips). 

 

And in OnTick I will calculate DD like this.

And It is Ok. At OnStop I print log like this. But it isn't same with the cTrader!

 

 

 

 

 

 

 

 


@chatcpe
Replies

PanagiotisChar
07 Aug 2023, 12:14

Hi there,

Your drawdown calculation is wrong. The drawdown is calculated from the peak equity to the lowest equity after that.

Aieden Technologies

Need help? Join us on Telegram


 


@PanagiotisChar

chatcpe
07 Aug 2023, 17:21

RE: cTrader calculate wrong Max equity drawdown

PanagiotisChar said: 

Hi there,

Your drawdown calculation is wrong. The drawdown is calculated from the peak equity to the lowest equity after that.

Aieden Technologies

Need help? Join us on Telegram


 Where? THis is my code 


       private void CalculateDDForAccount()
       {
           try
           {
               var newDDdol = Account.Balance - Account.Equity;
               if (newDDdol > MaxEquityDDInDol)
               {
                   MaxEquityDDInDol = newDDdol;
               }

               var newDDPercent = newDDdol / Account.Balance * 100;
               if (newDDPercent > MaxEquityDDPercent) 
               {
                   MaxEquityDDPercent = newDDPercent;
               }

           }
           catch (Exception ex)
           {
               Print($"Error in CalculateDDForAccount : {ex.Message}");
           }
       }

 


@chatcpe

PanagiotisChar
08 Aug 2023, 05:32

RE: RE: cTrader calculate wrong Max equity drawdown

chatcpe said: 

PanagiotisChar said: 

Hi there,

Your drawdown calculation is wrong. The drawdown is calculated from the peak equity to the lowest equity after that.

Aieden Technologies

Need help? Join us on Telegram


 Where? THis is my code 


       private void CalculateDDForAccount()
       {
           try
           {
               var newDDdol = Account.Balance - Account.Equity;
               if (newDDdol > MaxEquityDDInDol)
               {
                   MaxEquityDDInDol = newDDdol;
               }

               var newDDPercent = newDDdol / Account.Balance * 100;
               if (newDDPercent > MaxEquityDDPercent) 
               {
                   MaxEquityDDPercent = newDDPercent;
               }

           }
           catch (Exception ex)
           {
               Print($"Error in CalculateDDForAccount : {ex.Message}");
           }
       }

 

Everywhere :) The whole code is wrong


@PanagiotisChar

chatcpe
10 Aug 2023, 10:22

RE: RE: RE: cTrader calculate wrong Max equity drawdown

PanagiotisChar said: 

chatcpe said: 

PanagiotisChar said: 

Hi there,

Your drawdown calculation is wrong. The drawdown is calculated from the peak equity to the lowest equity after that.

Aieden Technologies

Need help? Join us on Telegram


 Where? THis is my code 


       private void CalculateDDForAccount()
       {
           try
           {
               var newDDdol = Account.Balance - Account.Equity;
               if (newDDdol > MaxEquityDDInDol)
               {
                   MaxEquityDDInDol = newDDdol;
               }

               var newDDPercent = newDDdol / Account.Balance * 100;
               if (newDDPercent > MaxEquityDDPercent) 
               {
                   MaxEquityDDPercent = newDDPercent;
               }

           }
           catch (Exception ex)
           {
               Print($"Error in CalculateDDForAccount : {ex.Message}");
           }
       }

 

Everywhere :) The whole code is wrong

I think it is already corrected.


@chatcpe