This should get you started:
//+------------------------------------------------------------------+ //| Gets chart scale (from 0 to 5) | //+------------------------------------------------------------------+ int ChartScaleGet(const long chart_ID=0) { //--- prepare the variable to get the property value long result=-1; //--- reset the error value ResetLastError(); //--- receive the property value if(!ChartGetInteger(chart_ID,CHART_SCALE,0,result)) { //--- display the error message in Experts journal Print(__FUNCTION__+", Error Code = ",GetLastError()); } //--- return the value of the chart property return((int)result); } //+------------------------------------------------------------------+ //| Sets chart scale (from 0 to 5) | //+------------------------------------------------------------------+ bool ChartScaleSet(const long value,const long chart_ID=0) { //--- reset the error value ResetLastError(); //--- set property value if(!ChartSetInteger(chart_ID,CHART_SCALE,0,value)) { //--- display the error message in Experts journal Print(__FUNCTION__+", Error Code = ",GetLastError()); return(false); } //--- successful execution return(true); }
Documentation on MQL5: Examples of Working with the Chart / Constants, Enumerations and Structures
- www.mql5.com
This section contains examples of working with chart properties. One or two complete functions are displayed for each property. These functions...
If you want to capture double clicks, you'll need to time 2 clicks of CHARTEVENT_CLICK or CHARTEVENT_OBJECT_CLICK:
Documentation on MQL5: OnChartEvent / Event Handling
- www.mql5.com
The function is called in indicators and EAs when the ChartEvent event occurs. The function is meant for handling chart changes made by a user or...
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Hi,
I'd like to reproduce as code the following steps:
- Scale to max zoom out
- Increase the value of the min and maximum Y axis (so, if it's plotting $10 - $20, the scales will be like $5 - $25).
- Set scales to fix mode
- Scale to "normal", original zoom
- Double-click over the Y axis
The result will be an axis bar like this:I already know how to do most of those steps; only the 5th item, the double-click, I don't know how to do it by code. I thought it would be using CHART_PRICE_MAX and CHART_PRICE_MIN, but those seems to be read-only values. So, how can I do this double-click by code? I couldn't find any suitable canditate in all the variables regarding ChartSetDouble (or ChartSetInteger).