Announcement

Collapse
No announcement yet.

ROC of MACD

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

  • ROC of MACD

    following Alexis instruction I generate as study of ROC of MACD, it "look" some what like an example he given but it plot no lines, help

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


    //{{EFSWizard_Declarations

    var vROC13 = new ROCStudy(13, "Close");
    var vMACD12_26 = new MACDStudy(12, 26, 9, vROC13, ROCStudy.ROC, false);
    var vLastAlert = -1;

    //}}EFSWizard_Declarations 17551


    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("ROC13");
    setCursorLabelName("vROC13", 0);
    setDefaultBarStyle(PS_SOLID, 0);
    setDefaultBarFgColor(Color.red, 0);
    setDefaultBarThickness(1, 0);
    setPlotType(PLOTTYPE_LINE, 0);
    //}}EFSWizard_PreMain 31762

    }

    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 ;
    //}}EFSWizard_Return 1661

    }

    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 5589

    //{{EFSWizard_Action_2
    function onAction2() {
    vLastAlert = 2;
    }
    //}}EFSWizard_Action_2 5582

    //}}EFSWizard_Actions 31632

  • #2
    nkhoi
    That is because you have nothing in the return;
    To add the plots look in the Returned Data Points section in the Formula Wizard. That is where you define what plots you want on the chart Also, in looking at the script you posted it appears that you set the efs to plot only one line.
    Alex

    Comment


    • #3
      I did some futher change using wizar and I get 2 lines, the idea is ploting ROC with setting 13 , then plotting MACD 8,13,1 of that ROC, am I close? but I still can't change the variable except going back and messing around with coding values!

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


      //{{EFSWizard_Declarations

      var vROC13 = new ROCStudy(13, "Close");
      var vMACD12_26 = new MACDStudy(12, 26, 9, vROC13, ROCStudy.ROC, false);
      var vLastAlert = -1;

      //}}EFSWizard_Declarations 17551


      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("ROC13");
      setCursorLabelName("vROC13", 0);
      setCursorLabelName("vROC13", 1);
      setDefaultBarStyle(PS_SOLID, 0);
      setDefaultBarStyle(PS_SOLID, 1);
      setDefaultBarFgColor(Color.red, 0);
      setDefaultBarFgColor(Color.blue, 1);
      setDefaultBarThickness(1, 0);
      setDefaultBarThickness(1, 1);
      setPlotType(PLOTTYPE_LINE, 0);
      setPlotType(PLOTTYPE_LINE, 1);
      //}}EFSWizard_PreMain 53965

      }

      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(
      vROC13.getValue(ROCStudy.ROC),
      vMACD12_26.getValue(MACDStudy.MACD)
      );
      //}}EFSWizard_Return 12889

      }

      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 5589

      //{{EFSWizard_Action_2
      function onAction2() {
      vLastAlert = 2;
      }
      //}}EFSWizard_Action_2 5582

      //}}EFSWizard_Actions 31632

      Comment


      • #4
        nkhoi
        By what I can see the efs appears to be set up correctly. You will now need to modify the parameters for the MACD to 8,13,1 which has to be done using the Formula Wizard
        At this time EFSs created with the Formula Wizard do not have adjustable variables such as those in the MACDofROC.efs I posted in the other thread,
        However now that you have the script laid out with the Formula Wizard modifying it to add that functionality should not be too complex. Compare this efs to the one I posted and you should see what changes would be required.
        Alex

        Comment

        Working...
        X