2005 Aug: Home, Home On The Range

ICE Data Services -

SchirdingStoch.efs, StochRawOscillator.efs, StochRawChannel.efs,
PriceBands.efs, PriceBandOscillator.efs
 

EFSLibrary - Discussion Board  

File Name: SchirdingStoch.efs, StochRawOscillator.efs, StochRawChannel.efs, PriceBands.efs, PriceBandOscillator.efs


Description:
These studies are based on the August 2005 article, Stochastics And Price Range Dynamics - Home, Home On The Range, by Andrew Tomlinson.

 

Formula Parameters:

SchirdingStoch.efs

  • %D Smoothing Periods: 3
  • Line Thickness: 2
  • %K Color: red
  • %D Color: blue


StochRawOscillator.efs

  • Number of Periods: 14
  • Line Thickness: 2
  • Line Color: maroon

StochRawChannel.efs

  • Number of Periods: 14
  • Line Thickness: 2
  • Line Color: green


PriceBands.efs

  • Number of Periods: 14
  • Line Thickness: 2
  • Line Color: maroon

PriceBandOscillator.efs

  • Number of Periods: 14
  • Line Thickness: 2
  • Line Color: maroon

Notes:
The related article is copyrighted material. If you are not a subscriber of Stocks & Commodities, please visit www.traders.com.

 

Download File:
SchirdingStoch.efs
StochRawOscillator.efs
StochRawChannel.efs
PriceBands.efs
PriceBandOscillator.efs








EFS Code:

SchirdingStoch.efs

/***************************************
Provided By : eSignal (c) Copyright 2005
Description:  Harry Schirding Stochastic

Version 1.0  6/09/2005

Notes:
August 2005 Issue - "Stochastics and Price Range Dynamics
                     What Flavor Smoothing would you like." 
    by Andrew Tomlinson
    
This study uses EFS2 functionality available in eSignal
version 7.9 or later.

Formula Parameters:                 Defaults:
Number of Periods                   14
%K Smoothing Periods                3
%D Smoothing Periods                3
Line Thickness                      2
%K Color                            red
%D Color                            blue
***************************************/

function preMain() {
    setStudyTitle("Harry Schirding Stochastic ");
    setShowTitleParameters(false);
    setCursorLabelName("Slow \%K", 0);
    setCursorLabelName("Slow \%D", 1);
    setDefaultBarFgColor(Color.red, 0);
    setDefaultBarFgColor(Color.blue, 1);
    setDefaultBarThickness(2, 0);
    setDefaultBarThickness(2, 1);
    setDefaultBarStyle(PS_DASH, 1);
    
    var fp1 = new FunctionParameter("nLength", FunctionParameter.NUMBER);
        fp1.setName("Number of Periods");
        fp1.setLowerLimit(1);
        fp1.setDefault(14);
    var fp2 = new FunctionParameter("nK", FunctionParameter.NUMBER);
        fp2.setName("\%K Smoothing Periods");
        fp2.setLowerLimit(1);
        fp2.setDefault(3);
    var fp3 = new FunctionParameter("nD", FunctionParameter.NUMBER);
        fp3.setName("\%D Smoothing Periods");
        fp3.setLowerLimit(1);
        fp3.setDefault(3);
    var fp4 = new FunctionParameter("nThickK", FunctionParameter.NUMBER);
        fp4.setName("\%K Thickness");
        fp4.setLowerLimit(1);
        fp4.setDefault(2);
    var fp5 = new FunctionParameter("nThickD", FunctionParameter.NUMBER);
        fp5.setName("\%D Thickness");
        fp5.setLowerLimit(1);
        fp5.setDefault(2);
    var fp6 = new FunctionParameter("cColorK", FunctionParameter.COLOR);
        fp6.setName("\%K Line Color");
        fp6.setDefault(Color.red);
    var fp7 = new FunctionParameter("cColorD", FunctionParameter.COLOR);
        fp7.setName("\%D Line Color");
        fp7.setDefault(Color.blue);
}

var bVersion = null;
var bInit = true;
var xHhv = null;
var xLlv = null;
var Range = null;
var Position = null;
var Quick = null;
var Slow = null;

function main(nLength, nK, nD, nThickK, nThickD, cColorK, cColorD) {
    if (bVersion == null) bVersion = verify();
    if (bVersion == false) return;    
    
    if (bInit == true) {
        xHhv = upperDonchian(nLength, high());
        xLlv = lowerDonchian(nLength, low());
        setDefaultBarThickness(nThickK, 0);
        setDefaultBarFgColor(cColorK, 0);
        setDefaultBarThickness(nThickD, 1);
        setDefaultBarFgColor(cColorD, 1);
        bInit = false;
    }
    
    if (getCurrentBarCount() < (nLength + nK)) return; 
    
    if (Range == null) Range = efsInternal("calcRange", getSeries(xHhv), getSeries(xLlv));
    if (Position == null) Position = efsInternal("calcPosition", getSeries(xLlv));
    if (Quick == null) Quick = efsInternal("calcQuick", nK, getSeries(Range), getSeries(Position));  // Slow %K
    if (Quick.getValue(-1*(nK + nD) +1) != null && Slow == null) {
        Slow = sma(nD, getSeries(Quick));  // Slow %D
    }
    
    if (Slow == null) {
        return new Array(Quick.getValue(0), null);
    } else {
        return new Array(Quick.getValue(0), Slow.getValue(0));
    }
}



/***** Support Functions *****/

function calcSlow(len, q) {
    var nSum = 0;
    for (var i = 0; i < len; i++) {
        nSum += q.getValue(-i);
    }
    return nSum/len;
}

function calcQuick(len, r, p) {
    var nSumP = 0;
    var nSumR = 0;
    
    for (var i = 0; i < len; i++) {
        if (p.getValue(-i) != null) nSumP += p.getValue(-i);
        if (r.getValue(-i) != null) nSumR += r.getValue(-i);
    }
    
    if (nSumR == 0) return null;
    
    return 100*(nSumP/nSumR);
}

function calcPosition(l) {
    return (close(0) - l.getValue(0));
}
 
function calcRange(h, l) {
    return (h.getValue(0) - l.getValue(0));
}


function verify() {
    var b = false;
    if (getBuildNumber() < 700) {
        drawTextAbsolute(5, 35, "This study requires version 7.9 or later.", 
            Color.white, Color.blue, Text.RELATIVETOBOTTOM|Text.RELATIVETOLEFT|Text.BOLD|Text.LEFT,
            null, 13, "error");
        drawTextAbsolute(5, 20, "Click HERE to upgrade.@URL=http://www.esignal.com/download/default.asp", 
            Color.white, Color.blue, Text.RELATIVETOBOTTOM|Text.RELATIVETOLEFT|Text.BOLD|Text.LEFT,
            null, 13, "upgrade");
        return b;
    } else {
        b = true;
    }
    
    return b;
}

StochRawOscillator.efs

/***************************************
Provided By : eSignal (c) Copyright 2005
Description:  Stochastic Raw Oscillator

Version 1.0  6/09/2005

Notes:
August 2005 Issue - "Stochastics and Price Range Dynamics
                     What Flavor Smoothing would you like." 
    by Andrew Tomlinson
    
This study uses EFS2 functionality available in eSignal
version 7.9 or later.

Formula Parameters:                 Defaults:
Number of Periods                   14
Line Thickness                      2
Line Color                          maroon
***************************************/

function preMain() {
    setStudyTitle("Stochastic Raw Oscillator ");
    setShowTitleParameters(false);
    setCursorLabelName("Stoch Osc", 0);
    setDefaultBarFgColor(Color.green, 0);
    setDefaultBarThickness(2, 0);
    
    var fp1 = new FunctionParameter("nLength", FunctionParameter.NUMBER);
        fp1.setName("Number of Periods");
        fp1.setLowerLimit(1);
        fp1.setDefault(14);
    var fp2 = new FunctionParameter("nThick", FunctionParameter.NUMBER);
        fp2.setName("Line Thickness");
        fp2.setLowerLimit(1);
        fp2.setDefault(2);
    var fp3 = new FunctionParameter("cColor", FunctionParameter.COLOR);
        fp3.setName("Line Color");
        fp3.setDefault(Color.green);
}

var bVersion = null;
var bInit = true;
var xHhv = null;
var xLlv = null;

function main(nLength, nThick, cColor) {
    if (bVersion == null) bVersion = verify();
    if (bVersion == false) return;    
    
    if (bInit == true) {
        xHhv = upperDonchian(nLength, high());
        xLlv = lowerDonchian(nLength, low());
        setDefaultBarThickness(nThick, 0);
        setDefaultBarFgColor(cColor, 0);
        bInit = false;
    }
    
    if (getCurrentBarCount() < nLength) return;
    
    var PBOsc = efsInternal("calcPBOsc", getSeries(xHhv), getSeries(xLlv));

    return PBOsc;
}



/***** Support Functions *****/

function calcPBOsc(h, l) {
    var Range = h.getValue(0) - l.getValue(0);
    var Position = close(0) - l.getValue(0);
    return (100 * (Position/Range));
}

function verify() {
    var b = false;
    if (getBuildNumber() < 700) {
        drawTextAbsolute(5, 35, "This study requires version 7.9 or later.", 
            Color.white, Color.blue, Text.RELATIVETOBOTTOM|Text.RELATIVETOLEFT|Text.BOLD|Text.LEFT,
            null, 13, "error");
        drawTextAbsolute(5, 20, "Click HERE to upgrade.@URL=http://www.esignal.com/download/default.asp", 
            Color.white, Color.blue, Text.RELATIVETOBOTTOM|Text.RELATIVETOLEFT|Text.BOLD|Text.LEFT,
            null, 13, "upgrade");
        return b;
    } else {
        b = true;
    }
    
    return b;
}

StochRawChannel.efs

/***************************************
Provided By : eSignal (c) Copyright 2005
Description:  Stochastics Raw Channel

Version 1.0  6/09/2005

Notes:
August 2005 Issue - "Stochastics and Price Range Dynamics
                     What Flavor Smoothing would you like." 
    by Andrew Tomlinson
    
This study uses EFS2 functionality available in eSignal
version 7.9 or later.

Formula Parameters:                 Defaults:
Number of Periods                   14
Line Thickness                      2
Line Color                          green
***************************************/

function preMain() {
    setPriceStudy(true);
    setStudyTitle("Stochastics Raw Channel ");
    setShowTitleParameters(false);
    setCursorLabelName("Upper Channel", 0);
    setCursorLabelName("Lower Channel", 1);
    setDefaultBarFgColor(Color.green, 0);
    setDefaultBarFgColor(Color.green, 1);
    setDefaultBarThickness(2, 0);
    setDefaultBarThickness(2, 1);
    
    var fp1 = new FunctionParameter("nLength", FunctionParameter.NUMBER);
        fp1.setName("Number of Periods");
        fp1.setLowerLimit(1);
        fp1.setDefault(14);
    var fp2 = new FunctionParameter("nThick", FunctionParameter.NUMBER);
        fp2.setName("Line Thickness");
        fp2.setLowerLimit(1);
        fp2.setDefault(2);
    var fp3 = new FunctionParameter("cColor", FunctionParameter.COLOR);
        fp3.setName("Line Color");
        fp3.setDefault(Color.green);
}

var bVersion = null;
var bInit = true;
var xHhv = null;
var xLlv = null;

function main(nLength, nThick, cColor) {
    if (bVersion == null) bVersion = verify();
    if (bVersion == false) return;    
    
    if (bInit == true) {
        xHhv = upperDonchian(nLength, high());
        xLlv = lowerDonchian(nLength, low());
        setDefaultBarThickness(nThick, 0);
        setDefaultBarThickness(nThick, 1);
        setDefaultBarFgColor(cColor, 0);
        setDefaultBarFgColor(cColor, 1);
        bInit = false;
    }
    
    return new Array(getSeries(xHhv), getSeries(xLlv));
}



/***** Support Functions *****/

function verify() {
    var b = false;
    if (getBuildNumber() < 700) {
        drawTextAbsolute(5, 35, "This study requires version 7.9 or later.", 
            Color.white, Color.blue, Text.RELATIVETOBOTTOM|Text.RELATIVETOLEFT|Text.BOLD|Text.LEFT,
            null, 13, "error");
        drawTextAbsolute(5, 20, "Click HERE to upgrade.@URL=http://www.esignal.com/download/default.asp", 
            Color.white, Color.blue, Text.RELATIVETOBOTTOM|Text.RELATIVETOLEFT|Text.BOLD|Text.LEFT,
            null, 13, "upgrade");
        return b;
    } else {
        b = true;
    }
    
    return b;
}

PriceBands.efs

/***************************************
Provided By : eSignal (c) Copyright 2005
Description:  Price Bands

Version 1.0  6/09/2005

Notes:
August 2005 Issue - "Stochastics and Price Range Dynamics
                     What Flavor Smoothing would you like." 
    by Andrew Tomlinson
    
This study uses EFS2 functionality available in eSignal
version 7.9 or later.

Formula Parameters:                 Defaults:
Number of Periods                   14
Line Thickness                      2
Line Color                          maroon
***************************************/

function preMain() {
    setPriceStudy(true);
    setStudyTitle("Price Bands ");
    setShowTitleParameters(false);
    setCursorLabelName("Upper Price Band", 0);
    setCursorLabelName("Lower Price Band", 1);
    setDefaultBarFgColor(Color.maroon, 0);
    setDefaultBarFgColor(Color.maroon, 1);
    setDefaultBarThickness(2, 0);
    setDefaultBarThickness(2, 1);
    
    var fp1 = new FunctionParameter("nLength", FunctionParameter.NUMBER);
        fp1.setName("Number of Periods");
        fp1.setLowerLimit(1);
        fp1.setDefault(14);
    var fp2 = new FunctionParameter("nThick", FunctionParameter.NUMBER);
        fp2.setName("Line Thickness");
        fp2.setLowerLimit(1);
        fp2.setDefault(2);
    var fp3 = new FunctionParameter("cColor", FunctionParameter.COLOR);
        fp3.setName("Line Color");
        fp3.setDefault(Color.maroon);
}

