Announcement

Collapse
No announcement yet.

ACC/DIST MA

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • ACC/DIST MA

    Could someone help me with this formula?
    I'm tring to use the Accumulation/Distribution with a 10 EMA.
    All I get is the ACC/DIST but NO MA
    Thanks for your time...Greg

    Formula Configuration"ACC/DIST MA", a non-price study, returns 2 data points for each bar. edit
    Studies Used

    variable name study
    vAccDist AccDistStudy() edit X
    vEMA10 MAStudy(10, 0, "Close", MAStudy.EXPONENTIAL) edit X
    add study
    Set 1Set 2 X+

    If these conditions are all true:
    add line... then the following will happen everytime:
    add line... while the following will happen only the first time:
    add lineReturned Data Points
    This study will plot 2 data points edit for each bar:
    ACC/DIST edit
    MA edit
    check EFS syntax
    Generated EFS Code

    //{{EFSWizard_Description
    //
    // This formula was generated by the Alert Wizard
    //
    //}}EFSWizard_Description


    //{{EFSWizard_Declarations
    var vAccDist = new AccDistStudy();
    var vEMA10 = new MAStudy(10, 0, "Close", MAStudy.EXPONENTIAL);
    var vLastAlert = -1;
    //}}EFSWizard_Declarations


    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(false);
    setStudyTitle("ACC/DIST MA");
    setCursorLabelName("ACC/DIST ", 0);
    setCursorLabelName("MA", 1);
    setDefaultBarStyle(PS_SOLID, 0);
    setDefaultBarStyle(PS_SOLID, 1);
    setDefaultBarFgColor(Color.blue, 0);
    setDefaultBarFgColor(Color.red, 1);
    setDefaultBarThickness(2, 0);
    setDefaultBarThickness(2, 1);
    setPlotType(PLOTTYPE_LINE, 0);
    setPlotType(PLOTTYPE_LINE, 1);
    //}}EFSWizard_PreMain

    }

    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
    //}}EFSWizard_Expression_1

    //}}EFSWizard_Expressions


    //{{EFSWizard_Return
    return new Array(
    close(),
    vEMA10.getValue(MAStudy.MA, 0, 10)
    );
    //}}EFSWizard_Return

    }

    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() {
    vLastAlert = 1;
    }
    //}}EFSWizard_Action_1

    //}}EFSWizard_Actions

  • #2
    Greg
    The first thing you need to do is edit the moving average study and base it on the AccDist Study as shown in the following image instead of on the Close



    For information on how to use the Formula Wizard see this article in the EFS KnowledgeBase. At the end of that article you will also find a link to another article showing how to create a Study on Study using the Formula Wizard.
    You may also want to see this thread which contains an animated image showing how to create a moving average of a study in the Formula Wizard.
    The next thing you need to do is to change the Returned Data Points. In the first one you are returning the Close instead of the AccDist Study. In the second one you are returning an array of the moving average instead of a single value. This is because you inserted 10 in the numBars field which should instead be 1 (see image enclosed below)
    Once you implement these changes your study should work fine
    Alex

    Comment

    Working...
    X