Announcement

Collapse
No announcement yet.

Simple EFS

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

  • Simple EFS

    Hello,

    I am looking for a simple 3 bar (ohlc/4) WMA that will plot itself red when its value is less than 1 bar befoure and green when its more.

  • #2
    done with the FormulaWizard...

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


    //{{EFSWizard_Declarations

    var vWMA3_of_OHLC4 = new MAStudy(3, 0, "OHLC/4", MAStudy.WEIGHTED);
    var vLastAlert = -1;

    //}}EFSWizard_Declarations 11576


    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("3barWMA");
    setCursorLabelName("up", 0);
    setCursorLabelName("down", 1);
    setDefaultBarStyle(PS_SOLID, 0);
    setDefaultBarStyle(PS_SOLID, 1);
    setDefaultBarFgColor(Color.green, 0);
    setDefaultBarFgColor(Color.red, 1);
    setDefaultBarThickness(1, 0);
    setDefaultBarThickness(1, 1);
    setPlotType(PLOTTYPE_LINE, 0);
    setPlotType(PLOTTYPE_LINE, 1);
    //}}EFSWizard_PreMain 52315

    }

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

    //{{EFSWizard_Expression_2
    else if (
    vWMA3_of_OHLC4.getValue(MAStudy.MA) >= vWMA3_of_OHLC4.getValue(MAStudy.MA)
    ) onAction2();
    //}}EFSWizard_Expression_2 15420

    //}}EFSWizard_Expressions 50021


    //{{EFSWizard_Return
    return (
    vWMA3_of_OHLC4.getValue(MAStudy.MA)
    );
    //}}EFSWizard_Return 12735

    }

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

    //{{EFSWizard_Action_2
    function onAction2() {
    setPriceBarColor(Color.RGB(0,255,0));
    vLastAlert = 2;
    }
    //}}EFSWizard_Action_2 10379

    //}}EFSWizard_Actions 41451

    Comment


    • #3
      Thank you for your help dloomis , but unfortunately the WMA does not change the color it is permanently green. Maybe because i am still using eSignal 7.1 ?

      Comment


      • #4
        the ma doesnt change color, the bars change color

        Comment


        • #5
          Nope
          Sorry neither do bars

          Comment


          • #6
            on the main menu bar, under Tools, do you have Formula wizard?

            If not, v7.2 should be in your future from esignal.com/download

            Comment


            • #7
              Thank you D Loomis
              I thought it was not working for the reason that i have a eSignal 7.1. Unfortunatelly i wont be able to download 7.2 for a while.

              Comment


              • #8
                Actually dloomis, check Set #2:

                PHP Code:
                vWMA3_of_OHLC4.getValue(MAStudy.MA) >= vWMA3_of_OHLC4.getValue(MAStudy.MA
                Should read:

                PHP Code:
                vWMA3_of_OHLC4.getValue(MAStudy.MA) >= vWMA3_of_OHLC4.getValue(MAStudy.MA, -1
                Formula Wizard generated code will work in v7.1 and v7.0 (as long as you're not using any functions that didn't exist back then of course).

                Comment


                • #9
                  Dion -

                  the formula wizard inserted OHLC/4 which had to be edited manulaly to OHLC4

                  the slash was a problem.

                  Comment


                  • #10
                    I replaced the line in the code, but still the WMA gets plotted in green and the bars stay as they were

                    Comment

                    Working...
                    X