请问mq4 的MACD Sample例程问题

 
请问mq4 的MACD Sample例程中
for(cnt=0;cnt<total;cnt++)
{
OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES);
if(OrderType()<=OP_SELL && // check for opened position
OrderSymbol()==Symbol()) // check for symbol
{
if(OrderType()==OP_BUY) // long position is opened
{
// should it be closed?
if(MacdCurrent>0 && MacdCurrent<SignalCurrent && MacdPrevious>SignalPrevious &&
MacdCurrent>(MACDCloseLevel*Point))
{
OrderClose(OrderTicket(), OrderLots(), Bid, 3,Violet); // close position
return(0); // exit
}
// check for trailing stop
if(TrailingStop>0)
{
if(Bid-OrderOpenPrice()>Point*TrailingStop)
{
if(OrderStopLoss()<Bid-Point*TrailingStop)
{
OrderModify(OrderTicket(), OrderOpenPrice(), Bid-Point*TrailingStop, OrderTakeProfit(), 0,Green);
return(0);
}
}
}
}
else // go to short position

的OrderType()<=OP_SELL为什么要用<=,而不用==.用<=就是指返回OP_SELL或OP_BUY吗?
 
See https://docs.mql4.com/cn/constants/trading

Constant Value Description
OP_BUY0Buying position.
OP_SELL1Selling position.
OP_BUYLIMIT2Buy limit pending position.
OP_SELLLIMIT3Sell limit pending position.
OP_BUYSTOP4Buy stop pending position.
OP_SELLSTOP5Sell stop pending position.



and https://docs.mql4.com/cn/trading/OrderType

Returns order operation type for the currently selected order. It can be any of the following values:
OP_BUY - buying position,
OP_SELL - selling position,
OP_BUYLIMIT - buy limit pending position,
OP_BUYSTOP - buy stop pending position,
OP_SELLLIMIT - sell limit pending position,
OP_SELLSTOP - sell stop pending position.
Note: order must be selected by OrderSelect() function.
Sample:
  int order_type;
if(OrderSelect(12, SELECT_BY_POS)==true)
{
order_type=OrderType();
// ...
}
else
Print("OrderSelect() returned error - ",GetLastError());
 
thank you!谢谢你!
 
You're welcome.