OvbOvs.efs
EFSLibrary - Discussion Board
File Name: OvbOvs.efs
Description:
OB/OS (Overbought/Oversold)
Formula Parameters:
- Lookback : 10
Notes:
Download File:
OvbOvs.efs
EFS Code:
/********************************* Provided By: eSignal (Copyright c eSignal), a division of Interactive Data Corporation. 2009. All rights reserved. This sample eSignal Formula Script (EFS) is for educational purposes only and may be modified and saved under a new file name. eSignal is not responsible for the functionality once modified. eSignal reserves the right to modify and overwrite this EFS file with each new release. Description: OB/OS (Overbought/Oversold) Version: 1.0 04/22/2009 Formula Parameters: Default: Lookback 10 Notes: **********************************/ var fpArray = new Array(); var bInit = false; function preMain() { setStudyTitle("Overbought/Oversold Indicator"); setCursorLabelName("OBOS", 0); setDefaultBarFgColor(Color.red, 0); setPriceStudy(false); var x = 0; fpArray[x] = new FunctionParameter("Lookback", FunctionParameter.NUMBER); with(fpArray[x++]) { setLowerLimit(1); setDefault(10); } } var xOvbOvs = null; function main(Lookback) { var nBarState = getBarState(); var nOvbOvs = 0; if (nBarState == BARSTATE_ALLBARS) { if (Lookback == null) Lookback = 10; } if (bInit == false) { xOvbOvs = efsInternal("Calc_OvbOvs", Lookback); bInit = true; } nOvbOvs = xOvbOvs.getValue(0); if (nOvbOvs == null) return; return nOvbOvs; } var bSecondInit = false; var xOBOS = null; var xClose = null; function Calc_OvbOvs(Lookback) { var nRes = 0; if (bSecondInit == false) { xOBOS = stochK(Lookback,1,1); xClose = close(); bSecondInit = true; } if (xOBOS.getValue(0) == null) return; if(xClose.getValue(0) > xClose.getValue(-Lookback)) nRes = xOBOS.getValue(0)/100; else nRes = (100-xOBOS.getValue(0))/100; return nRes; }