Announcement

Collapse
No announcement yet.

Adding text to watchlist

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

  • Adding text to watchlist

    I've written a very simple efs to start and want it to return text in addition to changing the bar background color. I can get the bar backgound color to change when all the efs conditions are true but cannot get any text to appear. For example, would like to get a green background and white text to appear when the conditions are true. Any help or advice would be appreciated! Posting the efs script below:

    Thanks, in advance,

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


    //{{EFSWizard_Declarations
    var vStoch8_3 = new StochStudy(8, 3, 3);
    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(false);
    setStudyTitle("Daily Stoch");
    //}}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 (
    vStoch8_3.getValue(StochStudy.FAST) > vStoch8_3.getValue(StochStudy.SLOW)
    ) 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

  • #2
    cosbyva
    If you search the forums for the keywords efs AND watch list you will find several complete examples on how to do this
    Alex


    Originally posted by cosbyva View Post
    I've written a very simple efs to start and want it to return text in addition to changing the bar background color. I can get the bar backgound color to change when all the efs conditions are true but cannot get any text to appear. For example, would like to get a green background and white text to appear when the conditions are true. Any help or advice would be appreciated! Posting the efs script below:

    Thanks, in advance,

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


    //{{EFSWizard_Declarations
    var vStoch8_3 = new StochStudy(8, 3, 3);
    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(false);
    setStudyTitle("Daily Stoch");
    //}}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 (
    vStoch8_3.getValue(StochStudy.FAST) > vStoch8_3.getValue(StochStudy.SLOW)
    ) 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

    Comment

    Working...
    X