symOverlay2.efs

ICE Data Services -


symOverlay2.efs 
  

File Name: symOverlay2.efs


Description:
Overlays a symbol as a price study and auto scales the overlay symbol's prices to match the price levels of your chart's symbol.


Formula Parameters:
nSymbol: Enter a symbol for comparison. Default is set to $SPX.

nFactor: Multiplier that adjusts nSymbol to match the price level of the chart's symbol

Notes:
The overlay symbol and nFactor for scaling can be changed via the "Edit Studies" option. The initial nFactor is based on the first (oldest) bar in your chart. It is recommended to apply a custom time template to your chart that limits the number of days or bars loaded into your chart. The current value of the nFactor is displayed in the cursor label window.

Download File:
symOverlay2.efs




EFS Code:


/*******************************Provided By : eSignal. (c) Copyright 2003*******************************/var vLoaded = false;function preMain() {    if (vLoaded == false) {        setPriceStudy(true);        setDefaultBarThickness(2);        setDefaultBarFgColor(Color.green);    } else {        setCursorLabelName(vSymbol);        setStudyTitle("Overlay: ");    }}var vSymbol = "";var vSym = "";var vInterval = 0;var str = new String();    function main(nSymbol, nFactor){    if (vLoaded == false) {        if (nSymbol == null)            nSymbol = "$SPX";        vInterval = getInterval();            if (nFactor == null) {            var c = close();            if (c == null) {                return;            }            var c1 = close(0, 1, nSymbol);            if (c1 == null) {                return;            }            nFactor = (c/c1);            nFactor *= 10000            nFactor = Math.round(nFactor);            nFactor /= 10000            str = nFactor;        } else {            var vFactor = nFactor+'';            var strLength = vFactor.length            var de = false;            for (i = 0; i < strLength; ++i) {                str += vFactor.charAt(i)                if (vFactor.charAt(i) == ".") {                    de = true;                }            }            if (de == false) {                str += ".0"            }        }        vSym = (str + nSymbol + "," + vInterval);        vLoaded = true;        vSymbol = (str + " x " + nSymbol);        preMain();    }        var v = close(0, 1, vSym);    if (v == null) {        return;    }    return v;}