Perform actions when changing the zoom factor.

 

Is there any way to perform actions on the change of the chart window's zoom factor? 

I can get the current chart scale and repaint the indicator/EA but it will only do that on the next tick after changing the chart scale.

I guess my method would be called something like onChartScaleChange() (which obviously, doesn't exist).

Is there any way to do this? Thanks a lot.

 
  1. Save the scale. OnTick look for a change. OnTimer look for a change.
  2. I don't know if scale change triggers an OnChartEvent() try to look for:

    CHARTEVENT_CHART_CHANGE

    Change of the chart size or modification of chart properties through the Properties dialog

              Types of Chart Events - Chart Constants - Standard Constants, Enumerations and Structures - MQL4 Reference

  3. What are you doing that is sensitive to scale?
 

Thank you very much for the help!

I will try to solve this with the advice you've given.

Re 3.: I want to have certain labels (sticking to price on the y scale) have fixed positions on the x axis.

When I zoom, these labels should be displayed at their new positions immediately, without waiting for a new tick.

The labels actually are of type CChartObjectText, so OBJPROP_XDISTANCE is not available.

 
whroeder1:
  1. Save the scale. OnTick look for a change. OnTimer look for a change.
  2. I don't know if scale change triggers an OnChartEvent() try to look for:
  3. What are you doing that is sensitive to scale?

CHARTEVENT_CHART_CHANGE works nicely, thank you!

Reason: