Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Strategy Analyzer Bug

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

    Strategy Analyzer Bug

    Hello,

    I'm experiencing a bug with the Strategy Analyzer that began happening today. This happens with any backtest.

    I am able to run the backtest just fine, but I receive the standard "NinjaTrader has detected a problem and needs to shut down." dialog when I click on any of the following tabs:

    Chart
    Graphs
    Executions
    Trades
    Periods
    Orders

    The Summary and Settings tabs to not generate this error. The Chart and Graphs tabs function correctly after clicking 'OK', but the Executions, Trades, Periods and Orders tabs never populate with any data.

    The trace data is as follows:

    2009-07-18 15:32:45:512 in OnUnhandledThreadException
    2009-07-18 15:32:45:512 ********* exception trapped *********
    2009-07-18 15:32:45:512 Index was outside the bounds of the array.
    2009-07-18 15:32:45:512 at NinjaTrader.Gui.PerformanceViewerControl.RunBackTe st()
    at NinjaTrader.Gui.PerformanceViewerControl.Display()
    at NinjaTrader.Gui.PerformanceViewerControl.OnTabSele cted(Object sender, EventArgs e)
    at System.EventHandler.Invoke(Object sender, EventArgs e)
    at System.Windows.Forms.TabControl.OnSelectedIndexCha nged(EventArgs e)
    at System.Windows.Forms.TabControl.WmSelChange()
    at System.Windows.Forms.TabControl.WndProc(Message& m)
    at System.Windows.Forms.Control.ControlNativeWindow.O nMessage(Message& m)
    at System.Windows.Forms.Control.ControlNativeWindow.W ndProc(Message& m)
    at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

    I've tried the following to troubleshoot this error:

    * Reset the DB
    * Repair the DB
    * Re-compile NinjaTrader.Custom.dll
    * Restart NinjaTrader
    * Restart my computer
    * Clear and reload the historical data

    What can I do to alleviate this problem?

    Thanks!

    #2
    Hello Marc,

    Thank you for your post.

    Can you please try renaming your database so that NinjaTrader uses a new one?


    1. Shut Down NinjaTrader
    2. Go to \Documents\NinjaTrader6.5\db
    3. Rename the file NinjaTrader.mbd to OldNinjaTrader.mbd
    Ray S.NinjaTrader Customer Service

    Comment


      #3
      Hello,

      Thank you for the reply. Unfortunately, that did not remedy the problem.

      Best,

      Marc

      Comment


        #4
        Originally posted by marc.newlin View Post
        Hello,

        Thank you for the reply. Unfortunately, that did not remedy the problem.

        Best,

        Marc
        1.) Please make sure you are on the latest version of NinjaTrader 6.5.1000.11. You can check under Help --> About.
        If not, please download from this link: http://www.ninjatrader.com/webnew/do...g_software.htm

        2.) Can you test if this issue persists on the "SampleMACrossover" strategy? If yes, please give me the details of the backtest so I can try to reproduce.

        -Does the issue seem to be only with one strategy, or any strategy?

        Thank you!
        Ray S.NinjaTrader Customer Service

        Comment


          #5
          Hello,

          Thank you again for the prompt replies on the weekend. It only occurs with a specific strategy I've been working on this weekend. (I wasn't aware of that before trying one of the included strategies.)

          I was under the assumption that because no exceptions were raised when the backtest was being run that the problem was outside the scope of my strategy.

          I'll debug the problem and will post a reply to this thread when I determine the specific cause.

          Thanks,

          Marc

          Comment


            #6
            Hello,

            I was able to remedy the problem, but I do not understand what effect the specific change I made had.

            The following code was in the Initialize() method:

            Code:
                       
            if (Instrument.FullName == "$EURCAD")
            {
                // 1 Minute
                SetProfitTarget("ETB.0", CalculationMode.Ticks, 4 * TicksPerPip);
                SetStopLoss("ETB.0", CalculationMode.Ticks, 25 * TicksPerPip, false);
            
                // 2 Minutes
                SetProfitTarget("ETB.1", CalculationMode.Ticks, 5 * TicksPerPip);
                SetStopLoss("ETB.1", CalculationMode.Ticks, 25 * TicksPerPip, false);
            
                // 5 Minutes
                SetProfitTarget("ETB.2", CalculationMode.Ticks, 5 * TicksPerPip);
                SetStopLoss("ETB.2", CalculationMode.Ticks, 30 * TicksPerPip, false);
            
                // 10 Minutes
                SetProfitTarget("ETB.3", CalculationMode.Ticks, 10 * TicksPerPip);
                SetStopLoss("ETB.3", CalculationMode.Ticks, 35 * TicksPerPip, false);
            
                Add(PeriodType.Minute, 2);
                Add(PeriodType.Minute, 5);
                Add(PeriodType.Minute, 10);
            }
            Changing it to this prevented the bug from occurring:

            Code:
                       
            if (Instrument.FullName == "$EURCAD")
            {
                // 1 Minute
                SetProfitTarget("ETB.0", CalculationMode.Ticks, 4 * TicksPerPip);
                SetStopLoss("ETB.0", CalculationMode.Ticks, 25 * TicksPerPip, false);
            
                // 2 Minutes
                SetProfitTarget("ETB.1", CalculationMode.Ticks, 5 * TicksPerPip);
                SetStopLoss("ETB.1", CalculationMode.Ticks, 25 * TicksPerPip, false);
            
                // 5 Minutes
                SetProfitTarget("ETB.2", CalculationMode.Ticks, 5 * TicksPerPip);
                SetStopLoss("ETB.2", CalculationMode.Ticks, 30 * TicksPerPip, false);
            
                // 10 Minutes
                SetProfitTarget("ETB.3", CalculationMode.Ticks, 10 * TicksPerPip);
                SetStopLoss("ETB.3", CalculationMode.Ticks, 35 * TicksPerPip, false);
            }
            
            Add(PeriodType.Minute, 2);
            Add(PeriodType.Minute, 5);
            Add(PeriodType.Minute, 10);
            The if statement was evaluating to True and the three calls to Add() were being executed when the error was occurring. Also, the Summary page shows the same results for both cases.

            Do you have any insight as to why this might be causing this bug? I would prefer to have the calls to Add() in the if block, as I have logic for other instruments in Initialize() that require different timeframes.

            Thanks,

            Marc

            Comment


              #7
              Marc, thanks for the reply - have you tried moving the if (Instrument) block to the start of the OnBarUpdate() and then just leaving the Add() part in the Initialize()?
              BertrandNinjaTrader Customer Service

              Comment


                #8
                Hello,

                Unfortunately I need to have the instrument if block in Initialize() because I add different timeframes based on the instrument. Please see this pseudo-code as an example:

                IF Instrument.FullName == "$EURUSD"
                Add (PeriodType.Minute, 1)
                Add (PeriodType.Minute, 2)
                ENDIF

                IF Instrument.FullName == "$EURCAD"
                Add (PeriodType.Minute, 3)
                Add (PeriodType.Minute, 4)
                ENDIF

                So, unfortunately, the if logic needs to be in Initialize(). I will instead just add all of the timeframes to each instrument and add logic to OnBarUpdate() to ignore the unnecessary ones.

                Thanks,

                Marc

                Comment


                  #9
                  marc.newlin,

                  Unfortunately you will most likely not be able to do such kind of "dynamic" adding instruments in Initialize().
                  Josh P.NinjaTrader Customer Service

                  Comment


                    #10
                    No problem, I was assuming I just didn't completely understand how NinjaTrader handles adding instruments.

                    Comment

                    Latest Posts

                    Collapse

                    Topics Statistics Last Post
                    Started by dtaylor, 08-07-2022, 09:43 PM
                    3 responses
                    577 views
                    0 likes
                    Last Post psangram  
                    Started by edward_steve12, Today, 03:23 AM
                    1 response
                    3 views
                    0 likes
                    Last Post Emma1
                    by Emma1
                     
                    Started by joseph_kuruvilla12, Today, 01:01 AM
                    1 response
                    7 views
                    0 likes
                    Last Post Emma1
                    by Emma1
                     
                    Started by samish18, Today, 04:01 AM
                    1 response
                    4 views
                    0 likes
                    Last Post Emma1
                    by Emma1
                     
                    Started by greenberet, Today, 04:05 AM
                    0 responses
                    3 views
                    0 likes
                    Last Post greenberet  
                    Working...
                    X