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

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

MT4代碼改成金字塔代碼 [金字塔]

  • 咨詢內(nèi)容:

    源碼如下:


    //+------------------------------------------------------------------+
    //|                                        3_Level_ZZ_Semafor.mq4    |
    //+------------------------------------------------------------------+
    {#property copyright "asystem2000"
    #property link      "asystem2000@yandex.ru"

    #property indicator_chart_window
    #property indicator_buffers 6
    #property indicator_color1 Chocolate
    #property indicator_color2 Chocolate
    #property indicator_color3 MediumVioletRed
    #property indicator_color4 MediumVioletRed
    #property indicator_color5 Yellow
    #property indicator_color6 Yellow
    }
    //---- input parameters
    extern double Period1=5;
    extern double Period2=13;
    extern double Period3=34;
    extern string   Dev_Step_1="1,3";
    extern string   Dev_Step_2="8,5";
    extern string   Dev_Step_3="13,8";
    extern int Symbol_1_Kod=140;
    extern int Symbol_2_Kod=141;
    extern int Symbol_3_Kod=142;

    //---- buffers
    double FP_BuferUp[];
    double FP_BuferDn[];
    double NP_BuferUp[];
    double NP_BuferDn[];
    double HP_BuferUp[];
    double HP_BuferDn[];

    int F_Period;
    int N_Period;
    int H_Period;
    int Dev1;
    int Stp1;
    int Dev2;
    int Stp2;
    int Dev3;
    int Stp3;

    //+------------------------------------------------------------------+
    //| Custom indicator initialization function                         |
    //+------------------------------------------------------------------+
    int init()
      {
    // --------- 暑痧尻蜩痼屐 镥痂鈿?瀠 鐿耱痤屙? 氰闈嚆鉬
       if (Period1>0) F_Period=MathCeil(Period1*Period()); else F_Period=0;
       if (Period2>0) N_Period=MathCeil(Period2*Period()); else N_Period=0;
       if (Period3>0) H_Period=MathCeil(Period3*Period()); else H_Period=0;
      
    //---- 吾疣徉螓忄屐 1 狍翦?
       if (Period1>0)
       {
       SetIndexStyle(0,DRAW_ARROW,0,1);
       SetIndexArrow(0,Symbol_1_Kod);
       SetIndexBuffer(0,FP_BuferUp);
       SetIndexEmptyValue(0,0.0);
      
       SetIndexStyle(1,DRAW_ARROW,0,1);
       SetIndexArrow(1,Symbol_1_Kod);
       SetIndexBuffer(1,FP_BuferDn);
       SetIndexEmptyValue(1,0.0);
       }
      
    //---- 吾疣徉螓忄屐 2 狍翦?
       if (Period2>0)
       {
       SetIndexStyle(2,DRAW_ARROW,0,2);
       SetIndexArrow(2,Symbol_2_Kod);
       SetIndexBuffer(2,NP_BuferUp);
       SetIndexEmptyValue(2,0.0);
      
       SetIndexStyle(3,DRAW_ARROW,0,2);
       SetIndexArrow(3,Symbol_2_Kod);
       SetIndexBuffer(3,NP_BuferDn);
       SetIndexEmptyValue(3,0.0);
       }
    //---- 吾疣徉螓忄屐 3 狍翦?
       if (Period3>0)
       {
       SetIndexStyle(4,DRAW_ARROW,0,4);
       SetIndexArrow(4,Symbol_3_Kod);
       SetIndexBuffer(4,HP_BuferUp);
       SetIndexEmptyValue(4,0.0);

       SetIndexStyle(5,DRAW_ARROW,0,4);
       SetIndexArrow(5,Symbol_3_Kod);
       SetIndexBuffer(5,HP_BuferDn);
       SetIndexEmptyValue(5,0.0);
       }
    // 吾疣徉螓忄屐 珥圜屙? 溴忤圉栝 ?泐?
       int CDev=0;
       int CSt=0;
       int Mass[];
       int C=0; 
       if (IntFromStr(Dev_Step_1,C, Mass)==1)
          {
            Stp1=Mass[1];
            Dev1=Mass[0];
          }
      
       if (IntFromStr(Dev_Step_2,C, Mass)==1)
          {
            Stp2=Mass[1];
            Dev2=Mass[0];
          }     
      
      
       if (IntFromStr(Dev_Step_3,C, Mass)==1)
          {
            Stp3=Mass[1];
            Dev3=Mass[0];
          }     
       return(0);
      }
    //+------------------------------------------------------------------+
    //| Custor indicator deinitialization function                       |
    //+------------------------------------------------------------------+
    int deinit()
      {
    //----
       
    //----
       return(0);
      }

    //+------------------------------------------------------------------+
    //| Custom indicator iteration function                              |
    //+------------------------------------------------------------------+
    int start()
      {
       if (Period1>0) CountZZ(FP_BuferUp,FP_BuferDn,Period1,Dev1,Stp1);
       if (Period2>0) CountZZ(NP_BuferUp,NP_BuferDn,Period2,Dev2,Stp2);
       if (Period3>0) CountZZ(HP_BuferUp,HP_BuferDn,Period3,Dev3,Stp3);
       return(0);
      }
    //+------------------------------------------------------------------+
    // 漕鐿腠栩咫 趔黻鯊?
    //int Take

     

    //+------------------------------------------------------------------+
    //| 澤黻?纛癆桊鉬囗? 氰闈嚆?                       |
    //+------------------------------------------------------------------+ 
    int CountZZ( double& ExtMapBuffer[], double& ExtMapBuffer2[], int ExtDepth, int ExtDeviation, int ExtBackstep )
      {
       int    shift, back,lasthighpos,lastlowpos;
       double val,res;
       double curlow,curhigh,lasthigh,lastlow;

       for(shift=Bars-ExtDepth; shift>=0; shift--)
         {
          val=Low[Lowest(NULL,0,MODE_LOW,ExtDepth,shift)];
          if(val==lastlow) val=0.0;
          else
            {
             lastlow=val;
             if((Low[shift]-val)>(ExtDeviation*Point)) val=0.0;
             else
               {
                for(back=1; back<=ExtBackstep; back++)
                  {
                   res=ExtMapBuffer[shift+back];
                   if((res!=0)&&(res>val)) ExtMapBuffer[shift+back]=0.0;
                  }
               }
            }
           
              ExtMapBuffer[shift]=val;
          //--- high
          val=High[Highest(NULL,0,MODE_HIGH,ExtDepth,shift)];
          if(val==lasthigh) val=0.0;
          else
            {
             lasthigh=val;
             if((val-High[shift])>(ExtDeviation*Point)) val=0.0;
             else
               {
                for(back=1; back<=ExtBackstep; back++)
                  {
                   res=ExtMapBuffer2[shift+back];
                   if((res!=0)&&(res<val)) ExtMapBuffer2[shift+back]=0.0;
                  }
               }
            }
          ExtMapBuffer2[shift]=val;
         }
       // final cutting
       lasthigh=-1; lasthighpos=-1;
       lastlow=-1;  lastlowpos=-1;

       for(shift=Bars-ExtDepth; shift>=0; shift--)
         {
          curlow=ExtMapBuffer[shift];
          curhigh=ExtMapBuffer2[shift];
          if((curlow==0)&&(curhigh==0)) continue;
          //---
          if(curhigh!=0)
            {
             if(lasthigh>0)
               {
                if(lasthigh<curhigh) ExtMapBuffer2[lasthighpos]=0;
                else ExtMapBuffer2[shift]=0;
               }
             //---
             if(lasthigh<curhigh || lasthigh<0)
               {
                lasthigh=curhigh;
                lasthighpos=shift;
               }
             lastlow=-1;
            }
          //----
          if(curlow!=0)
            {
             if(lastlow>0)
               {
                if(lastlow>curlow) ExtMapBuffer[lastlowpos]=0;
                else ExtMapBuffer[shift]=0;
               }
             //---
             if((curlow<lastlow)||(lastlow<0))
               {
                lastlow=curlow;
                lastlowpos=shift;
               }
             lasthigh=-1;
            }
         }
     
       for(shift=Bars-1; shift>=0; shift--)
         {
          if(shift>=Bars-ExtDepth) ExtMapBuffer[shift]=0.0;
          else
            {
             res=ExtMapBuffer2[shift];
             if(res!=0.0) ExtMapBuffer2[shift]=res;
            }
         }
     }
     
    int Str2Massive(string VStr, int& M_Count, int& VMass[])
      {
        int val=StrToInteger( VStr);
        if (val>0)
           {
             M_Count++;
             int mc=ArrayResize(VMass,M_Count);
             if (mc==0)return(-1);
              VMass[M_Count-1]=val;
             return(1);
           }
        else return(0);   
      }
     
     
    int IntFromStr(string ValStr,int& M_Count, int& VMass[])
      {
       
        if (StringLen(ValStr)==0) return(-1);
        string SS=ValStr;
        int NP=0;
        string CS;
        M_Count=0;
        ArrayResize(VMass,M_Count);
        while (StringLen(SS)>0)
          {
                NP=StringFind(SS,",");
                if (NP>0)
                   {
                     CS=StringSubstr(SS,0,NP);
                     SS=StringSubstr(SS,NP+1,StringLen(SS)); 
                   }
                   else
                   {
                     if (StringLen(SS)>0)
                        {
                          CS=SS;
                          SS="";
                        }
                   }
                if (Str2Massive(CS,M_Count,VMass)==0)
                   {
                     return(-2);
                   }
          }
        return(1);   
      }

    股價(jià)跌到一個(gè)相對(duì)低點(diǎn)出現(xiàn)數(shù)字3字符,漲到一個(gè)相對(duì)高點(diǎn)也出現(xiàn)一個(gè)數(shù)字3字符。
    把以上代碼改成金字塔的語(yǔ)言。


    此主題相關(guān)圖片如下:w@`w@iap~0lykyws2z%vvk.jpg

     

  • 金字塔客服: 這個(gè)玩意干嘛的?相對(duì)低點(diǎn)和相對(duì)高點(diǎn)怎么個(gè)相對(duì)法?

 

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

可聯(lián)系技術(shù)人員 QQ: 262069696  點(diǎn)擊在線交流進(jìn)行 有償 編寫(xiě)!不貴!點(diǎn)擊查看價(jià)格!


【字體: 】【打印文章】【查看評(píng)論

相關(guān)文章

    沒(méi)有相關(guān)內(nèi)容
主站蜘蛛池模板: 在线观看视频一区二区 | 大陆黄色一级片 | 深夜在线 | 一区二区三区在线观看视频 | 51视频在线 | 黑人最猛性free护士hd | 欧美成人aaa大片 | 日日欧美 | 波多野结衣一区在线 | 亚洲欧美激情综合首页 | 又色又爽又黄的网站 | 一级网站在线观看 | 欧美成人高清 | 伊人免费在线 | 成人性动漫高清免费观看网址 | 免费观看一级一片 | ak福利午夜在线观看 | 三级日本黄色片 | 综合自拍亚洲综合图不卡区 | 色多多污网站 | 色播在线永久免费视频 | 免费午夜在线视频 | 成人国产网站v片免费观看 成人国产一区二区三区 | 青青草污| 国产无套在线观看视频 | 国产成人在线免费观看 | 国产日日干 | 最近的中文字幕免费视频1 最近的中文字幕大全免费版 | 一本久 | 亚洲国产成人精品区 | 亚洲毛片在线看 | 91精品国产闺蜜国产在线 | 一色综合 | 中文字幕手机在线视频 | 热re91久久精品国产91热 | 国产成人精品日本亚洲语言 | 在线观看亚洲人成网站 | 天天操天天干天天做 | 手机免费看伦理片 | 好吊色几万部永久免费视频 | 亚洲精品综合久久 |