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; break; //return currentArrowedCandleIndex; } if ((upArrow!=EMPTY_VALUE) && (DoubleToStr(upArrow,Digits()) != "0.00000")) { currentArrowedCandleIndex = NumBars; break; //return currentArrowedCandleIndex; } } return (currentArrowedCandleIndex); }
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; } } return(-1); }
return -1 or something suitable if none of the conditions are met.
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
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: