Announcement

Collapse
No announcement yet.

2007 May: Moving Averages: Long On Talk, Short On Action

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

  • 2007 May: Moving Averages: Long On Talk, Short On Action

    File Name: TrongoneMA.efs

    Description:
    This study is based on the May 2007 article, Moving Averages: Long On Talk, Short On Action, by Anthony Trongone, PhD.

    Formula Parameters:
    SMA Periods: 34
    Volume Trigger: 100,000,000
    Lot Size: 1000

    Notes:
    This system is designed for QQQQ only and is a long only system. This study is designed for real time analysis and back testing. Intra-day time template should be set to 09:30-16:00 ET. The related article is copyrighted material. If you are not a subscriber of Stocks & Commodities, please visit www.traders.com.

    Download File:
    TrongoneMA.efs



    EFS Code:
    PHP Code:
    /***************************************
    Provided By : eSignal (c) Copyright 2007
    Description:  Moving Averages: Long On Talk, Short On Action 
                  by Anthony Trongone, PhD

    Version 1.0  3/08/2007

    Notes:
    * May 2007 Issue of Stocks and Commodities Magazine
    * Study requires version 8.0 or later.
    * This system is designed for QQQQ only.
    * This system is a long only system.
    * This study is designed for real time analysis and back testing.
    * Intra-day time template should be set to 09:30-16:00 ET


    Formula Parameters:                     Default:
    SMA Periods                             34
    Volume Trigger                          100,000,000
    Lot Size                                1000
    *************/

    function preMain() {
        
    setPriceStudy(true);
        
    setStudyTitle("Trongone MA ");
        
    setShowTitleParameters(false);
        
    setCursorLabelName("TMA"0);
        
    setCursorLabelName("Yesterday's Vol"1);
        
    setCursorLabelName("Night Session"2);
        
    setDefaultBarFgColor(Color.red0);
        
    setDefaultBarThickness(20);
        

        var 
    fp1 = new FunctionParameter("Periods"FunctionParameter.NUMBER);
            
    fp1.setName("SMA Periods");
            
    fp1.setLowerLimit(1);
            
    fp1.setDefault(34);
        var 
    fp2 = new FunctionParameter("V"FunctionParameter.NUMBER);
            
    fp2.setName("Volume Trigger");
            
    fp2.setLowerLimit(0);
            
    fp2.setDefault(100000000);
        var 
    fp3 = new FunctionParameter("LotSize"FunctionParameter.NUMBER);
            
    fp3.setName("Lot Size");
            
    fp3.setLowerLimit(1);
            
    fp3.setDefault(1000);
    }

    // Global Variables
    var bVersion  null;    // Version flag
    var bInit     false;   // Initialization flag
    var xMA       null;
    var 
    xVol      null;
    var 
    vPosition 0;      // 0 = flat,  1 = long
    var nOpen     null    // open of first bar of the day
    var bBT       true;   // back test flag

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

        
    //Initialization
        
    if (bInit == false) {
            
    xMA sma(Periodsinv("D"));
            
    xVol volume(inv("D"));
            
    bInit true;
        }

        if (
    isLastBarOnChart()) bBT false;
        
        var 
    nState getBarState();
        var 
    nMA    xMA.getValue(0);
        var 
    nVol_1 xVol.getValue(-1);
        var 
    sVol_1 formatVol(nVol_1);
        var 
    nNight open(0inv("D")) - close(-1inv("D"));
        
        if (
    nMA == null || nVol_1 == null || nNight == null) return;

        if (
    nState == BARSTATE_NEWBAR && day(0) != day(-1)) {
            
    nOpen  open(0);
            if (
    nVol_1 && nNight && nOpen nMA) {
                
    vPosition 1;
                
    setBarBgColor(Color.lightgrey);
                
    drawShape(Shape.UPARROWBelowBar1Color.blue);
                
    Alert.playSound("ding.wav");
                
    Alert.addToList(getSymbol(), "TMA Long"Color.blueColor.white);
                if (
    bBTStrategy.doLong("TMA Long"Strategy.MARKETStrategy.THISBARLotSize);
            }
        }

        if (
    vPosition == 1) {
            if (
    isDWM()) {
                if (
    nState == BARSTATE_NEWBAR) {
                    
    vPosition 0;
                    if (
    bBTStrategy.doSell("Close TMA Long"Strategy.CLOSEStrategy.THISBARLotSize);
                }
            } else if (
    day(0) == day(-1)) {
                if (
    day(0) != day(1) && !isLastBarOnChart()) {
                    
    vPosition 0;
                    
    drawShape(Shape.DIAMONDAboveBar1Color.red);
                    if (
    bBTStrategy.doSell("Close TMA Long"Strategy.CLOSEStrategy.THISBARLotSize);
                }
            }
        }
        
        if (
    vPosition == 1setBarBgColor(Color.lightgrey);
        
        return new Array(
    getSeries(xMA), sVol_1nNight.toFixed(2));
    }


    function 
    formatVol(n) {
        if (
    == null) return;
        
        var 
    sNum "";
        var 
    n.toFixed(0);
        var 
    nLen s.length;
        var 
    nCount 0;
        
        for (var 
    nLen>= 0i--) {
            
    nCount++;    
            if (
    nCount && != 0) {
                
    sNum "," s.substr(i1) + sNum;
                
    nCount 1;
            } else {
                
    sNum s.substr(i1) + sNum;
            }
        }
        
        return 
    sNum;
    }


    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