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

bars.Instrument.MasterInstrument.FundamentalData.AverageDailyVolume in onDataPoint

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

    bars.Instrument.MasterInstrument.FundamentalData.AverageDailyVolume in onDataPoint

    Hi,
    I am testing to get average daily volume in a bar type via bars.Instrument.MasterInstrument.FundamentalData.A verageDailyVolume.Value
    but it's .HasValue = false all the time, even if I waited to go to the next day... Is this being set/used by the framework?

    How about: bars.Instrument.MarketData.DailyVolume.Volume - even checking it for != null throws an exception:
    2022-05-16 18:57:43:427|3|4|Failed to call 'Add' method: System.NullReferenceException: Object reference not set to an instance of an object.
    at NinjaTrader.NinjaScript.BarsTypes.AvRenko.OnDataPo int(Bars bars, Double open, Double high, Double low, Double close, DateTime time, Int64 volume, Boolean isBar, Double bid, Double ask)
    at NinjaTrader.Data.BarsSeries.Add(Bars bars, Double open, Double high, Double low, Double close, DateTime time, Int64 volume, Double tickSize, Boolean isBar, Double bid, Double ask)

    Are any of these objects set by the framework?

    #2
    Hello momchi,

    That specific property may be used internally for instrument subscriptions, the AverageDailyVolume is part of the fundamental data which would not be handled by a BarsType. That could be used in an indicator or addon


    From OnDataPoint you would have to accumulate volume and then use math to create an average for the given period of time if you wanted to recreate that type of value.

    JesseNinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Skifree, Today, 03:41 AM
    1 response
    2 views
    0 likes
    Last Post Skifree
    by Skifree
     
    Started by usazencort, Today, 01:16 AM
    0 responses
    1 view
    0 likes
    Last Post usazencort  
    Started by kaywai, 09-01-2023, 08:44 PM
    5 responses
    603 views
    0 likes
    Last Post NinjaTrader_Jason  
    Started by xiinteractive, 04-09-2024, 08:08 AM
    6 responses
    23 views
    0 likes
    Last Post xiinteractive  
    Started by Pattontje, Yesterday, 02:10 PM
    2 responses
    23 views
    0 likes
    Last Post Pattontje  
    Working...
    X