find bar in specific time frame range yesterday

 

hi guys , how  is possible find  in yesterday  in time frame (example 30 M) the   bar that  have a value = at XXX ?

 
What have you tried ?
 

but   suppose  .. i shot a pics  one sec

Files:
candelpos.jpg  288 kb
 
  1. 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.

  2. 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