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

    分享自编“交叉变色均线”,但出现问题,希望老师们指...

    2011-11-01 · 11342 阅读
    新手:看了一遍变色均线的教程后,自编了一个交叉变色均线指标,金叉,死叉变色是可以了,但是变色的位置出现问题了,变色发生不在交叉点上,用SMA的情况会好一点,但用LWMA就变色的情况就会更糟!
      希望牛版,老师们指点指点,帮助解决这问题,跟大家分享自己第一个写的指标!谢谢
      
      
      //+------------------------------------------------------------------+
      //|                                                     变色均线.mq4 |
      //|                                                              OZB |
      //|                                        |
      //+------------------------------------------------------------------+
      #property copyright \"OZB\"
      #property indicator_chart_window
      #property indicator_buffers 4
      #property indicator_color1 Red
      #property indicator_color2 Blue
      #property indicator_color3 Red
      #property indicator_color4 Blue
      extern int 快线=10;
      extern int 慢线=30;
      double 快线dou[];
      double 快线kong[];
      double 慢线dou[];
      double 慢线kong[];
      int init()
        {  
          SetIndexBuffer(0,快线dou);
          SetIndexBuffer(1,快线kong);
          SetIndexBuffer(2,慢线dou);
          SetIndexBuffer(3,慢线kong);
          SetIndexStyle(0,DRAW_LINE);
          SetIndexStyle(1,DRAW_LINE);
          SetIndexStyle(2,DRAW_LINE);
          SetIndexStyle(3,DRAW_LINE);
          SetIndexDrawBegin(0,快线);
          SetIndexDrawBegin(1,快线);
          SetIndexDrawBegin(2,慢线);
          SetIndexDrawBegin(3,慢线);
          IndicatorDigits(Digits);
         return(0);
        }
      //+------------------------------------------------------------------+
      int deinit()
        {
      //----
         
      //----
         return(0);
        }
      //+------------------------------------------------------------------+
      int start()
        {
         double temp0,temp1,temp2,temp3;
         int limit;
         int counted_bars=IndicatorCounted();
         if(counted_bars0) counted_bars--;
         limit=Bars-counted_bars;
         for(int i=limit; i>=0; i--)
           {
             快线dou<i>=EMPTY_VALUE;
             快线kong<i>=EMPTY_VALUE;
             慢线dou<i>=EMPTY_VALUE;
             慢线kong<i>=EMPTY_VALUE;
             temp0=iMA(NULL,0,快线,0,MODE_LWMA,PRICE_CLOSE,i);
             temp1=iMA(NULL,0,快线,0,MODE_LWMA,PRICE_CLOSE,i+1);
             temp2=iMA(NULL,0,慢线,0,MODE_LWMA,PRICE_CLOSE,i);
             temp3=iMA(NULL,0,慢线,0,MODE_LWMA,PRICE_CLOSE,i+1);
             if(iMA(NULL,0,快线,0,MODE_SMA,PRICE_CLOSE,i)>=iMA(NULL,0,慢线,0,MODE_SMA,PRICE_CLOSE,i))
                {快线dou<i>=temp0; 快线dou[i+1]=temp1;慢线dou<i>=temp2; 慢线dou[i+1]=temp3;}
               else {快线kong<i>=temp0; 快线kong[i+1]=temp1;慢线kong<i>=temp2; 慢线kong[i+1]=temp3;}
            }   
                
               
         return(0);
        }
      //+------------------------------------------------------------------+
      [/td][/tr]
    ""
    还没有人打赏,支持一下
    回复

    举报

     

    回答|共 24 个

    天鹰 LV6

    发表于 2012-11-22 00:02:14 | 显示全部楼层

    牛牛牛牛  

    格西8023 LV5

    发表于 2012-11-22 00:02:14 | 显示全部楼层

    应该加分  

    释放人质 LV5

    发表于 2012-11-22 00:05:51 | 显示全部楼层

    我感觉雷雨趋势不错,挺好的ea!  

    l26709020 LV5

    发表于 2012-11-22 00:05:51 | 显示全部楼层

    观看中  

    fxsin平台 LV5

    发表于 2012-11-22 00:05:51 | 显示全部楼层

    加油站加油  

    elliott LV4

    发表于 2012-11-22 00:05:51 | 显示全部楼层

    楼主有没有好的EA推荐  

    月下独舞 LV4

    发表于 2012-11-22 00:05:51 | 显示全部楼层

    怎么就没人拜我为偶像那?? ~  

    mt5mt5 LV5

    发表于 2012-11-22 00:05:51 | 显示全部楼层

    我想要`~  

    受害者联盟 LV5

    发表于 2012-11-22 00:05:51 | 显示全部楼层

    终于看完了~~~  
    123下一页
    您需要登录后才可以回帖 登录 | 注册

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

    微信二维码

    有问题联系客服