ChartRedraw, best way to use?

 

Hi,


I know MQL5 demands ChartRedraw to update GUI on a chart.  However, I'm probably not using it optimally.  Consider the following scenario...


I have 5 indicators each which must update the properties of 100 objects each, or any one object at a time, either from a new tick, on a timer, or an OnChartEvent.


How often and when is it appropriate to use ChartRedraw?  Is it...


a) Once at the end of OnCalculate, or OnTimer, or OnChartEvent (or the subset ID),

b) After modifying each and every object property,

c) or some other way to optimize redrawing of GUI objects?

 
Matthew Renner:

Hi,


I know MQL5 demands ChartRedraw to update GUI on a chart.  However, I'm probably not using it optimally.  Consider the following scenario...


I have 5 indicators each which must update the properties of 100 objects each, or any one object at a time, either from a new tick, on a timer, or an OnChartEvent.


How often and when is it appropriate to use ChartRedraw?  Is it...


a) Once at the end of OnCalculate, or OnTimer, or OnChartEvent (or the subset ID),

b) After modifying each and every object property,

c) or some other way to optimize redrawing of GUI objects?

Since it is a User UI resource, it should be called whenever and wherever needed to reflect the updates needed on the interface to allow the user to be aware, as quickly as possible, of whatever the information he/she should have...

 

If you have Chart objects that need to update based on tick data, use on every tick, 

If you have buttons, that do interesting things, then use onChartEvent 

If its a must, use onTimer