Help with storing a value found inside of a function in an array

 

Hello Forex coders,

I am new to the programming realm (3 months of self-taught knowledge coding C++ and less than 1 month coding with MQL4). I have found an indicator from this forum and am attempting to edit it to better suit my purposes. This indicator locates an Inside Bar, definition:

if(Low[i+1]<= Low[i] && High[i+1]>=High[i]) .

This if statement works well and paints the bodies of Inside bars as it should. However, for my purposes I need the indicator to recognize multiple inside bars that form within the range of the original mothercandle. To better explain to you guys what I mean, in the above snippet, Low[i+1] & High[i+1] would be the mothercandle and the next bar would be the inside bar. What happens when I run this indicator is the indicator will recognize the original inside bar after the original mothercandle but will not paint an inside bar if it does not form inside of the previous inside bar. I have attached a picture below to illustrate what I mean. As you can see in the picture the indicator correctly paints bar 7 as an inside bar but does not paint bar 6, 5, or 4, does paint bar 3 because it is inside of bar 4. According to what I need I need the indicator to recognize the High and Low values of the original mothercandle (bar 8 in the picture) and continue recognizing the new forming bars as inside bars as long as the high and low of these new bars does not breach the ORIGINAL mothercandle not the PREVIOUS BAR. I will now attach the code in its entirety and really appreciate nay help anyone can offer. I am still learning but I am very stuck on this issue and would appreciate help from an experienced coder.


Thanks in advance

Files:
 

Hey guys,

Been experimenting with a number of different things today. These include the sleep() function, break; and switch operators, and thus far no success. There is really no one in this forum that knows how to stop executing my function of finding an IB while the High and Low of future bars does not exceed the High and Low of the mothercandle?

 

You can't stop "executing the function of finding ... while not exceeding." If you stop how could you know it's been exceeded?

Indicators CAN NOT sleep

Reason: