Announcement

Collapse
No announcement yet.

2007 Apr: Another Look at the Election Cycle

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

  • 2007 Apr: Another Look at the Election Cycle

    File Name: ElectionomicsTrader.efs

    Description:
    This study is based on the April 2007 article, Another Look at the Election Cycle, by Matt Blackman.

    Formula Parameters:
    NA


    Notes:
    The study requires a daily chart interval and eSignal version 8.0 or later. This system is a long only system and is enabled for Back Testing. The background of the chart is colored green when a long position is in force. The related article is copyrighted material. If you are not a subscriber of Active Trader Magazine, please visit www.activetradermag.com.


    Download File:
    ElectionomicsTrader.efs



    EFS Code:
    PHP Code:
    /***************************************
    Provided By : eSignal (c) Copyright 2007
    Description:  Electionomics Trader 


    Version 1.0  11/10/2006

    Notes:
    * Apr 2007 Issue of Active Trader Magazine
    * Study requires version 8.0 or later.
    * Study requires a Daily chart interval.
    * Study is enabled for back testing.


    Formula Parameters:                     Default:
    N/A
    *****************************************************************/

    function preMain() {
        
    setPriceStudy(true);
        
    setStudyTitle("Electionomics Trader ");
        
    setShowCursorLabel(false);
        
    setShowTitleParameters(false);    
    }

    // Global Variables
    var bVersion  null;    // Version flag
    var bInit     false;   // Initialization flag

    var aEyear = new Array();



    function 
    main() {
        if (
    bVersion == nullbVersion verify();
        if (
    bVersion == false) return;    

        if (
    isDaily() == false) {
            
    setStudyTitle(" !!!! Electionomics Trader study requires a Daily chart interval. !!!!!");
            return;
        }
        
        var 
    nState getBarState();
        var 
    nBarYear year(0);
        var 
    sBarYear nBarYear.toString();
        var 
    nBarMonth month(0);
        var 
    nBarDay day(0);
        var 
    bEyear false;
        
        
    //Initialization
        
    if (bInit == false) {
            var 
    xDate = new Date();
            var 
    nYear xDate.getFullYear();
            var 
    nNum 1900;
            var 
    0;
            while (
    nNum nYear) {
                
    aEyear[i] = nNum;
                
    i++;
                
    nNum += 4;
            }
            
    bInit true;
        }
        
        
        
    // buy
        
    if (Strategy.isInTrade() == false) { 
            var 
    sChar sBarYear.charAt(3);
            if (
    isEyear(nBarYear) == false && (sChar == || sChar == || sChar == ||
                
    sChar == || sChar == 6) && nBarMonth == && nBarDay >= 20) {
                
    Strategy.doLong("Buy"Strategy.CLOSEStrategy.THISBAR);
                
    setBarBgColor(Color.green0);
            }
        
    // sell
        
    } else if (isEyear(nBarYear) == true && nBarMonth == 11 &&
                
    nBarDay >= 20) {   
            
    Strategy.doSell("Sell"Strategy.CLOSEStrategy.THISBAR);
            
    setBarBgColor(Color.red0);
        }
        
        if (
    Strategy.isInTrade() == true) {
            
    setBarBgColor(Color.green0);
        }
        
        return ;
    }


    function 
    isEyear(nY) {
        var 
    false;
        for (var 
    0aEyear.lengthi++) {
            if (
    aEyear[i] == nY) {
                
    true;
                
    aEyear.length;
            }
        }
        return 
    b;
    }

    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;

    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