Announcement

Collapse
No announcement yet.

FWguide3BarBrkOut.efs

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

  • FWguide3BarBrkOut.efs

    File Name: FWguide3BarBrkOut.efs


    Description:
    Formula Wizard study of the Three Bar Break Out System example found in the Formula Wizard Guide. This back testing study is a trading system that takes a long position when the close goes above the previous 3 period’s highest high and goes short when the close goes below the previous 3 period’s lowest low. The price bars are colored green at long entry and red at short entry.

    Formula Parameters:
    None.

    Notes:
    This formula is a back testing formula to be used in conjunction with the Strategy Analyzer. It is not intended for real time analysis.

    Download File:
    FWguide3BarBrkOut.efs




    EFS Code:
    PHP Code:
    //{{EFSWizard_Description
    //
    //    This formula was generated by the Alert Wizard
    //
    //}}EFSWizard_Description 7532


    //{{EFSWizard_Declarations

    var vLastAlert = -1;

    //}}EFSWizard_Declarations 2482


    function preMain() {
    //{{EFSWizard_Code_PreMain_setPriceBarColor
    setColorPriceBars(true);
    //}}EFSWizard_Code_PreMain_setPriceBarColor 3448
       /**
        *  This function is called only once, before any of the bars are loaded.
        *  Place any study or EFS configuration commands here.
        */
    //{{EFSWizard_PreMain
        
    setPriceStudy(true);
        
    setStudyTitle("Three Bar Breakout System");
    //}}EFSWizard_PreMain 8625

    }

    function 
    main() {
       
    /**
        *  The main() function is called once per bar on all previous bars, once per
        *  each incoming completed bar, and if you don't have 'setComputeOnClose(true)'
        *  in your preMain(), it is also called on every tick.
        */

    //{{EFSWizard_Expressions
        //{{EFSWizard_Expression_1
            
    if (
                
    Strategy.isLong() == false &&
                
    close() > high(-1) &&
                
    close() > high(-2) &&
                
    close() > high(-3)
            ) 
    onAction1()
        
    //}}EFSWizard_Expression_1 18471
        
        //{{EFSWizard_Expression_2
            
    else if (
                
    Strategy.isShort() == false &&
                
    close() < low(-1) &&
                
    close() < low(-2) &&
                
    close() < low(-3)
            ) 
    onAction2();
        
    //}}EFSWizard_Expression_2 20408
        
    //}}EFSWizard_Expressions 60799


    //{{EFSWizard_Return
        
    return null;
    //}}EFSWizard_Return 2256

    }

    function 
    postMain() {
       
    /**
        *  The postMain() function is called only once, when the EFS is no longer used for
        *  the current symbol (ie, symbol change, chart closing, or application shutdown).
        */
    }

    //{{EFSWizard_Actions
        //{{EFSWizard_Action_1
        
    function onAction1() {
            
    setPriceBarColor(Color.RGB(0,128,0));
            if (
    vLastAlert != 1Strategy.doLong(""Strategy.CLOSEStrategy.THISBARStrategy.DEFAULT, 0);
            if (
    vLastAlert != 1Strategy.setStop(low()-.25);
            
    vLastAlert 1;
        }
        
    //}}EFSWizard_Action_1 29958
        
        //{{EFSWizard_Action_2
        
    function onAction2() {
            
    setPriceBarColor(Color.RGB(155,0,0));
            if (
    vLastAlert != 2Strategy.doShort(""Strategy.CLOSEStrategy.THISBARStrategy.DEFAULT, 0);
            if (
    vLastAlert != 2Strategy.setStop(high()+.25);
            
    vLastAlert 2;
        }
        
    //}}EFSWizard_Action_2 30545
        
    //}}EFSWizard_Actions 81561 
    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