keeping inside the start() function

 

Hi, my EAs have worked by just reacting to the incoming ticks, in order to activate the start() function. Now, I need my EAs to become much more pro-active, making calculations without waiting for ticks. My question is whether this template may work well:

int start()
{
   while(!IsStopped())
   {       
       RefreshRates()
       trading_rules();  
       Sleep(100);  <---- How much smaller can the sleep time be?
   }
}
  

I'm going to test and I would like to hear your opinion. :-)

Another question is how much smaller we can set the sleep time, without affecting the terminal.

Thanks for your help.

A.M.

 

Hi, you can do calculation every new candle?

datetime Now;

bool NewCandle
{
  if (time[1] !=Now)
  {
    Now = Time[1];
    return(true);
  }
  return (false);
}
you EA will only orderend if a tick arrive. But with this last, EA get the tick, do what you said and stop, wait for the next candle.

Don't know if it can help you.
 
abstract_mind:


Hi, my EAs have worked by just reacting to the incoming ticks, in order to activate the start() function. Now, I need my EAs to become much more pro-active, making calculations without waiting for ticks. My question is whether this template may work well:

I'm going to test and I would like to hear your opinion. :-)

Another question is how much smaller we can set the sleep time, without affecting the terminal.

Thanks for your help.

A.M.

1. Yes the template work if you add ";" after RefreshRates() ;D.

2. How smaller ?, look at your processor usage and the time between tick (use GetTickCount())

3. IsStopped() does not works well in this case :(. 

 

Hi Phi.nuts, I changes my Eas  to this template and they work much better.

Thanks.

 

You wanna crazy fun stuff ?

Do the code below in EA, attach it while your MT still have connection to server, and then disconnect your PC from the net (unplug your modem).

... and wait WHRoeder will reply in a secs ;D

#import "Connect.dll"            // http://msdn.microsoft.com/en-us/library/windows/desktop/aa366143(v=vs.85).aspx
   int  IsInternetConnected();   // 0 = connected 1 = not connected

int init ()
  {

  start (); //--- call start() from init()

  return (o);
  }

int start ()
  {
  
  while ( !IsStopped() )
    { 
     if (IsInternetConnected() == 1) 
        {
        Alert ("You have no internet connection");

        if ( IsConnected () ) 
           Alert ("You still connected to server");
           else
           Alert ("You have no connection to server");
        } 
    Sleep (500);
    }  
     
  return (0);
  }

 

Reason: