2006 Oct: Relative Spread Strength As A Long-Term Cyclic Tool

ICE Data Services -

RSS.efs, Rapid_RSS.efs  
EFSLibrary - Discussion Board  

File Name:

  • RSS.efs
  • Rapid_RSS.efs

Description:
These studies are based on the October 2006 article, Relative Spread Strength As A Long-Term Cyclic Tool, by Ian Copsey.

Formula Parameters:

RSS.efs

  • RS Length: 5
  • High Band: 80
  • Low Band: 20
  • Slow MA Length: 40
  • Fast MA Length: 10

Rapid_RSS.efs

  • Length: 14
  • OverBought: 70
  • OverSold: 30

Notes:
These formulas require eSignal version 8.0.0 or later. The related article is copyrighted material. If you are not a subscriber of Stocks & Commodities, please visit www.traders.com.

Download File:
RSS.efs
Rapid_RSS.efs




EFS Code:
RSS.efs

/***************************************
Provided By : eSignal (c) Copyright 2006
Description:  Relative Spread Strength 
              As A Long-Term Cyclic Tool
              by Ian Copsey

Version 1.0  08/11/2006

Notes:
* Oct 2006 Issue of Stocks and Commodities Magazine
* Study requires version 8.0 or higher.


Formula Parameters:                 Defaults:
RS Length                           5
High Band                           80
Low Band                            20
Slow MA Length                      40
Fast MA Length                      10
***************************************/


function preMain() {
    setStudyTitle("Relative Spread Strength ");
    setCursorLabelName("RSS", 0);
    setDefaultBarThickness(2, 0); 
    setDefaultBarFgColor(Color.red, 0);

    var fp1 = new FunctionParameter("nRSLength", FunctionParameter.NUMBER);
        fp1.setName("RS Length");
        fp1.setLowerLimit(1);
        fp1.setDefault(5);
    var fp2 = new FunctionParameter("nHband", FunctionParameter.NUMBER);
        fp2.setName("High Band");
        fp2.setDefault(80);
    var fp3 = new FunctionParameter("nLband", FunctionParameter.NUMBER);
        fp3.setName("Low Band");
        fp3.setDefault(20);
    var fp4 = new FunctionParameter("nLenMA2", FunctionParameter.NUMBER);
        fp4.setName("Slow MA Length");
        fp4.setLowerLimit(1);
        fp4.setDefault(40);
    var fp5 = new FunctionParameter("nLenMA1", FunctionParameter.NUMBER);
        fp5.setName("Fast MA Length");
        fp5.setLowerLimit(1);
        fp5.setDefault(10);
}


var bVersion = null;
var bInit = false;

var xSpread = null;
var xRSI = null;
var xRSS = null;

function main(nRSLength, nHband, nLband, nLenMA1, nLenMA2) {    
    if (bVersion == null) bVersion = verify();
    if (bVersion == false) return;    

    if (bInit == false) {
        addBand(nHband, PS_SOLID, 2, Color.blue, "High");
        addBand(nLband, PS_SOLID, 2, Color.blue, "Low");
        xSpread = efsInternal("calcSpread", nLenMA1, nLenMA2);
        xRSI = rsi(nRSLength, xSpread);
        xRSS = sma(5, xRSI);
        bInit = true;
    }
    
    return xRSS.getValue(0);
}


var xMA1 = null;
var xMA2 = null;

function calcSpread(nLen1, nLen2) {
    if (xMA1 == null) xMA1 = ema(nLen1);
    if (xMA2 == null) xMA2 = ema(nLen2);
    
    var nE1 = xMA1.getValue(0);
    var nE2 = xMA2.getValue(0);
    if (nE1 == null || nE2 == null) return;
    
    return (nE1 - nE2);
}


function verify() {
    var b = false;
    if (getBuildNumber() < 779) {
        drawTextAbsolute(5, 35, "This study requires version 8.0 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;
}

Rapid_RSS.efs

/***************************************
Provided By : eSignal (c) Copyright 2006
Description:  Relative Spread Strength 
              As A Long-Term Cyclic Tool
              by Ian Copsey

Version 1.0  08/11/2006

Notes:
* Oct 2006 Issue of Stocks and Commodities Magazine
* Study requires version 8.0 or higher.


Formula Parameters:                 Defaults:
Length                              14
OverBought                          70
OverSold                            30
***************************************/


function preMain() {
    setStudyTitle("Rapid RSI ");
    setCursorLabelName("CRS", 0);
    setDefaultBarThickness(2, 0); 
    setDefaultBarFgColor(Color.navy, 0);

    var fp1 = new FunctionParameter("nLength", FunctionParameter.NUMBER);
        fp1.setName("Length");
        fp1.setLowerLimit(1);
        fp1.setDefault(14);
    var fp2 = new FunctionParameter("nOb", FunctionParameter.NUMBER);
        fp2.setName("OverBought");
        fp2.setDefault(70);
    var fp3 = new FunctionParameter("nOs", FunctionParameter.NUMBER);
        fp3.setName("OverSold");
        fp3.setDefault(30);
}


var bVersion = null;
var bInit = false;

var xRapidRSI = null;

function main(nLength, nOb, nOs) {    
    if (bVersion == null) bVersion = verify();
    if (bVersion == false) return;    

    if (bInit == false) {
        addBand(nOb, PS_SOLID, 2, Color.blue, "OB");
        addBand(nOs, PS_SOLID, 2, Color.blue, "OS");
        xRapidRSI = efsInternal("calcRSS", nLength);
        bInit = true;
    }
    
    return xRapidRSI.getValue(0);
}


function calcRSS(nLen) {
    var nCntr = 0;
    var nUpSum = 0;
    var nDnSum = 0;
    var nRS = 0;
    var nCRS = null;
    
    for (nCntr = 0; nCntr < nLen; nCntr++) {
        if (close(-nCntr) > close(-(nCntr+1)) ) {
            nUpSum += close(-nCntr) - close(-(nCntr+1));
        }
        if (close(-nCntr) < close(-(nCntr+1)) ) {
            nDnSum += close(-(nCntr+1)) - close(-nCntr);
        }
    }

    if (nDnSum != 0) {
        nRS = nUpSum / nDnSum;
    } else {
        nRS = 100;
    }

    if (getCurrentBarCount() > nLen && nUpSum != nDnSum) {
        nCRS = 100 - 100 / (1 + nRS);
    } else {
        nCRS = 0;
    }

    return nCRS;
}


function verify() {
    var b = false;
    if (getBuildNumber() < 779) {
        drawTextAbsolute(5, 35, "This study requires version 8.0 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;
}