KST Oscillator

ICE Data Services -

KST.efs  
EFSLibrary - Discussion Board  

File Name: KST.efs

Description:

KST (Know Sure Thing) is Martin Prings formula

Formula Parameters:

  • Line Color: Green
  • Display Cursor Labels: True
  • Line Thickness: 2

Notes:

Download File:
KST.efs


EFS Code:

/*********************************
Provided By:  
    eSignal (Copyright c eSignal), a division of Interactive Data 
    Corporation. 2008. All rights reserved. This sample eSignal 
    Formula Script (EFS) is for educational purposes only and may be 
    modified and saved under a new file name.  eSignal is not responsible
    for the functionality once modified.  eSignal reserves the right 
    to modify and overwrite this EFS file with each new release.

Description:        
    KST (Know Sure Thing) is Martin Prings formula

Version:            1.0  11/24/2008

Formula Parameters:                     Default:
    Line Color                           Green
    Display Cursor Labels                True
    Line Thickness                        2

Notes:

**********************************/

var fpArray = new Array();
var bInit = false;

function preMain() {

    setPriceStudy(false);
    setShowCursorLabel(false);
    setShowTitleParameters( false );
    
    setStudyTitle("KST Oscillator");
    setCursorLabelName("KST Oscillator", 0);

    setDefaultBarFgColor(Color.red, 0);
    setPlotType(PLOTTYPE_LINE, 0); 
    setDefaultBarThickness(2, 0);
   
    askForInput();
    var x=0;
    fpArray[x] = new FunctionParameter("LineColor", FunctionParameter.COLOR);
    with(fpArray[x++]){
        setName("Line Color");
        setDefault(Color.green);
    }    

    fpArray[x] = new FunctionParameter("ViewValue", FunctionParameter.BOOLEAN);
    with(fpArray[x++]){
        setName("Display Cursor Labels");
        setDefault(true);
    }    
    
    fpArray[x] = new FunctionParameter("Thickness", FunctionParameter.NUMBER);
	with(fpArray[x++]){
        setName("Line Thickness");
        setLowerLimit(1);		
        setDefault(2);
    }
}

var xKST = null;

function main(Thickness, LineColor, ViewValue) {
    if ( bInit == false ) { 
        setDefaultBarFgColor(LineColor, 0);
        setDefaultBarThickness(Thickness, 0);
        setShowCursorLabel(ViewValue);        
        xKST = efsInternal("Calc_KST");
        bInit = true; 
    } 

    if (getCurrentBarCount < 30) return;
  
    return xKST.getValue(0); 
}

var xInit = false;
var xROC10SMA = null;
var xROC15SMA = null;
var xROC20SMA = null;
var xROC30SMA = null;

function Calc_KST() {
var nRes = 0;
    if (xInit == false) {
        xROC10SMA = sma(10, roc(10));
        xROC15SMA = sma(10, roc(15));
        xROC20SMA = sma(10, roc(20));
        xROC30SMA = sma(10, roc(30));
        xInit = true;
    }
    
    nRes = xROC10SMA.getValue(0) + (2 * xROC15SMA.getValue(0)) + (3 * xROC20SMA.getValue(0)) + (4 * xROC30SMA.getValue(0));
    if (nRes == null) nRes = 1;
    return nRes;
}