| File Name: Soybean_SeasonalStrategy.efs, Soybean_SeasonalStrategyMA.efs
Description: Soybean_SeasonalStrategy.efs Soybean Simple Date Seasonal Strategy
Soybean_SeasonalStrategyMA.efs Simple Moving Average Crossover Soybean Strategy
Formula Parameters: Soybean_SeasonalStrategy.efs SELLMONTH : 6 BUYMONTH : 9
Soybean_SeasonalStrategyMA.efs Fast Length : 18 Slow Length : 120
Notes: The related article is copyrighted material. If you are not a subscriber of Stocks & Commodities, please visit www.traders.com.
Download File: Soybean_SeasonalStrategy.efs Soybean_SeasonalStrategyMA.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: Soybean Simple Date Seasonal StrategyVersion: 1.0 09/09/2009Formula Parameters: Default: SELLMONTH 6 BUYMONTH 9 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();var bVersion = null;function preMain() { setPriceStudy(true); setShowCursorLabel(false); setShowTitleParameters( false ); setStudyTitle("Seasonal Strategy"); setColorPriceBars(true); askForInput(); var x=0; fpArray[x] = new FunctionParameter("SELLMONTH", FunctionParameter.NUMBER); with(fpArray[x++]){ setLowerLimit(1); setDefault(6); } fpArray[x] = new FunctionParameter("BUYMONTH", FunctionParameter.NUMBER); with(fpArray[x++]){ setLowerLimit(1); setDefault(9); }}function main(SELLMONTH, BUYMONTH) {var nBarState = getBarState();var SEASONALBUY = false;var SEASONALSHORT = false; if (bVersion == null) bVersion = verify(); if (bVersion == false) return; if (getCurrentBarIndex() == 0) return; if (nBarState == BARSTATE_ALLBARS) { if (SELLMONTH == null) SELLMONTH = 6; if (BUYMONTH == null) BUYMONTH = 9; } setPriceBarColor(Color.black); if (getMonth(0) < SELLMONTH || getMonth(0) > BUYMONTH ) SEASONALBUY = true; else SEASONALBUY = false; if (getMonth(0) > SELLMONTH && getMonth(0) < BUYMONTH + 1) SEASONALSHORT = true; else SEASONALSHORT = false; if (SEASONALBUY && !Strategy.isLong()) { Strategy.doLong("Buy", Strategy.MARKET, Strategy.NEXTBAR); } if (SEASONALSHORT && !Strategy.isShort()) { Strategy.doShort("Sell", Strategy.MARKET, Strategy.NEXTBAR); } if(Strategy.isLong()) setPriceBarColor(Color.lime); if(Strategy.isShort()) setPriceBarColor(Color.red); return; }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;} |
/*********************************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: Simple Moving Average Crossover Soybean StrategyVersion: 1.0 09/09/2009Formula Parameters: Default: Fast Length 18 Slow Length 120 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();var bInit = false;var bVersion = null;function preMain() { setPriceStudy(true); setShowCursorLabel(false); setShowTitleParameters( false ); setStudyTitle("Simple MA Soybean Strategy"); setColorPriceBars(true); askForInput(); var x=0; fpArray[x] = new FunctionParameter("FastLength", FunctionParameter.NUMBER); with(fpArray[x++]){ setName("Fast Length"); setLowerLimit(1); setDefault(18); } fpArray[x] = new FunctionParameter("SlowLength", FunctionParameter.NUMBER); with(fpArray[x++]){ setName("Slow Length"); setLowerLimit(1); setDefault(120); }}var xMAS = null;var xMAL = null;function main(FastLength, SlowLength) {var nBarState = getBarState();var nMAS = 0;var nMAS1 = 0;var nMAL = 0;var nMAL1 = 0; if (bVersion == null) bVersion = verify(); if (bVersion == false) return; if (getCurrentBarIndex() == 0) return; if (nBarState == BARSTATE_ALLBARS) { if (FastLength == null) FastLength = 18; if (SlowLength == null) SlowLength = 120; } if (bInit == false) { xMAS = sma(FastLength); xMAL = sma(SlowLength); bInit = true; } setPriceBarColor(Color.black); nMAS = xMAS.getValue(0); nMAS1 = xMAS.getValue(-1); nMAL = xMAL.getValue(0); nMAL1 = xMAL.getValue(-1); if (nMAL1 == null) return; if (nMAS1 < nMAL1 && nMAS > nMAL && !Strategy.isLong()) Strategy.doLong("Buy", Strategy.MARKET, Strategy.NEXTBAR); if (nMAS1 > nMAL1 && nMAS < nMAL && !Strategy.isShort()) Strategy.doShort("Sell", Strategy.MARKET, Strategy.NEXTBAR); if(Strategy.isLong()) setPriceBarColor(Color.lime); if(Strategy.isShort()) setPriceBarColor(Color.red); return; }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;} |
|