1-2-3ReversalStrategy.efs
EFSLibrary - Discussion Board
File Name: 1-2-3ReversalStrategy.efs
Description:
1-2-3 Reversal Strategy
Formula Parameters:
- KLength: 14
- KSmoothing: 1
- DLength: 3
Notes:
This System was created from the Book "How I Tripled My Money In The Futures Market" by Ulf Jensen, Page 183. This is reverse type of strategies.
The strategy buys at market, if close price is higher than the previous close during 2 days and the meaning of 9-days Stochastic Slow Oscillator is lower than 50.
The strategy sells at market, if close price is lower than the previous close price during 2 days and the meaning of 9-days Stochastic Fast Oscillator is higher than 50.
Download File:
1-2-3ReversalStrategy.efs
EFS Code:
/********************************* 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: 1-2-3 Reversal Strategy Version: 1.0 09/24/2008 Notes: This System was created from the Book "How I Tripled My Money In The Futures Market" by Ulf Jensen, Page 183. This is reverse type of strategies. The strategy buys at market, if close price is higher than the previous close during 2 days and the meaning of 9-days Stochastic Slow Oscillator is lower than 50. The strategy sells at market, if close price is lower than the previous close price during 2 days and the meaning of 9-days Stochastic Fast Oscillator is higher than 50. Formula Parameters: Default: KLength 14 KSmoothing 1 DLength 3 **********************************/ var fpArray = new Array(); function preMain() { setPriceStudy(true); setStudyTitle("1-2-3 Reversal Strategy"); setShowCursorLabel(false); setColorPriceBars(true); setDefaultPriceBarColor(Color.black); var x=0; fpArray[x] = new FunctionParameter("KLength", FunctionParameter.NUMBER); with(fpArray[x++]) { setLowerLimit(1); setDefault(14); } fpArray[x] = new FunctionParameter("KSmoothing", FunctionParameter.NUMBER); with(fpArray[x++]) { setLowerLimit(1); setDefault(1); } fpArray[x] = new FunctionParameter("DLength", FunctionParameter.NUMBER); with(fpArray[x++]) { setLowerLimit(1); setDefault(3); } } var bInit = false; var xStochK = null; var xStochD = null; function main(KLength, KSmoothing, DLength) { if(bInit == false) { xStochK = stochK(KLength, KSmoothing, DLength); xStochD = stochD(KLength, KSmoothing, DLength); bInit = true; } var nStochK = xStochK.getValue(0); var nStochD = xStochD.getValue(0); if(nStochK == null || nStochD == null) return; if(getCurrentBarIndex()==0) return; if(!Strategy.isLong()) { if(close(-2) < close(-1) && close(0) > close(-1) && nStochK < nStochD && nStochK > 50) Strategy.doLong("Long", Strategy.CLOSE, Strategy.THISBAR); } if(!Strategy.isShort()) { if(close(-2) > close(-1) && close(0) < close(-1) && nStochK > nStochD && nStochD < 50) Strategy.doShort("Short", Strategy.CLOSE, Strategy.THISBAR); } if(Strategy.isLong()) setPriceBarColor(Color.lime); else if(Strategy.isShort()) setPriceBarColor(Color.red); return; }