Announcement

Collapse
No announcement yet.

FWguideMAandPrice.efs

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

  • FWguideMAandPrice.efs

    File Name: FWguideMAandPrice.efs


    Description:
    Formula Wizard study based on the introductory example found in the Formula Wizard Guide. The study colors the price bars green when the price crosses above a 10 period moving average and red when the price crosses below.

    Formula Parameters:
    None.

    Notes:


    Download File:
    FWguideMAandPrice.efs




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


    //{{EFSWizard_Declarations

    var vEMA10 = new MAStudy(100"Close"MAStudy.EXPONENTIAL);
    var 
    vLastAlert = -1;

    //}}EFSWizard_Declarations 9951


    function preMain() {
       
    /**
        *  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("FWguide1");
        
    setCursorLabelName("myData"0);
        
    setDefaultBarStyle(PS_SOLID0);
        
    setDefaultBarFgColor(Color.red0);
        
    setDefaultBarThickness(10);
        
    setPlotType(PLOTTYPE_LINE0);
    //}}EFSWizard_PreMain 30109

    }

    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 (
                
    close() < vEMA10.getValue(MAStudy.MA)
            ) 
    onAction1()
        
    //}}EFSWizard_Expression_1 8977
        
        //{{EFSWizard_Expression_2
            
    else if (
                
    close() >= vEMA10.getValue(MAStudy.MA)
            ) 
    onAction2();
        
    //}}EFSWizard_Expression_2 10569
        
    //}}EFSWizard_Expressions 41214


    //{{EFSWizard_Return
        
    return vEMA10.getValue(MAStudy.MA);
    //}}EFSWizard_Return 4922

    }

    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(155,0,0));
            
    vLastAlert 1;
        }
        
    //}}EFSWizard_Action_1 10013
        
        //{{EFSWizard_Action_2
        
    function onAction2() {
            
    setPriceBarColor(Color.RGB(0,255,0));
            
    vLastAlert 2;
        }
        
    //}}EFSWizard_Action_2 10379
        
    //}}EFSWizard_Actions 40497 
    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