Fine zoom the charts
there are multiple zooming options and types and probably I will not cover them all here as there are multiple ways to achieve the same by calling various script command or use third party software to map mouse to keyboard actions and vice versa.
Zooming with mouse wheel
The mouse wheel zooming is by default adding/removing 10 bars to the chart.
Vertical zooming
If enabled in the chart config window with this setting,
we can change the size of the bars by right-clicking on the price area and dragging the mouse.
Video
Zoom to X bars
There is one command we can use
NumBar 50;
or with the object referenced syntax
$M2MC=getwindowobj("MY2MINCHART");
$M2MC.NumBar 50;
Reset the charts
Knowing the above we can easily reset our charts with one hotkey
$M2MC.ResetTopBottomMargin;
$M2MC.ZoomFit;
$M2MC.NumBar 50;
$mybar=50;
To find out the ideal number of bars easily, read till the end of this post.
Fine zooming
the command numbar does not allow a variable parameter, but there is a workaround using the Exec() function which allows us to do this kind of trick on any old command which has not been remade by DAS for the variables as a parameter.
First, reset the charts or set the default number of bars shown when you load the desktop in the desktop load script;
$mybar=50;
Zoom with buttons
Video
Bars down
$mybar=$mybar-1;
Exec("$my1minwindow.numbar "+$mybar);
Bars up
$mybar=$mybar+1;
Exec("$my1minwindow.numbar "+$mybar);
You can make it as buttons or use just as hotkeys.
Buttons with indicators
This is good to find out which zoom level you like the most so you can set your chart reset to the number you like most.
Zoom out
$M2MC=getwindowobj("MY2MINCHART");
$mybars=$mybar+1;
Exec("$M2MC.numbar "+$mybar);
$M2MC.GetCustButObj("Numbars").text=$mybar+" Bars";
Indicator button
the indicator button can work as a reset button as well
$mybars=50;
$M2MC=getwindowobj("MY2MINCHART");
$M2MC.ResetTopBottomMargin;
$M2MC.ZoomFit;
Exec("$M2MC.numbar "+$mybars);
$M2MC.GetCustButObj("Numbars").text=$mybars+" Bars";
Zoom In
$M2MC=getwindowobj("MY2MINCHART");
$mybars=$mybar-1;
Exec("$M2MC.numbar "+$mybar);
$M2MC.GetCustButObj("Numbars").text=$mybar+" Bars";
Of course, you can decide to zoom in numbers of 3 or 5 or 10 as you need by editing the steps in the 2nd line of the code.
$mybars=$mybar-3;
or
$mybars=$mybar-5;
If you happen to bring the number down below 0 it will not show any bars.
You cannot mix the mouse wheel with the fine zoom as the fine zoom does not know about the current state and always continues from its last known state.
I have implemented a knob on my Tourbox for this function!