Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Custom BarType life cycle

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

    Custom BarType life cycle

    Can anyone describe precisely when the Add method is called for a BarType?

    I am developing a custom BarType and found that the first time I load a chart the Add method was called many times. However, if I press F5 to reload the NinjaScript, the BarType.Add method is not called at all. If I restart Ninja and create a new chart, it still does not get called again (for the exact same data).
    It is as if, Ninja had already built the bars, stored them somewhere else so it did not have to rebuild them again. If this is true, does anyone know how to force Ninja to rebuild the bars?

    My BarType is time based. I discovered this while not connected to a datafeed.

    I know that coding a custom BarType is not supported by Ninja, so I am hoping another developer may be able to provide some guidance.

    Thanks for any input at all.
    Gary

    #2
    Originally posted by GaryAlbers View Post
    Can anyone describe precisely when the Add method is called for a BarType?

    I am developing a custom BarType and found that the first time I load a chart the Add method was called many times. However, if I press F5 to reload the NinjaScript, the BarType.Add method is not called at all. If I restart Ninja and create a new chart, it still does not get called again (for the exact same data).
    It is as if, Ninja had already built the bars, stored them somewhere else so it did not have to rebuild them again. If this is true, does anyone know how to force Ninja to rebuild the bars?

    My BarType is time based. I discovered this while not connected to a datafeed.

    I know that coding a custom BarType is not supported by Ninja, so I am hoping another developer may be able to provide some guidance.

    Thanks for any input at all.
    Gary
    Hi Gary,

    Its always good to compile after making any coding change. Charts are loaded when NT is booted up. Changes to chart coding requires a compile followed by a restart of NT to enable any changes.

    RJay
    RJay
    NinjaTrader Ecosystem Vendor - Innovative Trading Solutions

    Comment


      #3
      RJay,

      Yes, I was restarting Ninja after compiling the custom BarType. That in itself did not cause the BarType to be called again when the same chart is created (same date range, same time frame).

      However, I did learn something new. My suspicion that Ninja built the bars one time and cached them appeared to be true. I found .ntb files in the ..\db\cache folder which Ninja builds up, apparently from the output of the BarType. When there is data in the cache, Ninja does not call the BarType. I deleted the files from the cache folder and rebooted Ninja. That forced Ninja to call my custom BarType again. To verify my theory, I rebooted Ninja again and the BarType was NOT called since it was able to redraw the chart from the data in the cache.

      Yes, this is an unsupported process, but necessary for custom BarType development.
      Unless the Ninja folks volunteer better development guidelines

      Gary

      Comment


        #4
        Originally posted by GaryAlbers View Post
        RJay,

        Yes, I was restarting Ninja after compiling the custom BarType. That in itself did not cause the BarType to be called again when the same chart is created (same date range, same time frame).

        However, I did learn something new. My suspicion that Ninja built the bars one time and cached them appeared to be true. I found .ntb files in the ..\db\cache folder which Ninja builds up, apparently from the output of the BarType. When there is data in the cache, Ninja does not call the BarType. I deleted the files from the cache folder and rebooted Ninja. That forced Ninja to call my custom BarType again. To verify my theory, I rebooted Ninja again and the BarType was NOT called since it was able to redraw the chart from the data in the cache.

        Yes, this is an unsupported process, but necessary for custom BarType development.
        Unless the Ninja folks volunteer better development guidelines

        Gary
        Hi Gary,

        Sorry I did not read your request more thoroughly. I agree completely.

        NT does store separate images of historic data for each session type called and each chart type and each setting for that chart.

        It has been my experience that the historic data stored from a defective chart type program must be manually removed to download fresh historic data.

        Same is true should you get a data glitch during normal operations which prevents a single configuration from loading properly while any other setting works perfectly.

        RJay
        RJay
        NinjaTrader Ecosystem Vendor - Innovative Trading Solutions

        Comment


          #5
          Help still needed

          Can anybody please give me a clue as to when NinjaTrader calls the Add method of a BarsType.
          It does not call it every time the chart is refreshed.
          I thought it was at least called if there was no previous data built in the db cache but I am not even seeing it called in that situation now. (It was for a while, then I stepped away for a couple weeks and now it is not. I am not seeing what has changed.)

          Ninja support folks: I understand that you have declared support of this type off limits but I would like you to reconsider. I am just asking you to summarize the life cycle of the BarsType within in the Ninja engine so I can know how to work within that framework. If you want folks to innovate and create cool tools upon your platform some more information is needed about BarsType.

          Thanks,
          Gary Albers

          Comment


            #6
            +1 to this, I would also like to know.

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by Geovanny Suaza, 02-11-2026, 06:32 PM
            0 responses
            656 views
            0 likes
            Last Post Geovanny Suaza  
            Started by Geovanny Suaza, 02-11-2026, 05:51 PM
            0 responses
            371 views
            1 like
            Last Post Geovanny Suaza  
            Started by Mindset, 02-09-2026, 11:44 AM
            0 responses
            109 views
            0 likes
            Last Post Mindset
            by Mindset
             
            Started by Geovanny Suaza, 02-02-2026, 12:30 PM
            0 responses
            574 views
            1 like
            Last Post Geovanny Suaza  
            Started by RFrosty, 01-28-2026, 06:49 PM
            0 responses
            579 views
            1 like
            Last Post RFrosty
            by RFrosty
             
            Working...
            X