Announcement

Collapse
No announcement yet.

Relative Strength EFS Question

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

  • Relative Strength EFS Question

    I came across this relative strength efs: eSignal Bulletin Board » eSignal Formula Script (EFS) Central » EFS Library - Discussion Board » Spread / Overlays » RelativeStrengthRatio.efs.

    It calculates the strength of a security relative to a different security, like $SPX.

    I'm looking for something similar, but instead of comparing current prices of each security, I want to compare each security's change from prior day's close (on an intraday basis). For example, in comparing KO vs. PEP, I'd be looking to plot: ((Current Price of KO / Prior Day's Close of KO) / (Current Price of PEP / Prior Day's Close of PEP)).

    Any help or advice would be greatly appreciated. I'm trying to learn to write my own scripts for the first time, and it's been a tough start.

    Thanks,

    John P.



    /************************************************** **************************************************
    Copyright © eSignal, a division of Interactive Data Corporation. 2003. All rights reserved.
    This sample eSignal Formula Script (EFS) may be modified and saved under a new
    filename; however, eSignal is no longer responsible for the functionality once modified.
    eSignal reserves the right to modify and overwrite this EFS file with each new release.
    ************************************************** ************************************************** */

    var vLoaded = false;
    var vEdit = false;
    var cSym = "";
    var vSym = "$SPX";

    function preMain() {
    if (vLoaded == false) {
    setDefaultBarFgColor(Color.blue);
    } else {
    if (vEdit == false) {
    setStudyTitle(cSym + " vs. " + vSym + " ");
    setCursorLabelName(cSym + "\/" + vSym);
    } else {
    setStudyTitle(cSym + " vs. ");
    setCursorLabelName(cSym + "\/" + vSym);
    }
    }
    }

    function main(Symbol1) {
    if (vLoaded == false) {
    cSym = getSymbol();
    if (Symbol1 == null) {
    vSym = "$SPX";
    vEdit = false
    } else {
    vSym = Symbol1;
    vEdit = true;
    }
    vLoaded = true;
    preMain();
    }

    if (vSym != null) {
    var b = close(0, 1, vSym);
    var vValue = close()/b;
    return vValue;
    } else {
    return;
    }
    }
Working...
X