is there any known issue with CheckLoadHistory() ? - page 2

 
Dominik Egert #:
If I may throw in some grains of salt to this.

OnCalculate is called frequently. If you cannot receive the data on this call, you will have placed a requests for the data, return from OnCalculate and wait for the next call.

When returning from OnCalculate, always remember to return your current progress on calculations for your indicator.

So if it is the first run, and you request data, but you don't get it. You simply return 0. This way on the next call, you can retry to receive the data, if successful, start your calculation loop for the history data.

Whenever you are not done, but meet an update by the terminal, return your current state, and continue in the next call with where you were in your last call.
Yes, it's the simplest way to deal with it.
 
Dominik Egert #:
If I may throw in some grains of salt to this.

OnCalculate is called frequently. If you cannot receive the data on this call, you will have placed a requests for the data, return from OnCalculate and wait for the next call.

When returning from OnCalculate, always remember to return your current progress on calculations for your indicator.

So if it is the first run, and you request data, but you don't get it. You simply return 0. This way on the next call, you can retry to receive the data, if successful, start your calculation loop for the history data.

Whenever you are not done, but meet an update by the terminal, return your current state, and continue in the next call with where you were in your last call.

Thanks @Dominik Egert for your suggestion. I will try them out.

Meanwhile I have a question.

The original Market Profile was developed as an EA and the EA(indicator) was run on chart to draw Market Profile histogram. Running EA as indicator has limitation as while this is running, I can not add additional Expert for trading.

This forced me to change from EA(as indicator) to Indicator and EA was converted to BaseClass which is called by the Indicator.

Now OnCalculate() of indicator calls OnTick() of BaseClass. To my understanding on each OnCalculate call OnTick should be called too. Is there a different behavior of these two functions in such a case? Please update.

 
Alain Verleyen #:
Yes, it's the simplest way to deal with it.

Thanks @Alain Verleyen :)

Will try it out.

 
Anil Varma #:

Thanks @Dominik Egert for your suggestion. I will try them out.

Meanwhile I have a question.

The original Market Profile was developed as an EA and the EA(indicator) was run on chart to draw Market Profile histogram. Running EA as indicator has limitation as while this is running, I can not add additional Expert for trading.

This forced me to change from EA(as indicator) to Indicator and EA was converted to BaseClass which is called by the Indicator.

Now OnCalculate() of indicator calls OnTick() of BaseClass. To my understanding on each OnCalculate call OnTick should be called too. Is there a different behavior of these two functions in such a case? Please update.

There are fundamental differences between the calling of OnCalculate and OnTick.

It has been wrapped up in this thread:
 
Dominik Egert #:
There are fundamental differences between the calling of OnCalculate and OnTick.

It has been wrapped up in this thread:

Thanks Dominik

It is quite informative thread. Helped me learn new things in MQL.

Let me put all this learning for my indicator, and hopefully I will be able to resolve some issues.