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 yertle, Yesterday, 08:38 AM
    7 responses
    28 views
    0 likes
    Last Post yertle
    by yertle
     
    Started by bmartz, 03-12-2024, 06:12 AM
    2 responses
    20 views
    0 likes
    Last Post bmartz
    by bmartz
     
    Started by funk10101, Today, 12:02 AM
    0 responses
    4 views
    0 likes
    Last Post funk10101  
    Started by gravdigaz6, Yesterday, 11:40 PM
    1 response
    8 views
    0 likes
    Last Post NinjaTrader_Manfred  
    Started by MarianApalaghiei, Yesterday, 10:49 PM
    3 responses
    10 views
    0 likes
    Last Post NinjaTrader_Manfred  
    Working...
    X