On MT4: Unless the current chart is that specific
pair/TF 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
Download history in MQL4 EA - Forex Calendar - MQL4 programming forum - Page 3 #26 № 4
William Roeder:
On MT4: Unless the current chart is that specific pair/TF 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
On MT4: Unless the current chart is that specific pair/TF 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
Thanks a lot! I will implement this download history routine in my code.
Marbo:
Thanks a lot! I will implement this download history routine in my code.
Because I need to implement it into a script I made these changes. Can I be sure that after the WHILE-loop all histories are loaded or do I miss something?
string symbol[] = {"AUDCAD", "AUDCHF", "AUDJPY", "AUDNZD", "AUDUSD", "CADCHF", "CADJPY", "CHFJPY", "EURAUD", "EURCAD", "EURCHF", "EURGBP", "EURJPY", "EURNZD", "EURUSD", "GBPAUD", "GBPCAD", "GBPCHF", "GBPJPY", "GBPNZD", "GBPUSD", "NZDCAD", "NZDCHF", "NZDJPY", "NZDUSD", "USDCAD", "USDCHF", "USDJPY", "XAGUSD", "XAUUSD", "XTIUSD", "DE30", "US30", "US500", "USTEC"}; //+------------------------------------------------------------------+ //| Script program start function | //+------------------------------------------------------------------+ void OnStart() { //--- int s=0; while (s<ArraySize(symbol)-1 && !IsStopped()) { ResetLastError(); datetime refresh=iTime(symbol[s], PERIOD_M15, 0); if (_LastError==0 && refresh!=0) s++; }
Marbo:
Because I need to implement it into a script I made these changes. Can I be sure that after the WHILE-loop all histories are loaded or do I miss something?
I think it's better to show the complete code. This script should just scan for inside candles.
tring symbol[] = {"AUDCAD", "AUDCHF", "AUDJPY", "AUDNZD", "AUDUSD", "CADCHF", "CADJPY", "CHFJPY", "EURAUD", "EURCAD", "EURCHF", "EURGBP", "EURJPY", "EURNZD", "EURUSD", "GBPAUD", "GBPCAD", "GBPCHF", "GBPJPY", "GBPNZD", "GBPUSD", "NZDCAD", "NZDCHF", "NZDJPY", "NZDUSD", "USDCAD", "USDCHF", "USDJPY", "XAGUSD", "XAUUSD", "XTIUSD", "DE30", "US30", "US500", "USTEC"}; //+------------------------------------------------------------------+ //| Script program start function | //+------------------------------------------------------------------+ void OnStart() { //--- int s=0; int tf=PERIOD_M15; while (s<ArraySize(symbol)-1 && !IsStopped()) { ResetLastError(); datetime refresh=iTime(symbol[s], tf, 0); if (_LastError==0 && refresh!=0) s++; else Print(symbol[s]+" M"+(string)tf+": "+(string)_LastError); } for (s=0; s<ArraySize(symbol); s++) { if (iHigh(symbol[s], tf, 1)<iHigh(symbol[s], tf, 2) && iLow(symbol[s], tf, 1)>iLow(symbol[s], tf, 2)) { long chartID=ChartOpen(symbol[s], tf); } } }
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
Hey guys,
I made this little test-script:
The result was a date from 2018. When I started the script once again, the correct time and date was printed.
I know this is because I never look at USDTHB and the history is not loaded in the background.
What can I do in the script to make sure that the correct time and date is displayed when receiving data from pairs/timeframes I haven't looked at a long time?