Delay between trades - page 2

 

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--)

     {

      OrderSelect(x,SELECT_BY_POS,MODE_HISTORY);

      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;

         trade_closed_less_than_1_hour_ago=true;   

break; 

         //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

       }

         }

         if(trade_closed_less_than_1_hour_ago==false)

        {

//Code to open new order or whatever

         }

 
Don't paste code
Play video
Please edit your post.
For large amounts of code, attach it.