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

    小弟,学习两周EA,大家交流交流

    2011-10-05 · 4861 阅读
    //+------------------------------------------------------------------+
      //|                                                        EA4Mf.mq4 |
      //|                                                                  |
      //|                                                                  |
      //+------------------------------------------------------------------+
      #define MAGICMA  20100102
      #property copyright \"\"
      #property link      \"\"
      extern int ordersNum  = 1000;
      extern double Lots  = 0.01;
      extern double Lots1  = 1;
      extern int FastEMA = 5;
      extern int SlowEMA = 34;
      extern int SignalSMA = 5;
      extern int timeSinceOpen = 600;
      extern int timeClose = 120;
      extern double TakeProfit = 50;
      extern int stopL1 = 5;
      extern int stopL2 = 7;
      double timeLastOpen = 0;
      double timeLastOpen1 = 0;
      double lotx = 0;
      //+------------------------------------------------------------------+
      //| expert initialization function                                   |
      //+------------------------------------------------------------------+
      int init()
        {
      //----
         lotx = Lots1;
      //----
         return(0);
        }
      //+------------------------------------------------------------------+
      //| expert deinitialization function                                 |
      //+------------------------------------------------------------------+
      int deinit()
        {
      //----
         
      //----
         return(0);
        }
      //+------------------------------------------------------------------+
      //| expert start function                                            |
      //+------------------------------------------------------------------+
      int start()
        {
      //----
         if(OrdersTotal()0){//多头市场,逢低做多
            if(macd2macd1&&macd1>macd0){
               if(CurTime() - timeLastOpen > timeSinceOpen){
                  OrderSend(Symbol(),OP_BUY,Lots,Ask,3,0,0,\"\",MAGICMA,0,Red);//Ask+TakeProfit*Point
                  timeLastOpen = CurTime();
               }
            }
         }
         if(diff0=0&&macd2diff1 && diff1>0){
                  OrderClose(OrderTicket(),OrderLots(),Ask,3,White);
                  if(CurTime() - timeLastOpen > timeSinceOpen){
                       OrderSend(Symbol(),OP_BUY,lotx,Ask,3,0,0,\"\",MAGICMA,0,Red);
                       timeLastOpen = CurTime();
                       lotx = 6 * lotx;
                  }
               }
            }
            if(OrderType()==OP_BUY){
              if(diff0=0 || diff0=stopL2*Point*TakeProfit){// && CurTime() - OrderOpenTime() > timeX //OrderOpenPrice()-Bid>=stopL*Point*TakeProfit
                     OrderClose(OrderTicket(),OrderLots(),Bid,3,White);
                     /*if((CurTime() - timeLastOpen1 > timeSinceOpen1)&&(OrderOpenPrice()-Bid>=stopL2*Point*TakeProfit)){
                         OrderSend(Symbol(),OP_SELL,Lots1,Bid,3,0,0,\"\",MAGICMA,0,Red);//Bid-TakeProfit*Point
                         timeLastOpen1 = CurTime();
                     }*/
                  }
               }
               if(OrderType()==OP_SELL){
                  if(OrderOpenPrice()-Ask>=Point*TakeProfit||Ask-OrderOpenPrice()>=stopL2*Point*TakeProfit){//Ask-OrderOpenPrice()>=stopL*Point*TakeProfit
                      OrderClose(OrderTicket(),OrderLots(),Ask,3,White);
                      /*if((CurTime() - timeLastOpen1 > timeSinceOpen1)&&(Ask-OrderOpenPrice()>=stopL2*Point*TakeProfit)){//CurTime() - timeLastOpen1 > timeSinceOpen1&&
                           OrderSend(Symbol(),OP_BUY,Lots1,Ask,3,0,0,\"\",MAGICMA,0,Red);//Ask+TakeProfit*Point
                           timeLastOpen1 = CurTime();  
                      }*/
                  }
               }
            //}
         }  
          
         return(0);
      }
    ""
    还没有人打赏,支持一下
    回复

    举报

     

    回答|共 11 个

    huangming LV5

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

    (*^__^*) 嘻嘻……   

    果果 LV4

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

    真的有么  

    御赐黄马甲 LV5

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

    顶下再看  

    笑脸 LV5

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

    必须顶  

    君君囧小兔 LV5

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

    抢座位来了  

    卢苏 LV5

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

    支持你就顶你  

    犯光就你哈 LV3

    发表于 2014-12-18 04:56:58 | 显示全部楼层

    路过。。看下先。

    讲话稿金会 LV3

    发表于 2014-12-18 05:20:20 | 显示全部楼层


    继续,学习了

    白眉大侠 LV5

    发表于 2014-12-30 04:24:32 | 显示全部楼层

    想学EA,拜师,谁收了我吧
    12下一页
    您需要登录后才可以回帖 登录 | 注册

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

    微信二维码

    有问题联系客服