-
Please edit your (original) post and use the CODE button (Alt-S)! (For large amounts of code, attach it.)
General rules and best pratices of the Forum. - General - MQL5 programming forum (2019)
Messages Editor Your code int year = TimeYear(TimeCurrent()); int month = TimeMonth(TimeCurrent()); int day = TimeDay(TimeCurrent()); string s = (string)year + "." +(string)month + "."+(string)day + " " + (string)00+":00"; datetime firstBarTm = StringToTime(s);
Simplified datetime firstBarTm = date();
Find bar of the same time one day ago - MQL4 programming forum (2017)- Xiaolei Liu: When in currency pair “XAUUSD” , firstBarNum return 1, but in currency pair “EURUSD” , firstBarNum return 0 , why ?
On MT4: Unless the current chart is that specific symbol(s)/TF(s) referenced, you must handle 4066/4073 errors before accessing candle/indicator values.
Download history in MQL4 EA - Forex Calendar - MQL4 programming forum - Page 3 #26.4 (2019)
thanks , over .i have been solve this problem already.

You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
hello friend , Recently, I encountered a very confused problem.
int year = TimeYear(TimeCurrent());
int month = TimeMonth(TimeCurrent());
int day = TimeDay(TimeCurrent());
string s = (string)year + "." +(string)month + "."+(string)day + " " + (string)00+":00";
datetime firstBarTm = StringToTime(s);
int firstBarNum = iBarShift(NULL,0,firstBarTm);
In the above code, for example, in a 1-hour chart, On the first candle, at 00:00 When in currency pair “XAUUSD” , firstBarNum return 1, but in currency pair “EURUSD” , firstBarNum return 0 , why ?