Announcement

Collapse
No announcement yet.

RSI21 drops below lowest bollinger 20 band

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

  • RSI21 drops below lowest bollinger 20 band

    I am using the formula wizard and want the background to be green whenever RSI21 drops below lowest bollinger20band.
    What is wrong here?

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


    //{{EFSWizard_Declarations

    var vRSI21 = new RSIStudy(21, "Close");
    var vBollinger20_of_vRSI14 = new BollingerStudy(20, vRSI21, RSIStudy.RSI, 2);
    var vLastAlert = -1;

    //}}EFSWizard_Declarations 16086


    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("bol_u", 1);
    setCursorLabelName("bol_m", 2);
    setCursorLabelName("bol_l", 3);
    setDefaultBarStyle(PS_SOLID, 0);
    setDefaultBarStyle(PS_SOLID, 1);
    setDefaultBarStyle(PS_SOLID, 2);
    setDefaultBarStyle(PS_SOLID, 3);
    setDefaultBarFgColor(Color.lime, 0);
    setDefaultBarFgColor(Color.cyan, 1);
    setDefaultBarFgColor(Color.blue, 2);
    setDefaultBarFgColor(Color.cyan, 3);
    setDefaultBarThickness(2, 0);
    setDefaultBarThickness(1, 1);
    setDefaultBarThickness(1, 2);
    setDefaultBarThickness(1, 3);
    setPlotType(PLOTTYPE_LINE, 0);
    setPlotType(PLOTTYPE_LINE, 1);
    setPlotType(PLOTTYPE_LINE, 2);
    setPlotType(PLOTTYPE_LINE, 3);
    //}}EFSWizard_PreMain 96831

    }

    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 (
    vRSI21.getValue(RSIStudy.RSI) < vBollinger20_of_vRSI14.getValue(BollingerStudy.LOW ER)
    ) onAction1();
    //}}EFSWizard_Expression_1 15679

    //}}EFSWizard_Expressions 26196


    //{{EFSWizard_Return
    return new Array(
    vRSI21.getValue(RSIStudy.RSI),
    vBollinger20_of_vRSI14.getValue(BollingerStudy.UPP ER),
    vBollinger20_of_vRSI14.getValue(BollingerStudy.BAS IS),
    vBollinger20_of_vRSI14.getValue(BollingerStudy.LOW ER)
    );
    //}}EFSWizard_Return 32876

    }

    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() {
    setBarBgColor(Color.RGB(0,255,0));
    vLastAlert = 1;
    }
    //}}EFSWizard_Action_1 10114

    //}}EFSWizard_Actions 19933

  • #2
    RSy
    What do you mean by What is wrong here?
    It appears that the background is being painted when the condition you set is verified (see image)
    Alex

    Comment


    • #3
      I had to unload and reload the formula. It works..
      But I want the formula to plot a green dot at the bottom in the RSI-windows instead.

      I tried with

      drawShapeRelative(0, 10, Shape.CIRCLE, "", Color.RGB(0,255,0), Shape.BOTTOM)

      ...but it did't work.

      RSY

      Comment


      • #4
        RSy
        That is a command that is not yet available in Formula Wizard.
        You can however do it using the Editor as you can see in the attached efs and image.
        Alex

        Attached Files

        Comment


        • #5
          Thanks again Alex.

          I just edited the following line in formulawizard

          drawShapeRelative(0, 10, Shape.CIRCLE, "", Color.RGB(0,255,0), Shape.LEFT

          to

          drawShapeRelative(0, 10, Shape.CIRCLE, "", Color.RGB(0,255,0), Shape.RELATIVETOBOTTOM)

          It works well!

          RSy

          Comment

          Working...
          X