Download MetaTrader 5

one trade per bar...

To add comments, please log in or register
dejaw
33
dejaw  

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!

Keith Watford
Moderator
9641
Keith Watford  
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

dejaw
33
dejaw  
thanx man !
whroeder1
14772
whroeder1  
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
}

dejaw
33
dejaw  
thank You!!
To add comments, please log in or register