Announcement

Collapse
No announcement yet.

Something wrong when plotting dots in set 3?

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

  • Something wrong when plotting dots in set 3?

    I am using the formula wizard to plot dots at xy = 0 , 30
    Set 1 and 2 are plotting dots, but not set 3. Why?

    Heres the EFS:



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


    //{{EFSWizard_Declarations

    var vRSI30 = new RSIStudy(30, "Close");
    var vBollinger50_of_vRSI30 = new BollingerStudy(50, vRSI30, RSIStudy.RSI, 2, 5);
    var vSMA20_of_vBollinger50_of_vRSI30 = new MAStudy(20, 0, vBollinger50_of_vRSI30, BollingerStudy.UPPER, MAStudy.SIMPLE);
    var vSMA5_of_vRSI30 = new MAStudy(5, 0, vRSI30, RSIStudy.RSI, MAStudy.SIMPLE);
    var vSMA30_of_vSMA5_of_vRSI30 = new MAStudy(30, 0, vSMA5_of_vRSI30, MAStudy.MA, MAStudy.SIMPLE);
    var vLastAlert = -1;

    //}}EFSWizard_Declarations 55522


    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("");
    setCursorLabelName("rsi", 0);
    setCursorLabelName("ma1", 1);
    setCursorLabelName("ma2", 2);
    setCursorLabelName("bolu", 3);
    setCursorLabelName("bolb", 4);
    setCursorLabelName("boll", 5);
    setCursorLabelName("bolma", 6);
    setDefaultBarStyle(PS_SOLID, 0);
    setDefaultBarStyle(PS_SOLID, 1);
    setDefaultBarStyle(PS_SOLID, 2);
    setDefaultBarStyle(PS_SOLID, 3);
    setDefaultBarStyle(PS_SOLID, 4);
    setDefaultBarStyle(PS_SOLID, 5);
    setDefaultBarStyle(PS_SOLID, 6);
    setDefaultBarFgColor(Color.red, 0);
    setDefaultBarFgColor(Color.lime, 1);
    setDefaultBarFgColor(Color.lime, 2);
    setDefaultBarFgColor(Color.cyan, 3);
    setDefaultBarFgColor(Color.blue, 4);
    setDefaultBarFgColor(Color.cyan, 5);
    setDefaultBarFgColor(Color.red, 6);
    setDefaultBarThickness(2, 0);
    setDefaultBarThickness(1, 1);
    setDefaultBarThickness(2, 2);
    setDefaultBarThickness(1, 3);
    setDefaultBarThickness(1, 4);
    setDefaultBarThickness(1, 5);
    setDefaultBarThickness(1, 6);
    setPlotType(PLOTTYPE_LINE, 0);
    setPlotType(PLOTTYPE_LINE, 1);
    setPlotType(PLOTTYPE_LINE, 2);
    setPlotType(PLOTTYPE_LINE, 3);
    setPlotType(PLOTTYPE_LINE, 4);
    setPlotType(PLOTTYPE_LINE, 5);
    setPlotType(PLOTTYPE_LINE, 6);
    //}}EFSWizard_PreMain 165156

    }

    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 (
    vSMA30_of_vSMA5_of_vRSI30.getValue(MAStudy.MA) > vSMA30_of_vSMA5_of_vRSI30.getValue(MAStudy.MA, -1)
    ) onAction1()
    //}}EFSWizard_Expression_1 16309

    //{{EFSWizard_Expression_2
    else if (
    vSMA30_of_vSMA5_of_vRSI30.getValue(MAStudy.MA) < vSMA30_of_vSMA5_of_vRSI30.getValue(MAStudy.MA, -1)
    ) onAction2()
    //}}EFSWizard_Expression_2 18041

    //{{EFSWizard_Expression_3
    else if (
    vBollinger50_of_vRSI30.getValue(BollingerStudy.UPP ER) < vSMA20_of_vBollinger50_of_vRSI30.getValue(MAStudy. MA)
    ) onAction3();
    //}}EFSWizard_Expression_3 21834

    //}}EFSWizard_Expressions 83020


    //{{EFSWizard_Return
    return new Array(
    vRSI30.getValue(RSIStudy.RSI),
    vSMA5_of_vRSI30.getValue(MAStudy.MA),
    vSMA30_of_vSMA5_of_vRSI30.getValue(MAStudy.MA),
    vBollinger50_of_vRSI30.getValue(BollingerStudy.UPP ER),
    vBollinger50_of_vRSI30.getValue(BollingerStudy.BAS IS),
    vBollinger50_of_vRSI30.getValue(BollingerStudy.LOW ER),
    vSMA20_of_vBollinger50_of_vRSI30.getValue(MAStudy. MA)
    );
    //}}EFSWizard_Return 53289

    }

    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() {
    drawShapeRelative(0, 10, Shape.CIRCLE, "", Color.RGB(0,255,0), Shape.RELATIVETOBOTTOM);
    vLastAlert = 1;
    }
    //}}EFSWizard_Action_1 16240

    //{{EFSWizard_Action_2
    function onAction2() {
    drawShapeRelative(0, 20, Shape.CIRCLE, "", Color.RGB(255,0,0), Shape.RELATIVETOBOTTOM);
    vLastAlert = 2;
    }
    //}}EFSWizard_Action_2 17523

    //{{EFSWizard_Action_3
    function onAction3() {
    drawShapeRelative(0, 30, Shape.CIRCLE, "", Color.RGB(0,255,0), Shape.RELATIVETOBOTTOM);
    vLastAlert = 3;
    }
    //}}EFSWizard_Action_3 18021

    //}}EFSWizard_Actions 85699

  • #2
    Could anyone please help me with this one?

    RSy

    Comment


    • #3
      RSy
      For some reason the conditions have to be written differently and it has to be done in Editor not the Formula Wizard.
      I believe the efs now does what you want
      Alex

      Attached Files

      Comment


      • #4
        Thank you agint Alex. Exactly what are changed?

        RSy

        Comment


        • #5
          RSy
          I changed the else if to if in the section shown below and closed each condition.
          Alex

          //{{EFSWizard_Expressions
          //{{EFSWizard_Expression_1
          if (
          vSMA30_of_vSMA5_of_vRSI30.getValue(MAStudy.MA) > vSMA30_of_vSMA5_of_vRSI30.getValue(MAStudy.MA, -1)
          ) onAction1()
          //}}EFSWizard_Expression_1 16309

          //{{EFSWizard_Expression_2
          else if (
          vSMA30_of_vSMA5_of_vRSI30.getValue(MAStudy.MA) < vSMA30_of_vSMA5_of_vRSI30.getValue(MAStudy.MA, -1)
          ) onAction2()
          //}}EFSWizard_Expression_2 18041

          //{{EFSWizard_Expression_3
          else if (
          vBollinger50_of_vRSI30.getValue(BollingerStudy.UPP ER) < vSMA20_of_vBollinger50_of_vRSI30.getValue(MAStudy. MA)
          ) onAction3();
          //}}EFSWizard_Expression_3 21834


          has been changed to the following

          //{{EFSWizard_Expressions
          //{{EFSWizard_Expression_1
          if (
          vSMA30_of_vSMA5_of_vRSI30.getValue(MAStudy.MA) > vSMA30_of_vSMA5_of_vRSI30.getValue(MAStudy.MA, -1)
          ) onAction1();
          //}}EFSWizard_Expression_1 16309

          //{{EFSWizard_Expression_2
          if (
          vSMA30_of_vSMA5_of_vRSI30.getValue(MAStudy.MA) < vSMA30_of_vSMA5_of_vRSI30.getValue(MAStudy.MA, -1)
          ) onAction2();
          //}}EFSWizard_Expression_2 18041

          //{{EFSWizard_Expression_3
          if (
          vBollinger50_of_vRSI30.getValue(BollingerStudy.UPP ER) < vSMA20_of_vBollinger50_of_vRSI30.getValue(MAStudy. MA)
          ) onAction3();
          //}}EFSWizard_Expression_3 21834

          Comment


          • #6
            Ohh, I see.
            I start learning EFSs for a week ago, and I think I'm doing fine.
            I have bought the Jurik Tools andf made some EFS that I am using. This is really fun.

            But I need some tips for good strategies for backtesting.

            RSy

            Comment

            Working...
            X