Welcome Forex EA downloads & MT4/MT5 auto-trading resources — EAs, Gold EAs, quant tools and real-world automation.
Sign In Sign Up

Daily Drawdown - MetaTrader 5 Script | Trading Script Download - MT4/MT5 Resources - MetaTrader 5 Resources

author EAcpu | 2 reads | 0 comments |

daily drawdown - indicator for MetaTrader 5

In the lower right corner of the page, you can see the profit and loss percentage of your account.

daily drawdown - indicator for MetaTrader 5

  CreateEdit( "Daily DD" , 200 , 68 , 98 , 30 , "Daily DD" , innocent , black , 12 );
  CreateEdit( "Daily DDV" , 100 , 68 , 98 , 30 , "" , innocent , black , 12 );


 Object delete ( 0 , "Daily DD" );
Object delete ( 0 , "Daily DDV" );


 Mql date time w;
BuildTime ( timecurrent (),w);
String MD = integer to string (w.year) + "." + integer to string (Monday) + ".01" ;
Double historical profit = 0 , deposit = 0 ;
History selection ( 0 , time current ());
Oolong Ticket_history_deal= 0 ;
for ( integer i = 0 ; i < historical transaction total (); i++)
if ((ticket_history_deal= Historical transaction to get tickets (1))> 0 )
        {
Date time time = ( date time ) historical transaction acquisition integer (ticket_history_deal, DEAL_TIME );
if (time> string to time ( string time ( timecurrent (), TIME_DATE )))
if ( historical transaction acquisition integer (ticket_history_deal, transaction type ) == DEAL_TYPE_BUY || historical transaction acquisition integer (ticket_history_deal, transaction type ) == transaction type_sell )
              Historical profit + = Double the historical transaction (ticket_history_deal, transaction profit ) + Double the historical transaction (ticket_history_deal, DEAL_COMMISSION ) + Double the historical transaction (ticket_history_deal, transaction exchange );
Other deposits + = double historical transactions (ticket_history_deal, transaction profit );
        }
Double starting balance = double account information ( account balance ) - historical profit;
string text = "" ;
Double dd = (historical profit + account information double ( ACCOUNT_PROFIT )) * 100 / starting balance;
  Text = double to string (dd, 2 ) + “%” ;
Object set string ( 0 , "Daily DDV" , OBJPROP_TEXT , text);
ChartRedraw ();



Attachment download

📎 daily_drawdown.mq5 (13.12 KB)

Source: MQL5 #41316

Verification code Refresh