how i can stop loop to reach a spacific candle on which indicator showing arrow

 

hi

i m new to coding world  i need help i need some one kind who can guide me a little

i m working with loop how i will stop my loop i want to reach to a spacifi candle on which indicator showing arrow

i can stop loop to very next candle aftr arrow candle but i can not stop loop after unlimited candles

kindly helop me progrmmers

 
If the indicator isn't showing an arrow, then the value read is typically EMPTY_VALUE (sometimes indicators use zero.) If it isn't, then you have the bar you want - stop looping.
 
whroeder1:
If the indicator isn't showing an arrow, then the value read is typically EMPTY_VALUE (sometimes indicators use zero.) If it isn't, then you have the bar you want - stop looping.

thank you very much sir for you kindness to guide me

I want to know the index no. of that specific candle on which indicator is pasting arrow kindly see chart img i attached

Files:
loop.png  15 kb
 
Lubna Shahzadi: I want to know the index no. of that specific candle on which indicator is pasting arrow

You already said that. Saying it again changes nothing.

What part of "then you have the bar you want - stop looping" was unclear?

 
whroeder1:

You already said that. Saying it again changes nothing.

What part of "then you have the bar you want - stop looping" was unclear?

for(int I = 0; I < ???; I++)

i cant identify the body of loop

 
Why can't you? What part of "then you have the bar you want - stop looping" was unclear?
double arrows[];
int  Bars = CopyBuffer(
   indicator_handle,       // indicator handle
   buffer_num,             // indicator buffer number
   0,                      // start position
   Bars(_Symbol,_Period),  // amount to copy
   arrows                  // target array to copy
   );
for(int iBar = 0; iBar < Bars; ++iBar){
   if( arrows[iBar] != EMPTY_VALUE ) break;
}
Print("Found arrow at "+i);
We're not going to code it for you. We are willing to help you when you post your attempt (using CODE button) and state the nature of your problem.
          No free help
          urgent help.
 
whroeder1:
Why can't you? What part of "then you have the bar you want - stop looping" was unclear?We're not going to code it for you. We are willing to help you when you post your attempt (using CODE button) and state the nature of your problem.
          No free help
          urgent help.

sir I appreciate your efforts. I am just having some issues. CopyBuffer function is giving error, what is indicator handle etc

Files:
 
and the code is of mql4
 
Lubna Shahzadi: and the code is of mql4

You didn't state that previously and I know this thread wasn't in MT4 forum when I posted.

int iBar = 0;
for(; iBar < Bars; ++iBar){
   double arrow = iCustom( ... iBar);
   if( arrow != EMPTY_VALUE ) break;
}
Print("Found arrow at "+iBar);
 
whroeder1:

You didn't state that previously and I know this thread wasn't in MT4 forum when I posted.

I moved it.
 
whroeder1:

You didn't state that previously and I know this thread wasn't in MT4 forum when I posted.

it worked. thank you very much sir
Reason: