Ichimoku.efs
EFSLibrary - Discussion Board
File Name: Ichimoku.efs
Description:
The Ichimoku study developed by Goichi Hosoda from Japan.
Formula Parameters:
- Turning Line Periods: 9
- Standard Line Periods: 26
- Leading Span 2 Periods: 52
- Displacement: 26
- Ichimoku Cloud Style: Striped - [Stiped, Solid]
- Ichimoku Could Colo: grey
- Line Color: Turning Line: red
- Line Color: Standard Line: blue
- Line Color: Delayed Line: magenta
- Line Color: Leading Span 1 Line: lightgrey
- Line Color: Leading Span 2 Line: purple
- Line Thickness: Turning Line: 1
- Line Thickness: Standard Line: 1
- Line Thickness: Delayed Line: 1
- Line Thickness: Leading Span 1 Line: 1
- Line Thickness: Leading Span 2 Line: 1
Notes:
Bullish signals occur when the Turning Line crosses above the Standard Line, and bearish when crossing below. The shaded area between Leading Span 1 and 2, called the cloud, represents support and resistance. The Delayed Line is simply the close offset by 26 periods to give a quick comparison of today's price to that of 26 periods ago.
8/7/2007
* Study has been updated to utilize EFS2 functionality
* Additional formula parameters added to match built-in study parameters found in FutureSource Workstation Ichimoku study.
Download File:
Ichimoku.efs
EFS Code:
/********************************* Provided By: eSignal (Copyright © eSignal), a division of Interactive Data Corporation. 2007. 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. Version: 2.0 (8/7/2007) Notes: 8/7/2007 * Study has been updated to utilize EFS2 functionality * Additional formula parameters added to match built-in study parameters found in FutureSource Workstation Ichimoku study. **********************************/ // Global Variables var xTurn = null; var xStd = null; var xLS1 = null; var xLS2 = null; var bInit = false; // Initialization flag var vCntr = 0; // bar counter var vICntr = 0; // line counter for drawn lines function preMain() { setPriceStudy(true); setStudyTitle("Ichimoku"); setCursorLabelName("Turning Line", 0); setCursorLabelName("Standard Line", 1); setCursorLabelName("Delayed Line", 2); setCursorLabelName("Leading Span 1", 3); setCursorLabelName("Leading Span 2", 4); setDefaultBarFgColor(Color.red, 0); setDefaultBarFgColor(Color.blue, 1); setDefaultBarFgColor(Color.magenta, 2); setDefaultBarFgColor(Color.lightgrey, 3); setDefaultBarFgColor(Color.purple, 4); setShowTitleParameters(false); var fp1 = new FunctionParameter("nTrnPeriod", FunctionParameter.NUMBER); fp1.setName("Turning Line Periods"); fp1.setLowerLimit(1); fp1.setDefault(9); var fp2 = new FunctionParameter("nStdPeriod", FunctionParameter.NUMBER); fp2.setName("Standard Line Periods"); fp2.setLowerLimit(1); fp2.setDefault(26); var fp3 = new FunctionParameter("nLS2Period", FunctionParameter.NUMBER); fp3.setName("Leading Span 2 Periods"); fp3.setLowerLimit(1); fp3.setDefault(52); var fp4 = new FunctionParameter("nOffset", FunctionParameter.NUMBER); fp4.setName("Displacement"); fp4.setLowerLimit(0); fp4.setDefault(26); var fp5 = new FunctionParameter("sCloud", FunctionParameter.STRING); fp5.setName("Ichimoku Cloud Style"); fp5.addOption("Striped"); fp5.addOption("Solid"); fp5.setDefault("Striped"); var fp6 = new FunctionParameter("cCloud", FunctionParameter.COLOR); fp6.setName("Ichimoku Cloud Color"); fp6.setDefault(Color.grey); var fp11 = new FunctionParameter("nColorTrn", FunctionParameter.COLOR); fp11.setName("Line Color: Turning Line"); fp11.setDefault(Color.red); var fp12 = new FunctionParameter("nColorStd", FunctionParameter.COLOR); fp12.setName("Line Color: Standard Line"); fp12.setDefault(Color.blue); var fp13 = new FunctionParameter("nColorDelay", FunctionParameter.COLOR); fp13.setName("Line Color: Delayed Line"); fp13.setDefault(Color.magenta); var fp14 = new FunctionParameter("nColorLS1", FunctionParameter.COLOR); fp14.setName("Line Color: Leading Span 1 Line"); fp14.setDefault(Color.lightgrey); var fp15 = new FunctionParameter("nColorLS2", FunctionParameter.COLOR); fp15.setName("Line Color: Leading Span 2 Line"); fp15.setDefault(Color.purple); var fp21 = new FunctionParameter("nThickTrn", FunctionParameter.NUMBER); fp21.setName("Line Thickness: Turning Line"); fp21.setLowerLimit(1); fp21.setDefault(1); var fp22 = new FunctionParameter("nThickStd", FunctionParameter.NUMBER); fp22.setName("Line Thickness: Standard Line"); fp22.setLowerLimit(1); fp22.setDefault(1); var fp23 = new FunctionParameter("nThickDelay", FunctionParameter.NUMBER); fp23.setName("Line Thickness: Delayed Line"); fp23.setLowerLimit(1); fp23.setDefault(1); var fp24 = new FunctionParameter("nThickLS1", FunctionParameter.NUMBER); fp24.setName("Line Thickness: Leading Span 1 Line"); fp24.setLowerLimit(1); fp24.setDefault(1); var fp25 = new FunctionParameter("nThickLS2", FunctionParameter.NUMBER); fp25.setName("Line Thickness: Leading Span 2 Line"); fp25.setLowerLimit(1); fp25.setDefault(1); } function main(nTrnPeriod, nStdPeriod, nLS2Period, nOffset, sCloud, cCloud, nColorTrn, nColorStd, nColorDelay, nColorLS1, nColorLS2, nThickTrn, nThickStd, nThickDelay, nThickLS1, nThickLS2) { if (bInit == false) { setDefaultBarFgColor(nColorTrn, 0); setDefaultBarFgColor(nColorStd, 1); setDefaultBarFgColor(nColorDelay, 2); setDefaultBarFgColor(nColorLS1, 3); setDefaultBarFgColor(nColorLS2, 4); setDefaultBarThickness(nThickTrn, 0); setDefaultBarThickness(nThickStd, 1); setDefaultBarThickness(nThickDelay, 2); setDefaultBarThickness(nThickLS1, 3); setDefaultBarThickness(nThickLS2, 4); xTurn = middleDonchian(nTrnPeriod); xStd = middleDonchian(nStdPeriod); xLS1 = offsetSeries(efsInternal("calcLS1", xStd, xTurn), nOffset); xLS2 = offsetSeries(middleDonchian(nLS2Period), nOffset); bInit = true; } if(getBarState() == BARSTATE_NEWBAR){ vCntr++; vICntr++; if (vICntr > 350) vICntr = 0; } var nTurningLine = xTurn.getValue(0); var nStandardLine = xStd.getValue(0); var nLeadingSpan1 = xLS1.getValue(0); var nLeadingSpan2 = xLS2.getValue(0); if (nTurningLine == null || nStandardLine == null || nLeadingSpan1 == null || nLeadingSpan2 == null) return; if (sCloud == "Striped") { drawLineRelative(0, nLeadingSpan1, 0, nLeadingSpan2, PS_SOLID, 1, cCloud, "Cloud"+vICntr); } else { if(nLeadingSpan1>nLeadingSpan2) setBarBgColor(cCloud, 0, nLeadingSpan2, nLeadingSpan1); if(nLeadingSpan1<nleadingspan2) setbarbgcolor(ccloud,="" 0,="" nleadingspan1,="" nleadingspan2);="" }="" if="" (noffset=""> 0) { if(getBarState() == BARSTATE_NEWBAR){ var nNum = 1; }else{ var nNum = 0; } if(getBuildNumber()>636){ setBar(Bar.Value,-nOffset,2,close(0)); }else{ setBar(Bar.Value,-nOffset+nNum,new Array(null,null,close(0),null,null)); } return new Array(nTurningLine, nStandardLine, null, nLeadingSpan1, nLeadingSpan2); } else { return new Array(nTurningLine, nStandardLine, close(0), nLeadingSpan1, nLeadingSpan2); } } function calcLS1( xSTD, xTRN ) { return (xSTD.getValue(0) + xTRN.getValue(0)) / 2; }