Download MetaTrader 5

Delay between trades - page 2

To add comments, please log in or register
Download MetaTrader 5 mobile version and trade from anywhere in the world!
FXBulldog 2015.03.24 20:52  

After a bit of adjustment, I did get the code to work, per original requirements.  Thanks for the Forum input.  The final working code included a sleep function to get the delay to work properly - I am sure that it is not the "cleanest" code, but it delivers what I am looking for, so I am at least happy with that :


   bool trade_closed_less_than_1_hour_ago=false;

   for(int x=OrdersHistoryTotal()-1;x>=0;x--)



      if(OrderSymbol()==Symbol() && (TimeCurrent()-OrderCloseTime())<3600 && OrderMagicNumber()==39379)


         //if the OrderSelect() function above is TRUE, define the trade entry filter here - include the Sleep(3600000) function;



         //Probably no need to continue with loop once a trade is found that was closed less than 1 hour ago

         //sleep is in milliseconds to ensure the required minimum of 1 hour delay since last closed trade





//Code to open new order or whatever


whroeder1 2015.03.25 12:23  
Don't paste code
Play video
Please edit your post.
For large amounts of code, attach it.
To add comments, please log in or register