so i see this error, how can it be fixed, I am sure the chart has history and receiving ticks
When i check with CheckLoadHistory(), it confirms there are bars
Good Luck with debugging it :D MT4 does work but on MT5 i was facing the exactly same issue. While the bars are there time to time i was actively receiving 0.0 from the Ticks , not even bars. Let me know if you find the solution. Try to read the article that is mentioned above and make data requests or return if the reading is 0.0...
Good Luck with debugging it :D MT4 does work but on MT5 i was facing the exactly same issue. While the bars are there time to time i was actively receiving 0.0 from the Ticks , not even bars. Let me know if you find the solution. Try to read the article that is mentioned above and make data requests or return if the reading is 0.0...
i have tried this, seems to be working but please check and confirm me
//+------------------------------------------------------------------+//| HighLow.mq5 |//| Copyright 2021, Dark Ryd3r |//| https://t.me/DarkRyd3r |//+------------------------------------------------------------------+#property copyright"Copyright 2021, Dark Ryd3r"#property link"https://t.me/DarkRyd3r"#property version"1.00"#property indicator_chart_windowint total = 0,shift = 0;
double iH[],iL[];
string symbolsList[];
//+------------------------------------------------------------------+//| Custom indicator initialization function |//+------------------------------------------------------------------+intOnInit() {
total = SymbolsTotal(true);
ArrayResize(symbolsList, total);
ArrayResize(iH, total);
//--- indicator buffers mappingfor(int i=0; i<total; i++) {
symbolsList[i] = SymbolName(i,true);
}
//---return(INIT_SUCCEEDED);
}
//+------------------------------------------------------------------+//| Custom indicator iteration function |//+------------------------------------------------------------------+intOnCalculate(constint rates_total,
constint prev_calculated,
constdatetime &time[],
constdouble &open[],
constdouble &high[],
constdouble &low[],
constdouble &close[],
constlong &tick_volume[],
constlong &volume[],
constint &spread[]) {
//---for(int i=0; i<total; i++) {
int res=CheckLoadHistory( symbolsList[i],PERIOD_M1,TimeGMT ()-PeriodSeconds(PERIOD_M1));
switch (res) {
case -1 :
//Print ( "Unknown symbol ",PERIOD_M1);break ;
case -2 :
//Print ( "Requested bars more than max bars in chart" );break ;
case -3 :
//Print ( "Program was stopped" );break ;
case -4 :
//Print ( "Indicator shouldn't load its own data" );break ;
case -5 :
//Print ( "Load failed" );break ;
case0 :
// Print ( "Loaded OK" );break ;
case1 :
// Print ( "Loaded previously" );break ;
case2 :
// Print ( "Loaded previously and built" );break ;
default :
Print ( "Unknown result" );
}
if(res==2 || res==1 || res==0) {
iH[i] = iHigh(symbolsList[i],PERIOD_M1,0); // HighPrint("#"+(string)(i+1)+" "+symbolsList[i]+"| High : "+DoubleToString(iH[i],(int)SymbolInfoInteger(symbolsList[i],SYMBOL_DIGITS))+"." );
} else {
Print("Error : ", symbolsList[i] +" "+ GetLastError());
}
}
//--- return value of prev_calculated for next callreturn(rates_total);
}
//+------------------------------------------------------------------+//| |//+------------------------------------------------------------------+int CheckLoadHistory( string symbol, ENUM_TIMEFRAMES period, datetime start_date) {
datetime first_date=0;
datetime times[100];
//--- check symbol & periodif ( symbol == NULL || symbol == "" ) symbol = Symbol ();
if ( period == PERIOD_CURRENT ) period = Period ();
//--- check if symbol is selected in the Market Watchif (! SymbolInfoInteger ( symbol, SYMBOL_SELECT )) {
if ( GetLastError ()== ERR_MARKET_UNKNOWN_SYMBOL ) return (-1);
SymbolSelect ( symbol, true );
}
//--- check if data is presentSeriesInfoInteger ( symbol, period, SERIES_FIRSTDATE,first_date);
if (first_date>0 && first_date<=start_date) return (1);
//--- don't ask for load of its own data if it is an indicatorif ( MQL5InfoInteger ( MQL5_PROGRAM_TYPE )== PROGRAM_INDICATOR && Period ()== period && Symbol ()== symbol )
return (-4);
//--- second attemptif ( SeriesInfoInteger ( symbol, PERIOD_M1, SERIES_TERMINAL_FIRSTDATE,first_date)) {
//--- there is loaded data to build timeseriesif (first_date>0) {
//--- force timeseries buildCopyTime ( symbol, period,first_date+ PeriodSeconds ( period ),1,times);
//--- check dateif ( SeriesInfoInteger ( symbol, period, SERIES_FIRSTDATE,first_date))
if (first_date>0 && first_date<=start_date) return (2);
}
}
//--- max bars in chart from terminal optionsint max_bars= TerminalInfoInteger ( TERMINAL_MAXBARS );
//--- load symbol history infodatetime first_server_date=0;
while (! SeriesInfoInteger ( symbol, PERIOD_M1, SERIES_SERVER_FIRSTDATE,first_server_date) && ! IsStopped ())
Sleep (5);
//--- fix start date for loadingif (first_server_date>start_date) start_date=first_server_date;
if (first_date>0 && first_date<first_server_date)
Print ( "Warning: first server date ",first_server_date, " for ", symbol,
" does not match to first series date ",first_date);
//--- load data step by stepint fail_cnt=0;
while (! IsStopped ()) {
//--- wait for timeseries buildwhile (! SeriesInfoInteger ( symbol, period, SERIES_SYNCHRONIZED ) && ! IsStopped ())
Sleep (5);
//--- ask for built barsint bars = Bars ( symbol, period );
if ( bars >0) {
if ( bars >=max_bars) return (-2);
//--- ask for first dateif ( SeriesInfoInteger ( symbol, period, SERIES_FIRSTDATE,first_date))
if (first_date>0 && first_date<=start_date) return (0);
}
//--- copying of next part forces data loadingint copied= CopyTime ( symbol, period, bars,100,times);
if (copied>0) {
//--- check for dataif (times[0]<=start_date) return (0);
if ( bars +copied>=max_bars) return (-2);
fail_cnt=0;
} else {
//--- no more than 100 failed attempts
fail_cnt++;
if (fail_cnt>=100) return (-5);
Sleep (10);
}
}
//--- stoppedreturn (-3);
}
//+------------------------------------------------------------------+//| Returns string value of the period |//+------------------------------------------------------------------+string GetPeriodName( ENUM_TIMEFRAMES period ) {
if ( period == PERIOD_CURRENT ) period = Period ();
//---switch ( period ) {
casePERIOD_M1 :
return ( "M1" );
casePERIOD_M2 :
return ( "M2" );
casePERIOD_M3 :
return ( "M3" );
casePERIOD_M4 :
return ( "M4" );
casePERIOD_M5 :
return ( "M5" );
casePERIOD_M6 :
return ( "M6" );
casePERIOD_M10 :
return ( "M10" );
casePERIOD_M12 :
return ( "M12" );
casePERIOD_M15 :
return ( "M15" );
casePERIOD_M20 :
return ( "M20" );
casePERIOD_M30 :
return ( "M30" );
casePERIOD_H1 :
return ( "H1" );
casePERIOD_H2 :
return ( "H2" );
casePERIOD_H3 :
return ( "H3" );
casePERIOD_H4 :
return ( "H4" );
casePERIOD_H6 :
return ( "H6" );
casePERIOD_H8 :
return ( "H8" );
casePERIOD_H12 :
return ( "H12" );
casePERIOD_D1 :
return ( "Daily" );
casePERIOD_W1 :
return ( "Weekly" );
casePERIOD_MN1 :
return ( "Monthly" );
}
//---return ( "unknown period" );
}
//+------------------------------------------------------------------+
i have tried this, seems to be working but please check and confirm me
You don't need to load the history like someone wrongly advised. Well you can if you want, but that will not solve your problem.
MT5 is multi-threaded application, of course, it can always happen that a given symbol/timeframe data are not available, it will then return an error, you just have to deal with it (wait next tick, use a timer, use sleep, or whatever creative mechanism you could find).
Vladimir posted the links to the documentation. This topic has been discussed numerous time on the forum, no need to repeat all again and again, do some researches.
Well atleast its not happening on MT4. So we are coming to the result that is the common issue of MT5. I had some cases on multi pair ea and indicators that , it would not download the data automatically even if its on a marketwatch and manual download or data fixing is needed. So the data management is not perfect at all. Allso receiving 0.0 on some ticks can cause looses. So missing the data on the fly for some pairs is totally upsetting. You can try to receive data each Milisecond. Then again, it will not help 0.0 ONES. All you can do is ignore the result if its 0.0. Unless there is known valid solution. Lets say 100MS must be universal for all pairs in marketwatch. So once that is reached every pair must updated synched way. Sad part comes that is, When it happens few of them will return you 0.0 while there is a data ;). So if you are trying to create cross indicator from 2 different pairs get ready for such weird problems.
Ferhat Mutlu #: Well atleast its not happening on MT4. So we are coming to the result that is the common issue of MT5. I had some cases on multi pair ea and indicators that , it would not download the data automatically even if its on a marketwatch and manual download or data fixing is needed. So the data management is not perfect at all. Allso receiving 0.0 on some ticks can cause looses. So missing the data on the fly for some pairs is totally upsetting. You can try to receive data each Milisecond. Then again, it will not help 0.0 ONES. All you can do is ignore the result if its 0.0. Unless there is known valid solution. Lets say 100MS must be universal for all pairs in marketwatch. So once that is reached every pair must updated synched way. Sad part comes that is, When it happens few of them will return you 0.0 while there is a data ;). So if you are trying to create cross indicator from 2 different pairs get ready for such weird problems.
You don't need to load the history like someone wrongly advised. Well you can if you want, but that will not solve your problem.
MT5 is multi-threaded application, of course, it can always happen that a given symbol/timeframe data are not available, it will then return an error, you just have to deal with it (wait next tick, use a timer, use sleep, or whatever creative mechanism you could find).
Vladimir posted the links to the documentation. This topic has been discussed numerous time on the forum, no need to repeat all again and again, do some researches.
Does this issue occur with Ask and Bid, also? Or only close, open, high, low? or just the ones with i prefix?
You don't need to load the history like someone wrongly advised. Well you can if you want, but that will not solve your problem.
MT5 is multi-threaded application, of course, it can always happen that a given symbol/timeframe data are not available, it will then return an error, you just have to deal with it (wait next tick, use a timer, use sleep, or whatever creative mechanism you could find).
Vladimir posted the links to the documentation. This topic has been discussed numerous time on the forum, no need to repeat all again and again, do some researches.
please give search terms to use to find readings on 1) what prices this bug affects, and 2) proven methods that avoid or fix the bug.
I have idea for error correction, but at this stage is just a hypothesis. If i can see proofs of working fixes, then, I would not have to spend so much time testing my own code and hyposthese.
please give search terms to use to find readings on 1) what prices this bug affects, and 2) proven methods that avoid or fix the bug.
I have idea for error correction, but at this stage is just a hypothesis. If i can see proofs of working fixes, then, I would not have to spend so much time testing my own code and hyposthese.
It does happen for ask and bid. Allso there is allso mind scratching thing. If you want to get the bid value of another symbol, you will not get that because you will be able to call data based on the current symbols tick. The way is prevent that to call data every X ms possible. That way atleast you will get different ticks based on the symbols. Not all symbols creating the tick at the same time. That is another issue of MT5 :) OnTick gets updated only based on the symbol you are in. OnTimer is the best for such cross pair tick data. Then you will get the most realistic data but again. Still reason is unknown for 0.0. Not an exact explanation
ERR_HISTORY_NOT_FOUND
4401
Requested history not found
so i see this error, how can it be fixed, I am sure the chart has history and receiving ticks
When i check with CheckLoadHistory(), it confirms there are bars
Good Luck with debugging it :D MT4 does work but on MT5 i was facing the exactly same issue. While the bars are there time to time i was actively receiving 0.0 from the Ticks , not even bars. Let me know if you find the solution. Try to read the article that is mentioned above and make data requests or return if the reading is 0.0...
ERR_HISTORY_NOT_FOUND
4401
Requested history not found
so i see this error, how can it be fixed, I am sure the chart has history and receiving ticks
When i check with CheckLoadHistory(), it confirms there are bars
Good Luck with debugging it :D MT4 does work but on MT5 i was facing the exactly same issue. While the bars are there time to time i was actively receiving 0.0 from the Ticks , not even bars. Let me know if you find the solution. Try to read the article that is mentioned above and make data requests or return if the reading is 0.0...
i have tried this, seems to be working but please check and confirm me
i have tried this, seems to be working but please check and confirm me
You don't need to load the history like someone wrongly advised. Well you can if you want, but that will not solve your problem.
MT5 is multi-threaded application, of course, it can always happen that a given symbol/timeframe data are not available, it will then return an error, you just have to deal with it (wait next tick, use a timer, use sleep, or whatever creative mechanism you could find).
Vladimir posted the links to the documentation. This topic has been discussed numerous time on the forum, no need to repeat all again and again, do some researches.
Well atleast its not happening on MT4. So we are coming to the result that is the common issue of MT5. I had some cases on multi pair ea and indicators that , it would not download the data automatically even if its on a marketwatch and manual download or data fixing is needed. So the data management is not perfect at all. Allso receiving 0.0 on some ticks can cause looses. So missing the data on the fly for some pairs is totally upsetting. You can try to receive data each Milisecond. Then again, it will not help 0.0 ONES. All you can do is ignore the result if its 0.0. Unless there is known valid solution. Lets say 100MS must be universal for all pairs in marketwatch. So once that is reached every pair must updated synched way. Sad part comes that is, When it happens few of them will return you 0.0 while there is a data ;). So if you are trying to create cross indicator from 2 different pairs get ready for such weird problems.
Does this issue occur with Ask and Bid, also?
You don't need to load the history like someone wrongly advised. Well you can if you want, but that will not solve your problem.
MT5 is multi-threaded application, of course, it can always happen that a given symbol/timeframe data are not available, it will then return an error, you just have to deal with it (wait next tick, use a timer, use sleep, or whatever creative mechanism you could find).
Vladimir posted the links to the documentation. This topic has been discussed numerous time on the forum, no need to repeat all again and again, do some researches.
You don't need to load the history like someone wrongly advised. Well you can if you want, but that will not solve your problem.
MT5 is multi-threaded application, of course, it can always happen that a given symbol/timeframe data are not available, it will then return an error, you just have to deal with it (wait next tick, use a timer, use sleep, or whatever creative mechanism you could find).
Vladimir posted the links to the documentation. This topic has been discussed numerous time on the forum, no need to repeat all again and again, do some researches.
please give search terms to use to find readings on 1) what prices this bug affects, and 2) proven methods that avoid or fix the bug.
I have idea for error correction, but at this stage is just a hypothesis. If i can see proofs of working fixes, then, I would not have to spend so much time testing my own code and hyposthese.please give search terms to use to find readings on 1) what prices this bug affects, and 2) proven methods that avoid or fix the bug.
I have idea for error correction, but at this stage is just a hypothesis. If i can see proofs of working fixes, then, I would not have to spend so much time testing my own code and hyposthese.Just run this code and watch - each time there are less and less unsynchronized symbols: