Please don't create a new topic, just continue with your existing one.
Would
bool MySelect(int iWhat, int eSelect, int ePool=MODE_TRADES) // MySelect bool initiation, value given below
// so I'm thinking to add in a myselect function for Buy and one for Sell.. as i simply dont understand 'return(OrderType() <= OP_SELL);'
{
if(!OrderSelect(iWhat, eSelect, ePool) ) return (false);
if(OrderMagicNumber() != magicnumber ) return (false); // OMN = OMN ELSE MySelect = FALSE
if(OrderSymbol() != symbolchart ) return (false); // OrderSymbol = SYMBOL
if(ePool != MODE_HISTORY ) return (true ); // order selected is not closed / from history
if(OrderType() != OP_BUY) return(OrderType() == OP_SELL);
else return(OrderType() == OP_BUY);
}
// so I'm thinking to add in a myselect function for Buy and one for Sell.. as i simply dont understand 'return(OrderType() <= OP_SELL);'
{
if(!OrderSelect(iWhat, eSelect, ePool) ) return (false);
if(OrderMagicNumber() != magicnumber ) return (false); // OMN = OMN ELSE MySelect = FALSE
if(OrderSymbol() != symbolchart ) return (false); // OrderSymbol = SYMBOL
if(ePool != MODE_HISTORY ) return (true ); // order selected is not closed / from history
if(OrderType() != OP_BUY) return(OrderType() == OP_SELL);
else return(OrderType() == OP_BUY);
}
not make more sense?
xanderhinds: Would not make more sense?
| Had you seen the original https://www.mql5.com/en/forum/143514#comment_3626889 The comment on type <= sell explains why it's not just return true. if(OrderType() != OP_BUY) return(OrderType() == OP_SELL); else return(OrderType() == OP_BUY); // equivalent return OrderType() == OP_BUY || OrderType() == OP_SELL; // And since buy=0 and sell = 1 and there are no negatives return OrderType() <= OP_SELL; |
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
// so I'm thinking to add in a myselect function for Buy and one for Sell.. as i simply dont understand 'return(OrderType() <= OP_SELL);'
{
if(!OrderSelect(iWhat, eSelect, ePool) ) return (false);
if(OrderMagicNumber() != magicnumber ) return (false); // OMN = OMN ELSE MySelect = FALSE
if(OrderSymbol() != symbolchart ) return (false); // OrderSymbol = SYMBOL
if(ePool != MODE_HISTORY ) return (true ); // order selected is not closed / from history
return(OrderType() <= OP_SELL);
}
So I was forwarded to this piece of code that I'm currently trying to understand.. can anyone tell me why
return(OrderType() <= OP_SELL);
Is there?