Announcement

Collapse
No announcement yet.

FWguideMACD.efs

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

  • FWguideMACD.efs

    File Name: FWguideMACD.efs


    Description:
    Formula Wizard study of the MACD-Cross example found in the Formula Wizard Guide. The study draws green up arrows when the Signal line crosses above the MACD line and draws red down arrows when the Signal line crosses below the MACD line. The study also plays a sound and populates the Triggered Alert List.

    Formula Parameters:
    None.

    Notes:


    Download File:
    FWguideMACD.efs




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


    //{{EFSWizard_Declarations

    var vMACD12_26 = new MACDStudy(12269"Close"false);
    var 
    vLastAlert = -1;

    //}}EFSWizard_Declarations 9531


    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("FWguide MACD");
    //}}EFSWizard_PreMain 7243

    }

    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 (
                
    vMACD12_26.getValue(MACDStudy.SIGNAL) < vMACD12_26.getValue(MACDStudy.MACD)
            ) 
    onAction1()
        
    //}}EFSWizard_Expression_1 13258
        
        //{{EFSWizard_Expression_2
            
    else if (
                
    vMACD12_26.getValue(MACDStudy.SIGNAL) >= vMACD12_26.getValue(MACDStudy.MACD)
            ) 
    onAction2();
        
    //}}EFSWizard_Expression_2 15545
        
    //}}EFSWizard_Expressions 48926


    //{{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() {
            if (
    vLastAlert != 1Alert.addToList(getSymbol(), "MACD Signal Cross Down"Color.RGB(0,0,0), Color.RGB(195,0,0));
            if (
    vLastAlert != 1Alert.playSound("C:\\Program Files\\eSignal\\Sounds\\Ding.wav");
            if (
    vLastAlert != 1drawShapeRelative(0high(), Shape.DOWNARROW""Color.RGB(155,0,0), Shape.BOTTOM);
            
    vLastAlert 1;
        }
        
    //}}EFSWizard_Action_1 43572
        
        //{{EFSWizard_Action_2
        
    function onAction2() {
            if (
    vLastAlert != 2Alert.addToList(getSymbol(), "MACD Signal Cross UP"Color.RGB(0,0,0), Color.RGB(0,255,0));
            if (
    vLastAlert != 2Alert.playSound("C:\\Program Files\\eSignal\\Sounds\\Boing.wav");
            if (
    vLastAlert != 2drawShapeRelative(0low(), Shape.UPARROW""Color.RGB(0,255,0), Shape.TOP);
            
    vLastAlert 2;
        }
        
    //}}EFSWizard_Action_2 43694
        
    //}}EFSWizard_Actions 108619 
    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