Download MetaTrader 5
To add comments, please log in or register
Add our channel to friends and follow the news!
dejaw
33
dejaw 2014.06.17 21:10 

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
7979
Keith Watford 2014.06.18 02:45  
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 2014.06.18 06:57  
thanx man !
whroeder1
13640
whroeder1 2014.06.18 11:37  
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 2014.06.18 15:42  
thank You!!
/
To add comments, please log in or register