Announcement

Collapse
No announcement yet.

Flashing drawtextrelative

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

  • Flashing drawtextrelative

    Hi,
    i have tried to change the mybgColor every tick White/red. but nothing happened. Do you know, what`s wrong?


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


    //{{EFSWizard_Declarations
    var vLastAlert = -1;
    var mybgColor = Color.white;

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

    }

    function main() {

    mybgColor = Color.white;

    /**
    * 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 (
    adx(14, 14) > 30

    ) onAction1()
    //}}EFSWizard_Expression_1

    //{{EFSWizard_Expression_2
    else if (
    adx(14, 14) <= 30
    ) onAction2();
    //}}EFSWizard_Expression_2

    //}}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() {
    mybgColor = Color.red
    drawTextRelative(-123, low(), "ALERT", Color.RGB(0,0,0), mybgColor , Text.LEFT, "Arial", 193, "N");
    vLastAlert = 1;
    }
    //}}EFSWizard_Action_1

    //{{EFSWizard_Action_2
    function onAction2() {
    drawTextRelative(-10, low(), "OK", Color.RGB(192,220,192), Color.RGB(0,255,0), Text.LEFT, "Arial", 16, "N");
    vLastAlert = 2;
    }
    //}}EFSWizard_Action_2

    //}}EFSWizard_Actions

  • #2
    Bugeleisen
    Try using the solution Jason provided to you in this thread
    Alex

    Comment

    Working...
    X