Announcement

Collapse
No announcement yet.

Simple MA Study

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

  • Simple MA Study

    I'm trying to plot two lines in their own window below the price bars that represent the difference between the current bar's high and a 6 period simple moving average of the close and the second line represents the diference between the current bar's low and the same 6 period simple moving average of the closes.

    I don't know why the attached (also printed below) code is not working and would appreciate any help.

    Thanks,


    Mark

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


    //{{EFSWizard_Declarations

    var vSMA6 = new MAStudy(6, 0, "Close", MAStudy.SIMPLE);

    //}}EFSWizard_Declarations 9279


    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("MA Scalp");
    setCursorLabelName("h6", 0);
    setCursorLabelName("l6", 1);
    setDefaultBarStyle(PS_SOLID, 0);
    setDefaultBarStyle(PS_SOLID, 1);
    setDefaultBarFgColor(Color.darkgreen, 0);
    setDefaultBarFgColor(Color.red, 1);
    setDefaultBarThickness(1, 0);
    setDefaultBarThickness(1, 1);
    setPlotType(PLOTTYPE_LINE, 0);
    setPlotType(PLOTTYPE_LINE, 1);
    //}}EFSWizard_PreMain 50135

    }

    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 0

    //}}EFSWizard_Expressions 9063


    //{{EFSWizard_Return
    return new Array(
    high()-vSMA6,
    low()-vSMA6
    );
    //}}EFSWizard_Return 8407

    }
    Attached Files

  • #2
    geronimo
    Try the attached
    Alex
    Attached Files

    Comment

    Working...
    X