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 CaptainJack, 05-29-2026, 05:09 AM
      0 responses
      178 views
      0 likes
      Last Post CaptainJack  
      Started by CaptainJack, 05-29-2026, 12:02 AM
      0 responses
      99 views
      0 likes
      Last Post CaptainJack  
      Started by charlesugo_1, 05-26-2026, 05:03 PM
      0 responses
      131 views
      0 likes
      Last Post charlesugo_1  
      Started by DannyP96, 05-18-2026, 02:38 PM
      1 response
      210 views
      0 likes
      Last Post NinjaTrader_ChelseaB  
      Started by CarlTrading, 05-11-2026, 05:56 AM
      0 responses
      186 views
      0 likes
      Last Post CarlTrading  
      Working...
      X