EA won't place a trade - page 3

 

Ok well start wasn't working for me, as soon as I changed it to OnTick it worked..

But OnTick is an MQL5 function isn't it??

 
Cerberus: But OnTick is an MQL5 function isn't it??
Event Handling Functions - MQL4 Documentation
 
Cerberus:

Ok well start wasn't working for me, as soon as I changed it to OnTick it worked..

But OnTick is an MQL5 function isn't it??


Just to clear things up

Can you please show your code that works with OnTick that doesn't work with start()

 
void OnTick() 

   {
   double BSL     = NormalizeDouble((Bid - 400*Point),Digits);
   double BTP     = NormalizeDouble((Bid + 400*Point),Digits);
   double SSL     = NormalizeDouble((Ask + 400*Point),Digits);
   double STP     = NormalizeDouble((Ask - 400*Point),Digits);
   int    MinStop = MarketInfo(Symbol(), MODE_STOPLEVEL);
   
   if(MinStop > 400) {
      Alert("Minimum stop distance allowed is: ",MinStop);
   }
   
   if (iMA(NULL, 0, 3, 0, MODE_EMA, 0, 1) > iMA(NULL, 0, 10, 0, MODE_EMA, 0, 1)) {
      int order = OrderSend(Symbol(), OP_BUY,1,Ask,10,BSL,BTP);
      if(order < 0) {
         Alert("trade not placed");
      }
   }
   Alert(GetLastError());
   
   if (iMA(NULL, 0, 3, 0, MODE_EMA, 0, 1) < iMA(NULL, 0, 10, 0, MODE_EMA, 0, 1)) {
      int order = OrderSend(Symbol(), OP_SELL,1,Bid,10,SSL,STP);
      if(order < 0) {
         Alert("trade not placed");
      }
   }
}
 
Cerberus:


That code works in start() as well with 625 and 914
 
Incidentally, so does your original code.
 
Weird okay.. I'll try it again. But thanks everyone for the help!!
Reason: