one trade per bar...

 

hi guys,


maybe someone could  tell me please how to do only one trade per bar ?

when tp are taken, ea opens another trade on the same bar, I need it to do only one trade per bar...


thanks!

 
PIPEC:

hi guys,


maybe someone could  tell me please how to do only one trade per bar ?

when tp are taken, ea opens another trade on the same bar, I need it to do only one trade per bar...


thanks!


Get the close time of the trade(s)

Then use iBarShift with the time, if it equals 0, don't open a new trade

 
thanx man !
 
PIPEC: maybe someone could  tell me please how to do only one trade per bar ?
static datetime LastTrade;
if( Time[0] != LastTrade && ...){
   ticket = OrderSend(...)
   if(ticket < 0) Alert(...
   else LastTrade = Time[0]; // Once per bar
}

 
thank You!!
Reason: