Download MetaTrader 5

Monitor History Data Changes

To add comments, please log in or register
zifu wang
636
zifu wang  

Dear All,

     How to monitor this event which a deeper history is downloaded or history blanks is filled?

Rodrigo Malacarne
Moderator
10250
Rodrigo Malacarne  
kwang1:

Dear All,

     How to monitor this event which a deeper history is downloaded or history blanks is filled?

Hello Mr. Wang, I believe your question is badly formulated, as, at least for me, it's not possible to understand exactly what you want.

Please specify exactly what you need, so we could help you.

zifu wang
636
zifu wang  
Malacarne:

Hello Mr. Wang, I believe your question is badly formulated, as, at least for me, it's not possible to understand exactly what you want.

Please specify exactly what you need, so we could help you.

If since the last call of OnCalculate() price data has changed (a deeper history downloaded or history blanks filled), the value of the input parameter prev_calculated will be set to zero by the terminal.

I wanna monitor this by Expert, please advise how to do.

Alain Verleyen
Moderator
32753
Alain Verleyen  
kwang1:

If since the last call of OnCalculate() price data has changed (a deeper history downloaded or history blanks filled), the value of the input parameter prev_calculated will be set to zero by the terminal.

I wanna monitor this by Expert, please advise how to do.

To be precise, prev_calculated isn't an input parameter, it's a parameter of the OnCalculate event handler.

If you want to monitor this in your event, you have to made the value available in one way or another. This can be done by :

  • Writing/reading the value to a file.
  • Using Global variables of the terminal.
  • Using a custom event (sended in indicator, receive in EA with OnChartEvent).
  • ...
zifu wang
636
zifu wang  
angevoyageur:

To be precise, prev_calculated isn't an input parameter, it's a parameter of the OnCalculate event handler.

If you want to monitor this in your event, you have to made the value available in one way or another. This can be done by :

  • Writing/reading the value to a file.
  • Using Global variables of the terminal.
  • Using a custom event (sended in indicator, receive in EA with OnChartEvent).
  • ...
OnChartEvent() is a handler of a group of ChartEvent events. The function can be called only in Expert Advisors and indicators.

The function should be of void type with 4 parameters:
void OnChartEvent(const int id,         // Event ID
                  const long& lparam,   // Parameter of type long event
                  const double& dparam, // Parameter of type double event
                  const string& sparam  // Parameter of type string events
  );

Is the value of the id parameter CHARTEVENT_CHART_CHANGE which can be used to monitor the changes (a deeper history downloaded or history blanks filled)?
Alain Verleyen
Moderator
32753
Alain Verleyen  
kwang1:
OnChartEvent() is a handler of a group of ChartEvent events. The function can be called only in Expert Advisors and indicators.

The function should be of void type with 4 parameters:

Is the value of the id parameter CHARTEVENT_CHART_CHANGE which can be used to monitor the changes (a deeper history downloaded or history blanks filled)?

Please do some research on forum and read documentation on how to use Custom Events. It's not the easiest solution though.

I suggest you Global variables of the terminal.

To add comments, please log in or register