幫助需要xpma變色波(彩虹)
Results 1 to 4 of 4

Thread: 幫助需要xpma變色波(彩虹)

  1. #1
    大家好,我可以對此有所幫助。我已經在代碼中稍微調整了一些東西,但是在我的生活中不能弄清楚如何調整斜率或弄清楚如何緩衝以使黃色稍微保持黃色。我正在使用flexichart交易5秒的圖表,並且希望波浪變黃,因為趨勢已耗盡燃料並且在整合期間。我目前已將此設置為lwma。此外,顏色向後紅色向上,綠色向下,我沒有想到這一點,無需進入並更改每個單獨的指標。我顯然不是程序員。

    這是我到目前為止的代碼和屏幕截圖。

    //版本:11
    //最後更新日期:2011年5月23日
    // ----------------------------------------------- -------------------
    //| XP移動平均線|
    //| xpMA.mq4 |
    //|由Coders Guru開發|
    //|
    http://www.xpworx.com|
    // ----------------------------------------------- -------------------
    #property鏈接http://www.xpworx.com
    // ----------------------------------------------- -------------------
    #property indior_chart_window
    #property indior_buffers 4
    #property indior_color1黃色
    #property indior_color2綠色
    #property indior_color3紅色
    #property indior_width1 1
    #property indior_width2 1
    #property indior_width3 1
    // ----------------------------------------------- -------------------
    /*移動平均類型常量:
    ------------------------------------
    MODE_SMA 0簡單移動平均線,
    MODE_EMA 1指數移動平均線,
    MODE_SMMA 2平滑移動平均線,
    MODE_LWMA 3線性加權移動平均線。
    MODE_DEMA 4雙指數移動平均線。
    MODE_TEMA 5三次指數移動平均線。
    MODE_T3MA 6 T3移動平均線。
    MODE_JMA 7 Jurik移動平均線。
    MODE_HMA 8船體移動平均線。
    MODE_DECEMA 9 DECEMA移動平均線。
    MODE_SALT 10鹽指示器。
    ------------------------------------ *
    #define MODE_DEMA 4
    #define MODE_TEMA 5
    #define MODE_T3MA 6
    #define MODE_JMA 7
    #define MODE_HMA 8
    #define MODE_DECEMA 9
    #define MODE_SALT 10
    /*應用價格常數:
    -------------------------------
    PRICE_CLOSE 0收盤價。
    PRICE_OPEN 1開盤價。
    PRICE_HIGH 2高價。
    PRICE_LOW 3低價。
    PRICE_MEDIAN 4中位數價格,(高 低)/2。
    PRICE_TYPICAL 5典型價格,(高 低 收盤)/3。
    PRICE_WEIGHTED 6加權收盤價,(高 低 收盤 收盤價)/4。
    --------------------------------- *
    extern int MA_Period = 25;
    extern int MA_Type = MODE_LWMA;
    extern int MA_Applied = PRICE_CLOSE;
    extern double T3MA_VolumeFactor = 0.8;
    extern double JMA_Phase = 1;
    extern int Step_Period = 1;
    // ----------------------------------------------- -------------------
    extern int BarsCount = 20000;
    extern bool Alert_On = false;
    extern bool Arrows_On = false;
    extern bool Email_On = false;
    // ----------------------------------------------- -------------------
    int UpArrowCode = 241;
    int DownArrowCode = 242;
    顏色UpArrowColor =紅色;
    顏色DownArrowColor =藍色;
    int UpArrowSize = 3;
    int DownArrowSize = 3;
    // ----------------------------------------------- -------------------
    string pro = xpMA v11;
    string ver =;
    // ----------------------------------------------- -------------------
    double UpBuffer [];
    double DownBuffer [];
    double buf [];
    雙緩衝[];
    double tempbuffer [];
    double matriple [];
    雙信號[];
    // ----------------------------------------------- -------------------
    int nShift;
    雙點;
    // ----------------------------------------------- -------------------
    int init()
    {
    ver = GenVer();
    DeleteObjects();

    郵票(ver,pro - ver,15,20);
    string copy = C 2005-2011 XPWORX。版權所有。;
    copy = StringSetChar(copy,0,'©');
    郵票(版權,複製,15,35);


    IndiorBuffers(7);

    SetIndexStyle(1,DRAW_LINE,STYLE_SOLID,0);
    SetIndexBuffer(2,UpBuffer);
    SetIndexStyle(1,DRAW_LINE,STYLE_SOLID,0);
    SetIndexBuffer(1,DownBuffer);
    SetIndexStyle(0,DRAW_LINE,STYLE_SOLID,0);
    SetIndexBuffer(0,BUF);

    SetIndexBuffer(3,信號);
    SetIndexBuffer(4,緩衝液);
    SetIndexBuffer(5,tempbuffer);
    SetIndexBuffer(6,matriple);

    SetIndexLabel(0,XP移動平均線);
    SetIndexLabel(1,DownBuffer);
    SetIndexLabel(2,UpBuffer);
    SetIndexLabel(3,信號);

    開關(期間())
    {
    案例1:nShift = 5;打破;
    案例5:nShift = 7;打破;
    案例15:nShift = 10;打破;
    案例30:nShift = 15;打破;
    案例60:nShift = 20;打破;
    情況240:nShift = 30;打破;
    案例1440:nShift = 80;打破;
    case 10080:nShift = 150;打破;
    案例43200:nShift = 250;打破;
    }

    if(Digits == 2 || Digits == 3)point = 0.01;
    if(Digits == 4 || Digits == 5)point = 0.0001;

    返回(0);
    }

    int deinit()
    {
    DeleteObjects();
    返回(0);
    }

    void start()
    {
    int limit;
    int counts_bars = IndiorCounted();
    if(counts_barslt; 0)return(-1);
    if(counting_barsgt; 0)counting_bars--;
    極限=棒材 - counted_bars;

    開關(MA_Type)
    {
    案例MODE_SMA:
    案例MODE_EMA:
    案例MODE_SMMA:
    案例MODE_LWMA:
    {
    for(int i = 0; ilt; limit; i )buffer [i] = iMA(NULL,0,MA_Period,0,MA_Type,MA_Applied,i);
    打破;
    }
    案例MODE_DEMA:
    {
    for(i = 0; ilt; limit; i )tempbuffer [i] = iMA(NULL,0,MA_Period,0,MODE_EMA,MA_Applied,i);
    for(i = 0; ilt; limit; i )matriple [i] = iMAOnArray(tempbuffer,0,MA_Period,0,MODE_EMA,i);
    for(i = 0; ilt; limit; i )buffer [i] = iMAOnArray(matriple,0,MA_Period,0,MODE_EMA,i);
    打破;
    }
    案例MODE_TEMA:
    {
    for(i = 0; ilt; limit; i )tempbuffer [i] = iMA(NULL,0,MA_Period,0,MODE_EMA,MA_Applied,i);
    for(i = 0; ilt; limit; i )buffer [i] = iMAOnArray(tempbuffer,0,MA_Period,0,MODE_EMA,i);
    打破;
    }
    案例MODE_T3MA:
    {
    for(i = 0; ilt; limit; i )buffer [i] = iCustom(NULL,0,T3MA,MA_Period,T3MA_VolumeFactor,0,i);
    打破;
    }
    案例MODE_JMA:
    {
    for(i = 0; ilt; limit; i )buffer [i] = iCustom(NULL,0,JMA,MA_Period,JMA_Phase,0,i);
    打破;
    }
    案例MODE_HMA:
    {
    for(i = 0; ilt; limit; i )buffer [i] = iCustom(NULL,0,HMA,MA_Period,0,i);
    打破;
    }
    案例MODE_DECEMA:
    {
    for(i = 0; ilt; limit; i )buffer [i] = iCustom(NULL,0,DECEMA_v1,MA_Period,MA_Applied,0,i);
    打破;
    }
    案例MODE_SALT:
    {
    for(i = 0; ilt; limit; i )buffer [i] = iCustom(NULL,0,SATL,0,i);
    打破;
    }
    }

    if(limitlt; BarsCount)BarsCount = limit;

    for(int shift = 0; shiftlt; BarsCount; shift )
    {
    UpBuffer [shift] =緩衝[shift];
    DownBuffer [shift] =緩衝[shift];
    buf [shift] =緩衝[shift];
    }

    for(shift = 0; shiftlt; BarsCount; shift )
    {
    double dMA = 0;
    for(int k = shift 1; k lt; = shift Step_Period; k )dMA = buffer [k];
    dMA = dMAStep_Period;

    if(buffer [shift] lt; dMA)UpBuffer [shift] = EMPTY_VALUE;
    否則if(buffer [shift] gt; dMA)DownBuffer [shift] = EMPTY_VALUE;
    其他
    {
    UpBuffer [shift] = EMPTY_VALUE;
    DownBuffer [shift] = EMPTY_VALUE;
    }
    }
    for(shift = 0; shiftlt; BarsCount-1; shift )
    {
    信號[SHIFT] = 0;
    if(UpBuffer [shift 1] == EMPTY_VALUE UpBuffer [shift]!= EMPTY_VALUE buf [shift 1]!= UpBuffer [shift])
    {
    if(Arrows_On shift!= 0)DrawObject(1,shift,buffer [shift] - nShift * point);
    if(Arrows_On shift == 0)DrawOnce(1,shift,buffer [shift] - nShift * point,0);
    signal [shift] = 1;
    }

    if(DownBuffer [shift 1] == EMPTY_VALUE DownBuffer [shift]!= EMPTY_VALUE buf [shift 1]!= DownBuffer [shift])
    {
    if(Arrows_On shift!= 0)DrawObject(2,shift,buffer [shift] nShift * point);
    if(Arrows_On shift == 0)DrawOnce(2,shift,buffer [shift] nShift * point,1);
    signal [shift] = -1;
    }
    }

    if(UpBuffer [1] == EMPTY_VALUE UpBuffer [0]!= EMPTY_VALUE buf [1]!= UpBuffer [0])
    {
    if(Alert_On)AlertOnce(Symbol() : PeriodToText() - Up Signal,1);
    if(Email_On)SendMailOnce(xpMA Signal,Symbol() : PeriodToText() - Up Signal,1);
    }
    if(DownBuffer [1] == EMPTY_VALUE DownBuffer [0]!= EMPTY_VALUE buf [1]!= DownBuffer [0])
    {
    if(Alert_On)AlertOnce(Symbol() : PeriodToText() - Down Signal,2);
    if(Email_On)SendMailOnce(xpMA Signal,Symbol() : PeriodToText() - Down Signal,2);
    }

    返回(0);
    }

    bool DrawOnce(int direction,int bar,double price,int ref)
    {
    static int LastDraw [10];

    if(LastDraw [ref] == 0 || LastDraw [ref] lt; Bars)
    {
    DrawObject(方向,條形,價格);
    LastDraw [ref] =酒吧;
    return(true);
    }
    返回(假);
    }

    void DrawObject(int direction,int bar,double price)
    {
    static int count = 0;
    計數 ;
    字符串Obj =;
    if(direction == 1)//向上箭頭
    {
    Obj = xpMA_up_ DoubleToStr(bar,0);
    ObjectCreate(的OBJ,OBJ_ARROW,0,時間[巴],價格);
    對象集(的OBJ,OBJPROP_COLOR,UpArrowColor);
    對象集(的OBJ,OBJPROP_ARROWCODE,UpArrowCode);
    對象集(的OBJ,OBJPROP_WIDTH,UpArrowSize);
    }
    if(direction == 2)//向下箭頭
    {
    Obj = xpMA_down_ DoubleToStr(bar,0);
    ObjectCreate(的OBJ,OBJ_ARROW,0,時間[巴],價格);
    對象集(的OBJ,OBJPROP_COLOR,DownArrowColor);
    對象集(的OBJ,OBJPROP_ARROWCODE,DownArrowCode);
    對象集(的OBJ,OBJPROP_WIDTH,DownArrowSize);
    }
    WindowRedraw();
    }

    void DeleteObjects()
    {
    int objs = ObjectsTotal();
    字符串名稱;
    for(int cnt = ObjectsTotal() - 1; cntgt; = 0; cnt--)
    {
    命名=的ObjectName(CNT);
    if(StringFind(name,xpMA,0)gt; -1)ObjectDelete(name);
    if(StringFind(name,Stamp,0)gt; -1)ObjectDelete(name);
    WindowRedraw();
    }
    }

    bool AlertOnce(string msg,int ref)
    {
    static int LastAlert [10];

    if(LastAlert [ref] == 0 || LastAlert [ref] lt; Bars)
    {
    警報(MSG);
    LastAlert [ref] =酒吧;
    return(true);
    }
    返回(假);
    }

    bool SendMailOnce(string subject,string body,int ref)
    {
    static int LastAlert [10];

    if(LastAlert [ref] == 0 || LastAlert [ref] lt; Bars)
    {
    的SendMail(主題,正文);
    LastAlert [ref] =酒吧;
    return(true);
    }
    返回(假);
    }

    string PeriodToText()
    {
    開關(Period())
    {
    情況1:
    返回(M1);
    打破;
    案例5:
    返回(M5);
    打破;
    案例15:
    返回(M15);
    打破;
    案例30:
    返回(M30);
    打破;
    案例60:
    返回(H1);
    打破;
    案例240:
    返回(H4);
    打破;
    案例1440:
    返回(D1);
    打破;
    案例10080:
    返回(W1);
    打破;
    案例43200:
    返回(MN1);
    打破;
    }
    }

    void Stamp(字符串objName,字符串文本,int x,int y)
    {
    string Obj = Stamp_ objName;
    int objs = ObjectsTotal();
    字符串名稱;

    for(int cnt = 0; cntlt; ObjectsTotal(); cnt )
    {
    命名=的ObjectName(CNT);
    if(StringFind(name,Obj,0)gt; -1)
    {
    對象集(的OBJ,OBJPROP_XDISTANCE,X);
    對象集(的OBJ,OBJPROP_YDISTANCE,Y);
    WindowRedraw();
    }
    其他
    {
    ObjectCreate(的OBJ,OBJ_LABEL,0,0,0);
    ObjectSetText(的OBJ,文本,圖8,Arial字體,橙);
    對象集(的OBJ,OBJPROP_XDISTANCE,X);
    對象集(的OBJ,OBJPROP_YDISTANCE,Y);
    WindowRedraw();
    }
    }
    if(ObjectsTotal()== 0)
    {
    ObjectCreate(的OBJ,OBJ_LABEL,0,0,0);
    ObjectSetText(的OBJ,文本,圖8,Arial字體,橙);
    對象集(的OBJ,OBJPROP_XDISTANCE,X);
    對象集(的OBJ,OBJPROP_YDISTANCE,Y);
    WindowRedraw();

    }

    返回(0);
    }


    string GenVer()
    {
    字符串方法;
    if(MA_Type == 0)method = SMA;
    if(MA_Type == 1)method = EMA;
    if(MA_Type == 2)method = SMMA;
    if(MA_Type == 3)method = LWMA;
    if(MA_Type == 4)method = DEMA;
    if(MA_Type == 5)method = TEMA;
    if(MA_Type == 6)method = T3MA;
    if(MA_Type == 7)method = JMA;
    if(MA_Type == 8)method = HMA;
    if(MA_Type == 9)method = DECEMA;
    if(MA_Type == 10)method = SALT;

    return(方法( MAn Period));
    }



  2. #2
    這是非常棒的工作,但我無法獲得編譯代碼。你有MQ4可以發帖嗎?非常感激。

  3. #3
    1附件
    Quote Originally Posted by ;
    這是非常棒的工作,但我無法獲得編譯代碼。你有MQ4可以發帖嗎?非常感激。
    xronin-這就是為什麼在發布代碼時應始終將它放在CODE標記之間,因為當它作為文本發佈時會被破壞。我刪除了所有空格,現在編譯。
    https://www.forex-pedia.com/attachme...1313466181.mq4

  4. #4
    酷...謝謝。我會看一看。

發布權限

  • 您不可發布新主題
  • 您不可回复
  • 您不可發布附件
  • 您不可編輯您的帖子
  •  
  • BB代碼是打開的
  • 表情符號是打開的
  • [IMG]代碼是打開的
  • [視頻]代碼是打開的
  • HTML代碼是關閉的
forex-pedia網站使用cookie 文字跟蹤
forex-pedia.com網站使用cookie 文字跟蹤,某些設定已經固定。您可以點擊此處閱讀我們的Cookie使用說明。 請點擊右鍵接受我們的cookies。如果您選擇繼續使用forex-pedia.com網站,我們將認為您接受我們的cookies。