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 zstheorist, Today, 07:52 PM
          0 responses
          7 views
          0 likes
          Last Post zstheorist  
          Started by pmachiraju, 11-01-2023, 04:46 AM
          8 responses
          150 views
          0 likes
          Last Post rehmans
          by rehmans
           
          Started by mattbsea, Today, 05:44 PM
          0 responses
          6 views
          0 likes
          Last Post mattbsea  
          Started by RideMe, 04-07-2024, 04:54 PM
          6 responses
          33 views
          0 likes
          Last Post RideMe
          by RideMe
           
          Started by tkaboris, Today, 05:13 PM
          0 responses
          6 views
          0 likes
          Last Post tkaboris  
          Working...
          X