Announcement

Collapse
No announcement yet.

Alert for a New Bar in range bar chart

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

  • Alert for a New Bar in range bar chart

    Hello I 'm using range bar chart ; as it is not related to time but to range bar exceeding , we don't know when the new candlestick shall appear,.

    Rather staying in front of my computer , I would like to know if it exists a pop up window /sound alert that tells me a new bar just appear.

    Thanks for your help

    Axel

  • #2
    Re: Alert for a New Bar in range bar chart

    Axel
    You can do that through efs using the getBarState() function to check for BARSTATE_NEWBAR [ie the first tick of each new bar] and then execute any one of the Alert functions eg
    if(getBarState()==BARSTATE_NEWBAR) Alert.xxx()
    where xxx is the type of alert you want ie popup, sound, etc
    For the syntax required by these functions see the links to the related articles in the EFS KnowledgeBase
    Alex


    Originally posted by axel
    Hello I 'm using range bar chart ; as it is not related to time but to range bar exceeding , we don't know when the new candlestick shall appear,.
    Rather staying in front of my computer , I would like to know if it exists a pop up window /sound alert that tells me a new bar just appear.
    Thanks for your help
    Axel

    Comment


    • #3
      thanks Alexis, but I thought the EFS would already exist as I 'm not a pogrammer yet.

      Is there anyone using Bar chart here ??



      Comment


      • #4
        ....I wrote it , that's fine
        Last edited by axel; 07-02-2010, 08:26 AM.

        Comment


        • #5
          Hi axel,

          FWIW, I recommend you post your completed code to the forum, then the code would be available (as you expressed in a previous post). This would be a contribution to the forum, and a potential resource for others.

          Based on my experience, posting code with your questions, then following up with completed working code reinforces what you have learned. I've also observed you will be more likely to get followup help on the code or any future questions on code you post.

          Steve


          Originally posted by axel
          ....I wrote it , that's fine
          ...

          Originally posted by axel
          thanks Alexis, but I thought the EFS would already exist as I 'm not a pogrammer yet.

          Is there anyone using Bar chart here ??



          Comment


          • #6
            debugging...no errors in myscript but nothing happens !?!

            function main() {
            var nState;
            nState = getBarState();
            if (nState == BARSTATE_ALLBARS) {
            //the bars are being loaded by the script. This happens when a script is first loaded
            debugPrint("Script is loading\n");
            }
            else if (nState == BARSTATE_NEWBAR) {
            //this flag is set when a new bar is coming in
            //debugPrint("The first tick of a new bar has arrived\n");
            Alert.playSound( "beep.wav" );
            }
            // else if (nState == BARSTATE_CURRENTBAR) {
            //this flag is set as each new tick comes in
            // debugPrint("A new tick has arrived\n");
            // }

            }

            Comment


            • #7
              axel
              FWIW the script is working at my end ie it is printing the debug line when the script is first loaded and sounding an alert at each new bar
              Alex


              Originally posted by axel
              debugging...no errors in myscript but nothing happens !?!

              function main() {
              var nState;
              nState = getBarState();
              if (nState == BARSTATE_ALLBARS) {
              //the bars are being loaded by the script. This happens when a script is first loaded
              debugPrint("Script is loading\n");
              }
              else if (nState == BARSTATE_NEWBAR) {
              //this flag is set when a new bar is coming in
              //debugPrint("The first tick of a new bar has arrived\n");
              Alert.playSound( "beep.wav" );
              }
              // else if (nState == BARSTATE_CURRENTBAR) {
              //this flag is set as each new tick comes in
              // debugPrint("A new tick has arrived\n");
              // }

              }

              Comment


              • #8
                I simplified the script and it works now :

                function main() {
                var nState;
                nState = getBarState();
                if (nState == BARSTATE_NEWBAR) Alert.playSound( "Chime Down.wav" );
                }

                Comment

                Working...
                X