Reference for scaling the chart: intentional or bug?

 

Hi!

I was trying to solve an annoying bug here when I found out something I'm inclined to believe it's intentional, but better to check in case it's actually some bug:

Suppose I open a chart and manually put some zoom out with the scale sytem (button -). Then I move to the left, to visualize its history, let's say 1 year back. Then, if a click to zoom in (+), the first bar to the left is kept fixed while the zoom is applied to the bars at its right (so, the value returned by CHART_FIRST_VISIBLE_BAR remains the same.)

Now suppose I do zoom out again and I go to the end of the chart, where the current bar being formed is visible. Then, if I click to zoom in (+), it's the bar at the right, the latest being formed, that is kept fixed while the zoom is applied to the bars at the left (so CHART_FIRST_VISIBLE_BAR's value keeps changing every time I click to zoom in and out).

Well is this intentional? Because I can surely understand why the latest bar would be used as reference, being kept fixed, when its visible - for manual traders, I'd say this is the ideal behaviour -, but I can't see why the reference side would be changed to the left one once its the history that is being visualized. And I can report there is at least one scenario in which this change causes a little problem:

If I want to navigate programatically to a certain position on the chart and, then, do some zoom in or zoom out, it becames mandatory to first do the scaling with CHART_SCALE and only later call ChartNavigate. If the opposite is done, there will be some moments in which the chart wont end up where it was supposed to go.

 

I confirm the behaviour you are describing. If the current bar is visible, it's zoomed from it as a fixed point (right of the chart). If not visible, it's from the left of the chart.

However, I don't see how it's problematic. If it's needed to do the scaling before the navigation, then just do it ?

 
Alain Verleyen #:
I confirm the behaviour you are describing. If the current bar is visible, it's zoomed from it as a fixed point (right of the chart). If not visible, it's from the left of the chart.

So it's intentional, then. Well,

Alain Verleyen #:
However, I don't see how it's problematic. If it's needed to do the scaling before the navigation, then just do it ?

Indeed, I ended up having to change the order of the scaling to counter that. The thing is: it seems a gratuitious change, the kind of thing that doesn't seems to help and only open doors for bugs/headaches (as I was facing by putting the scaling after the navigation). It seems to me it would be better if the tool had a single behaviour instead of changing it depending on something pretty visual as "is the last formed bar visible?", specially when so many things about MT5 is done in code. That would be my suggestion. 

Anyway, thanks for the reply!

 
Martin Bittencourt #:

So it's intentional, then. Well,

I didn't say it's intentional. I don't know. I just checked and confirmed what you described.

Indeed, I ended up having to change the order of the scaling to counter that. The thing is: it seems a gratuitious change, the kind of thing that doesn't seems to help and only open doors for bugs/headaches (as I was facing by putting the scaling after the navigation). It seems to me it would be better if the tool had a single behaviour instead of changing it depending on something pretty visual as "is the last formed bar visible?", specially when so many things about MT5 is done in code. That would be my suggestion. 

Anyway, thanks for the reply!

I understand and actually I think it's a bug. I am investigating...
 
Martin Bittencourt:

Hi!

I was trying to solve an annoying bug here when I found out something I'm inclined to believe it's intentional, but better to check in case it's actually some bug:

Suppose I open a chart and manually put some zoom out with the scale sytem (button -). Then I move to the left, to visualize its history, let's say 1 year back. Then, if a click to zoom in (+), the first bar to the left is kept fixed while the zoom is applied to the bars at its right (so, the value returned by CHART_FIRST_VISIBLE_BAR remains the same.)

Now suppose I do zoom out again and I go to the end of the chart, where the current bar being formed is visible. Then, if I click to zoom in (+), it's the bar at the right, the latest being formed, that is kept fixed while the zoom is applied to the bars at the left (so CHART_FIRST_VISIBLE_BAR's value keeps changing every time I click to zoom in and out).

Well is this intentional? Because I can surely understand why the latest bar would be used as reference, being kept fixed, when its visible - for manual traders, I'd say this is the ideal behaviour -, but I can't see why the reference side would be changed to the left one once its the history that is being visualized. And I can report there is at least one scenario in which this change causes a little problem:

If I want to navigate programatically to a certain position on the chart and, then, do some zoom in or zoom out, it becames mandatory to first do the scaling with CHART_SCALE and only later call ChartNavigate. If the opposite is done, there will be some moments in which the chart wont end up where it was supposed to go.

I confirm it's a bug !

Actually, the fixed position can be set where you want (default on left side of the chart), and when the first bar is visible it doesn't work.

I will report it to MQ.

Chart Management - Additional Features - Price Charts, Technical and Fundamental Analysis - MetaTrader 5 Help
Chart Management - Additional Features - Price Charts, Technical and Fundamental Analysis - MetaTrader 5 Help
  • www.metatrader5.com
This section provides information about how to manage charts in the trading platform. Chart managing using the context menu and the...