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