0 Views
0 Downloads
0 Favorites
Push
#property version   "1.00"
#property strict
input int percent = 30;
//+------------------------------------------------------------------+
//| Expert tick function                                             |
//+------------------------------------------------------------------+
void OnTick() {
   
   static datetime last_not = 0;
   
   if(Time[0] <= last_not)
      return;
      
   double prev_profit = 0;
   double curr_profit = AccountProfit();
   
   if(-curr_profit >= (AccountBalance() *  percent) / 100 && -prev_profit <= (AccountBalance() *  percent) / 100) {
      string per = IntegerToString(percent);
      last_not = TimeCurrent();
      SendNotification("Drowdown is " + per +"%");
   }    
   prev_profit = curr_profit;
}
//+------------------------------------------------------------------+

Comments