MAOverBoughtOverSold.efs

ICE Data Services -


MAOverBoughtOverSold.efs 
  

File Name: MAOverBoughtOverSold.efs


Description:
Moving Average (default of 13) of an Over Bought/Over Sold indicator: (((high-open) + (close-low))/ ((2*(high-low)))*100


Formula Parameters:
nLength: Default is 13 for moving average

Notes:
NA

Download File:
MAOverBoughtOverSold.efs




EFS Code:
/*********************************Provided By : eSignal. (c) Copyright 2003*********************************/addBand(80, PS_SOLID, 2, Color.black, "upper")addBand(20, PS_SOLID, 2, Color.black, "lower")function preMain() {    setStudyTitle("Over Bought / Over Sold");    setCursorLabelName("OB/OS", 0);    setCursorLabelName("OB/OS MA", 1);     setDefaultBarFgColor(Color.blue, 0);    setDefaultBarFgColor(Color.red, 1);    setDefaultBarThickness(1, 0);    setDefaultBarThickness(2, 1);        setStudyMax(100);    setStudyMin(0);}var aMA = null;var vret = null; function main(nLength) {    if (nLength == null)        nLength = 13;        if (aMA == null)        aMA = new Array(13);     var o = open();    var h = high();    var l = low();    var c = close();    var vret = (((h-o)+(c-l))/(2*(h-l)))*100        if (getBarState() == BARSTATE_NEWBAR) {        aMA.pop();        aMA.unshift(vret)    } else {        aMA[0] = vret;    }        var dSum = 0;    if (aMA[nLength-1] != null) {        for (i = 0; i < nLength; ++i) {            dSum += aMA[i];        }        var vMA = dSum/nLength;    } else {        return;    }        return new Array(vret, vMA);}