OnChartEvent() of a non current chart

 

How can I get the OnChartEvent()  of a non current chart?

 
macpee:

How can I get the OnChartEvent()  of a non current chart?

As far as I am aware, this is not possible.

What you would need is a "proxy". An Indicator that forwards the events to your program by injecting the indicator onto the remote chart and have it receive the events for you, then pass it on to your chart with custom events, or by any other type of iE file of GVar.
 
Dominik Christian Egert #:
As far as I am aware, this is not possible.

What you would need is a "proxy". An Indicator that forwards the events to your program by injecting the indicator onto the remote chart and have it receive the events for you, then pass it on to your chart with custom events, or by any other type of iE file of GVar.
Thank you, but any clue on how to go about it? E.g. proxy example code.
 
macpee #:
Thank you, but any clue on how to go about it? E.g. proxy example code.
Ahm, search for multi currency EA and how to sync tick events.


Anyways, the process is about such:


Build an indicator. Have it receive the events you want. make it send the events by creating a custom event and direct it to your origin chart.

In your main program, load the indicator to the remote chart, send a custom event to that chart, have your proxy receive that special event, notifying it of the chartID you want the proxy to send the custom events to.

If I would give you code for all of that, you wouldn't understand the underlying process. And you couldn't customize it to your needs.

Please do research on how it works. Start with the documentation and read about custom events. It should be quite simple, once you know how it works.
 
Dominik Christian Egert #:
Ahm, search for multi currency EA and how to sync tick events.


Anyways, the process is about such:


Build an indicator. Have it receive the events you want. make it send the events by creating a custom event and direct it to your origin chart.

In your main program, load the indicator to the remote chart, send a custom event to that chart, have your proxy receive that special event, notifying it of the chartID you want the proxy to send the custom events to.

If I would give you code for all of that, you wouldn't understand the underlying process. And you couldn't customize it to your needs.

Please do research on how it works. Start with the documentation and read about custom events. It should be quite simple, once you know how it works.
Thank you once again. I think the info you have given me would go a long way as long as I persevere in the search.
 
macpee:

How can I get the OnChartEvent()  of a non current chart?

You should better explain what you are trying to achieve. Why do you need that ?
 
Alain Verleyen #:
You should better explain what you are trying to achieve. Why do you need that ?

Thank you for your concern and readiness to contribute to the solution.

The task is for my EA to Print (ChartSymbol(ID)) when I move (manually) the vertical line named "vert_line" drawn on a non-current chart whose symbol is of course ChartSymbol(ID).

 
macpee #:

Thank you for your concern and readiness to contribute to the solution.

The task is for my EA to Print (ChartSymbol(ID)) when I move (manually) the vertical line named "vert_line" drawn on a non-current chart whose symbol is of course ChartSymbol(ID).

Well I guess your EA needs to monitor several charts ?

The solution suggested by Dominik is certainly the more efficient, but maybe a bit hard to implement depending of your coding level.

A simpler solution would be for your EA to check the other chart objects and detect a movement. Depends of your exact needs and skills.

 
Alain Verleyen #:

Well I guess your EA needs to monitor several charts ?

The solution suggested by Dominik is certainly the more efficient, but maybe a bit hard to implement depending of your coding level.

A simpler solution would be for your EA to check the other chart objects and detect a movement. Depends of your exact needs and skills.

I was thinking of an alternative solution but I don't know how well the terminal will receive it in terms of not crashing and not freezing. My thought is as follows:


From OnTimer, browse through all the 30 open charts using their ID's and while loop.

Check for the availability and position of the vertical line named "vert_line" on each chart.

If the "vert_line" new position is different from its previous position, then it has been moved.

If it has been moved then take note of the ChartSymbol(ID)

Print (ChartSymbol(ID) and go to the next Chart.

If it has not been moved then go to the next Chart.


I have not tried this though.

 
macpee: How can I get the OnChartEvent()  of a non current chart?

You can't, but you can get the equivalent.
          The Implementation of a Multi-currency Mode in MetaTrader 5 - MQL5 Articles (2011)

 
William Roeder #:

You can't, but you can get the equivalent.
          The Implementation of a Multi-currency Mode in MetaTrader 5 - MQL5 Articles (2011)

Wow! This needs a whole lot of study. I think I need to take my time on it. Thanks man.

Reason: