Exit of program

 

Hello,
I have a great problem while testing the Expert Advisor. How is it possible to stop my own trading program automatically with a defined condition? That means I will go out of the program completely! At the moment the program runs and runs....without stopping. In the programming handbook I have not found how to control it. Please, can you help me?

 
bool Terminated = false;
int start()
   {
   if (Terminated == true)
     {
     Comment("EA is Currently Terminated.");
     return (0);
     }
//your code

   if (your condition to stop the EA)
      {
      Terminated = true;
      }

//----
   return(0);
   }
//+------------------------------------------------------------------+
 
qjol:


Hello,

thanks a lot, your routine works for the termination the EA! I have put the first statement into init()
and in

if (your condition to stop the EA)
{
Terminated == true
}

you should write Terminated = true, with only 1 =

Regards
maxmax

 
maxmax:


Hello,

thanks a lot, your routine works for the termination the EA! I have put the first statement into init()

Not true, you should put this into start()

and in

if (your condition to stop the EA)
{
Terminated == true
}

you should write Terminated = true, with only 1 =

you're right I fixed that

Regards
maxmax

 
qjol:


Hi,

Termination works well with the statement in "init" . But I will try it inside "start".

Reason: