Announcement

Collapse
No announcement yet.

2012 Oct: A Seasonal Strategy With Leveraged ETFs by Gerald Gardner

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

  • 2012 Oct: A Seasonal Strategy With Leveraged ETFs by Gerald Gardner

    File Name: HalloweenIndicator.efs

    Description:
    A Seasonal Strategy With Leveraged ETFs by Gerald Gardner

    Formula Parameters:

    HalloweenIndicator.efs
    Buy Color: lime
    Sell 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:
    HalloweenIndicator.efs

    HalloweenIndicator.efs


    EFS Code:
    PHP Code:
    /*********************************
    Provided By:  
    eSignal (Copyright c eSignal), a division of Interactive Data 
    Corporation. 2012. 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:        
    A Seasonal Strategy With Leveraged ETFs by Gerald Gardner

    Version:            1.00  13/08/2012

    Formula Parameters:                     Default:
    Buy Color                               lime
    Sell Color                              red

    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("HalloweenIndicator");
        
    setPriceStudy(true);

        var 
    x=0;
        
        
    fpArray[x] = new FunctionParameter("gBuyColor"FunctionParameter.COLOR);
        
    with(fpArray[x++])
        {
            
    setName("Buy Color");    
            
    setDefault(Color.lime);
        } 
        
        
    fpArray[x] = new FunctionParameter("gSellColor"FunctionParameter.COLOR);
        
    with(fpArray[x++])
        {
            
    setName("Sell Color");    
            
    setDefault(Color.red);
        } 
    }


    var 
    bInit false;
    var 
    bVersion null;

    var 
    xClose null;
    var 
    xSMA null;
    var 
    xMonth null;

    function 
    main(gBuyColor,gSellColor)
    {
        if (
    bVersion == nullbVersion verify();
        if (
    bVersion == false) return; 
        
        if(!
    bInit)
        {
            
    xClose close();        
            
    xSMA sma(50);   
            
    xMonth getMonth();     
            
            
    bInit true;
        }
        
        var 
    vClose xClose.getValue(0);
        var 
    vSMA   xSMA.getValue(0);
        var 
    vMonth xMonth.getValue(0);
        
        if ((
    vClose == null) || (vSMA == null) || (vMonth == null)) 
            return;
        
        
    // Back Testing formulas are not for real time analysis.
        // Therefore, prevent processing and exit at bar 0.
        
    if (getCurrentBarIndex() != 0
        {
            var 
    bLStrategy Strategy.isLong();    

            if (
    vMonth==10)
            {
                if ((
    vClose vSMA) && (!bLStrategy))
                {
                   
    Strategy.doLong("Enter Long"Strategy.MARKETStrategy.NEXTBAR);        
                   
    drawTextRelative(1BelowBar1"Long"Color.blackgBuyColorText.PRESETnullnull);           
                }            
            }
            
            if ((
    vMonth==5) && (bLStrategy))
            {
                
    Strategy.doSell("Exit Long"Strategy.MARKETStrategy.NEXTBAR);  
                
    drawTextRelative(1AboveBar1"Exit Long"Color.blackgSellColorText.PRESETnullnull);         
            }               
        }
            
        return 
    vSMA;
    }

    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