SVE_Stoch_IFT.efs, SVE_Stoch_IFT_Strategy.efs
EFSLibrary - Discussion Board
File Name:
- SVE_Stoch_IFT.efs
- SVE_Stoch_IFT_Strategy.efs
Description:
Applying The Put/Call Ratio Indicator by Sylvain Vervoort
Formula Parameters:
SVE_Stoch_IFT.efs
- Stochastic Period: 30
- Stochastic Slowing: 5
SVE_Stoch_IFT_Strategy.efs
- Stochastic Period: 30
- Stochastic Slowing: 5
- SMA Period: 165
Notes:
The related article is copyrighted material. If you are not a subscriber of Stocks & Commodities, please visit www.traders.com.
Download File:
SVE_Stoch_IFT.efs
SVE_Stoch_IFT_Strategy.efs
SVE_Stoch_IFT.efs, SVE_Stoch_IFT_Strategy.efs
EFS Code:
SVE_Stoch_IFT.efs
/********************************* Provided By: Interactive Data Corporation (Copyright © 2011) All rights reserved. This sample eSignal Formula Script (EFS) is for educational purposes only. Interactive Data Corporation reserves the right to modify and overwrite this EFS file with each new release. Description: Smoothed Inverse Fisher Transform Stochastic Oscillator Version: 1.00 13/10/2011 Formula Parameters: Default: Stochastic Period 30 Stochastic Slowing 5 Notes: The related article is copyrighted material. If you are not a subscriber of Stocks & Commodities, please visit www.traders.com. **********************************/ var fpArray = new Array(); function preMain() { setPriceStudy(false); setCursorLabelName("SVE_Stoch_IFT", 0); var x=0; fpArray[x] = new FunctionParameter("stochPeriod", FunctionParameter.NUMBER); with(fpArray[x++]) { setName("Stochastic Period"); setLowerLimit(2); setUpperLimit(100); setDefault(30); } fpArray[x] = new FunctionParameter("stochSlowing", FunctionParameter.NUMBER); with(fpArray[x++]) { setName("Stochastic Slowing"); setLowerLimit(1); setUpperLimit(10); setDefault(5); } } var bInit = false; var bVersion = null; var xRainb = null; var xHHV = null; var xLLV = null; var xSmaR = null; var xSmaL = null; var xSmaH = null; function main(stochPeriod, stochSlowing) { if (bVersion == null) bVersion = verify(); if (bVersion == false) return; if (!bInit) { xRainb = efsInternal("Calc_RainbW"); xHHV = hhv(stochPeriod, xRainb); xLLV = llv(stochPeriod, xRainb); xSmaR = sma(stochSlowing, xRainb); xSmaL = sma(stochSlowing, xLLV); xSmaH = sma(stochSlowing, xHHV); bInit = true; } var nSmaR = xSmaR.getValue(0); var nSmaL = xSmaL.getValue(0); var nSmaH = xSmaH.getValue(0); if (nSmaR == null || nSmaL == null || nSmaH == null) return; var nSumR = nSmaR * stochSlowing; var nSumL = nSmaL * stochSlowing; var nSumH = nSmaH * stochSlowing; var nRBWStoch = (nSumR - nSumL)/(nSumH - nSumL + 0.0001)*100; var x = 0.1 * (nRBWStoch-50); var nIFTStoch = ((Math.exp(2 * x) - 1) / (Math.exp(2 * x) + 1) + 1) * 50; return nIFTStoch; } /************************************************* SUPPORT FUNCTIONS **************************************************/ var bInitRainbow = false; var xWMA1 = null; var xWMA2 = null; var xWMA3 = null; var xWMA4 = null; var xWMA5 = null; var xWMA6 = null; var xWMA7 = null; var xWMA8 = null; var xWMA9 = null; var xWMA10 = null; // rainbow averaging technique function Calc_RainbW() { var nRes = 0; var nWMA1 = 0; var nWMA2 = 0; var nWMA3 = 0; var nWMA4 = 0; var nWMA5 = 0; var nWMA6 = 0; var nWMA7 = 0; var nWMA8 = 0; var nWMA9 = 0; var nWMA10 = 0; if (!bInitRainbow) { xWMA1 = wma(2); xWMA2 = wma(2, xWMA1); xWMA3 = wma(2, xWMA2); xWMA4 = wma(2, xWMA3); xWMA5 = wma(2, xWMA4); xWMA6 = wma(2, xWMA5); xWMA7 = wma(2, xWMA6); xWMA8 = wma(2, xWMA7); xWMA9 = wma(2, xWMA8); xWMA10 = wma(2, xWMA9); bInitRainbow = true; } nWMA1 = xWMA1.getValue(0); nWMA2 = xWMA2.getValue(0); nWMA3 = xWMA3.getValue(0); nWMA4 = xWMA4.getValue(0); nWMA5 = xWMA5.getValue(0); nWMA6 = xWMA6.getValue(0); nWMA7 = xWMA7.getValue(0); nWMA8 = xWMA8.getValue(0); nWMA9 = xWMA9.getValue(0); nWMA10 = xWMA10.getValue(0); if (nWMA10 == null) return; nRes = (5 * nWMA1 + 4 * nWMA2 + 3 * nWMA3 + 2 * nWMA4 + nWMA5 + nWMA6 + nWMA7 + nWMA8 + nWMA9 + nWMA10) / 20; return nRes; } // verify version function verify() { var b = false; if (getBuildNumber() < 779) { drawTextAbsolute(5, 35, "This study requires version 8.0 or later.", Color.white, Color.blue, Text.RELATIVETOBOTTOM|Text.RELATIVETOLEFT|Text.BOLD|Text.LEFT, null, 13, "error"); drawTextAbsolute(5, 20, "Click HERE to upgrade.@URL=http://www.esignal.com/download/default.asp", Color.white, Color.blue, Text.RELATIVETOBOTTOM|Text.RELATIVETOLEFT|Text.BOLD|Text.LEFT, null, 13, "upgrade"); return b; } else { b = true; } return b; }
SVE_Stoch_IFT_Strategy.efs
/********************************* Provided By: Interactive Data Corporation (Copyright © 2011) All rights reserved. This sample eSignal Formula Script (EFS) is for educational purposes only. Interactive Data Corporation reserves the right to modify and overwrite this EFS file with each new release. Description: Smoothed Inverse Fisher Transform Stochastic Oscillator Strategy Version: 1.00 13/10/2011 Formula Parameters: Default: Stochastic Period 30 Stochastic Slowing 5 SMA Period 165 Notes: The related article is copyrighted material. If you are not a subscriber of Stocks & Commodities, please visit www.traders.com. **********************************/ var fpArray = new Array(); function preMain() { setPriceStudy(true); setCursorLabelName("SVE_Stoch_IFT_Strategy", 0); var x=0; fpArray[x] = new FunctionParameter("stochPeriod", FunctionParameter.NUMBER); with(fpArray[x++]) { setName("Stochastic Period"); setLowerLimit(2); setUpperLimit(100); setDefault(30); } fpArray[x] = new FunctionParameter("stochSlowing", FunctionParameter.NUMBER); with(fpArray[x++]) { setName("Stochastic Slowing"); setLowerLimit(1); setUpperLimit(10); setDefault(5); } fpArray[x] = new FunctionParameter("smaPeriod", FunctionParameter.NUMBER); with(fpArray[x++]) { setName("SMA Period"); setLowerLimit(1); setDefault(165); } } var bInit = false; var bVersion = null; var xSVE_Stoch = null; var xSMA = null; function main(stochPeriod, stochSlowing, smaPeriod) { // Back Testing formulas are not for real time analysis. // Therefore, prevent processing and exit at bar 0. if (getCurrentBarIndex() == 0) return; if (bVersion == null) bVersion = verify(); if (bVersion == false) return; if (!bInit) { xSVE_Stoch = efsInternal("Calc_SVE_Stoch_IFT", stochPeriod, stochSlowing); xSMA = sma(smaPeriod); bInit = true; } var nStoch0 = xSVE_Stoch.getValue(0); var nStoch1 = xSVE_Stoch.getValue(-1); var nSMA = xSMA.getValue(0); if (nStoch0 == null || nSMA == null) return; // exit strategy if (Strategy.isInTrade()) { // exit long if (Strategy.isLong()) { if (nStoch1 > 60 && nStoch0 <= 60) Strategy.doSell("Long Exit Signal", Strategy.CLOSE, Strategy.THISBAR); } // exit short else if (Strategy.isShort()) { if (nStoch1 < 30 && nStoch0 >= 30) Strategy.doCover("Short Exit Signal", Strategy.CLOSE, Strategy.THISBAR); } } // entry strategy if (!Strategy.isInTrade()) { if (nStoch1 < 30 && nStoch0 >= 30) Strategy.doLong("Long signal", Strategy.CLOSE, Strategy.THISBAR); if (nStoch1 > 60 && nStoch0 <= 60) if (close(0) < nSMA) Strategy.doShort("Short signal", Strategy.CLOSE, Strategy.THISBAR); } if(Strategy.isLong()) { setBarBgColor(Color.darkgreen); } else if(Strategy.isShort()) { setBarBgColor(Color.maroon); } return; } // SVE_Stoch_IFT params var stochInit = false; var xRainb = null; var xHHV = null; var xLLV = null; var xSmaR = null; var xSmaL = null; var xSmaH = null; function Calc_SVE_Stoch_IFT(stochPeriod, stochSlowing) { if (!stochInit) { xRainb = efsInternal("Calc_RainbW"); xHHV = hhv(stochPeriod, xRainb); xLLV = llv(stochPeriod, xRainb); xSmaR = sma(stochSlowing, xRainb); xSmaL = sma(stochSlowing, xLLV); xSmaH = sma(stochSlowing, xHHV); stochInit = true; } var nSmaR = xSmaR.getValue(0); var nSmaL = xSmaL.getValue(0); var nSmaH = xSmaH.getValue(0); if (nSmaR == null || nSmaL == null || nSmaH == null) return; var nSumR = nSmaR * stochSlowing; var nSumL = nSmaL * stochSlowing; var nSumH = nSmaH * stochSlowing; var nRBWStoch = (nSumR - nSumL)/(nSumH - nSumL + 0.0001)*100; var x = 0.1 * (nRBWStoch-50); var nIFTStoch = ((Math.exp(2 * x) - 1) / (Math.exp(2 * x) + 1) + 1) * 50; return nIFTStoch; } var bInitRainbow = false; var xWMA1 = null; var xWMA2 = null; var xWMA3 = null; var xWMA4 = null; var xWMA5 = null; var xWMA6 = null; var xWMA7 = null; var xWMA8 = null; var xWMA9 = null; var xWMA10 = null; // rainbow averaging technique function Calc_RainbW() { var nRes = 0; var nWMA1 = 0; var nWMA2 = 0; var nWMA3 = 0; var nWMA4 = 0; var nWMA5 = 0; var nWMA6 = 0; var nWMA7 = 0; var nWMA8 = 0; var nWMA9 = 0; var nWMA10 = 0; if (!bInitRainbow) { xWMA1 = wma(2); xWMA2 = wma(2, xWMA1); xWMA3 = wma(2, xWMA2); xWMA4 = wma(2, xWMA3); xWMA5 = wma(2, xWMA4); xWMA6 = wma(2, xWMA5); xWMA7 = wma(2, xWMA6); xWMA8 = wma(2, xWMA7); xWMA9 = wma(2, xWMA8); xWMA10 = wma(2, xWMA9); bInitRainbow = true; } nWMA1 = xWMA1.getValue(0); nWMA2 = xWMA2.getValue(0); nWMA3 = xWMA3.getValue(0); nWMA4 = xWMA4.getValue(0); nWMA5 = xWMA5.getValue(0); nWMA6 = xWMA6.getValue(0); nWMA7 = xWMA7.getValue(0); nWMA8 = xWMA8.getValue(0); nWMA9 = xWMA9.getValue(0); nWMA10 = xWMA10.getValue(0); if (nWMA10 == null) return; nRes = (5 * nWMA1 + 4 * nWMA2 + 3 * nWMA3 + 2 * nWMA4 + nWMA5 + nWMA6 + nWMA7 + nWMA8 + nWMA9 + nWMA10) / 20; return nRes; } // verify version function verify() { var b = false; if (getBuildNumber() < 779) { drawTextAbsolute(5, 35, "This study requires version 8.0 or later.", Color.white, Color.blue, Text.RELATIVETOBOTTOM|Text.RELATIVETOLEFT|Text.BOLD|Text.LEFT, null, 13, "error"); drawTextAbsolute(5, 20, "Click HERE to upgrade.@URL=http://www.esignal.com/download/default.asp", Color.white, Color.blue, Text.RELATIVETOBOTTOM|Text.RELATIVETOLEFT|Text.BOLD|Text.LEFT, null, 13, "upgrade"); return b; } else { b = true; } return b; }