Announcement

Collapse
No announcement yet.

Ichimoku.efs

Collapse
This topic is closed.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Ichimoku.efs

    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:
    PHP 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.red0);
        
    setDefaultBarFgColor(Color.blue1);
        
    setDefaultBarFgColor(Color.magenta2);
        
    setDefaultBarFgColor(Color.lightgrey3);
        
    setDefaultBarFgColor(Color.purple4);
        
    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(nTrnPeriodnStdPeriodnLS2PeriodnOffsetsCloudcCloud,
                    
    nColorTrnnColorStdnColorDelaynColorLS1nColorLS2,
                    
    nThickTrnnThickStdnThickDelaynThickLS1nThickLS2) {

        if (
    bInit == false) {
            
    setDefaultBarFgColor(nColorTrn0);
            
    setDefaultBarFgColor(nColorStd1);
            
    setDefaultBarFgColor(nColorDelay2);
            
    setDefaultBarFgColor(nColorLS13);
            
    setDefaultBarFgColor(nColorLS24);
            
    setDefaultBarThickness(nThickTrn0);
            
    setDefaultBarThickness(nThickStd1);
            
    setDefaultBarThickness(nThickDelay2);
            
    setDefaultBarThickness(nThickLS13);
            
    setDefaultBarThickness(nThickLS24);
            
    xTurn middleDonchian(nTrnPeriod);    
            
    xStd  middleDonchian(nStdPeriod);    
            
    xLS1  offsetSeries(efsInternal("calcLS1"xStdxTurn), nOffset);
            
    xLS2  offsetSeries(middleDonchian(nLS2Period), nOffset);
            
    bInit true;
        }
        
        
        if(
    getBarState() == BARSTATE_NEWBAR){
            
    vCntr++;
            
    vICntr++;
            if (
    vICntr 350vICntr 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(0nLeadingSpan10nLeadingSpan2PS_SOLID1cCloud"Cloud"+vICntr);
        } else {
            if(
    nLeadingSpan1>nLeadingSpan2)
                
    setBarBgColor(cCloud0nLeadingSpan2nLeadingSpan1);
            if(
    nLeadingSpan1<nLeadingSpan2)
                
    setBarBgColor(cCloud0nLeadingSpan1nLeadingSpan2);
        }

        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(
    nTurningLinenStandardLinenullnLeadingSpan1nLeadingSpan2);
        } else {
            return new Array(
    nTurningLinenStandardLineclose(0), nLeadingSpan1nLeadingSpan2);
        }
    }


    function 
    calcLS1xSTDxTRN ) {
        return (
    xSTD.getValue(0) + xTRN.getValue(0)) / 2;

    Jason K.
    Project Manager
    eSignal - an Interactive Data company

    EFS KnowledgeBase
    JavaScript for EFS Video Series
    EFS Beginner Tutorial Series
    EFS Glossary
    Custom EFS Development Policy

    New User Orientation
Working...
X