513双均线,帮着改一下

楼主  收藏   举报   帖子创建时间:  2019-05-05 05:39 回复:0 关注量:463
这个EA,只能运行于一个货币对(任意)
  
  能把他敢成,同时在多个货对下运行

  • //+----------------------------------------------------------------------------------------+
  • //|                                                EMA Cross                               |
  • //|                                                Clay - Copyright 2006                   |              
  • //| v 1.1 fixed emas                                                                       |
  • //+----------------------------------------------------------------------------------------+

  •    

  • //---- input parameters
  • extern double    StopLoss = 30;
  • extern double    TakeProfit = 1000;
  • extern double    Lots = 0.1;
  • extern double    TrailingStop = 200;

  • extern int ShortEma = 3;
  • extern int LongEma = 8;


  • //+------------------------------------------------------------------+
  • //| expert initialization function                                   |
  • //+------------------------------------------------------------------+
  • int init()
  •   {
  • //----
  •    
  • //----
  •    return(0);
  •   }
  • //+------------------------------------------------------------------+
  • //| expert deinitialization function                                 |
  • //+------------------------------------------------------------------+
  • int deinit()
  •   {
  • //----
  •    
  • //----
  •    return(0);
  •   }

  • //+------------------------------------------------------------------+
  • //| expert start function                                            +
  • //| This is where we initialize internal variables for program use   +                                   
  • //+------------------------------------------------------------------+
  • int start()
  •   {
  • //----

  • //LotCalc Declarations
  •    int cnt, ticket, total;
  • //MAs
  •    double FEMAnow,FEMAprevious,FEMA2previous,SEMAnow,SEMAprevious,SEMA2previous;
  •    
  •    
  •    if(Bars/ li   int isCrossed  = 0;br / li    br / li    if (FEMAnow  SEMAnow && FEMAprevious > SEMAprevious && FEMA2previous < SEMAprevious)
  •     {isCrossed = 1;
  •     }

  •     if (FEMAnow < SEMAnow && FEMAprevious < SEMAprevious && FEMAprevious > SEMAprevious)
  •     {isCrossed = 2;
  •     }

  •    
  •    //We check the trading terminal to see if it is empty
  •    total  = OrdersTotal();
  •    if(total < 1) //If trading terminal is empty...
  •      {
  •       if(isCrossed == 1) //if cross indicates LONG swing...
  •       

  •          {
  •             ticket=OrderSend(Symbol(),OP_BUY,Lots,Ask,2,Ask-StopLoss*Point,Ask+TakeProfit*Point,"EMa cross",12345,0,Yellow);
  •             if(ticket>0)
  •               {
  •                if(OrderSelect(ticket,SELECT_BY_TICKET,MODE_TRADES)) Print("BUY order opened : ",OrderOpenPrice());
  •               }
  •             else Print("Error opening BUY order : ",GetLastError());
  •             return(0);
  •          }
  •         if(isCrossed == 2) //if cross indicates SHORT swing...
  •       
  •          {

  •             ticket=OrderSend(Symbol(),OP_SELL,Lots,Bid,2,Bid+StopLoss*Point,Bid-TakeProfit*Point,"EMA cross",12345,0,Red);
  •             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);
  •          }
  •          return(0);
  •      }
  •    
  •    //Position exit function...
  •    for(cnt=0;cntPoint*TrailingStop)
  •                  {
  •                   if(OrderStopLoss()0)  
  •               {                 
  •                if((OrderOpenPrice()-Ask)>(Point*TrailingStop))
  •                  {
  •                   if((OrderStopLoss()>(Ask+Point*TrailingStop)) || (OrderStopLoss()==0))
  •                     {
  •                      OrderModify(OrderTicket(),OrderOpenPrice(),Ask+Point*TrailingStop,OrderTakeProfit(),0,Red);
  •                      return(0);
  •                     }
  •                  }
  •               }
  •            }
  •         }
  •      }

  •    return(0);
  •   }//+------------------------------------------------------------------+

复制代码
打赏