📅 财经日历 📊 实时波动 📈 大盘云图 📶 行情走势 🆚 投机情绪 🚀 今日热点

    513双均线,帮着改一下

    2011-09-14 · 4565 阅读
    这个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);
    •   }//+------------------------------------------------------------------+

    复制代码
    ""
    还没有人打赏,支持一下
    回复

    举报

     

    回答|共 9 个

    sh2100 LV4

    发表于 2012-11-25 18:27:51 | 显示全部楼层

    顶你一下.  

    baoshan2007 LV0

    发表于 2012-11-25 18:27:51 | 显示全部楼层

    必须顶  

    左手起茧 LV5

    发表于 2012-11-25 18:27:51 | 显示全部楼层

    我该不会是最后一个顶的吧  

    yujopozb LV4

    发表于 2012-11-25 18:27:51 | 显示全部楼层

    我怎么没法看帖子了  

    月上萧萧 LV4

    发表于 2012-11-25 18:27:51 | 显示全部楼层

    经过你的指点 我还是没找到在哪 ~~~  

    坐失良机 LV3

    发表于 2015-1-23 02:14:58 | 显示全部楼层

    我靠

    wyq LV3

    发表于 2015-1-23 02:21:56 | 显示全部楼层

    顶楼主~~~~~~~~~~~~~~~

    FUujI8cW LV3

    发表于 2015-1-25 05:16:43 | 显示全部楼层

    想学EA,拜师,谁收了我吧

    曋曋 LV3

    发表于 2015-2-5 14:23:28 | 显示全部楼层

    [s:136]
    您需要登录后才可以回帖 登录 | 注册

    提醒: 禁止引战、谩骂、灌水内容

    微信二维码

    有问题联系客服