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 Hwop38, 05-04-2026, 07:02 PM
      0 responses
      164 views
      0 likes
      Last Post Hwop38
      by Hwop38
       
      Started by CaptainJack, 04-24-2026, 11:07 PM
      0 responses
      317 views
      0 likes
      Last Post CaptainJack  
      Started by Mindset, 04-21-2026, 06:46 AM
      0 responses
      245 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Started by M4ndoo, 04-20-2026, 05:21 PM
      0 responses
      350 views
      0 likes
      Last Post M4ndoo
      by M4ndoo
       
      Started by M4ndoo, 04-19-2026, 05:54 PM
      0 responses
      179 views
      0 likes
      Last Post M4ndoo
      by M4ndoo
       
      Working...
      X