Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Custom indicator question

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

    Custom indicator question

    I've created a custom indicator that uses the Plotstyle.Bar plot style and updates at close of each bar in the OnBarUpdate method, using the Value.set statement.

    This indicator is also using the OnMarketDepth method. I would like to update the indicator each time the OnMarketDepth method is accessed. I tried using the Value.set statement in the OnMarketDepth method, and it did not update the indicator.

    What is the correct way to update an indicator from within the OnMarketDepth method?

    Thanks,
    Phineas

    #2
    We do not advise doing this as by doing so, you will bring your PC to its knees. There are a lot of changes in OnMarketDepth() that if you forced a repaint of the chart screen on each change you would kill your CPU.
    RayNinjaTrader Customer Service

    Comment


      #3
      Thanks Ray, got it.

      Basically what I want to do is plot the value of the indicator as it changes within an XX minute bar and also plot the max and min values within the same bar.

      So, I have now kept the indicator update routine in OnBarUpdate and update indicator on each tick (calculateOnbarClose=false).
      This works fine, not too much load on CPU. Now I just have to figure out how to keep the Max and Min for each bar. Which is easy if I know the start/end of the bar, but with calcuateOnbarClose=false, I don't know how to do that.

      Is there a way to keep track of the min/max (or start/end of bar)?
      Thanks,
      Phineas

      Comment


        #4
        The start of the bar can be checked via "FirstTickOfBar" property...When you know the start of the bar, you also know know the prior bar ended. You can NOT know the end of the bar since it requires the first tick of the new bar to signal the end of the last bar.
        RayNinjaTrader Customer Service

        Comment


          #5
          That will do it, Thanks

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by Geovanny Suaza, 02-11-2026, 06:32 PM
          0 responses
          576 views
          0 likes
          Last Post Geovanny Suaza  
          Started by Geovanny Suaza, 02-11-2026, 05:51 PM
          0 responses
          334 views
          1 like
          Last Post Geovanny Suaza  
          Started by Mindset, 02-09-2026, 11:44 AM
          0 responses
          101 views
          0 likes
          Last Post Mindset
          by Mindset
           
          Started by Geovanny Suaza, 02-02-2026, 12:30 PM
          0 responses
          553 views
          1 like
          Last Post Geovanny Suaza  
          Started by RFrosty, 01-28-2026, 06:49 PM
          0 responses
          551 views
          1 like
          Last Post RFrosty
          by RFrosty
           
          Working...
          X