Not window handle! Subwindow number of the current chart
Thank you Slawa for the WindowPriceMin() & WindowPriceMax() parameter.
BUT when I start off with PERIOD_M1 the results are correct, but if the period is changed to PERIOD_M5 the same values are returned yet the chart visually displays different y values!, BUT if I delete my indicator and run it again the WindowPriceMin() & WindowPriceMax() return the correct values. Thanking you in advance.
BUT when I start off with PERIOD_M1 the results are correct, but if the period is changed to PERIOD_M5 the same values are returned yet the chart visually displays different y values!, BUT if I delete my indicator and run it again the WindowPriceMin() & WindowPriceMax() return the correct values. Thanking you in advance.
There is a nuance concerning indicators.
Indicators are first calculated one by one, then drawn.
Minimum price and maximum price are calculated during drawing, i.e., when the timeframe is changed, your indicator gets the previous value of the minimum and the maximum. You should wait until the next tick comes, everything will be ok.
The above does not relate to Expert Advisors and scripts.
Indicators are first calculated one by one, then drawn.
Minimum price and maximum price are calculated during drawing, i.e., when the timeframe is changed, your indicator gets the previous value of the minimum and the maximum. You should wait until the next tick comes, everything will be ok.
The above does not relate to Expert Advisors and scripts.

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
// debug
int iWin=WindowHandle(Symbol(), Period());
Print("iWin=",iWin," WindowPriceMax()=",WindowPriceMax(iWin)," WindowPriceMin()=",WindowPriceMin(iWin));
// end debug