Announcement

Collapse
No announcement yet.

EFS looking for low greater than last low won't work

Collapse
This topic is closed.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • EFS looking for low greater than last low won't work

    When writing a formula for a function to change the color of the watchlist for this simple function : low(inv("D")) > low(inv("D")-1) it will not work. I have written other efs that work on their own, but when adding this variable the efs will not work. Here is a simple example:

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


    //{{EFSWizard_Declarations
    var vLastAlert = -1;
    //}}EFSWizard_Declarations


    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("L>L");
    //}}EFSWizard_PreMain

    }

    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 (
    low(inv("D")) > low(inv("D"), -1)
    ) onAction1();
    //}}EFSWizard_Expression_1

    //}}EFSWizard_Expressions


    //{{EFSWizard_Return
    return null;
    //}}EFSWizard_Return

    }

    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,128,0));
    vLastAlert = 1;
    }
    //}}EFSWizard_Action_1

    //}}EFSWizard_Actions

    Any suggestions would be greatly appreciated!

  • #2
    cosbyva
    The syntax you are using in low(inv("D"), -1) is incorrect
    See this article in the EFS KnowledgeBase for the proper syntax of the function (complete with example)
    Alex


    Originally posted by cosbyva View Post
    When writing a formula for a function to change the color of the watchlist for this simple function : low(inv("D")) > low(inv("D")-1) it will not work. I have written other efs that work on their own, but when adding this variable the efs will not work. Here is a simple example:

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


    //{{EFSWizard_Declarations
    var vLastAlert = -1;
    //}}EFSWizard_Declarations


    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("L>L");
    //}}EFSWizard_PreMain

    }

    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 (
    low(inv("D")) > low(inv("D"), -1)
    ) onAction1();
    //}}EFSWizard_Expression_1

    //}}EFSWizard_Expressions


    //{{EFSWizard_Return
    return null;
    //}}EFSWizard_Return

    }

    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,128,0));
    vLastAlert = 1;
    }
    //}}EFSWizard_Action_1

    //}}EFSWizard_Actions

    Any suggestions would be greatly appreciated!

    Comment


    • #3
      Alex,

      Thanks! It works great now!

      Chris

      Comment


      • #4
        Chris
        You are welcome
        Alex


        Originally posted by cosbyva View Post
        Alex,

        Thanks! It works great now!

        Chris

        Comment

        Working...
        X