Announcement

Collapse
No announcement yet.

Alert question

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

  • Alert question

    Hi, I want to use an alert that will trigger when price crosses a certain level at any point in the day. I am using 5-minute charts and my EFS code looks something like this:

    if(close(-1) < priceLevel && close() >= priceLevel) {
    triggerAlert();
    }

    I want the alert to happen the first time this statement becomes true in a 5-minute bar (even if its 2 minutes in), but right now I only get signals when I reload a different chart or at the end of a 5-minute bar. I have also unchecked "make all forumlas compute on close" in the EFS settings.

    Thanks for any help.

  • #2
    It sounds like there's something preventing the EFS to be run during each tick. I would suggest attaching the EFS file, so we can take a look at what you have.
    Regards,
    Jay F.
    Product Manager
    _____________________________________
    Have a suggestion to improve our products?
    Click Support --> Request a Feature in eSignal 11

    Comment


    • #3
      Sure, I will attach it. This code is basically a very ugly way of telling me if something is about to break out of its opening 30 minute range (using 5 minute bars).

      Thanks!
      Attached Files

      Comment


      • #4
        I believe it is the condition in main() that is preventing this from running on every tick. One way to test this is with a debugPrintln().
        Regards,
        Jay F.
        Product Manager
        _____________________________________
        Have a suggestion to improve our products?
        Click Support --> Request a Feature in eSignal 11

        Comment


        • #5
          Here you go..

          I corrected some errors in the code and added () to all the conditional statements (if statements).

          There are a few things you want to remember when creating the code...

          1. Use "()" in if statements to separate individual conditions.
          For example...
          if ( (condition1 == 1) && (condition2 == 2) ) {
          }

          This prevents logic issues from smacking you in the forehead.

          2. Your checking for HIGH and LOW were passing a symbol to the system. This is not necessary for an EFS that is running on a single symbol..
          high(-1, vSymbol); is the same as high(-1). - assuming vsymbol is the symbol of the chart.

          3. You had a condition (getHour() >= 9) in both main() and your sub-function. This duplication is un-necessary. Your subfunction will only run if the main() condition is true. So it does not need to be duplicated in the sub-function.

          I believe this file should work for you. If not, let me know.

          Brad
          Attached Files
          Brad Matheny
          eSignal Solution Provider since 2000

          Comment


          • #6
            Jay was correct...

            Jay, you were correct. I can't believe I missed that.

            Here is the corrected file again.

            Brad
            Attached Files
            Brad Matheny
            eSignal Solution Provider since 2000

            Comment


            • #7
              Thanks for the help guys, one more question for you. Is it necessary to return the high and low values inside of main() like you have it in order to run every tick? I want this to be a standalone function whose sole purpose is to create the alerts.

              Comment


              • #8
                NO

                No, not at all.

                I just added them to see what you were triggering as an entry.

                Just "comment out" (with "//" at the beginning of the line) the "return" statements at the end of main().

                Brad
                Brad Matheny
                eSignal Solution Provider since 2000

                Comment


                • #9
                  I have a question about alerts? How do i put in a text alert not related to a symbol. For example: an alert that says 10:00 reversal time to show up in my alert window?

                  Fibbgann
                  Excellent book on JavaScript for beginners

                  Comment


                  • #10
                    FibbGann
                    Insert the following in the main() section of the formula
                    Alex

                    PHP Code:
                    if((getHour()*100)+getMinute())==1000)
                    Alert.addToList(getSymbol(),"It is 10:00 - Reversal Time",Color.black,Color.blue); 
                    Last edited by ACM; 10-03-2003, 06:59 PM.

                    Comment


                    • #11
                      if(getHour(-1)<9 and getHour()=10)
                      Alert.addToList(GM,"it's 10am",Color,red,Color,yellow)

                      might have some promise

                      Comment


                      • #12
                        Forgive me if I am mistaken. I was not adding it to any formula. just wanted it to show up in my Alert window. the original alert window offered in the esignal "NEW" windows.

                        Fibbgann
                        Excellent book on JavaScript for beginners

                        Comment


                        • #13
                          I'm assuming I have to put it in a formula instead of using the little Alet bell offered in the tool bars?

                          Fibbgann
                          Excellent book on JavaScript for beginners

                          Comment


                          • #14
                            FibbGann
                            That is correct. The Alert tool you refer to has no time related settings.
                            Alex

                            Comment

                            Working...
                            X