StochDoubleD.efs

ICE Data Services -

StochDoubleD.efs  

File Name: StochDoubleD.efs

Description:
Stochastic study with two %D lines.

 

Formula Parameters:

  • nKLength: Default is 14
  • nKsmoothing: Default is 1
  • nDlength1: Default is 9
  • nDlength2: Default is 18
  • nUpperBand: Default is 80
  • nLowerBand: Default is 20

Notes:
The two stochastic studies use the same inputs for nKLength and nKsmoothing.

 

Download File:
StochDoubleD.efs


EFS Code:

/*****************************************************************
Provided By : eSignal. (c) Copyright 2003
*****************************************************************/


function preMain() {
    setStudyTitle("Stochastic Double %D ");
    setCursorLabelName("\%D1", 0);
    setCursorLabelName("\%D2", 1);
    setDefaultBarFgColor(Color.blue, 0);
    setDefaultBarFgColor(Color.navy, 1);
}

var study1 = null;
var study2 = null;

function main(nKLength, nKsmoothing, nDlength1, nDlength2, nUpperBand, nLowerBand) {
    if (nKLength == null) nKLength = 14;
    if (nKsmoothing == null) nKsmoothing = 1;
    if (nDlength1 == null) nDlength1 = 9;
    if (nDlength2 == null) nDlength2 = 18;
    if (nUpperBand == null) nUpperBand = 80;
    if (nLowerBand == null) nLowerBand = 20;
    
    if (study1 == null || study2 == null) {
        study1 = new StochStudy(nKLength, nKsmoothing, nDlength1);
        study2 = new StochStudy(nKLength, nKsmoothing, nDlength2);
        addBand(nUpperBand, PS_SOLID, 1, Color.lightgrey, "upper");
        addBand(nLowerBand, PS_SOLID, 1, Color.lightgrey, "lower");
    }
    
    var vD1 = study1.getValue(StochStudy.SLOW);
    if (vD1 == null) return;
    var vD2 = study2.getValue(StochStudy.SLOW);
    if (vD2 == null) return;
    
    return new Array(vD1, vD2);
}