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

    请版主帮忙看看,到底哪里出错了(已解决)

    句号 LV4
    2011-09-08 · 4882 阅读
    目的:在系统bands的基础上,再输出一条线,价格上触布林上线输出1,下触布林线下线输出2。没想明白错在哪个地方,请帮忙指点。
      
      
      
      //+------------------------------------------------------------------+
      //|                                                        Bands.mq4 |
      //|                      Copyright ?2005, MetaQuotes Software Corp. |
      //|                                     //+------------------------------------------------------------------+
      #property copyright \"Copyright ?2005, MetaQuotes Software Corp.\"
      
      #property indicator_separate_window
      #property indicator_buffers 6
      #property indicator_color1 LightSeaGreen
      #property indicator_color2 LightSeaGreen
      #property indicator_color3 LightSeaGreen
      #property indicator_color4 LightSeaGreen
      
      //---- indicator parameters
      extern int    BandsPeriod=20;
      extern int    BandsShift=0;
      extern double BandsDeviations=2.0;
      
      int mark=0;
      
      
      //---- buffers
      double MovingBuffer[];
      double UpperBuffer[];
      double LowerBuffer[];
      double out[];
      
      double ll[];
      double hh[];
      
      //+------------------------------------------------------------------+
      //| Custom indicator initialization function                         |
      //+------------------------------------------------------------------+
      int init()
        {
      //---- indicators
         SetIndexStyle(0,DRAW_LINE);
         SetIndexBuffer(0,MovingBuffer);
         SetIndexStyle(1,DRAW_LINE);
         SetIndexBuffer(1,UpperBuffer);
         SetIndexStyle(2,DRAW_LINE);
         SetIndexBuffer(2,LowerBuffer);
         SetIndexStyle(3,DRAW_LINE);
         SetIndexBuffer(3,out);
      
         
         
      //----
         SetIndexDrawBegin(0,BandsPeriod+BandsShift);
         SetIndexDrawBegin(1,BandsPeriod+BandsShift);
         SetIndexDrawBegin(2,BandsPeriod+BandsShift);
            SetIndexDrawBegin(3,BandsPeriod+BandsShift);
       
      //----
         return(0);
        }
      //+------------------------------------------------------------------+
      //| Bollinger Bands                                                  |
      //+------------------------------------------------------------------+
      int start()
        {
         int    i,k,counted_bars=IndicatorCounted();
         double deviation;
         double sum,oldval,newres;
      //----
         if(Bars=i)
              {
               newres=Close[k]-oldval;
               sum+=newres*newres;
               k--;
              }
            deviation=BandsDeviations*MathSqrt(sum/BandsPeriod);
            UpperBuffer<i>=oldval+deviation;
            LowerBuffer<i>=oldval-deviation;
            ll<i>=iLow(0,0,i);
            hh<i>=iHigh(0,0,i);
            
            if(hh<i>>UpperBuffer<i>&&ll<i>>LowerBuffer<i>&&mark!=1)  {mark=1;}
            if(hh<i>
    ""
    还没有人打赏,支持一下
    回复

    举报

     

    回答|共 14 个

    dyh3154 LV5

    发表于 2012-11-22 01:36:01 | 显示全部楼层

    说的不错  

    gp123456789 LV4

    发表于 2012-11-22 01:36:01 | 显示全部楼层

    shit  

    yiyang LV5

    发表于 2012-11-22 01:36:01 | 显示全部楼层

    鉴定完毕.!  

    悠悠女儿香 LV5

    发表于 2012-11-22 01:36:01 | 显示全部楼层

    我有一个EA 好坏你自己定  免费的  需要的话 可以发给你玩玩  

    carlot LV5

    发表于 2012-11-22 01:36:01 | 显示全部楼层

    不错 不错  比我强多了  

    booz LV5

    发表于 2012-11-22 01:36:01 | 显示全部楼层

    慢慢来,呵呵  

    pap LV5

    发表于 2012-11-22 01:36:01 | 显示全部楼层

    EA水很深 并不是一般人就能玩的了的 打消这个念头吧~~  

    DRSmdPUQ LV3

    发表于 2014-12-22 00:05:25 | 显示全部楼层

    看看吧,谢谢分享

    wayoday LV0

    发表于 2014-12-22 00:19:39 | 显示全部楼层

    nice!!!!!!!!!!!!
    12下一页
    您需要登录后才可以回帖 登录 | 注册

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

    微信二维码

    有问题联系客服