Firing trades before EA fully loaded

 

In my EA, I have it set to trade on every new candle. With the trade methods behind the time checker, I would think that it would not fire any trades until the EA is fully loaded. So when it is closed and I open it, before it has even completed all of the display of indicators and before it has checked on the many limitation settings I have in it, I get new trades opening. Any suggestions on how to make it wait say 2 candles before opening any trades? What ever I do, I think it will have to happen in the init.

 

if you have a ordersend() in the init it is possible.

Maybe also your Comment() is after the logic, so orders gets executed before Comment() is triggerd.

Letting EA sleep for 2 candles is nearly the same code as every

isNewBars() function is, combine it with a counter and voilá.

//z

 

OrderSend is not in the init, not sure what a comment() has to do with the price of tea in china.

Here is the code snippet I use for new candle:

datetime PrevTime = 0;

init
...

deinit
...

start


      datetime CurrTime = iTime(Symbol(),0,1);
 
      if( CurrTime != PrevTime )
      {

      }

      // Do my trading evaluaton here


      PrevTime = Time[0];
 
LEHayes:

before it has even completed all of the display of indicators

i tought you output the info trough Comment();

i dont know your Ea, but should the trading evaluation not be inside the {}?