Opening a new order one day after last order (MT5)

 

Need some idea (MT5): 

How to allow opening of a new order only after the last order has be opened for at least more than one day?

 
jon:

Need some idea (MT5): 

How to allow opening of a new order only after the last order has be opened for at least more than one day?

 1) Create global variable(or static) like bool new_trade=false;

2) Select last order

3) Chek current time-time of order. If it is more than 24*60*60 new_trade=true; else new_trade=false;  

 

Do you also want to check a closed order ? If so 

 

datetime lastOrderClose = 0;

for(int iPos=OrdersHistoryTotal()-1; iPos >= 0; iPos--)
    if (  OrderSelect(iPos, SELECT_BY_POS, MODE_HISTORY)  // Only orders w/
    &&  OrderMagicNumber()  == Magic.Number             // my magic number
    &&  OrderSymbol()       == Symbol()             // and my pair.
    &&  OrderCloseTime() > lastOrderClose)
        lastOrderClose = OrderCloseTime();
if (TimeCurrent()-lastOrderClose > 24*60*60)
    new_trade = true;
else new_trade = false;