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 Geovanny Suaza, 02-11-2026, 06:32 PM
      0 responses
      571 views
      0 likes
      Last Post Geovanny Suaza  
      Started by Geovanny Suaza, 02-11-2026, 05:51 PM
      0 responses
      331 views
      1 like
      Last Post Geovanny Suaza  
      Started by Mindset, 02-09-2026, 11:44 AM
      0 responses
      101 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Started by Geovanny Suaza, 02-02-2026, 12:30 PM
      0 responses
      549 views
      1 like
      Last Post Geovanny Suaza  
      Started by RFrosty, 01-28-2026, 06:49 PM
      0 responses
      549 views
      1 like
      Last Post RFrosty
      by RFrosty
       
      Working...
      X