Download MetaTrader 5

Disable autoscroll by scrolling manually backwards?

To add comments, please log in or register
mar
1147
mar  

Hi forum,

for me it's inconvinient to disable autoscroll before I can scroll backwards. So I thought if it is possible to disable it automatically if WindowFirstVisibleBar() is above a certain number. I use chart scale 4 with a shift on the right side. So with enabled autoscroll the WindowFirstVisibleBar() function returns 76. That means if the first visible bar would be >76, I try to scroll backwards and I want autoscroll being disabled automatically.

I thought it might be a good idea to do it in a CHARTEVENT_MOUSE_MOVE:

if (id==CHARTEVENT_MOUSE_MOVE) {
   if (ChartGetInteger(0, CHART_SCALE, 0)==4) {
      if (WindowFirstVisibleBar()>76) ChartSetInteger(0, CHART_AUTOSCROLL, false);
      else ChartSetInteger(0, CHART_AUTOSCROLL, true);
   }
}

 Unfortunately, it only works this way: I scroll back with two fingers on my touchpad and when the next tick comes in, the chart jumps to the beginning without disabling autoscroll.

When I scroll back and quickly (before a tick comes in) touch the touchpad with only one finger (similar to a click), autoscroll is disabled. 

I also put the code above into the OnCalculate() to execute before the tick let's the chart jump to the beginning but that had no effect.

 

Does anyone have an idea how to solve this? Maybe with another event I am not thinking about right now? 

Ex Ovo Omnia
3264
Ex Ovo Omnia  
mar:

Hi forum,

for me it's inconvinient to disable autoscroll before I can scroll backwards. So I thought if it is possible to disable it automatically if WindowFirstVisibleBar() is above a certain number. I use chart scale 4 with a shift on the right side. So with enabled autoscroll the WindowFirstVisibleBar() function returns 76. That means if the first visible bar would be >76, I try to scroll backwards and I want autoscroll being disabled automatically.

I thought it might be a good idea to do it in a CHARTEVENT_MOUSE_MOVE:

 Unfortunately, it only works this way: I scroll back with two fingers on my touchpad and when the next tick comes in, the chart jumps to the beginning without disabling autoscroll.

When I scroll back and quickly (before a tick comes in) touch the touchpad with only one finger (similar to a click), autoscroll is disabled. 

I also put the code above into the OnCalculate() to execute before the tick let's the chart jump to the beginning but that had no effect.

 

Does anyone have an idea how to solve this? Maybe with another event I am not thinking about right now? 

You may try to mine the idea from this indicator. I do not have energy to rewrite it just to answer a question.

Files:
syncscroll.ex4 121 kb
mar
1147
mar  

Hi Ovo,

thanks for your code. To be honest, it is pretty hard to understand for me but I will try my best to find the autoscroll-logic you have used.

Unfortunately, I can't compile the code to see what it exactly does.

Ex Ovo Omnia
3264
Ex Ovo Omnia  
mar:

Hi Ovo,

thanks for your code. To be honest, it is pretty hard to understand for me but I will try my best to find the autoscroll-logic you have used.

Unfortunately, I can't compile the code to see what it exactly does.

 

It is not for understanding the entire code, just the part where the CHART_AUTOSCROLL appears. And it cannot be compiled alone, but you have the compiled indicator to see if the code locks/unlocks the way you expect.
kayfx
5
kayfx  
Ex Ovo Omnia:
It is not for understanding the entire code, just the part where the CHART_AUTOSCROLL appears. And it cannot be compiled alone, but you have the compiled indicator to see if the code locks/unlocks the way you expect.

Hey Ovo,

I try this issue too. and I just success to be disable AutoScroll triggered by chart moving.

But, I only use below for catching infomation if MT4 scrolling.

if( id == CHARTEVENT_MOUSE_MOVE ) {}

So, it works between only mouse moving.

Your SyncScroll.ex4 can do this with click & drag, scroll (without mousemoving) and keydown. I can't understand your codes.

What should I use for getting scroll chart? Any advice for me plz?

thx.

To add comments, please log in or register