number of bar formed after a specefic bar

 

Good morning

i have coded an indicator detects pin bar now i want filter

i choose oly the pin bar  after it and below the low of it was formed some bars

the probleme now at this instant the numbers of my pin bar is 1 for exemple if some bars was formed after it  the number of my pin bar is not 1 any more how i fix his nuber to test

if there is some candles closed below of his low(the pin bar)

think you 

 
nix816: pin bar is 1 for exemple if some bars was formed after it  the number of my pin bar is not 1 any more

Save the datetime of the bar, next time use iBarShift to get the index again.

 

thik you for the idea i will  try 

 

it does not work with iTime i

i explain better my problem we suppose that the shift of my pin bar is 1 now i want to test if is there a candle closed lower than  my pin bar

 
if(Isbullish(2)&&Close[1]<Low[2]){ //discovering the engolfing candle 
 UpData=iTime(0,0,1);         // saving the date of the engolfing candle
 
}

j = iBarShift(0,0,UpData,True); // getting the position (the shift) of my engolfing candle


if(j>1){
while(High[j]>High[1]){


 if((High[j]-Low[1])>30*pips){
Down[j]=High[j]+3*pips;  // drowing an arrow 3 pips higher than the high of my engolfing candle whene the low of a candle is lower then
                         // the engolfing candle by 30 pips
}
}





//--- return value of prev_calculated for next call
   return(rates_total);

this is my code if i run it all stops and mt4 become blanck

Reason: