Announcement

Collapse
No announcement yet.

Alert for Trix Indicator

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

  • Alert for Trix Indicator

    I am trying to add an alert to the TRIX indicator so there will be an audio alert, an up or down arrow, and a pop up every time it crosses the zero line. I tried to go into the efs wizard but the wizard gives me a message that it does not recognize the study. How can i get the alert added? Any help is appreciated.
    Attached Files

  • #2
    Re: Alert for Trix Indicator

    ericy99
    The Formula Wizard can only read formulas that were written using the Formula Wizard. For all other scripts you need to use the EFS Editor
    The following section of code [which includes comments explaining what it does] will do what you are trying to accomplish. Copy and Paste it after line 128 of the script then save the formula with a new name
    Alex

    PHP Code:
    //check that we have at least 12 bars (ie the Length + 3 bars for the conditions) 
       
    if(getCurrentBarCount()>=12){
           
    //retrieve the values of the indicator at the prior bar and two bars back and
           //assign these to the variable myRez1 and myRez2 
           
    var myRez ref(-1,-2);//this creates a two dimensional array of the returned items
           
    var myRez1 myRez[0][0];//value of Rez at the prior bar
           
    var myRez2 myRez[1][0];//value of Rez two bars ago
       
    }
       
    //now set your conditions to be evaluated at every first tick of a new bar
       
    if(getBarState()==BARSTATE_NEWBAR){//if at every first tick of a new bar
           
    if(myRez2>&& myRez1<0){//if the indicator was above 0 two bars back and is below 0 on the prior bar
               
    Alert.playSound("ding.wav");//play a sound
               
    Alert.addToList(getSymbol(),"Crossing under",Color.black,Color.red);//trigger a popup
               
    drawShapeRelative(-1,myRez2,Shape.DOWNARROW,null,Color.red,null,"DN"+rawtime(0));//draw an arrow
           
    }
           if(
    myRez2<&& myRez1>0){//if the indicator was below 0 two bars back and is above 0 on the prior bar
               
    Alert.playSound("ding.wav");//play a sound
               
    Alert.addToList(getSymbol(),"Crossing over",Color.black,Color.blue);//trigger a popup
               
    drawShapeRelative(-1,myRez2,Shape.UPARROW,null,Color.blue,null,"UP"+rawtime(0));//draw an arrow
           
    }
       } 




    Originally posted by ericy99
    I am trying to add an alert to the TRIX indicator so there will be an audio alert, an up or down arrow, and a pop up every time it crosses the zero line. I tried to go into the efs wizard but the wizard gives me a message that it does not recognize the study. How can i get the alert added? Any help is appreciated.

    Comment


    • #3
      Ok that works perfectly. Much thanks!!

      Comment


      • #4
        ericy99
        You are most welcome
        Alex


        Originally posted by ericy99
        Ok that works perfectly. Much thanks!!

        Comment

        Working...
        X