Chart Scaling - How to Keep a Plot Visible

 

Hi.

I'm interested in controlling the scaling of a chart from my MQL4 code, for the purpose of keeping certain markings I am creating always visible on the chart.

For example, say I am creating a mark N ticks below the low of bar. If the market is in a downtrend, and the recent bars are near the lower right corner of the chart, my marking N ticks below will be off-the-chart and not visible.

What I would like to do is: a) determine the # of bars on the chart b) determine the highest high and lowest low of those bars c) from MQL4, set the chart so that the visible range covers the area N ticks above and N ticks below the highest high and lowest low.

Can this be done? If so which are the calls involved? (I have searched, but not found the answer.)

If this cannot be done as described, what are the next-best work-arounds?

Many thanks to those who can provide info on this!

 
  1. sj1:

    would like to do is: a) determine the # of bars on the chart b) determine the highest high and lowest low of those bars c) from MQL4, set the chart so that the visible range covers the area N ticks above and N ticks below the highest high and lowest low.


        top     = WindowPriceMax(),
        bottom  = WindowPriceMin(),
        shiftChart      =WindowFirstVisibleBar();
        shiftChartEnd   =shiftChart -WindowBarsPerChart();
        if (shiftChartEnd<0)    shiftChartEnd = 0;  // Tester/shift
    

  2. sj1:
    I'm interested in controlling the scaling of a chart from my MQL4 code, for the purpose of keeping certain markings I am creating always visible on the chart.
    Zoom in message? https://www.mql5.com/en/forum/124688
Reason: