Custom Zoom on Charts

Hi,

I was wondering if anyone knows how to create toolbar buttons to zoom the chart to a variety of levels that display a certain number of bars back from the latest visible bar. I know under the menu item View > Zoom there are the options "ALL" and "Normal" and normal is a certain number of bars from the last visible bar (as configured in the preferences menu).

What I was hoping to achieve is to be able to click on a tool bar zoom to the last

  • 5 bars (roughly a week)
  • 20 bars ( roughly a month)
    -63 bars (roughly 3 months)
    -125 bars (roughly 6 months)
    -250 bars (roughly a year of trading)
  • All
    With a button for each option. I am using EOD data. This would give me consistency when trying to view trends over certain time frames.

I know there are SetChartOptions to control the Y_min and Y max but not sure how to control the X-Min and X-max.

Hope this question makes sense.

Cheers

Jamie

You can create such functions through AB's OLE interface as seen in some cases described below:

https://www.amibroker.com/kb/2015/10/05/how-to-browse-charts-in-selected-date-range/
It is worth reading the last paragraph about other ways to compare as well and info on bitness.

Another detailed one, with almost ready-to-use code is shared here:
http://www.amibroker.org/userkb/2007/06/28/zoom-to-range-applications/

1 Like

@jamiedrewdavies you can also find some ideas/solutions here:

2 Likes