Use Sleep() to delay trades ?

 

Hi Forum,

I want to experiment delaying orders after receiving a trade signal. Would I use the sleep() function? and if so, where's the best place to insert it, above the lot calculation?

https://www.mql5.com/en/docs/common/sleep 

 //--- open buy (first)
      if(signals)
        {
         lot=CalcLotSize(lots_is_fixed,percent_lot,stop_loss,fixed_lot,1);
         if(!CheckLots(lot))return;
         if(m_trade.PositionOpen(symbol,ORDER_TYPE_BUY,lot,ask,0,0,order_comment))
           {

            recalc=true;
            signals=false;
            return;
           }
        }

 Thanks for the help, much appreciated... 

Documentation on MQL5: Common Functions / Sleep
  • www.mql5.com
Common Functions / Sleep - Documentation on MQL5
 
Vos77:

Hi Forum,

I want to experiment delaying orders after receiving a trade signal. Would I use the sleep() function? and if so, where's the best place to insert it, above the lot calculation?

https://www.mql5.com/en/docs/common/sleep 

 Thanks for the help, much appreciated... 


i cant see your EA above that point, but you would certainly want to calculate the lot-size after the sleep, if you have other EA's trading on the same account, as they may have made profit/loss that will affect your calculations.