Announcement

Collapse
No announcement yet.

Triggered Alert Request

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

  • Triggered Alert Request

    Hello members,

    I have been trying to get an alert to appear in the triggered alert box only when a certain condition appears.

    In this case I just want an alert when a bar turns green. However, the alert occurs everytime the price changes.

    Can someone please help

    function preMain(){

    setStudyTitle("MFIcolors");
    setCursorLabelName("MFI", 0);
    setPlotType(PLOTTYPE_HISTOGRAM);
    }

    var color=0
    var MFIold=0;
    var sMyVol="Volume";
    var MFI=0;

    function main(){
    if(getBarState()==BARSTATE_NEWBAR)
    MFIold=MFI
    var MyVol = "Volume";
    if (sMyVol != null) MyVol = sMyVol;
    var Range = high(0) - low(0);
    var Vol = getValue(MyVol,0);
    //var MFI = 0.0;
    if (Vol > 0) MFI = Range / Vol * 1000000000;
    else MFI = 0;

    debugPrintln(MFI+" "+MFIold)

    if(MFI>MFIold && volume()>volume(-1))
    setBarFgColor(Color.green)
    Alert.addToList( "IBM", "Breakout!", Color.green, Color.black );
    if(MFI<MFIold && volume()<volume(-1))
    setBarFgColor(Color.brown)
    if(MFI>MFIold && volume()<volume(-1))
    setBarFgColor(Color.blue)
    if(MFI<MFIold && volume()>volume(-1))
    setBarFgColor(Color.red)


    return MFI;
    }
    function test() {
    if(MFI>MFIold && volume()>volume(-1)){
    Alert.addToList( "IBM", "Breakout!", Color.green, Color.black );
    }

    }



    Cheers

    Carlton

  • #2
    OK,

    I think all I need help with is to get an alert when the bar turns green.

    if(MFI>MFIold && volume()>volume(-1))
    setBarFgColor(Color.green)
    Alert.addToList("AA", "hello", Color.blue, Color.green);
    debugPrintln("hello");

    At the moment, I get an alert everytime the volume changes

    Appreciate your help.

    Carlton

    Comment


    • #3
      Try this:

      PHP Code:
      function preMain(){
          
      setStudyTitle("MFIcolors");
          
      setCursorLabelName("MFI"0);
          
      setPlotType(PLOTTYPE_HISTOGRAM);
      }

      var 
      color=0;
      var 
      MFIold=0;
      var 
      MFI=0;
      var 
      Flag 0;
      function 
      main(){
          if(
      getBarState()==BARSTATE_NEWBAR){
              
      MFIold MFI;
              
      Flag 0;
          }
          var 
      Range high(0) - low(0);
          var 
      Vol volume(0);
          var 
      Vol_1 volume(-1);
          
      //var MFI = 0.0;
          
      if (Vol 0MFI Range Vol 1000000000;
          else 
      MFI 0;

          
      //debugPrintln(MFI+" "+MFIold);

          
      if(MFI>MFIold){
              if(
      Vol>Vol_1){
                  
      setBarFgColor(Color.green);
                  if(
      Flag !=1){
                      
      Alert.addToList"IBM""Breakout!"Color.greenColor.black );
                      
      Flag 1;
                  }
              }
              if(
      Vol<Vol_1setBarFgColor(Color.blue);
          }
          if(
      MFI<MFIold){
              if(
      Vol<Vol_1setBarFgColor(Color.brown);
              if(
      Vol>Vol_1setBarFgColor(Color.red);
          }
          return 
      MFI;

      Wayne
      Last edited by waynecd; 01-26-2011, 10:43 AM.

      Comment


      • #4
        Wayne,

        That is great. Thanks mate.

        Really appreciate it.

        Cheers

        Carlton

        Comment


        • #5
          Triggered Alert Request (contd)

          Hello Wayne/Esignal members,

          I didn't want to start a new thread but each time I try to submit a reply the website bombs.

          I'm trying to reply to request that Wayne fulfilled for me, subject:
          Triggered Alert Request.

          I'm trying to ask if Wayne could further tweak the EFS to alert not just when the MFI is Green, but also when the price is above the open.

          At the moment, the EFS alerts whenever the MFI histogram turns green whether the price is above or below the open.

          Appreciate it.

          Cheers

          Carlton

          function preMain(){
          setStudyTitle("MFIcolors");
          setCursorLabelName("MFI", 0);
          setPlotType(PLOTTYPE_HISTOGRAM);
          }

          var color=0;
          var MFIold=0;
          var MFI=0;
          var Flag = 0;
          function main(){
          if(getBarState()==BARSTATE_NEWBAR){
          MFIold = MFI;
          Flag = 0;
          }
          var Range = high(0) - low(0);
          var Vol = volume(0);
          var Vol_1 = volume(-1);
          //var MFI = 0.0;
          if (Vol > 0) MFI = Range / Vol * 1000000000;
          else MFI = 0;

          //debugPrintln(MFI+" "+MFIold);

          if(MFI>MFIold){
          if(Vol>Vol_1){
          setBarFgColor(Color.green);
          if(Flag !=1){
          Alert.addToList( "IBM", "Breakout!", Color.green, Color.black );
          Flag = 1;
          }
          }
          if(Vol<Vol_1) setBarFgColor(Color.blue);
          }
          if(MFI<MFIold){
          if(Vol<Vol_1) setBarFgColor(Color.brown);
          if(Vol>Vol_1) setBarFgColor(Color.red);
          }
          return MFI;
          }

          Comment


          • #6
            PHP Code:
            function preMain(){
                
            setStudyTitle("MFIcolors");
                
            setCursorLabelName("MFI"0);
                
            setPlotType(PLOTTYPE_HISTOGRAM);
                
            setDefaultBarThickness(3,0);
            }

            var 
            color=0;
            var 
            MFIold=0;
            var 
            MFI=0;
            var 
            Flag 0;
            function 
            main(){
                if(
            getBarState()==BARSTATE_NEWBAR){
                    
            MFIold MFI;
                    
            Flag 0;
                }
                var 
            Range high(0) - low(0);
                var 
            Vol volume(0);
                var 
            Vol_1 volume(-1);
                
            //var MFI = 0.0;
                
            if (Vol 0MFI Range Vol 1000000000;
                else 
            MFI 0;

                
            //debugPrintln(MFI+" "+MFIold);

                
            if(MFI>MFIold){
                    if(
            Vol>Vol_1){
                        
            setBarFgColor(Color.green);
                        if(
            close(0) > open(0) && Flag !=1){
                            
            Alert.addToList"IBM""Breakout!"Color.greenColor.black );
                            
            Flag 1;
                        }
                    }
                    if(
            Vol<Vol_1setBarFgColor(Color.blue);
                }
                if(
            MFI<MFIold){
                    if(
            Vol<Vol_1setBarFgColor(Color.brown);
                    if(
            Vol>Vol_1setBarFgColor(Color.red);
                }
                return 
            MFI;

            Comment


            • #7
              Use the last one posted, the forum doesn't allow me to edit or delete.

              The only difference is the following line under preMain():
              PHP Code:
              setDefaultBarThickness(3,0); 
              Just change the 3 to whatever thickness you want to adjust the thickness of the bars.

              Wayne

              Comment


              • #8
                Wayne,

                I going to put the EFS to the test later tomorrow - I just wanted to take the time to say thank you. I'll let you know how I get on with it tomorrow.


                Cheers


                C

                Comment


                • #9
                  Missing } after function body

                  Hi Wayne,

                  You updated the the efs below for me to alert me when the close is > than the open.

                  I tried to tweak the efs to also alert when the close < than the open, however whenever I run the efs I get the following error message:

                  missing } after function body.

                  I wonder if you could take a look at it and let me know where I'm going wrong?

                  function preMain(){
                  setStudyTitle("MFIUpDown");
                  setCursorLabelName("MFI", 0);
                  setPlotType(PLOTTYPE_HISTOGRAM);
                  setDefaultBarThickness(3,0);
                  }

                  var color=0;
                  var MFIold=0;
                  var MFI=0;
                  var Flag = 0;
                  function main(){
                  if(getBarState()==BARSTATE_NEWBAR){
                  MFIold = MFI;
                  Flag = 0;
                  }
                  var Range = high(0) - low(0);
                  var Vol = volume(0);
                  var Vol_1 = volume(-1);
                  //var MFI = 0.0;
                  if (Vol > 0) MFI = Range / Vol * 1000000000;
                  else MFI = 0;

                  //debugPrintln(MFI+" "+MFIold);

                  if(MFI>MFIold){
                  if(Vol>Vol_1){
                  setBarFgColor(Color.green);
                  if(close(0) > open(0) && Flag !=1){
                  Alert.addToList(getSymbol(), "MFI Up", Color.green, Color.green );
                  Alert.playSound( "Blip.wav" );
                  if(close(0) < open(0) && Flag !=1){
                  Alert.addToList(getSymbol(), "MFI Up", Color.red, Color.red );
                  Alert.playSound( "Boing.wav" );
                  Flag = 1;
                  }
                  }
                  if(Vol<Vol_1) setBarFgColor(Color.blue);
                  }
                  if(MFI<MFIold){
                  if(Vol<Vol_1) setBarFgColor(Color.brown);
                  if(Vol>Vol_1) setBarFgColor(Color.red);
                  }
                  return MFI;
                  }

                  Comment


                  • #10
                    Hi cpatte7372,

                    Every open bracket ({) requires a close bracket (}) that encapsulates the methods for a set condition. Corrections follow:

                    PHP Code:
                    function preMain(){
                        
                    setStudyTitle("MFIUpDown");
                        
                    setCursorLabelName("MFI"0);
                        
                    setPlotType(PLOTTYPE_HISTOGRAM);
                        
                    setDefaultBarThickness(3,0);
                    }

                    var 
                    color=0;
                    var 
                    MFIold=0;
                    var 
                    MFI=0;
                    var 
                    Flag 0;
                    function 
                    main(){
                        if(
                    getBarState()==BARSTATE_NEWBAR){
                            
                    MFIold MFI;
                            
                    Flag 0;
                        }
                        var 
                    Range high(0) - low(0);
                        var 
                    Vol volume(0);
                        var 
                    Vol_1 volume(-1);
                        
                    //var MFI = 0.0;
                        
                    if (Vol 0MFI Range Vol 1000000000;
                        else 
                    MFI 0;

                        
                    //debugPrintln(MFI+" "+MFIold);

                        
                    if(MFI>MFIold){
                            if(
                    Vol>Vol_1){
                                
                    setBarFgColor(Color.green);
                                if(
                    close(0) > open(0) && Flag != 1){
                                    
                    Alert.addToList(getSymbol(), "MFI Up"Color.greenColor.green );
                                    
                    Alert.playSound"Blip.wav" );
                                    
                    Flag 1;
                                }
                                if(
                    close(0) < open(0) && Flag != -1){
                                    
                    Alert.addToList(getSymbol(), "MFI Dn"Color.redColor.red );
                                    
                    Alert.playSound"Boing.wav" );
                                    
                    Flag = -1;
                                }
                            }
                            if(
                    Vol<Vol_1setBarFgColor(Color.blue);
                        }
                        if(
                    MFI<MFIold){
                            if(
                    Vol<Vol_1setBarFgColor(Color.brown);
                            if(
                    Vol>Vol_1setBarFgColor(Color.red);
                        }
                        return 
                    MFI;

                    Wayne

                    Comment


                    • #11
                      Wayne,

                      Thanks again mate.

                      Really appreciate it.

                      Cheers

                      Carlton

                      Comment


                      • #12
                        Wayne,

                        Tested it and works like a dream.

                        Cheers

                        Comment


                        • #13
                          Glad it worked

                          Comment


                          • #14
                            Add Price to Alert

                            Hello Experts,

                            Can someone please tell how to add the price to this EFS when it alerts. At the moment, I'm getting the symbol, desription and the time, but no price.

                            Cheers

                            function preMain(){
                            setStudyTitle("MFI3min");
                            setCursorLabelName("MFI", 0);
                            setPlotType(PLOTTYPE_HISTOGRAM);
                            setDefaultBarThickness(3,0);
                            }

                            var color=0;
                            var MFIold=0;
                            var MFI=0;
                            var Flag = 0;
                            function main(){
                            if(getBarState()==BARSTATE_NEWBAR){
                            MFIold = MFI;
                            Flag = 0;
                            }
                            var Range = high(0) - low(0);
                            var Vol = volume(0);
                            var Vol_1 = volume(-1);
                            //var MFI = 0.0;
                            if (Vol > 0) MFI = Range / Vol * 1000000000;
                            else MFI = 0;

                            //debugPrintln(MFI+" "+MFIold);

                            if(MFI>MFIold){
                            if(Vol>Vol_1){
                            setBarFgColor(Color.green);
                            if(close(0) > open(0) && Flag != 1){
                            Alert.addToList(getSymbol(), "MFI Up On 3mins", Color.green );
                            Alert.playSound( "thump1.wav" );
                            Flag = 1;
                            }
                            if(close(0) < open(0) && Flag != -1){
                            Alert.addToList(getSymbol(), "MFI Dowm 3mins", Color.red );
                            Alert.playSound( "Boing.wav" );
                            Flag = -1;
                            }
                            }
                            if(Vol<Vol_1) setBarFgColor(Color.blue);
                            }
                            if(MFI<MFIold){
                            if(Vol<Vol_1) setBarFgColor(Color.brown);
                            if(Vol>Vol_1) setBarFgColor(Color.red);
                            }
                            return MFI;
                            }

                            Comment


                            • #15
                              Hello cpatte7372,

                              if your question is about settings of EFS Alert List, then, unfortenutely you cannot add column Price
                              into EFS Alert List via settings neither in ver 10.6 nor in ver 11.x. As a workaround you could include a price value in description
                              string, i.e., as follows:
                              Alert.addToList(getSymbol(), "MFI Dowm 3min; Current price is "+close(0) , Color.red );

                              If you need to include Price column in EFS Alert List from Alert settings, you could request this feature using
                              Support/Request a feature Dialog

                              Thank you

                              Comment

                              Working...
                              X