After compiling it shows that "not all control path returns value"
where is the mistake?
Can anybody suggest me?
bool DTNAR() { double DTNAiPtFc=100; double buyprice,sellprice,pointDTNA,AskV,BidV,pacal; buyprice=MarketInfo(Symbol(),MODE_ASK); sellprice=MarketInfo(Symbol(),MODE_BID); if(DTNAiPtFc>0) { int y=0; int z; pointDTNA=MarketInfo(Symbol(),MODE_POINT); for (z=y;z<=DTNAiPtFc;z++) { pacal=pointDTNA*z; AskV=buyprice*pacal; BidV=sellprice*pacal; if(AskV>0&&BidV>0) { for(int TrC=OrdersTotal()-1;TrC>=0;TrC--) { if(!OrderSelect(TrC,SELECT_BY_POS))continue; if(OrderSymbol()!=Symbol())continue; if(OrderType()!=OP_BUY||OrderType()!=OP_SELL)continue; if(OrderOpenPrice()==AskV||OrderOpenPrice()==BidV) Print ("Double trade zone"); return(true); } } } return(false); } else return(false); }
Thanks for the reply
But I still have one question
what might be the solution to that so that the condition will return value true or false.
I would be great to see the suggestion.
No idea what are you using that code for
You had an issue, and it is solved. The rest is on you
Post the code here with tags, no image, so readers can make amendments.
This cannot work:
if(OrderType()!=OP_BUY||OrderType()!=OP_SELL)continue;
It will never be true. Try this:
if(OrderType()!=OP_BUY && OrderType()!=OP_SELL)continue;
General rules and best pratices of the Forum. - General - MQL5 programming forum
Messages Editor
Post the code here with tags, no image, so readers can make amendments.
This cannot work:
It will never be true. Try this
Thanks for your reply to my question.
Actually I am not being able to return the value from the inner for loop to the whole function.
Here is the code:-
bool DTNAR() { double DTNAiPtFc=100; double buyprice,sellprice,pointDTNA,AskV,BidV,pacal; buyprice=MarketInfo(Symbol(),MODE_ASK); sellprice=MarketInfo(Symbol(),MODE_BID); if(DTNAiPtFc>0) { int y=0; int z; pointDTNA=MarketInfo(Symbol(),MODE_POINT); for (z=y;z<=DTNAiPtFc;z++) { pacal=pointDTNA*z; AskV=buyprice*pacal; BidV=sellprice*pacal; if(AskV>0&&BidV>0) { for(int TrC=OrdersTotal()-1;TrC>=0;TrC--) { if(!OrderSelect(TrC,SELECT_BY_POS))continue; if(OrderSymbol()!=Symbol())continue; if(OrderType()!=OP_BUY||OrderType()!=OP_SELL)continue; if(OrderOpenPrice()==AskV||OrderOpenPrice()==BidV) return(true); Print ("Double trade zone"); } } } } else return(false); }
I would be very much thank full if you could suggest me that how could I return the value from the inner for loop to the function in this code. Is there any mistake, or am I not doing in correct way.
Please don't post image of code. Please edit your (original) post and use the CODE button (Alt-S)! (For large amounts of code, attach it.)
General rules and best pratices of the Forum. - General - MQL5 programming forum
Messages Editor
Thanks for your reply to my question.
Actually I am not being able to return the value from the inner for loop to the whole function.
Here is the code:-
bool DTNAR() { double DTNAiPtFc=100; double buyprice,sellprice,pointDTNA,AskV,BidV,pacal; buyprice=MarketInfo(Symbol(),MODE_ASK); sellprice=MarketInfo(Symbol(),MODE_BID); if(DTNAiPtFc>0) { int y=0; int z; pointDTNA=MarketInfo(Symbol(),MODE_POINT); for (z=y;z<=DTNAiPtFc;z++) { pacal=pointDTNA*z; AskV=buyprice*pacal; BidV=sellprice*pacal; if(AskV>0&&BidV>0) { for(int TrC=OrdersTotal()-1;TrC>=0;TrC--) { if(!OrderSelect(TrC,SELECT_BY_POS))continue; if(OrderSymbol()!=Symbol())continue; if(OrderType()!=OP_BUY||OrderType()!=OP_SELL)continue; if(OrderOpenPrice()==AskV||OrderOpenPrice()==BidV) return(true); Print ("Double trade zone"); } } } } else return(false); }
I would be very much thank full if you could suggest me that how could I return the value from the inner for loop to the function in this code. Is there any mistake, or am I not doing in correct way.
For what do you need all these variables? Please comment your code and say what you want to achieve.
bool DTNAR() { double DTNAiPtFc=100; double buyprice,sellprice,pointDTNA,AskV,BidV,pacal; buyprice=MarketInfo(Symbol(),MODE_ASK); sellprice=MarketInfo(Symbol(),MODE_BID); if(DTNAiPtFc>0) { int y=0; int z; pointDTNA=MarketInfo(Symbol(),MODE_POINT); for (z=y;z<=DTNAiPtFc;z++) { pacal=pointDTNA*z; AskV=buyprice*pacal; BidV=sellprice*pacal; if(AskV>0&&BidV>0) { for(int TrC=OrdersTotal()-1;TrC>=0;TrC--) { if(!OrderSelect(TrC,SELECT_BY_POS))continue; if(OrderSymbol()!=Symbol())continue; if(OrderType()!=OP_BUY||OrderType()!=OP_SELL)continue;//This can be optional if required we can remove this line also if(OrderOpenPrice()==AskV||OrderOpenPrice()==BidV) //This is the condition that i need to check, if this condition is true i am trying the function to return true else false return(true); Print ("Double trade zone");//if required we can also remove this } } } } else return(false); }
Could you please check the code I have written the comment what i am trying to do.

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
After compiling it shows that "not all control path returns value"
where is the mistake?
Can anybody suggest me?