Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

find out, if indicator runs on a chart with realtime ticks coming in

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

    find out, if indicator runs on a chart with realtime ticks coming in

    Hi,

    I have an indicator, that does extensive drawing and calculation.

    When I'm adding that indicator to a chart with over 5000 bars, that has real-time ticks coming in (end date today and during session) it needs over a minute to process historical bars.

    This calculation time is going down to a couple of seconds, if I'm adding the indicator to a chart with the same amount of bars, but with let's say yesterday as the end date.

    Is it possible to find out, if an indicator runs on a chart with real-time ticks coming in, before the indicator starts to process historical bars?

    Thanks


    #2
    Hello td_910, thanks for your post.

    An indicator will always go from State.Historical to State.Realtime when it starts up. This is a performance issue due to having 5000 bars on the chart. The only thing that could be done about that is to reduce/optimize the drawing or reducing the number of bars loaded onto the chart.

    Best regards.

    Comment


      #3
      the performance issue only occurs with real-time ticks coming in

      What do you think of the following workaround?

      Code:
      if(ChartBars != null)
      {
          if (ChartBars.Properties.To.Date >= DateTime.Now.Date)
          {
              Print ("Realtime");
              return;
          }
          else
              Print ("Historical");
      }

      Comment


        #4
        Hello td_910, thanks for your reply.

        I'm curious why the code only slows down when it hits real-time data. If you are running the script OnEachTick, then you might need to move some logic within this code block to reduce the calculations that happen on every tick:

        if(IsFirstTickOfBar){ //OnBarCloseLogic }

        If you turn on Tick Replay, I am guessing your script would go much slower in historical mode as tick replay plays back the ticks of historical bars as if they came in in real-time data. We would need to find out why the script is being slow only on incoming data.

        I look forward to assisting further.

        Comment


          #5
          Hi Chris,

          yes, I know, it's an issue siince a couple of months, but now I can use that workaround for the time being.

          The indicator runs on OnPriceChange.

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by Geovanny Suaza, 02-11-2026, 06:32 PM
          0 responses
          595 views
          0 likes
          Last Post Geovanny Suaza  
          Started by Geovanny Suaza, 02-11-2026, 05:51 PM
          0 responses
          343 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
          556 views
          1 like
          Last Post Geovanny Suaza  
          Started by RFrosty, 01-28-2026, 06:49 PM
          0 responses
          554 views
          1 like
          Last Post RFrosty
          by RFrosty
           
          Working...
          X