/*********************************Provided By: eSignal (Copyright c eSignal), a division of Interactive Data Corporation. 2008. 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: TFS: MBO indicatorVersion: 1.0 09/26/2008Notes: MBO indicator is the third component of TFS trading system. This indicator was developed by Bryan Strain and Mark Whitley. The idea of MBO is similar to moving average convergence/divergence (MACD) indicator. It is calculated by subtracting the 200-day moving average from the 25-day moving average.Formula Parameters: Default: Fastavg 25 Slowavg 200 **********************************/var fpArray = new Array();var bInit = false;function preMain() { setStudyTitle("TFS: MBO Indicator"); setCursorLabelName("MBO",0); setPlotType(PLOTTYPE_HISTOGRAM,0); setCursorLabelName("ZeroLine",1); addBand(0, PS_SOLID, 1, Color.blue); setDefaultBarFgColor(Color.red, 0); var x=0; fpArray[x] = new FunctionParameter("FastAvg", FunctionParameter.NUMBER); with(fpArray[x++]){ setLowerLimit(1); setDefault(25); } fpArray[x] = new FunctionParameter("SlowAvg", FunctionParameter.NUMBER); with(fpArray[x++]){ setLowerLimit(1); setDefault(200); } }var xFastAvg = null;var xSlowAvg = null;function main(FastAvg, SlowAvg) {var nState = getBarState(); if (nState == BARSTATE_ALLBARS) { if (FastAvg == null) FastAvg = 25; if (SlowAvg == null) SlowAvg = 200; } if ( bInit == false ) { xFastAvg = sma(FastAvg); xSlowAvg = sma(SlowAvg); bInit = true; } if (getCurrentBarCount() <= SlowAvg) return; var nMBO = xFastAvg.getValue(0) - xSlowAvg.getValue(0); return nMBO;} |