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 bar types

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

    Custom bar types

    Hi,

    I'm working on creating my first custom bar type. The bar is supposed to adapt it's duration & range based on market conditions. It works for the most part, but I've seen that the historical bars can sometimes look much different from the bars that would have been drawn live.

    I enabled tick replay to see if this would rectify these discrepancies but my bar type doesn't render anything at all when tick replay is enabled, it's just a completely blank chart canvas. I don't see anything in the "Developing for tick replay" docs that outline any special considerations for bar types, nor am I using anything called out on that page. I'm really only using a session iterator, the Bars object and Volume. Do you have some suggestions for what could be happening or what I can look into?


    Thanks,
    Nick

    My defaults look like this if it helps:
    BarsPeriod = new BarsPeriod { BarsPeriodType = (BarsPeriodType)654334, BarsPeriodTypeName = "AdaptiveBars2", Value = 1 };
    BuiltFrom = BarsPeriodType.Tick;
    DaysToLoad = 15;
    IsIntraday = true;
    Last edited by NickyD; 05-13-2022, 11:01 AM.

    #2
    Hi Nicky, thanks for posting. There is some information here on Tick replay in OnDataPoint:

    https://ninjatrader.com/support/help...ndatapoint.htm

    Check the Log tab of the Control Center for any errors. Focus on your OnDataPoint method since this is where the bars are built. There might be an error coming from this method in the Log.

    Kind regards,
    -ChrisL
    Chris L.NinjaTrader Customer Service

    Comment


      #3
      Hmm, there's no exception errors in the log but I'm just now realizing that this doesn't happen with all time frames. There's something wrong with my custom logic to analyze prior days volume and range. Or possibly with my GetInitialLookBackDays but I think it's the former.

      I am looking at this statement from the page you linked:
      "When using TickReplay, historical updates will call for every tick handled by the core regardless of the BuiltFrom property defined"

      If my bars specifically define "BuiltFrom = BarsPeriodType.Tick;" then it seems to me that my OnDataPoint should more or less behave the exact same (forgetting about shared timestamp or other edge case issues) for historical bars in TickReplay or not... is that understanding correct?



      Comment


        #4
        Hi Nicky, thanks for the follow up. If your BuiltFrom setting is Tick then there should be no difference between Tick Replay on or off. All the default bar types are available to study so you can analyze how they function. The Tick bars type is the most straight forward one to study.
        Chris L.NinjaTrader Customer Service

        Comment


          #5
          Ok, thanks.

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by algospoke, 04-17-2024, 06:40 PM
          5 responses
          46 views
          0 likes
          Last Post NinjaTrader_Jesse  
          Started by arvidvanstaey, Today, 02:19 PM
          1 response
          4 views
          0 likes
          Last Post NinjaTrader_Zachary  
          Started by mmckinnm, Today, 01:34 PM
          3 responses
          5 views
          0 likes
          Last Post NinjaTrader_ChelseaB  
          Started by f.saeidi, Today, 01:32 PM
          2 responses
          8 views
          0 likes
          Last Post f.saeidi  
          Started by alifarahani, 04-19-2024, 09:40 AM
          9 responses
          55 views
          0 likes
          Last Post NinjaTrader_Jesse  
          Working...
          X