I have the error "Not all control paths return a value". I've seen it before and have been able to resolve it for a simple bool return value. This is a bit different and seems to be a challenge for me since it has a for-loop and at the same time returns integers. Please see my code below:
int ArrowedCandleIndex () {
for (int i=0; i<NumBars; i++)
{
double dnArrow = iCustom(Symbol(),Period(),ARROWS_SIGNAL_NAME,ARROWS_SIGNAL_BUFFER_DN,i);
double upArrow = iCustom(Symbol(),Period(),ARROWS_SIGNAL_NAME,ARROWS_SIGNAL_BUFFER_UP,i);
if ((dnArrow!=EMPTY_VALUE) && (DoubleToStr(dnArrow,Digits()) != "0.00000")) {
currentArrowedCandleIndex = NumBars;
return currentArrowedCandleIndex;
}
if ((upArrow!=EMPTY_VALUE) && (DoubleToStr(upArrow,Digits()) != "0.00000")) {
currentArrowedCandleIndex = NumBars;
return currentArrowedCandleIndex;
}
}
}
How can I resolve this issue?
for
loop without finding anything? – Raymond Chen