I want to start the calculation of ShiftTime from spesific datetime in the future for BeginTime and skip calculation in current time before BeginTime (return nothing).
datetime BeginTime = D'2018.09.01 00:00';
datetime ShiftTime = iTime(NULL, PERIOD_MN1, 1);
I try this code, is it correct?
int ShiftBar=iBarShift(NULL, PERIOD_MN1, BeginTime);
datetime ShiftTime = iTime(NULL, PERIOD_MN1, ShiftBar+1);
Please advice me. Thanks in advanced.
Thanks for the answer but I am not got your point. What's the meaning of red & yellow highlight?
I want to ignore previous 1 month until specified date (BeginTime), in this case is 1 September 2018 and start this calculation from specified date (BeginTime) and then calculate previous 1 month from that date continuously into future.
Here's the full code:
datetime BeginTime = D'2018.09.01 00:00'; datetime ShiftTime = iTime(NULL, PERIOD_MN1, 1); int ShiftBar=iBarShift(NULL, PERIOD_MN1, BeginTime); datetime EndTime = iTime(NULL, PERIOD_MN1, ShiftBar+1); for(int i=0; i<OrdersHistoryTotal(); i++) { if (OrderSelect(i, SELECT_BY_POS, MODE_HISTORY)) { if(OrderOpenTime() >= EndTime) { totalLots += OrderLots(); } } } if (totalLots<1.0) { Alert("Total Lot less than 1.0 lot"); return(1); }
Thanks for the answer but I am not got your point. What's the meaning of red & yellow highlight?
I want to ignore previous 1 month until specified date (BeginTime), in this case is 1 September 2018 and start this calculation from specified date (BeginTime) and then calculate previous 1 month from that date continuously into future.
Here's the full code:
- Your Begin Time is not yet arrive (according to server time).
- int ShiftBar is exactly 1.
- datetime EndTime is 2 months back (read timeseries on iTime)

- docs.mql4.com

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
I want to start the calculation of ShiftTime from spesific datetime in the future for BeginTime and skip calculation in current time before BeginTime (return nothing).
datetime BeginTime = D'2018.09.01 00:00';
datetime ShiftTime = iTime(NULL, PERIOD_MN1, 1);
I try this code, is it correct?
int ShiftBar=iBarShift(NULL, PERIOD_MN1, BeginTime);
datetime ShiftTime = iTime(NULL, PERIOD_MN1, ShiftBar+1);
Please advice me. Thanks in advanced.