// Magazine: Technical Analysis of Stocks & Commodities, May 2004// Article: The Inverse Fisher Transform by John F. Ehlers// Study: INVERSE FISHER TRANSFORM OF RSI// Provided By: TS Support, LLC for eSignalvar RSI = null;function preMain(){ setStudyTitle("INVERSE FISHER TRANSFORM OF RSI"); setCursorLabelName("IFish",0); setDefaultBarFgColor(Color.red,0); addBand(.5, PS_SOLID, 1, Color.black); addBand(-.5, PS_SOLID, 1, Color.black); setDefaultBarThickness(2); //setComputeOnClose();}function main(){ wmaLength = 9; rsiLength = 5; if (RSI == null) RSI = new RSIStudy(rsiLength,"close"); var IFish = 0, WtdSum = 0 ; Value1 = .1 * (RSI.getValue(RSIStudy.RSI) - 50); for(i = 0; i < wmaLength; i++) WtdSum += (wmaLength - i) * (.1 * (RSI.getValue(RSIStudy.RSI,-i) - 50)) ; CumWt = (wmaLength + 1 ) * wmaLength * .5 ; Value2 = WAverage = WtdSum / CumWt ; IFish = (Math.exp(2 * Value2) - 1) / (Math.exp(2 * Value2) + 1); return IFish;} |