MQL4布尔逻辑问题

时间:2018-11-28 19:58:34

标签: mql4

您好,我需要这段小代码的帮助。
你能告诉我这是怎么回事吗?谢谢。

if(Cross(15, iMA(NULL, PERIOD_H1, 3, 0, MODE_SMA, PRICE_CLOSE, 0) < iMA(NULL, PERIOD_H1, 80, 0, MODE_SMA, PRICE_CLOSE, 0)) 
&& if(Cross (16, iMA(NULL, PERIOD_M1, 3, 0, MODE_SMA, PRICE_CLOSE, 0) > iMA(NULL, PERIOD_M1, 20, 0, MODE_SMA, PRICE_CLOSE, 0)) //Moving Average crosses above Moving Average
//Moving Average crosses below Moving Average
))
{
  RefreshRates();
  price = Ask;   
  if(IsTradeAllowed())
  {
    ticket = myOrderSend(OP_BUY, price, TradeSize, "");
    if(ticket <= 0) return;
  }
  else //not autotrading => only send alert
    myAlert("order", "");
}

1 个答案:

答案 0 :(得分:0)

if(Cross(15,iMA(NULL,PERIOD_H1,3,0,MODE_SMA,PRICE_CLOSE,0) <           

iMA(NULL,PERIOD_H1,80,0,MODE_SMA,PRICE_CLOSE,0)) &&
Cross(16,iMA(NULL,PERIOD_M1,3,0,MODE_SMA,PRICE_CLOSE,0) >   

iMA(NULL,PERIOD_M1,20,0,MODE_SMA,PRICE_CLOSE,0))) 
//Moving Average crosses above Moving Average
{
 RefreshRates();
 price = Ask;   
 if(IsTradeAllowed())
 {
  ticket = myOrderSend(OP_BUY, price, TradeSize, "");
  if(ticket <= 0) return;
 }
 else //not autotrading => only send alert
 myAlert("order", "");
 }
}