What have you tried ?
- There is no bar "that have a value = at XXX" Bars have four values (OHLC,) and four ranges. Your image points to the first candle totally above current market. Until you can state your condition in concrete terms, it can not be coded. First, latest, above, below, crossed, closed above, etc.
- Get the index for the beginning of the day (BOD), last bar of previous day (EOY) index for previous day (BOY.) Loop over the bars and check
your condition.
Find bar of the same time one day ago - MQL4 programming forum 2017.10.06
int LastTimeBar(){ int output = 0; for(int i = 0; i < iBars(NULL, TimeFrame); i++){ if(TimeHour(iTime(NULL, TimeFrame, i)) == (int)StringSubstr(ReferenceCandle, 0, StringFind(ReferenceCandle, ":")) && TimeMinute(iTime(NULL, TimeFrame, i)) == (int)StringSubstr(ReferenceCandle, StringFind(ReferenceCandle, ":")+1, 2)){ output = i;break;} } return output; }
The function
LastTimeBar()
will give you the candle index of your ReferenceCandle (xx:xx)
TimeFrame is self explantory.
Wishing you well - Teemy
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 guys , how is possible find in yesterday in time frame (example 30 M) the bar that have a value = at XXX ?