If there is any way to execute the EA in desired time

 

We can apply expert advisor in any chart. But the problem is when tick changed then only the EA is executed. If there is any way to execute the EA in desired time. For example i would like to monitor a file which holds new order information and if new order information is added in the file then the ea should send order according to the order information placed in file....


Thanks

-Min

 

You can loop an EA, it only needs one tick to get started.

// EA

int start(){

   while(!IsStopped()){

      ... your repeating code

   Sleep( zzz );

   }

   return(0);

}
 
phy:

You can loop an EA, it only needs one tick to get started.

thanks..

 

phy, you dont need a tick

call start inside init.

 
meikel:

phy, you dont need a tick

call start inside init.

in ea i have called a function from external dll which monitors file content changed and the function returns true only when the file content is changed other wise the function will not return. If the file is not changed for long time then it gives error message timeout and the EA is disabled. what is the solution.. below is the EA code


#import "CppStdcallInerfaceWrapper.dll"
int IsFileChanged();


int start()
  {
//----
   
      while(!IsStopped())
      {
         Print("in while loop");
         int fileChanged = IsFileChanged();
         //Below code will be executed only when the IsFileChanged() function returns 
         Print("File is changed.");
         if (fileChanged == 1)
         {
            
            int ticket;
            ticket=OrderSend(Symbol(),OP_BUY,1,Ask,3,Ask-25*Point,Ask+25*Point,"My order #1",10703234,0,Green);
            if(ticket<0)
              {
               Print("OrderSend failed with error #",GetLastError());
               return(0);
              }
              else
              {
               Print("OrderSend for Symbol",Symbol());
              }


            
         }
         Sleep( 500 );
      }
   
//----
   return(0);
  }
 

I think you need a RefreshRates() in your loop.

Timeout problem maybe no response from DLL.

Reason: