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 SalmaTrader, 07-07-2026, 10:26 PM
        0 responses
        50 views
        0 likes
        Last Post SalmaTrader  
        Started by CarlTrading, 07-05-2026, 01:16 PM
        0 responses
        22 views
        0 likes
        Last Post CarlTrading  
        Started by CaptainJack, 06-17-2026, 10:32 AM
        0 responses
        16 views
        0 likes
        Last Post CaptainJack  
        Started by kinfxhk, 06-17-2026, 04:15 AM
        0 responses
        22 views
        0 likes
        Last Post kinfxhk
        by kinfxhk
         
        Started by kinfxhk, 06-17-2026, 04:06 AM
        0 responses
        23 views
        0 likes
        Last Post kinfxhk
        by kinfxhk
         
        Working...
        X