Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

onmarketdata question

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

    onmarketdata question

    I found the following sample code regarding live data;

    protected override void OnMarketData(MarketDataEventArgs e)
    {
    // Print some data to the Output window
    if (e.MarketDataType == MarketDataType.Last)
    Print("Last = " + e.Price + " " + e.Volume);
    else if (e.MarketDataType == MarketDataType.Ask)
    Print("Ask = " + e.Price + " " + e.Volume);
    else if (e.MarketDataType == MarketDataType.Bid)
    Print("Bid = " + e.Price + " " + e.Volume);
    }

    This I understand prints the price with the associated volume.
    Is there a something I can put in place of " e.Volume " to get the number of transactions
    instead of the total volume?

    Thanks

    #2
    You would want to keep track of your own counter if you want # of trades and count the number of times your code goes into OnMarketData() for a last type.
    Josh P.NinjaTrader Customer Service

    Comment


      #3
      Thanks very much

      Originally posted by NinjaTrader_Josh View Post
      You would want to keep track of your own counter if you want # of trades and count the number of times your code goes into OnMarketData() for a last type.

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by cmoran13, 04-16-2026, 01:02 PM
      0 responses
      43 views
      0 likes
      Last Post cmoran13  
      Started by PaulMohn, 04-10-2026, 11:11 AM
      0 responses
      25 views
      0 likes
      Last Post PaulMohn  
      Started by CarlTrading, 03-31-2026, 09:41 PM
      1 response
      162 views
      1 like
      Last Post NinjaTrader_ChelseaB  
      Started by CarlTrading, 04-01-2026, 02:41 AM
      0 responses
      98 views
      1 like
      Last Post CarlTrading  
      Started by CaptainJack, 03-31-2026, 11:44 PM
      0 responses
      157 views
      2 likes
      Last Post CaptainJack  
      Working...
      X