It is all to do with what mql4 calls the chart scale. Go to the snippet starting at line 112. The chart scale is from 0 to 5, with 0 being zoomed out as far as possible and 5 being zoomed in as far as possible.Radar » Sat Mar 11, 2017 1:47 am wrote:
I just had a squizz inside Steve's Peak HiLo indicator, to see if I could get it to zoom back in a bit after it has drawn its lines, (the way it zooms right out does my head in), but I got totally lost in there
The only thing that I could work out is that I couldn't work any of it out
Some indies are really simple to modify... PHL ain't one of 'em
Have fun!
Radar =8^)
Line 112 reads the current chart scale by calling the int ChartScaleGet(const long chart_ID=0) function I copied from the mql4 documentation.
Line 115 zooms out the chart by setting its scale to 0, with a call to the bool ChartScaleSet(const long value,const long chart_ID=0) function I copied from the mql4 documentation.
The rest of the code in the snippet changes to a different time frame and back again as the chart did not seem to display correctly without this. This may be unnecessary. I did not understand the code when I wrote the indi, and still don't. It ain't bust, so I have resisted the temptation to fix it.
If you want to zoom back in again after the indi has drawn its lines, go to line 652 and insert the same code snippet with ChartScaleSet(a zoom factor up to 5) to the zoom factor you want. Suppose you want it set to 3. Your snippet would be:
Code: Select all
int scale = ChartScaleGet();
if (scale != 3)
{
ChartScaleSet(3);
//A quick time frame change to force accurate display
per = ChartPeriod(0);
int nextPer = GetNextPeriod(per);
ChartSetSymbolPeriod(0, Symbol(), nextPer);//Change time frame
ChartSetSymbolPeriod(0, Symbol(), per);//reset time frame
}//if (scale != 3)