var bVersion = null;
var bInit = true;
var xHhv = null;
var xLlv = null;

function main(nLength, nThick, cColor) {
    if (bVersion == null) bVersion = verify();
    if (bVersion == false) return;    
    
    if (bInit == true) {
        xHhv = upperDonchian(nLength, high());
        xLlv = lowerDonchian(nLength, low());
        setDefaultBarThickness(nThick, 0);
        setDefaultBarThickness(nThick, 1);
        setDefaultBarFgColor(cColor, 0);
        setDefaultBarFgColor(cColor, 1);
        bInit = false;
    }
    
    return new Array(xHhv.getValue(-1), xLlv.getValue(-1));
}



/***** Support Functions *****/

function verify() {
    var b = false;
    if (getBuildNumber() < 700) {
        drawTextAbsolute(5, 35, "This study requires version 7.9 or later.", 
            Color.white, Color.blue, Text.RELATIVETOBOTTOM|Text.RELATIVETOLEFT|Text.BOLD|Text.LEFT,
            null, 13, "error");
        drawTextAbsolute(5, 20, "Click HERE to upgrade.@URL=http://www.esignal.com/download/default.asp", 
            Color.white, Color.blue, Text.RELATIVETOBOTTOM|Text.RELATIVETOLEFT|Text.BOLD|Text.LEFT,
            null, 13, "upgrade");
        return b;
    } else {
        b = true;
    }
    
    return b;
}

PriceBandOscillator.efs  

/***************************************
Provided By : eSignal (c) Copyright 2005
Description:  Price Band Oscillator

Version 1.0  6/09/2005

Notes:
August 2005 Issue - "Stochastics and Price Range Dynamics
                     What Flavor Smoothing would you like." 
    by Andrew Tomlinson
    
This study uses EFS2 functionality available in eSignal
version 7.9 or later.

Formula Parameters:                 Defaults:
Number of Periods                   14
Line Thickness                      2
Line Color                          maroon
***************************************/

function preMain() {
    setStudyTitle("Price Band Oscillator ");
    setShowTitleParameters(false);
    setCursorLabelName("Price Band Osc", 0);
    setDefaultBarFgColor(Color.maroon, 0);
    setDefaultBarThickness(2, 0);
    
    var fp1 = new FunctionParameter("nLength", FunctionParameter.NUMBER);
        fp1.setName("Number of Periods");
        fp1.setLowerLimit(1);
        fp1.setDefault(14);
    var fp2 = new FunctionParameter("nThick", FunctionParameter.NUMBER);
        fp2.setName("Line Thickness");
        fp2.setLowerLimit(1);
        fp2.setDefault(2);
    var fp3 = new FunctionParameter("cColor", FunctionParameter.COLOR);
        fp3.setName("Line Color");
        fp3.setDefault(Color.maroon);
}

var bVersion = null;
var bInit = true;
var xHhv = null;
var xLlv = null;

function main(nLength, nThick, cColor) {
    if (bVersion == null) bVersion = verify();
    if (bVersion == false) return;    
    
    if (bInit == true) {
        xHhv = upperDonchian(nLength, high());
        xLlv = lowerDonchian(nLength, low());
        setDefaultBarThickness(nThick, 0);
        setDefaultBarFgColor(cColor, 0);
        bInit = false;
    }
    
    if (getCurrentBarCount() < nLength+1) return;
    
    var Range = xHhv.getValue(-1) - xLlv.getValue(-1);
    var Position = close(0) - xLlv.getValue(-1);
    var PBOsc = 100 * (Position/Range);

    return PBOsc;
}



/***** Support Functions *****/

function verify() {
    var b = false;
    if (getBuildNumber() < 700) {
        drawTextAbsolute(5, 35, "This study requires version 7.9 or later.", 
            Color.white, Color.blue, Text.RELATIVETOBOTTOM|Text.RELATIVETOLEFT|Text.BOLD|Text.LEFT,
            null, 13, "error");
        drawTextAbsolute(5, 20, "Click HERE to upgrade.@URL=http://www.esignal.com/download/default.asp", 
            Color.white, Color.blue, Text.RELATIVETOBOTTOM|Text.RELATIVETOLEFT|Text.BOLD|Text.LEFT,
            null, 13, "upgrade");
        return b;
    } else {
        b = true;
    }
    
    return b;
}