- the high and low of the last 3 bars from yesterday
- Get Time of High and Low of the day
- Difference between the Highest High of last 50 bars and Current candle Low
use iBarShift to get the bar indexes for start and end of the period required
feed that to iHighest and iLowest to get the bar index of highest and lowest
feed that to iHigh iLow to get the final values
nH3 = 3 * 60 / Period(), // Number of bars for 3 hours iH3 = iBod - nH3 + 1;
Because that is what you asked for (nH3=3). You want to read [iBod+1 … iBod-2] (2 bars in the current chart.)
if (iBod <= 2) return; // Not yet two bars completed. double HH = iHighest(NULL,0, MODE_HIGH,3,iBod-2);Find bar of the same time one day ago - MQL4 programming forum 2017.10.06
use iBarShift to get the bar indexes for start and end of the period required
feed that to iHighest and iLowest to get the bar index of highest and lowest
feed that to iHigh iLow to get the final values
Thanks for your answer. I just realized I wasn't use good indexes
Because that is what you asked for (nH3=3). You want to read [iBod+1 … iBod-2] (2 bars in the current chart.)
Thanks W. Roeder
I made it like this before I saw your answer
datetime now = Time[0], bod = now - now % (24*60*60); int iBod = iBarShift(_Symbol, _Period, bod); int nH2 = 2 , iH2 = iBod - nH2 + 1; if (iH2 <= 0) return; double HH = High[iHighest(_Symbol, _Period, MODE_HIGH,nH2+1,iH2)]; double LL = Low[iLowest(_Symbol, _Period, MODE_LOW, nH2+1,iH2)] ;
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use