Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

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 JoMoon2024, Today, 06:56 AM
          0 responses
          6 views
          0 likes
          Last Post JoMoon2024  
          Started by Haiasi, 04-25-2024, 06:53 PM
          2 responses
          19 views
          0 likes
          Last Post Massinisa  
          Started by Creamers, Today, 05:32 AM
          0 responses
          6 views
          0 likes
          Last Post Creamers  
          Started by Segwin, 05-07-2018, 02:15 PM
          12 responses
          1,786 views
          0 likes
          Last Post Leafcutter  
          Started by poplagelu, Today, 05:00 AM
          0 responses
          3 views
          0 likes
          Last Post poplagelu  
          Working...
          X