on Timer

 
hi guys, do u see any problem in call ontimer here? i didnt have any problem with close the order but i expected congrat=true in comments because of my ontimer function, but it seems on timer didnt call or ontimer didnt work properly. it works  when the tanzim become true !
void OnTimer()
  {
  static int mecend=0;
  mecend++;
  if(heyyy || send || modify ||failmod ||tanzim ||congrat)
    {
      if(tanzim||congrat)
        {
         if(mecend==1800)
           {
            notif();
            mecend=0;
           }
        }
    static int second = 0;
 second++;
 if(heyyy || send || modify ||failmod) 
 {
   if(second==10) 
 {
  notif();
  second = 0;
 }
 }

    }
  
  }

void close(double p)
{
 bool baste=OrderClose(OrderTicket(),OrderLots(),p,1,clrAqua);
 if(baste==false)
   {
    last=GetLastError();
    heyyy=true;
    OnTimer();
    //======================================================================================SEND NOTIFICAN
   }
   else if(baste==true)
          {
           congrat=true;
           OnTimer();
          }
 
}
 
William Roeder #:

Use the debugger or print out your variables, including _LastError and prices and find out why. Do you really expect us to debug your code for you?
          Code debugging - Developing programs - MetaEditor Help
          Error Handling and Logging in MQL5 - MQL5 Articles (2015)
          Tracing, Debugging and Structural Analysis of Source Code - MQL5 Articles (2011)
          Introduction to MQL5: How to write simple Expert Advisor and Custom Indicator - MQL5 Articles (2010)

at first debugger don't work for mt4,and second according to my knowledge, ontimer don't work correctly in strategy tester.i can't test it in live index! I just would tell me, if u see a wrong thing 
 
  1. It does work in MT4.
  2. You are calling OnTimer directly, so that works as well.
 
ejmin ejoni:
hi guys, do u see any problem in call ontimer here? i didnt have any problem with close the order but i expected congrat=true in comments because of my ontimer function, but it seems on timer didnt call or ontimer didnt work properly. it works  when the tanzim become true !

You would have to call OnTimer 1800 times to make mecend==1800.