Announcement

Collapse
No announcement yet.

2014 Feb: The Degree Of Complexity by Oscar G. Cagigas

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

  • 2014 Feb: The Degree Of Complexity by Oscar G. Cagigas

    File Name: BasicDonchianSystem.efs

    Description:
    The Degree Of Complexity by Oscar G. Cagigas

    Formula Parameters:

    BasicDonchianSystem.efs
    Len1: 40
    Len2: 15
    Long Color: lime
    Short Color: red

    Notes:
    The related article is copyrighted material. If you are not a subscriber
    of Stocks & Commodities, please visit www.traders.com.

    Download File:
    BasicDonchianSystem.efs


    BasicDonchianSystem.efs


    EFS Code:
    PHP Code:

    /*********************************
    Provided By:  
        Interactive Data Corporation (Copyright В© 2013) 
        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:        
        The Degree Of Complexity by Oscar G. Cagigas

    Formula Parameters:                     Default:
    Len1                                    40
    Len2                                    15
    Long Color                              lime
    Short Color                             red

    Version:            1.00  12/05/2013

    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()
    {   
        
    setStudyTitle("BasicDonchianSystem");
        
    setPriceStudy(true);    

        var 
    0;

        
    fpArray[x] = new FunctionParameter("fpLen1"FunctionParameter.NUMBER);
        
    with(fpArray[x++])
        {
            
    setName("Len1");
            
    setLowerLimit(20);
            
    setUpperLimit(40);
            
    setDefault(40);
        }

        
    fpArray[x] = new FunctionParameter("fpLen2"FunctionParameter.NUMBER);
        
    with(fpArray[x++])
        {
            
    setName("Len2");
            
    setLowerLimit(5);
            
    setUpperLimit(30);
            
    setDefault(15);
        }

        
    fpArray[x] = new FunctionParameter("gLongColor"FunctionParameter.COLOR);
        
    with(fpArray[x++])
        {
            
    setName("Long Color");    
            
    setDefault(Color.lime);
        } 
        
        
    fpArray[x] = new FunctionParameter("gShortColor"FunctionParameter.COLOR);
        
    with(fpArray[x++])
        {
            
    setName("Short Color");    
            
    setDefault(Color.red);
        }  
    }

    var 
    bInit false;
    var 
    bVersion null;

    var 
    xHHV1 null;
    var 
    xLLV1 null;

    var 
    xHHV2 null;
    var 
    xLLV2 null;

    var 
    xHigh null;
    var 
    xLow  null;
    var 
    xOpen null;

    function 
    main(fpLen1,fpLen2,gLongColor,gShortColor
    {
        if (
    bVersion == nullbVersion verify();
        if (
    bVersion == false) return;

        if (!
    bInit)
        {   
            
    xHigh high();
            
    xLow low();
            
    xOpen open();
            
            
    xHHV1 hhv(fpLen1xHigh);
            
    xLLV1 llv(fpLen1xLow);
            
            
    xHHV2 hhv(fpLen2xHigh);
            
    xLLV2 llv(fpLen2xLow);
        
            
    bInit true;
        }

        var 
    nBuyStop   xHHV1.getValue(-1);
        var 
    nSellStop  xLLV2.getValue(-1);
        var 
    nShortStop xLLV1.getValue(-1);
        var 
    nCoverStop xHHV2.getValue(-1);

        var 
    nHigh xHigh.getValue(0);
        var 
    nLow  xLow.getValue(0);
        var 
    nOpen xOpen.getValue(0);

        if (
    nBuyStop == null || nSellStop == null || nShortStop == null || nCoverStop == null || nHigh == null || nLow == null || nOpen == null)
            return;
        
        
    nPrice=null;    

        if (
    getCurrentBarIndex() != 0
        {                   
                
    // Entry Strategy
                
    if (!Strategy.isInTrade())
                {
                   
    //LONG ENTRY
                        
    if (nHigh nBuyStop)                    
                        {
                           
    Strategy.doLong("Enter Long"Strategy.CLOSEStrategy.THISBAR);                                                                           
                           
    drawTextRelative(0BelowBar2"Long"Color.blackgLongColorText.PRESETnullnull); 
                        } 
                    else
                    {
                        
    //SHORT ENTRY
                        
    if (nLow nShortStop)
                        {                       
                           
    Strategy.doShort("Enter Short"Strategy.CLOSEStrategy.THISBAR);                                                                           
                           
    drawTextRelative(0AboveBar2"Short"Color.blackgShortColorText.PRESETnullnull);  
                        }
                    }
                }
            
                
    // Exit Strategy
                
    if (Strategy.isInTrade())
                {
                    
    //EXIT
                    
    if ((nLow nSellStop) && Strategy.isLong())
                            {                           
                               
    Strategy.doSell("Exit"Strategy.CLOSEStrategy.THISBAR);                                                                               
                               
    drawTextRelative(0AboveBar2"Exit"Color.blackgShortColorText.PRESETnullnull);  
                            }
                    else
                        {
                            
    //COVER
                            
    if ((nHigh nCoverStop) && Strategy.isShort())
                            {                           
                               
    Strategy.doCover("Cover"Strategy.CLOSEStrategy.THISBAR);                                                                               
                               
    drawTextRelative(0BelowBar2"Cover"Color.blackgLongColorText.PRESETnullnull); 
                            }
                    }
                }             
            }     

        return;
    }

    function 
    verify() 
    {
        var 
    false;
        if (
    getBuildNumber() < 779
        {
            
    drawTextAbsolute(535"This study requires version 8.0 or later."
                
    Color.whiteColor.blueText.RELATIVETOBOTTOM|Text.RELATIVETOLEFT|Text.BOLD|Text.LEFT,
                
    null13"error");
            
    drawTextAbsolute(520"Click HERE to upgrade.@URL=http://www.esignal.com/download/default.asp"
                
    Color.whiteColor.blueText.RELATIVETOBOTTOM|Text.RELATIVETOLEFT|Text.BOLD|Text.LEFT,
                
    null13"upgrade");
            return 
    b;
        } 
        else 
        {
            
    true;
        }

        return 
    b;

Working...
X