Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

NT automation issues

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

    #16
    I put into my strategies a print for every incoming bar in OnBarUpdate and found something quite interesting. What I do in the strategy is wait for live bars to start being received. Then once one live bar is received I always print if a bar is live or historical. This ignores startup historical bars when the strategy is first enabled, and then prints out the status of live or new bars. Here is part of today's output:

    [skipped early morning}...
    Live Instrument: TF 06-11, 15 Minute. Time: 3/4/2011 11:15:00 AM Close: 824.1 Bar: 17528
    Live Instrument: 6E 06-11, 15 Minute. Time: 3/4/2011 11:20:00 AM Close: 1.3947 Bar: 20675
    Live Instrument: YG 06-11, 15 Minute. Time: 3/4/2011 11:16:00 AM Close: 1431.6 Bar: 55392
    Live Instrument: ES 06-11, 15 Minute. Time: 3/4/2011 11:30:00 AM Close: 1315.75 Bar: 20489
    Live Instrument: ES 06-11, 60 Minute. Time: 3/4/2011 11:30:00 AM Close: 1315.75 Bar: 5312
    Live Instrument: YG 06-11, 15 Minute. Time: 3/4/2011 11:31:00 AM Close: 1430.9 Bar: 55393
    Live Instrument: 6E 06-11, 15 Minute. Time: 3/4/2011 11:35:00 AM Close: 1.395 Bar: 20676
    Live Instrument: ES 06-11, 15 Minute. Time: 3/4/2011 11:45:00 AM Close: 1318.25 Bar: 20490
    Live Instrument: YG 06-11, 15 Minute. Time: 3/4/2011 11:46:00 AM Close: 1434.1 Bar: 55394
    Live Instrument: 6E 06-11, 15 Minute. Time: 3/4/2011 11:50:00 AM Close: 1.3954 Bar: 20677
    Live Instrument: TF 06-11, 15 Minute. Time: 3/4/2011 11:30:00 AM Close: 822 Bar: 17529
    Live Instrument: TF 06-11, 60 Minute. Time: 3/4/2011 11:30:00 AM Close: 822 Bar: 4545
    Live Instrument: ES 06-11, 15 Minute. Time: 3/4/2011 12:00:00 PM Close: 1314 Bar: 20491
    Live Instrument: TF 06-11, 15 Minute. Time: 3/4/2011 12:00:00 PM Close: 821 Bar: 17530

    Here is the code that produced that:
    In public class Tra******et : Strategy
    {
    bool realTime = false;
    ....

    In protected override void OnBarUpdate()
    {
    // Catch and hold realtime transition
    if( !Historical )
    realTime = true;
    if( realTime ){
    string live = Historical ? "Historical": "Live";
    Print(live + " Instrument: " + Instrument.FullName + ", " + BarsPeriod.Value + " " + BarsPeriod.Id + ". Time: " + Time[0] + " Close: " + Close[0] + " Bar: " + CurrentBar);
    }

    This produced that very useful output above. Note these two lines:
    Live Instrument: 6E 06-11, 15 Minute. Time: 3/4/2011 11:50:00 AM Close: 1.3954 Bar: 20677
    Live Instrument: TF 06-11, 15 Minute. Time: 3/4/2011 11:30:00 AM Close: 822 Bar: 17529

    This means that the OnBarUpdate for TF 06-11, 15 Minute for the 11:30 AM bar came after the 6E 06-11, 15 Minute for the 11:50 bar. I was watching at this time (it was 11:55AM when these updates were printed) and a DOM showed TF 06-11 getting volume and price updates real time. Yesterday I called Vision Financial tech support to ask about this and they said if the DOM is getting price and volume then they are supplying data to NT. It must be NT that is not charting the data!
    Last edited by tradetree; 03-04-2011, 11:29 AM.

    Comment


      #17
      If you are not receiving real time updates for the strategy but are for the DOM, then this could be due to session template applied.

      For the primary series, the session template is the one selected when you run the strategy.

      If a multi-series script adds an additional Bars object that already exists on the chart, the script will use the preexisting series instead of creating a new one to conserve memory. This includes that series' session template as applied from the chart. If the Bars object does not exist on the chart, the session template of the added Bars object will be the default one set for that instrument in the Instrument Manager and not the session template of the primary Bars object.
      Ryan M.NinjaTrader Customer Service

      Comment


        #18
        I'm not sure you got my post. The setup is much simpler than that. I created a chart for TF 06-11, 15min bars. The template in the instrument manager is the default that comes with NT, untouched. The bars on the chart are updating real-time as is the DOM.

        I applied my strategy to this chart which produces the output I posted. The real time bars are printed out for hours in OnBarUpdate(). After a few hours there is one bar, that is supposed to show up at 11:30 that shows up at 11:55. The Time[0] in NT is 11:30, but the real time is 11:55.

        There is no Bars object code or multiple instruments. There is one instrument. The Data Series is set to <use instrument settings>.

        Does that clarify the issue?

        Comment


          #19
          Thank you for your findings. I'm not sure why you are getting that output. I'm not able to reproduce this using your snippet and this is what is needed to move forward.

          Your snippet makes sense logically but it may work better for you to print the value of Historical property directly. The extra bool layer and conditional operator don't make it any simpler. You can also use DateTime.Now to print time stamp of your computer clock. This will allow you to compare output to something more tangible, rather than looking at it relative to bar updates of other series.

          It would also help to clarify the crux of the latest issue you reported. You originally reported that Historical property could erroneously report as true in some circumstances and your latest post suggests something different. Historical (or live?) is reported correctly but the output is not in sync with the bar update? Can you please clarify your understanding of the issue?
          Ryan M.NinjaTrader Customer Service

          Comment


            #20
            I'm glad you mentioned the DateTime.Now as I didn't know about that. Here is a summary of where things are at:
            1) Now that I have visibility into why emails were not going out, they always go out! I don't know why, but the visibility is a major improvement. What was happening before was that it would work for awhile and then one day an important signal would not go out. Now at least I should see this and then I'll post again with the condition under which it happens. I believe that it is related to other posts about data stopping to be received or "Loading data..." stuck on a chart. I have seen that before myself, but now I should see when it is in that condition. So this issue is off the table until another occurrence (and a new post for it).
            2) I will watch the delayed data issue. There are two possibilities. This could be delay from the data provider, or one of the issues I mentioned in #1 above. I have seen a chart just stop updating and it is NOT from the provider, it is in NT. In this case, however, I am using TF which is an ICE instrument and I only get delayed data for ICE. That will change as I will sign up for ICE real-time data. But before you think that was the issue, it is not necessarily. Delayed data should always be delayed, not delay once in awhile. Anyway, I'll post a new thread if there is new information on this one.

            Regarding my code snippet, I am thrilled with it. It may not look simpler, but now I have a "heartbeat" for all my charts on one window. I used to stare at the last bar to see if it was updating. There are many things that can and do go wrong with real-time data if you have many charts and strategies running. Now the heartbeat gives me peace of mind. I actually think NT should roll it into a single call for others to use.
            Last edited by tradetree; 03-06-2011, 05:34 PM.

            Comment


              #21
              tradetree, thanks for the response. I'll have Ryan get back to you tomorrow.
              AustinNinjaTrader Customer Service

              Comment


                #22
                Yes, in this case I would look at possibility of data feed delay. To check for this does not require any programming. Bring up a time and sales window and compare the updates of the last time compared to your computer clock.
                Ryan M.NinjaTrader Customer Service

                Comment


                  #23
                  So the time in this window shows the last trade at the exchange time? So if my computer clock is within 1 min of the time and sales, then there is no delay? If it drifts, so that sometimes there is no delay and sometimes there is a delay, is that because there just are no trades taking place during that time? How do you know if there are trades that you are not getting from the data provider vs. trades that are not taking place at all?

                  Comment


                    #24
                    Yes, Time and Sales window lists time supplied by your data provider for the trades, so you can check if this is out of sync compared to your computer time.

                    You are working in another thread about data updating with Brett, and not using the most liquid contract, which can make analyzing delays difficult. Currently there is constant stream of updates on 03-11, but not on 06-11.
                    Ryan M.NinjaTrader Customer Service

                    Comment

                    Latest Posts

                    Collapse

                    Topics Statistics Last Post
                    Started by geotrades1, Today, 10:02 AM
                    0 responses
                    1 view
                    0 likes
                    Last Post geotrades1  
                    Started by rajendrasubedi2023, Today, 09:50 AM
                    0 responses
                    10 views
                    0 likes
                    Last Post rajendrasubedi2023  
                    Started by ender_wiggum, Today, 09:50 AM
                    0 responses
                    4 views
                    0 likes
                    Last Post ender_wiggum  
                    Started by bmartz, Today, 09:30 AM
                    1 response
                    8 views
                    0 likes
                    Last Post NinjaTrader_Erick  
                    Started by geddyisodin, Today, 05:20 AM
                    3 responses
                    24 views
                    0 likes
                    Last Post NinjaTrader_Gaby  
                    Working...
                    X