Announcement

Collapse
No announcement yet.

blau's ci

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • blau's ci

    i found an old thread at http://forum.esignalcentral.com/show...light=blaus+ci but the problem with the script was that it didn't reload with each bar but had to manually be reloaded. chris at www.sr-analyst.com was kind enough to fix it and i'm posting the corrected script here.

    bob

  • #2
    blau's ci

    i don't think the script posted so i'll try this again.

    bob


    /************************************************** *****************
    Provided By : TS Support, LLC for eSignal. (c) Copyright 2002

    v2.0 - modified by Christopher D. Kryza
    ************************************************** ******************/


    var EMA = 0;
    var EMA1 = 0;
    var vEMA = 0;
    var vEMA1 = 0;
    var EMA_1 = 0;
    var EMA1_1 = 0;
    var vEMA_1 = 0;
    var vEMA1_1 = 0;



    function preMain(){
    setStudyTitle("Blau's CI");
    setCursorLabelName("Blau's CI",0);
    setDefaultBarFgColor(Color.red,0);
    addBand(0, PS_DASH, 2, Color.black);
    }


    function main(r,s){

    var nBarState = getBarState();

    if ( nBarState == BARSTATE_ALLBARS ) {
    return null;
    }


    if (r == null)
    r = 32;

    if(s == null)
    s = 12;

    if (nBarState == BARSTATE_NEWBAR){

    EMA_1 = EMA;
    EMA1_1 = EMA1;
    vEMA_1 = vEMA;
    vEMA1_1 = vEMA1;
    }

    var K = 2 / (r + 1);
    var K1 = 2 / (s + 1);

    EMA = K * (close(0) - open(0)) + (1.0 - K) * EMA_1;
    EMA1 = K1 * EMA + (1.0 - K1) * EMA1_1;
    vEMA = K * (high(0) - low(0)) + (1.0 - K) * vEMA_1;
    vEMA1 = K1 * vEMA + (1.0 - K1) * vEMA1_1;

    if(vEMA1 != 0){

    return EMA1 / vEMA1;
    }
    else
    return null;

    }
    Attached Files

    Comment

    Working...
    X