金钱豹分享mt4曲线箭头同时显示代码

Discussion in 'MetaTrader' started by laserhz, Aug 8, 2010.

  1. 此改善来源于 http://www.talkforex.com/blog/html/28/39428-755.html

    原代码只有箭头,现在增加曲线,同时显示!

    改善代码如下:
    //======================================================
    #property indicator_chart_window
    #property indicator_buffers 2
    #property indicator_color1 Red
    #property indicator_color2 LightSeaGreen
    extern int nSecond=10;
    double mk[];
    double quXian[];
    double temp0,temp1;
    int init()
    {
    IndicatorBuffers(2);

    SetIndexBuffer(0,mk);
    SetIndexStyle(0,DRAW_ARROW);
    SetIndexArrow(0,241);
    IndicatorDigits(Digits);

    SetIndexBuffer(1,quXian);
    SetIndexStyle (1,DRAW_LINE);
    SetIndexDrawBegin(1,nSecond);

    return(0);
    }
    int start()
    {
    int limit;
    int counted_bars=IndicatorCounted();
    if(counted_bars>0) counted_bars--;
    limit=Bars-counted_bars-nSecond;
    for(int i=0; i<limit; i++)
    {
    temp0=iMA(NULL,0,nSecond,0,0,0,i);
    temp1=iMA(NULL,0,nSecond,0,0,0,i+1);
    quXian=temp0;

    mk=EMPTY_VALUE;
    if(Close>temp0 && Close[i+1]<temp1) mk=temp0;
    if(Close<temp0 && Close[i+1]>temp1) mk=temp0;
    }

    return(0);
    }