How Do I stop EA from not entering trade

 
Hi,

I am using the simple moving average EA. What I would like to find out is how to stop the EA from not trading anymore on the current candle once it has closed position. For example, the moving average i am using is 50 ema and I am using the 1 hour time interval. When I run the EA and the price crosses above the 50 ema, the trigger is set and it opens a long trade position, with target at 2 pips and stop a -10 pips. I am using every tick option when testing. Now, let us say that it reaches the target and takes profit of 2 pips. What I would to do now is for the EA to not trade anymore until the next candle.

Right now, if the stop loss or profit is reached and the current candle is not yet finished, then the EA will enter another trade on that candle. I dont want it to do this. Again, I want the EA to not trade anymore until the next candle. Is this possible? Is there a NextCandle() functions?

Thanks
 
I've seen this done using the assumption Volume[0]==0 on the first tick of the new bar. Haven't tried it myself though..
   
 
  1. check the history trade , by picking up the last order in the whole history (run loop of orderselect(....,MODE_HISTORY))
  2. if orderclosetime() >Time[0] ==> blocktrade =true;
  3. if(!blocktrade){.........ordersend(...)....}
Reason: