Problem solved
Remove #Property strict
That's a work around, add 1 extra line
if(sells>0) return(true); else return(false); // Add this line
That's a work around, add 1 extra line
Thank you buddy
Or the simpler: | return( sells>0 ); // if(sells>0) return(true); // else return(false); // Add this line |
WHRoeder - I keep stripping more lines out of my code thanks to your tips. I would have done exactly the same as GumRai. Thanks!
That's a work around, add 1 extra line
Hi GumRai, just for the sake of conversation, you don't really need the else in there, right ? : )
if(sells>0) return(true); return(false);
Hello, I am trying to code my system however after compiling it returns the "not all control paths return a value" and when I double click it shows its in the following block, could someone please point out the problem.
Thank you in advance
You may get a warning for OrderSelect if you don't check the result.
bool CalculateCurrentSellOrders(string symbol) { int sells=0; for (int i=0;i<OrdersTotal();i++) { if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES)==false) Print("OrderSelect() failed with error : "+GetLastError()); if(OrderSymbol()!=Symbol()||OrderMagicNumber()!=MAGICMA)continue; if(OrderType()==OP_SELL) sells++; } if(sells>0) return(true); return(false); }
Hope it helps
Hi GumRai, just for the sake of conversation, you don't really need the else in there, right ? : )
No, you're right.
WHRoeders post above yours is even simpler to achieve the same thing
No, you're right.
WHRoeders post above yours is even simpler to achieve the same thing
True, but only for particular situations like this one. The other way is more general, regardless of how many and what conditions are, if none of them return true, it will return false.
It is, must admit, an elegant solution for this particular example.
...
and if you don't use :
Hope it helps
i<OrdersTotal()If you add -1 you miss 1 item of the array.
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hello, I am trying to code my system however after compiling it returns the "not all control paths return a value" and when I double click it shows its in the following block, could someone please point out the problem.
Thank you in advance