人人爽天天爽夜夜爽qc-人人爽天天爽夜夜爽曰-人人天天爱天天做天天摸-人人天天夜夜-色网站在线-色网站在线看

您現(xiàn)在的位置:程序化交易>> 期貨公式>> 金字塔等>> 金字塔知識>>正文內(nèi)容

[原創(chuàng)]請教高手,怎么編的 [金字塔]

  • 咨詢內(nèi)容:

    求助金字塔高手怎么把下面的MT4的指標(biāo)變?yōu)榻鹱炙模x謝!




    //+------------------------------------------------------------------+
    //|                                              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);
      }
    //+------------------------------------------------------------------+

     

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

     

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

     

  • 網(wǎng)友回復(fù): 加上注釋和思路說明,不然處理不了

 

有思路,想編寫各種指標(biāo)公式,程序化交易模型,選股公式,預(yù)警公式的朋友

可聯(lián)系技術(shù)人員 QQ: 1145508240  有需要幫忙請點擊這里留言!!!進(jìn)行 有償 編寫!不貴!點擊查看價格!


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

相關(guān)文章

    沒有相關(guān)內(nèi)容
主站蜘蛛池模板: 欧美日韩黄色大片 | 日本不卡视频一区二区三区 | 小明影视 | 欧美 日韩 国产在线 | 国产亚洲精品日韩香蕉网 | 日本综合在线观看 | 大伊香蕉在线精品视频人碰人 | 一级毛片免费毛片一级毛片免费 | 在线看片成人 | 亚洲一区二区三区高清视频 | 男人爱看的视频网站免费 | 成人午夜免费在线观看 | 久久青草18免费观看网站 | 日本亚洲欧美美色 | 欧美成人免费午夜全 | 看片网站在线观看 | 国产亚洲精品hd网站 | 成年人在线播放视频 | 国产精品视频全国免费观看 | 成人羞羞视频在线观看免费 | 久久99综合国产精品亚洲首页 | 国产成年人网站 | 美女一级毛片免费看看 | 免费黄色小视频网站 | 久久国产高清一区二区三区 | 成人精品亚洲 | 在线观看国产一区二三区 | 极品色天使在线婷婷天堂亚洲 | 亚洲免费在线观看 | 色老头成人免费视频天天综合 | 国产1卡二卡3卡四卡免费 | 五月天婷婷精品免费视频 | 欧美专区一区二区三区 | 又猛又黄又爽无遮挡的视频网站 | 日韩中文字幕在线亚洲一区 | 日b视频免费 | dy888午夜国产精品不卡 | 丁香六月在线观看 | 日韩在线免费视频观看 | 日韩精品一区二区三区不卡 | 国产精品1024免费看 |