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(nMALength, nOBOSLength) { if (nMALength == null) nMALength = 13; if (nOBOSLength == null) nOBOSLength = 1; if (aMA == null) aMA = new Array(nMALength); var o = open(0, -nOBOSLength); if (o == null) return; var h = high(0, -nOBOSLength); if (h == null) return; var l = low(0, -nOBOSLength); if (l == null) return; var c = close(0, -nOBOSLength); if (c == null) return; var sumO = 0; var sumH = 0; var sumL = 0; var sumC = 0; for (i = 0; i < nOBOSLength; ++i) { sumO += o[i]; sumH += h[i]; sumL += l[i]; sumC += c[i]; } sumO /= nOBOSLength; sumH /= nOBOSLength; sumL /= nOBOSLength; sumC /= nOBOSLength; vret = (((sumH-sumO)+(sumC-sumL))/(2*(sumH-sumL)))*100 if (getBarState() == BARSTATE_NEWBAR) { aMA.pop(); aMA.unshift(vret) } else { aMA[0] = vret; } var dSum = 0; if (aMA[nMALength-1] != null) { for (i = 0; i < nMALength; ++i) { dSum += aMA[i]; } var vMA = dSum/nMALength; } else { return; } return new Array(vret, vMA); }