Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Zen-Fire time data questions?

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

    #16
    Originally posted by NinjaTrader_Ray View Post
    Programming against OnMarketData() we consider advanced programming. I believe we even state that in the Help Guide. I can provide you some guidance but you are really on your own since the questions you ask are outside of NinjaScript and deal with basic programming.

    Also, why not just make sure your PC clock in in sync?
    Sync'ing the PC clock would be too easy

    Actually I sync it up right before the opening everyday, but when dealing with a certain indicator I use, I often get a different open price on my 1min chart compared to my 150tick chart, so I decided to look in to solving the issue with grabbing the correct open tick price. My strategy must have the correct open price on both charts.

    Here is what I worked out. It may not be the cleanest way to do it, but I wasn't in the mood to study the Microsoft site.

    private bool xChange = false; //exChange is about to open
    private bool needData = true; //Looking for the true opening price
    private double o = 0; //First tick - true opening price

    protected override void OnBarUpdate()
    {
    if (ToTime(Time[0]) >= 72950 && ToTime(Time[0]) <= 73010)
    {xChange = true;}
    else{xChange = false;}
    //More strategy code below here........
    }
    protected override void OnMarketData(MarketDataEventArgs e)
    {
    if (xChange)
    {
    if (e.MarketDataType == MarketDataType.Last)
    Print("Time = " + e.Time + " " + e.Price);
    if(needData)
    {
    if (i == 1)
    {
    o = e.Price;
    needData = false;
    }
    if (ToTime(e.Time) == 73000)
    {i = 1;}
    }
    }
    }

    insomniac

    Comment


      #17
      I am told that Zen-Fire provides tick timestamps to microsecond precision. When I use e.Time in OnMarketData, I only get timestamps to second precision. How can I make NinjaTrader not chop off the microseconds when it converts the original Zen-Fire tick timestamps to my local PC time?

      Comment


        #18
        honvl, unfortunately it's not supported to access the sub second timestamps programmatically.

        Comment


          #19
          When I use the C# Stopwatch class to time the difference between two OnMarketData events, it seems that the more indicators I have loaded, the greater the minimum difference becomes. This means that OnMarketData is only processed after other tick-based indicators are calculated. What programming methods can I use to assure that a certain indicator or processing loop is given the highest processing priority on an incoming tick?
          Last edited by honvl; 05-01-2009, 04:40 AM.

          Comment


            #20
            Hi honvl, unfortunately there's no method you can use for this.

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by Geovanny Suaza, 02-11-2026, 06:32 PM
            0 responses
            599 views
            0 likes
            Last Post Geovanny Suaza  
            Started by Geovanny Suaza, 02-11-2026, 05:51 PM
            0 responses
            345 views
            1 like
            Last Post Geovanny Suaza  
            Started by Mindset, 02-09-2026, 11:44 AM
            0 responses
            103 views
            0 likes
            Last Post Mindset
            by Mindset
             
            Started by Geovanny Suaza, 02-02-2026, 12:30 PM
            0 responses
            558 views
            1 like
            Last Post Geovanny Suaza  
            Started by RFrosty, 01-28-2026, 06:49 PM
            0 responses
            558 views
            1 like
            Last Post RFrosty
            by RFrosty
             
            Working...
            X