Libraries: CheckHistory - Check and load history function

 

CheckHistory - Check and load history function:

Slightly modified history load function from MetaQuotes

Author: Andrey Khatimlianskii

 

I have noticed such a feature...

If you need to remove buffer data from some indicator for a symbol, which is not selected in the "Market Watch" and for which the history is not filled, you need to screw something like this into the function:

.....
   uint start=GetTickCount();
   // my lines [start]
   long m=SymbolInfoInteger(symbol,SYMBOL_SELECT);
   if(m<1)
     {
      bool is_selected=SymbolSelect(symbol,true);
      Sleep(500);
     }
   // my lines [end]
   if(CheckTerminalHistory(symbol,period,size) || CheckServerHistory(symbol,period,size))
     {
      if(print_info)
        {
   
.....
 
I'm doing something wrong, I can't figure out what. Chart (tester) - H1. I need to load bars - H4 in the amount of 3000 pieces (BarsToAnalyse=3000). It does not load... Line with the function:
if ( first && !CheckLoadHistory( _Symbol,PERIOD_H4, BarsToAnalyze ) )
 
Forex_Noob:
I'm doing something wrong, I can't figure out what. Chart (tester) - H1. I need to load bars - H4 in the amount of 3000 pieces (BarsToAnalyse=3000). It does not load... Line with the function:

What does it write in the log? What happens at all? Does it just hang?

If you run it on a regular chart, does it load? Is there any history on the broker's server?

 

I understand that the loading is done using SeriesInfoInteger with the parameter SERIES_SYNCHRONIZED ?

This is an interesting thing I should check... because I'm messing around with these historical quotes... I open a chart and simulate Home until the loading of bars stops. I wonder - what will be the difference between these methods....

 
elugovoy:

I understand that the loading is done using SeriesInfoInteger with the parameter SERIES_SYNCHRONIZED ?

This is an interesting thing I should check... because I'm messing around with these historical quotes... I open a chart and simulate Home until the loading of bars stops. I wonder - what will be the difference between these methods....

There should be no difference, the function loads and recalculates all the necessary history normally.
 

The only thing that works at the end of 2018. +5 and Thanks!

Any thoughts to improve ?

 
Vladimir Pastushak:

The only thing that works at the end of 2018. +5 and Thank You!

Any thoughts to improve ?

Vladimir, don't speak in riddles

 
Andrey Khatimlianskii:

Vladimir, don't speak in riddles

I was in a hurry, and your code also hangs on symbols with problematic history....

I have tested a lot of codes for loading history, all hangs on some tsfd.

So does your code.

 
Vladimir Pastushak:

I was in a hurry, and your code also hangs on characters with problematic history.

I've tested a lot of codes for loading history, all of them hang on some tsfd.

Your code is the same.

There was a discussion that even iBars freezes under certain conditions.

No desire to look into it now.

 

Hello,


I have two questions concerning your code.

Within the function

CheckServerHistory() 

CheckServerHistory(...)
{
        ...
        if(first_server_date>TimeCurrent()-size*PeriodSeconds(period)) return(false);
        ...
}

Will this really work, because the time difference and the counting of periods is different when taking market closes into account?


In the function

CheckLoadHistory()

CheckLoadHistory(...)
{
        if(CheckTerminalHistory(symbol,period,size) || CheckServerHistory(symbol,period,size))
        { ... }
}


Here the execution is first checking terminal data and after that it checks server data. 

Does it make sence to do it the other way around?