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
Try updating all symbol/TF at the start of OnTick.
Download history in MQL4 EA - Forex Calendar - MQL4 programming forum - Page 3 #26 № 4
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
The Code I am using Traps all errors in a central Place I call GOD. GOD Global Operation Debugger . It tracks the errors in every single function Just prior to this error I was using copy rates.I load Three time frames back to back to compare the oanda data to a Reuters data feed specifically Refinitiv eikon core feed .The failure is in the function that deals with error 4066 . I also Track every article I have read on these topics and store them in an array for reference during debugging. in the code below is a reference to the article I based the coded on
datetime dtError4066() { //+-------------------------------------------------------------------+ //| Local Variables Initialization | //+-------------------------------------------------------------------+ RefreshRates(); bool bBreak = false; datetime dtRetunThis = 0; datetime dtCurrentTime = TimeCurrent(); datetime dtCurrentM1Time = 0; datetime dtCurrentTimeFrame = 0; int iError = 0; //+-------------------------------------------------------------------+ //| Main body | //+-------------------------------------------------------------------+ while(!bBreak) { dtCurrentM1Time = iTime(msEASymbol, PERIOD_M1, 0); dtCurrentTimeFrame = iTime(msEASymbol, miEATimeFrame, 0); if ( dtCurrentTime >= dtCurrentM1Time && dtCurrentTime >= dtCurrentTimeFrame ) dtRetunThis = dtCurrentTime; else if ( dtCurrentM1Time >= dtCurrentTimeFrame && dtCurrentM1Time >= dtCurrentTime ) dtRetunThis = dtCurrentM1Time; else if ( dtCurrentTimeFrame >= dtCurrentM1Time && dtCurrentTimeFrame >= dtCurrentTime ) dtRetunThis = dtCurrentTimeFrame; else dtRetunThis = dtCurrentTime; iError = GetLastError(); if( iError == 4066 ) {ResetLastError(); Sleep(1000); RefreshRates(); } else break; } //+-------------------------------------------------------------------+ //+ Deinitialization of Function | //+-------------------------------------------------------------------+ mcaGOD[ piFunc ].sDebuggerURL1 = " https://www.mql5.com/en/forum/143422"; return(bReturnThis); }Any help I would be most grateful . Thanks PS the bolded section is the failure point. It was late for me last night I posted the code slightly wrong. It has been corrected