Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Strategy Analyzer bug

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

    Strategy Analyzer bug

    For example, add
    Code:
    double close = Close[1];
    to OnBarUpdate() like
    Code:
    protected override void OnBarUpdate()
    		{
    			if (CurrentBar < BarsRequiredToTrade)
    				return;
    
                double close = Close[1];
    
                if (CrossAbove(smaFast, smaSlow, 1))
    			    EnterLong();
    			else if (CrossBelow(smaFast, smaSlow, 1))
    			    EnterShort();
    		}
    in @SampleMACrossOver.cs.
    Set "TickReplay" to true, "Order Fill Resolution" to High and his "Type" to Tick.
    After the first execution, everything seems normal, but after the second time we have an Exception and broken tick history.
    2016-09-16 09:57:33:458|3|4|Failed to call 'Add' method: System.NullReferenceException: Object reference not set to an instance of an object.
    at NinjaTrader.Data.BarsSeries.GetTime(Int32 index)
    at NinjaTrader.Data.Bars.GetTime(Int32 index)
    at NinjaTrader.NinjaScript.NinjaScriptBase.Update(Int 32 idx, Int32 bip)
    at NinjaTrader.NinjaScript.NinjaScriptBase.<>c__Displ ayClass447_2.<TickReplayOrUpdate>b__2(Object s, BarsUpdateEventArgs o)
    at NinjaTrader.Data.BarsSeries.Add(Bars bars, Double open, Double high, Double low, Double close, DateTime time, Int64 volume, Double tickSize, Boolean isBar, Double bid, Double ask)

    #2
    Hello alexr,

    Thanks for your post.

    What datafeed are you using?
    What instrument did you use for the strategy test?
    What start/end dates did you use?
    Paul H.NinjaTrader Customer Service

    Comment


      #3
      Specifically, in this case
      1. CQG
      2. 6E, 6B...
      3. 08.01.16 - 09.14.16
      In principle, the September contract on the 6E, it is going anywhere.

      This happens not only on my machine. My friends have the same problem.
      Last edited by alexr; 09-16-2016, 07:49 AM.

      Comment


        #4
        After downloading historical data, the first pass occurs successfully. Second, too, but there is an exception. The third test is not passed.

        Comment


          #5
          Hello alexr,

          Thanks for your replies.

          I've tried numerous times but have not been able to recreate the issue.

          As a check, please confirm you are using NT8RC1 (8.0.0.13), this can be found by looking at Help>About.

          Assuming you are using RC1 (8.0.0.13), to further replicate on my end:
          1) Please create a chart and save it as a template
          2) Please create/save a strategy template
          You can post here in the thread or if you prefer, feel free to send them via e-mail to PlatformSupport[at]Ninjatrader[dot]com Mark the e-mail Atten:Paul and a link to this thread.
          Paul H.NinjaTrader Customer Service

          Comment


            #6
            Hello, Paul.

            I've some free time for answer. I prepared all, and... there are no errors. Everything works perfectly. If errors will appear again, I'll let you know immediately.

            Comment


              #7
              Everything was fine, it was again the same.

              Up. I use RC1.
              Attached Files
              Last edited by alexr; 09-19-2016, 04:14 AM.

              Comment


                #8
                Hi Paul

                I have the exact same issue mentioned here

                Error Description
                Exactly the same as mentioned in this thread

                NinjaTrader version
                8.0.0.13 64-bit (Standard) - Release Candidate 1
                I use NinjaTrader brokerage

                Symptoms
                While testing with the Strategy Analyzer using the date range 4 January 2016 to 4 January 2016 (I.E 1 day) I run into the error

                Instrument: ES
                Price based on: Last
                Type: Tick
                Value: 2000
                Tick Replay: True

                Historical Fill Resolution: High
                Type: Tick
                Value: 1
                Sometimes the error appears after several test runs other times after the first test run.

                Steps attempted to isolate my code VS NinjaTrader core code
                When the error pops up, I've commented out all my code from OnBarUpdate() and OnMarketData()

                I.E my code is not executed but the OnBarUpdate and OnMarketData function calls remain.

                This ensures that the issue is with NinjaTrader and not in my code

                Workaround
                Restarting NinjaTrader does not fix it.
                The only workaround appears to be to change the date range in the Strategy Analyzer when the issue pops up.
                To illustrate this, say you test with data from 1 January to 10 January.
                When the problems pops up, change the date range to 1 January to 11 January and the problem goes away for a few test runs before appearing again.

                My guess
                It seems to be that something is cached, I.E the data being read during the test run gets corrupted or misaligned somehow and the fix clears the cache?
                Last edited by LazyLizzard; 09-28-2016, 04:01 AM.

                Comment


                  #9
                  Hello LazyLizzard,

                  Thanks for your post and the helpful details of your process.

                  We are still investigating the original posters report and will add your information to that investigative report.

                  We will update this thread when we have further information.
                  Paul H.NinjaTrader Customer Service

                  Comment


                    #10
                    I think the problems reported might be due to some inconsistencies in data-load facilities of RC1.
                    I have found that these inconsistencies can be triggered by 'junk ticks' (especially -1 or perhaps 0).
                    I suspect that these inconsistencies are caused by exceptions at a lower level of data-load, which are sometimes silently handled by higher levels of data-load (no error logged but get gaps in data, as in reloading minute chart with bad ticks), and sometimes not handled by higher levels (exception generated as perhaps happens in Tick Replay in original post).

                    For example until SFT-1581 is implemented I have to remove bad rows from Historical Data every day to prevent problems.
                    My data gets loaded into the chart OK real-time regardless of the bad ticks. This seems to be because the Trading Hours for the instrument defines a trading gap where the bad ticks usually arrive. However if I close NT (saving workspace) and restart it the chart will reload with huge gaps in some dates next to where these junk ticks were recorded.
                    For example I was running a chart USDJPY 75min which was displaying fine with no data gaps, until I had to restart NT. Then a gap appeared from 00:45 8 Sep 2016 to 23:00 same day. I found that if I deleted the junk minute rows (-1 prices) timed at 22:05 and 22:10 then re-opened the chart, then all the 'lost' minute data would re-appear.
                    If I try to run a strategy without removing these junk ticks it will likely take a different position to what live-loaded chart indicators suggest, This is because there will be large gaps in the data loaded by the strategy, causing its indicators to have completely different values to the live-loaded chart values.
                    I have not reported this data-load problem before since it seems so inconsistent.

                    Examples of inconsistencies:
                    Data gaps don't occur in load on every date which has junk ticks.
                    Also they do not occur with all time frames or all 'trading hours' (I found using Default 24x7 meant no data gaps with 75 minute bars, however using Forex did cause data gaps).
                    Also which dates (with junk ticks) get data gaps seems to vary depending on how many previous dates have been loaded (varies if different start dates are used).

                    Since I cant find a consistent pattern in the problem I just currently use the tedious workaround of deleting all junk rows before re-loading any data into any part of NT.

                    Its possible that alexr was originally getting an exception caused by junk ticks when loading from some kind of cache in NT, but later the data-supplier cleaned their historical data to remove the junk.

                    The next release of NT needs to be able to deal with junk ticks, my suggestions:
                    1) Dont allow any more in.
                    2) Provide a facility for automated removal of existing junk ticks in Historical Data.
                    or if you cant do 1 & 2 then
                    3) Test all variations of data load to ensure they simply skip junk ticks (and junk Historical Data rows) without producing exceptions or side effects like skipping lots of good data (causing data gaps).

                    Comment

                    Latest Posts

                    Collapse

                    Topics Statistics Last Post
                    Started by junkone, 04-21-2024, 07:17 AM
                    10 responses
                    148 views
                    0 likes
                    Last Post NinjaTrader_BrandonH  
                    Started by tsantospinto, 04-12-2024, 07:04 PM
                    6 responses
                    99 views
                    0 likes
                    Last Post tsantospinto  
                    Started by rocketman7, Today, 02:12 AM
                    5 responses
                    26 views
                    0 likes
                    Last Post NinjaTrader_ChelseaB  
                    Started by ZenCortexReal, Today, 08:54 AM
                    0 responses
                    1 view
                    0 likes
                    Last Post ZenCortexReal  
                    Started by ZenCortexReal, Today, 08:52 AM
                    0 responses
                    0 views
                    0 likes
                    Last Post ZenCortexReal  
                    Working...
                    X