大伊人青草狠狠久久-大伊香蕉精品视频在线-大伊香蕉精品一区视频在线-大伊香蕉在线精品不卡视频-大伊香蕉在线精品视频75-大伊香蕉在线精品视频人碰人

您現在的位置:程序化交易>> 期貨公式>> 金字塔等>> 金字塔知識>>正文內容

[原創]請教高手,怎么編的 [金字塔]

  • 咨詢內容:

    求助金字塔高手怎么把下面的MT4的指標變為金字塔的,謝謝!




    //+------------------------------------------------------------------+
    //|                                              SuperTrend.mq4 v1.2 |
    //|                   Copyright ?2012, Jason Robinson (jnrtrading). |
    //|                                   http://www.spreadtrade2win.com |
    //+------------------------------------------------------------------+
    #property copyright "Copyright ?2012, Jason Robinson."
    #property link      "http://www.spreadtrade2win.com"

    #property indicator_chart_window
    #property indicator_color1 Lime
    #property indicator_color2 Red
    #property indicator_width1 2
    #property indicator_width2 2
    #property indicator_buffers 2
    double TrendUp[], TrendDown[];
    int changeOfTrend;
    extern int Nbr_Periods = 10;
    extern double Multiplier = 3.0;
    //+------------------------------------------------------------------+
    //| Custom indicator initialization function                         |
    //+------------------------------------------------------------------+
    int init()
      {
    //---- indicators
       SetIndexBuffer(0, TrendUp);
       SetIndexStyle(0, DRAW_LINE, STYLE_SOLID, 2);
       SetIndexLabel(0, "Trend Up");
       SetIndexBuffer(1, TrendDown);
       SetIndexStyle(1, DRAW_LINE, STYLE_SOLID, 2);
       SetIndexLabel(1, "Trend Down");
    //----
       return(0);
      }
    //+------------------------------------------------------------------+
    //| Custom indicator deinitialization function                       |
    //+------------------------------------------------------------------+
    int deinit()
      {
    //----
      
    //----
       return(0);
      }
    //+------------------------------------------------------------------+
    //| Custom indicator iteration function                              |
    //+------------------------------------------------------------------+
    int start()
      {
       int limit, i, flag, flagh, trend[5000];
       double up[5000], dn[5000], medianPrice, atr;
       int counted_bars = IndicatorCounted();
    //---- check for possible errors
       if(counted_bars < 0) return(-1);
    //---- last counted bar will be recounted
       if(counted_bars > 0) counted_bars--;
       limit=Bars-counted_bars;
       //Print(limit);
      
    //----
       for (i = Bars; i >= 0; i--) {
          TrendUp[i] = EMPTY_VALUE;
          TrendDown[i] = EMPTY_VALUE;
          atr = iATR(NULL, 0, Nbr_Periods, i);
          //Print("atr: "+atr[i]);
          medianPrice = (High[i]+Low[i])/2;
          //Print("medianPrice: "+medianPrice[i]);
          up[i]=medianPrice+(Multiplier*atr);
          //Print("up: "+up[i]);
          dn[i]=medianPrice-(Multiplier*atr);
          //Print("dn: "+dn[i]);
          trend[i]=1;
      
         
          if (Close[i]>up[i+1]) {
             trend[i]=1;
             if (trend[i+1] == -1) changeOfTrend = 1;
             //Print("trend: "+trend[i]);
            
          }
          else if (Close[i]<dn[i+1]) {
             trend[i]=-1;
             if (trend[i+1] == 1) changeOfTrend = 1;
             //Print("trend: "+trend[i]);
          }
          else if (trend[i+1]==1) {
             trend[i]=1;
             changeOfTrend = 0;      
          }
          else if (trend[i+1]==-1) {
             trend[i]=-1;
             changeOfTrend = 0;
          }

          if (trend[i]<0 && trend[i+1]>0) {
             flag=1;
             //Print("flag: "+flag);
          }
          else {
             flag=0;
             //Print("flagh: "+flag);
          }
         
          if (trend[i]>0 && trend[i+1]<0) {
             flagh=1;
             //Print("flagh: "+flagh);
          }
          else {
             flagh=0;
             //Print("flagh: "+flagh);
          }
         
          if (trend[i]>0 && dn[i]<dn[i+1])
             dn[i]=dn[i+1];
         
          if (trend[i]<0 && up[i]>up[i+1])
             up[i]=up[i+1];
         
          if (flag==1)
             up[i]=medianPrice+(Multiplier*atr);
            
          if (flagh==1)
             dn[i]=medianPrice-(Multiplier*atr);
            
          //-- Draw the indicator
          if (trend[i]==1) {
             TrendUp[i]=dn[i];
             if (changeOfTrend == 1) {
                TrendUp[i+1] = TrendDown[i+1];
                changeOfTrend = 0;
             }
          }
          else if (trend[i]==-1) {
             TrendDown[i]=up[i];
             if (changeOfTrend == 1) {
                TrendDown[i+1] = TrendUp[i+1];
                changeOfTrend = 0;
             }
          }
       }
       WindowRedraw();
         
    //----
       return(0);
      }
    //+------------------------------------------------------------------+

     

  • 金字塔客服: 以上代碼能不能加上注釋

     

  • 用戶回復: 想知道這個,怎么沒人解答???

     

  • 網友回復: 加上注釋和思路說明,不然處理不了

 

有思路,想編寫各種指標公式,程序化交易模型,選股公式,預警公式的朋友

可聯系技術人員 QQ: 1145508240  有需要幫忙請點擊這里留言?。?!進行 有償 編寫!不貴!點擊查看價格!


【字體: 】【打印文章】【查看評論

相關文章

    沒有相關內容
主站蜘蛛池模板: 国产精品主播在线 | 久久综合丁香 | 国产美女色视频 | 伊人在综合 | 澳门成人免费永久视频 | 成人交性视频免费看 | 日本三级中文字幕 | 国内久久 | 素人视频在线观看 | 国内永久第一免费福利视频 | 久久爱伊人一区二区三区小说 | 久久久国产一区二区三区 | 在线观看亚洲精品专区 | 久草精品视频 | 免费看一级毛片欧美 | 91啦丨国产丨 | 97se亚洲综合在线天天 | 亚洲欧美日韩国产专区一区 | 亚洲精品tv久久久久久久久久 | 五月婷婷在线免费观看 | 精品一区二区三区中文字幕 | 奇米影音第四色 | 伊人久久中文字幕久久cm | 一男一女一级毛片 | 九九视频九九热 | 一级毛片高清免费播放 | 国内自拍一二三四2021 | 国产日韩欧美亚洲 | 69av美女| 久久久久爽亚洲精品 | 99精品福利视频 | 女人18一级特级毛片免费看 | 三a大片| 成人a毛片久久免费播放 | 欧美黄色免费网址 | 一级特黄aa大片欧美小说 | 永久免费精品影视网站 | 修修视频在线观看 | 亚洲欧美一区二区三区 | 四虎在线播放免费永久视频 | 99热这里只有精品免费国产 |