S
Joined
Likes
203

Profile posts Latest activity Postings About

  • hello sunbim
    i have an oscillator but my problem it doesn it work on metastock v10.can you help to identify perhpas small details on the code.here ocillator .


    belkhayate Oscillateur

    function preMain() {

    setStudyTitle("Belkhayate Indicator");
    setPriceStudy(false);
    setDefaultBarFgColor(Color.red, 1);
    setDefaultBarFgColor(Color.blue, 0);

    }
    var cg_1 = 0;

    function main(Length) {
    if(Length == null)
    Length = 10;

    var count = 0;
    var num = 0;
    var cg;
    var temp;
    var denom = 0;
    var vHigh = getValue("high", 0, -Length);
    var vLow = getValue("low", 0, -Length);


    if(vHigh == null || vLow == null) {
    return;
    }

    for(count = 0; count < Length - 1; count++) {
    num += (1 + count) * ((vHigh[count] + vLow[count])/2);
    denom += (vHigh[count] + vLow[count])/2;
    }

    if(denom != 0)
    cg = - num/denom;

    temp = cg_1;
    if (getBarState() == BARSTATE_NEWBAR)
    cg_1 = cg;

    return new Array(cg,temp);

    }

    /*
    Inputs: Price((H+L)/2),
    Length(10);

    Vars: count(0),
    Num(0),
    Denom(0),
    CG(0);
    Num=0;
    Denom=0;

    For count=0 to Length-1 begin
    Num=Num+(1+count)*(Price[count]);
    Denom=Denom+(Price[count]);
    End;

    If Denom<>0 then CG=-Num/Denom;

    Plot1(CG,"CG");

    Plot2(CG[1],"CG1");
    */
  • Loading…
  • Loading…
  • Loading…