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 sjsj2732, 03-23-2026, 04:31 AM
      0 responses
      42 views
      0 likes
      Last Post sjsj2732  
      Started by NullPointStrategies, 03-13-2026, 05:17 AM
      0 responses
      294 views
      0 likes
      Last Post NullPointStrategies  
      Started by argusthome, 03-08-2026, 10:06 AM
      0 responses
      290 views
      0 likes
      Last Post argusthome  
      Started by NabilKhattabi, 03-06-2026, 11:18 AM
      0 responses
      135 views
      1 like
      Last Post NabilKhattabi  
      Started by Deep42, 03-06-2026, 12:28 AM
      0 responses
      98 views
      0 likes
      Last Post Deep42
      by Deep42
       
      Working...
      X