EA及其工作原理
    
          {
            Print("TakeProfit less than 10");
            return (0); // check TakeProfit
          }
//----
        SEma = iMA(NULL, 0, ShortEma, 0, MODE_EMA, PRICE_CLOSE, 0);
        LEma = iMA(NULL, 0, LongEma, 0, MODE_EMA, PRICE_CLOSE, 0);
//----
        static int isCrossed = 0;
        isCrossed = Crossed(LEma, SEma);
//----
        total = OrdersTotal();
        if (total < 1)
          {
            if (isCrossed == 1) // 满足空仓条件,开空仓
              {
                ticket = OrderSend(Symbol(), OP_SELL, Lots, Bid, 3, Bid + StopLoss * Point,
                        Bid - TakeProfit * Point, "EMA_CROSS", 12345, 0, Green);
                if (ticket > 0)
                  {
                    if (OrderSelect(ticket, SELECT_BY_TICKET, MODE_TRADES))
                        Print("SELL order opened : ", OrderOpenPrice());
                  } else
                    Print("Error opening SELL order : ", GetLastError());
                return (0);
              }
            if (isCrossed == 2) // 满足多仓条件,开多仓
              {
                ticket = OrderSend(Symbol(), OP_BUY, Lots, Ask, 3, Ask - StopLoss * Point,
                        Ask + TakeProfit * Point, "EMA_CROSS", 12345, 0, Red);
                if (ticket > 0)
 
网站导航 | 公司简介 | 法律声明 | 诚聘英才 | 征稿启事 | 联系我们 | 广告服务 | 用户反馈
欢迎访问证券之星!请点此与我们联系 版权所有:Copyright © 1996-