What function is available for showing total number of bars visible on chart window?
Documentation on MQL5: Constants, Enumerations and Structures / Chart Constants / Examples of Working with the Chart
- www.mql5.com
Examples of Working with the Chart - Chart Constants - Constants, Enumerations and Structures - MQL5 Reference - Reference on algorithmic/automated trading language for MetaTrader 5
#define WINDOW_MAIN 0 void GetChartLimits(int&iLeft, int&iRight, double&top, double&bot,int iW=0){ /* MT4 build 445: In the tester (visual mode,) on the first tick, these * routines return left=100, right=37 (depends on default bar scaling.) * This is what the chart looks like when you maximize it while it is * generating the FXT file. On ticks after that, it appears like the * left/right are correct but the hi/lo are one tick behind the displayed * chart. On the start of a new bar, the hi/lo can be off when a recent * extreme drops off but the scale hasn't resized. I tried calling * WindowRedraw() first but that did not change results. I don't know * about live charts. */ top = WindowPriceMax(iW); iLeft = WindowFirstVisibleBar(); bot = WindowPriceMin(iW); iRight = iLeft-WindowBarsPerChart(); if(top-bot < pips2dbl) top = bot+pips2dbl; // Avoid scroll bug / div0 if(iRight < 0) iRight = 0; // Chart is shifted. } // GetChartLimitsUse Migrating from MQL4 to MQL5 - MQL5 Articles № 19 to convert to MT5.
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