Thanks William
Dropping else did help me get rid of error.
However, as I was doubting SWITCH / CASE OPERATOR did not return true values when condition was true.
I have instead now resorted to use IF OPERATOR and is working as expected.
//+-----------------------------------------------------------------------------------------------------------------------------+ //| METHOD: IsTaggedKeyPivot() //| APPLICATION: Return [true] if High / Low Price TAGGED a key pivot level //+-----------------------------------------------------------------------------------------------------------------------------+ bool CFollowTheTrend::IsTaggedKeyPivot(ENUM_ORDER_TYPE pOrderType, int pIndex) { int k = pIndex + 1; // INDEX[1] = pIndex AND INDEX[2] ON WHICH TAG IS CHECKED int j = 1; // INDEX FOR PIVOT VALUE double vLow = HAshiM15[k].low; double vHigh = HAshiM15[k].high; double vClose = HAshiM15[k].close; enum_PIVOT_LEVEL vPivotLevel; // ORDER TYPE LONG if(pOrderType == ORDER_TYPE_BUY) { if(vHigh > Pivots[j].R3_0618 && vClose < Pivots[j].R3_0618) return(true); if(vHigh > Pivots[j].R1_0236 && vClose < Pivots[j].R1_0236) return(true); if(vHigh > Pivots[j].PG && vClose < Pivots[j].PG) return(true); if(vHigh > Pivots[j].S1_0236 && vClose < Pivots[j].S1_0236) return(true); if(vHigh > Pivots[j].S3_0618 && vClose < Pivots[j].S3_0618) return(true); } // ORDER TYPE SHORT if(pOrderType == ORDER_TYPE_SELL) { PrintFormat("Index[%i] Low[%.1f] < Pivot[%.1f] and Close[%.1f] > Pivot[%.1f]",k,vLow,Pivots[j].R1_0236,vClose,Pivots[j].R1_0236); if(vLow < Pivots[j].R3_0618 && vClose > Pivots[j].R3_0618) return(true); if(vLow < Pivots[j].R1_0236 && vClose > Pivots[j].R1_0236) return(true); if(vLow < Pivots[j].PG && vClose > Pivots[j].PG) return(true); if(vLow < Pivots[j].S1_0236 && vClose > Pivots[j].S1_0236) return(true); if(vLow < Pivots[j].S3_0618 && vClose > Pivots[j].S3_0618) return(true); } return(false); } // END Of method IsTaggedKeyPivot()

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
Hi
I am trying to get a true/false result through a method(), if price have tagged a certain Pivot Level. I have tried to code it as below, however getting error "not all control paths return a value".
It seems "return(vLow < Pivots[k].S3_0618 && vClose > Pivots[k].S3_0618)" does not returns a boolean value.
Please help me how can I correct this.