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 op1031, Today, 05:51 PM
          0 responses
          3 views
          0 likes
          Last Post op1031
          by op1031
           
          Started by nighttrader99, Today, 04:34 PM
          1 response
          7 views
          0 likes
          Last Post NinjaTrader_ShawnB  
          Started by Simon Investimens, Today, 02:51 PM
          1 response
          15 views
          0 likes
          Last Post NinjaTrader_ChrisL  
          Started by Unsuitable, Today, 02:49 PM
          0 responses
          14 views
          0 likes
          Last Post Unsuitable  
          Started by AroraAbhishek, Today, 01:49 PM
          1 response
          12 views
          0 likes
          Last Post NinjaTrader_BrandonH  
          Working...
          X