Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Timer to remove alert after x seconds

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

    Timer to remove alert after x seconds

    Hi all,
    I have an indicator that alerts when a calculated volume level is exceeded and displays text on the chart. What I would like is, to have the text(alert) removed from the chart after say 15 seconds from when it triggered. I have looked at the BarTimer but can't understand how to get that to work for this.

    As always, your help is appreciated!

    #2
    You could trigger a timerevent that would run irregardless if there is data coming through on the chart.



    Easier option would be to store the time and do a check to see if 15 seconds has lapsed.



    Comment


      #3
      Would the second (easier) option work in market replay as well? Does it get time from NinjaTrader or the PC?

      Thanks!

      Comment


        #4
        That uses market replay.

        Comment


          #5
          Great! Thank you

          Comment


            #6
            Having trouble getting the time variable when it triggers. Here is the code I'm using...

            timer = ToTime(Time[0]);
            Print ("Time is " + timer);

            The output from the Print command returns the time but with 00 seconds, can't seem to store the seconds. Here's the output window text....

            Time is 90100

            The actual time it triggered at was 9:00:19 AM

            Comment


              #7
              It looks like it will be an issue.

              Post #8 from NT_PatrickH explains how to get around it.

              Comment


                #8
                Originally posted by mlarocco View Post
                Having trouble getting the time variable when it triggers. Here is the code I'm using...

                timer = ToTime(Time[0]);
                Print ("Time is " + timer);

                The output from the Print command returns the time but with 00 seconds, can't seem to store the seconds. Here's the output window text....

                Time is 90100

                The actual time it triggered at was 9:00:19 AM
                What timeframe is the chart?

                Comment


                  #9
                  I am using a 1 minute chart. Apparently, this is normal behavior. I was able to add the time period for a 1 second chart and then count the bars after the alert was triggered.....


                  Add(PeriodType.Second, 1);

                  if (timer == 0)
                  timer = CurrentBars[1];

                  if (My Condition)
                  {
                  timer = CurrentBars[1];
                  }

                  if ((timer + 15) == CurrentBars[1])
                  {
                  RemoveDrawObject("Trigger");
                  }


                  Works great

                  Comment

                  Latest Posts

                  Collapse

                  Topics Statistics Last Post
                  Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                  0 responses
                  581 views
                  0 likes
                  Last Post Geovanny Suaza  
                  Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                  0 responses
                  337 views
                  1 like
                  Last Post Geovanny Suaza  
                  Started by Mindset, 02-09-2026, 11:44 AM
                  0 responses
                  103 views
                  0 likes
                  Last Post Mindset
                  by Mindset
                   
                  Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                  0 responses
                  554 views
                  1 like
                  Last Post Geovanny Suaza  
                  Started by RFrosty, 01-28-2026, 06:49 PM
                  0 responses
                  552 views
                  1 like
                  Last Post RFrosty
                  by RFrosty
                   
                  Working...
                  X