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

MarketDataEvnArgs or GetCurrentAskVolume

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

    MarketDataEvnArgs or GetCurrentAskVolume

    I am trying to get a running sum of block bid and ask volumes that have actually transpired... i.e. Sum ask volume > 4

    Which is correct to use

    GetCurrentAskVolume()... Is this actual trading volume that has transpired or is this the volume currently being offered at the asking price?

    Or

    OnMarketData

    protected override void OnMarketData(MarketDataEventArgs marketDataUpdate)

    if (marketDataUpdate.MarketDataType == MarketDataT ype.Ask)
    Print("Ask = " + marketDataUpdate.Price + " " + marketDataUpdate.Volume);


    Under OnMarketData() The help guide says this method does not return a value


    Method Return Value
    This method does not return a value.

    Although the page under MarketDataEvnArs indicates it returns a double value


    Thank you for clarifying


    #2
    Hello sdauteuil,

    These essentionally would be the same.

    GetCurrentAskVolume() gets the snapshot volume of the most recent ask update at the time it's requested.

    OnMarketData()'s argument.Volume is that same data, but from every update, processed in order, instead of just when requested.

    OnMarketData does not return a value. This is a void. The argument (marketDataUpdate) has the data. If you need this outside of OnMarketData, then you would need to save that information to a variable or array.

    Some of the argument properties are doubles like .Ask and .Bid and some are longs like .Volume. Some properties are bools like .IsReset or instruments like .Instrument. The arugument and the arguments properties are not returned, as you cannot call OnMarketData() yourself as a calling method. NinjaTrader calls OnMarketData() and provides the data to the argument.
    https://ninjatrader.com/support/help...aeventargs.htm
    Last edited by NinjaTrader_ChelseaB; 04-11-2021, 05:12 PM.
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Thank you for the clarification

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by kevinenergy, 02-17-2023, 12:42 PM
      115 responses
      2,699 views
      1 like
      Last Post kevinenergy  
      Started by prdecast, Today, 06:07 AM
      1 response
      4 views
      0 likes
      Last Post NinjaTrader_LuisH  
      Started by Christopher_R, Today, 12:29 AM
      1 response
      14 views
      0 likes
      Last Post NinjaTrader_LuisH  
      Started by chartchart, 05-19-2021, 04:14 PM
      3 responses
      577 views
      1 like
      Last Post NinjaTrader_Gaby  
      Started by bsbisme, Yesterday, 02:08 PM
      1 response
      15 views
      0 likes
      Last Post NinjaTrader_Gaby  
      Working...
      X