Download MetaTrader 5
To add comments, please log in or register
Publish your application in Cobe Base. Millions of traders will see it!
Vos77
169
Vos77 2012.01.23 11:01 

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
johhny6
130
johhny6 2012.03.17 12:02  
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.



/
To add comments, please log in or register