Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

OnMarketData

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

    OnMarketData

    Hello,

    Does FirstTickOfBar work if placed inside OnMarketData? Or only inside OnBarUpdate? If not, is there a method for Synchronizing start of bar to also show up inside OnMarketData?

    One thing I'm trying to check is the Volume[0] inside OnBarUpdate and how I can get similar readings when an OnMarketData.Last gives it's volume data. I reset my custom volume counter to equal 1 at FirstTickOfBar inside OnBarUpdate. If making a counter variable insde OnMarketData can do the same thing, can I use the volume data from there with equal results?

    Thanks,
    Kirk
    Last edited by zeller4; 10-04-2010, 06:43 PM.

    #2
    Kirk, the OnMarketData() is driven exclusively by Level 1 data events, so it's not tied to any bars object, hence the FirstTIckOfBar is not in proper context here. I would continue to set your variable then in OnBarUpdate on each tick, you can still check it's value in OnMarketData(), for example if the last event was a LastPrice update.

    Comment


      #3
      Originally posted by zeller4 View Post
      Hello,

      Does FirstTickOfBar work if placed inside OnMarketData? Or only inside OnBarUpdate? If not, is there a method for Synchronizing start of bar to also show up inside OnMarketData?

      One thing I'm trying to check is the Volume[0] inside OnBarUpdate and how I can get similar readings when an OnMarketData.Last gives it's volume data. I reset my custom volume counter to equal 1 at FirstTickOfBar inside OnBarUpdate. If making a counter variable insde OnMarketData can do the same thing, can I use the volume data from there with equal results?

      Thanks,
      Kirk
      Kirk,

      If NT isn't providing it, Just build it yourself.


      #region Variables
      private int activeBar = -1;
      private int CustomVolumeCounter =0;

      protected override void OnMarketData(MarketDataEventArgs e)
      {
      if (CurrentBar != activeBar)
      {

      CustomVolumeCounter = 1;

      activeBar = CurrentBar;
      }
      }

      RJay
      RJay
      NinjaTrader Ecosystem Vendor - Innovative Trading Solutions

      Comment


        #4
        Thanks RJay,
        I'll give that a try.

        Kirk

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by cmoran13, Yesterday, 01:02 PM
        0 responses
        27 views
        0 likes
        Last Post cmoran13  
        Started by PaulMohn, 04-10-2026, 11:11 AM
        0 responses
        18 views
        0 likes
        Last Post PaulMohn  
        Started by CarlTrading, 03-31-2026, 09:41 PM
        1 response
        160 views
        1 like
        Last Post NinjaTrader_ChelseaB  
        Started by CarlTrading, 04-01-2026, 02:41 AM
        0 responses
        95 views
        1 like
        Last Post CarlTrading  
        Started by CaptainJack, 03-31-2026, 11:44 PM
        0 responses
        148 views
        2 likes
        Last Post CaptainJack  
        Working...
        X