Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

NT8B4 - Playback-MR - Unhandled Exception: ...

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

    NT8B4 - Playback-MR - Unhandled Exception: ...

    Unhandled Exception - Exception has been thrown by the target of an invocation.


    About the only thing I know - is that I had ES 12-14 maximized, was flipping between browsers on full screen (IE/FireFox/CHR0ME)

    Playback-MR continued on and is still working.

    This Playback-MR is about 10 months in of the 19 months.

    It didn't happen before.


    Code:
    2015-09-13 22:39:55:214 (Playback Connection) Cbi.Account.AccountItemCallback: account='Playback101' accountItem=CashValue currency=UsDollar value=*****
    2015-09-13 22:39:55:214 (Playback Connection) Cbi.Account.AccountItemCallback: account='Playback101' accountItem=GrossRealizedProfitLoss currency=UsDollar value=*****
    2015-09-13 22:39:55:214 (Playback Connection) Cbi.Account.AccountItemCallback: account='Playback101' accountItem=RealizedProfitLoss currency=UsDollar value=*****
    2015-09-13 22:39:55:214 (Playback Connection) Cbi.Account.PositionUpdateCallback: instrument='ES 12-14' account='Playback101' avgPrice=0 quantity=0 marketPosition=Flat operation=Remove
    2015-09-13 22:39:55:225 *************** unhandled exception trapped ***************
    2015-09-13 22:39:55:225 Exception has been thrown by the target of an invocation.
    2015-09-13 22:39:55:234 System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.IndexOutOfRangeException: Index was outside the bounds of the array.
       at NinjaTrader.NinjaScript.StrategyBase.get_Position()
       at NinjaTrader.Core.Globals.FormatCurrency(Double value, StrategyBase strategy)
       at NinjaTrader.Gui.NinjaScript.StrategiesGrid.<OnPositionUpdate>b__66_0(PositionEventArgs e)
       --- End of inner exception stack trace ---
       at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
       at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)
       at System.Delegate.DynamicInvokeImpl(Object[] args)
       at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
       at MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, Delegate catchHandler)
    2015-09-13 22:40:07:719 (Playback Connection) Cbi.Account.Submit0: orderId='68295f2638d94a589cbd188021addb5e'
    Attached Files

    #2
    Hi sledge,

    Does this occur again if you replay this same time period? If so, does it happen in exactly the same spot in the replay data?
    <span class="name">Alex C.</span><span class="title">NinjaTrader Customer Service</span><iframe name="sig" id="sigFrame" src="/support/forum/core/clientscript/Signature/signature.php" frameborder="0" border="0" cellspacing="0" style="border-style: none;width: 100%; height: 120px;"></iframe>

    Comment


      #3
      First and only time.

      Comment


        #4
        Hi sledge,

        It isn't quite enough to go on for a bug report, but I will test this on my end and see if I can duplicate. Let me know if this creeps up again.
        <span class="name">Alex C.</span><span class="title">NinjaTrader Customer Service</span><iframe name="sig" id="sigFrame" src="/support/forum/core/clientscript/Signature/signature.php" frameborder="0" border="0" cellspacing="0" style="border-style: none;width: 100%; height: 120px;"></iframe>

        Comment


          #5
          It doesn't exactly look like my code threw the exception.

          Comment


            #6
            Nt8b6

            Originally posted by NinjaTrader_AlexC View Post
            Hi sledge,

            It isn't quite enough to go on for a bug report, but I will test this on my end and see if I can duplicate. Let me know if this creeps up again.
            It's creeped up again. NT8B6.

            It happened 2 times, and on the same exact trade on each separate chart. 09-01-2015 (ES 09-15). (These strategies are very similar).

            This was a 8 ES contract replay in tabs from ES 03-14 to ES 12-15 in NT8B6 on Windows 10 32bit, overnight replay.. I wasn't even around when it happened (That's not to say MS wasn't around snooping on my machine).

            My OnPositionUpdate code is rather meaningless since I couldn't get it to work at all in NT8B2 or 3, I forget. I just went with a work around and never got back to seeing if it works.

            This OnPositionUpdate is hit many of times during the whole replay, and has been called in other instances for this day.

            My Output1 Window shows that a print for each strategy, "2 OnPositionUpdate.MarketPosition=LONG"...

            The day appears to have replayed fine and replay continued until completion. (Around 215 trades, (There's no execution count so I have no idea on that side).

            The only thing I see different is this one is an UPDATE instead of previous INSERT.

            After I save off my results and before I change my strategies, I'll rerun that entire week before and after and see if it shows up again in the same spot.



            Code:
            2015-11-11 18:01:24:815 (Playback Connection) NinjaScript.StrategyBase.Process.PositionEventArgs.Filtered: instrument='ES 09-15' account='Playback101' avgPrice=xxxx.25 quantity=2 marketPosition=Long operation=Update
            2015-11-11 18:01:24:833 *************** unhandled exception trapped ***************
            2015-11-11 18:01:24:833 Exception has been thrown by the target of an invocation.
            2015-11-11 18:01:24:833 System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.IndexOutOfRangeException: Index was outside the bounds of the array.
               at NinjaTrader.NinjaScript.StrategyBase.get_Position()
               at NinjaTrader.Core.Globals.FormatCurrency(Double value, StrategyBase strategy)
               at NinjaTrader.Gui.NinjaScript.StrategiesGrid.<OnPositionUpdate>b__66_0(PositionEventArgs e)
               --- End of inner exception stack trace ---
               at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
               at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)
               at System.Delegate.DynamicInvokeImpl(Object[] args)
               at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
               at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)
            2015-11-11 18:01:25:409 (Playback Connection) Cbi.CustomOrder.OnMarketData.IsSimulatedStopEnabled.Submit: orderId='c4193a5293c9487f96875369c5736b64' account='Playback101' name='Stop loss' orderState=TriggerPending instrument='ES 09-15' orderAction=BuyToCover orderType='Stop Market' limitPrice=0 stopPrice=yyyy.75 quantity=1 tif=Gtc oco='a247c319bd52458f8a4fdd81a0b5f693' filled=0 averageFillPrice=0 id=5019 gtd='2099-12-01'
            Code:
            protected override void OnPositionUpdate(Position position, double averagePrice, int quantity,
            
            MarketPosition marketPosition )
            
            {
            
            
            
            //Print ( "1a marketPosition=" + marketPosition.ToString() );
            
            	//Print ( "1b position.MarketPosition=" + position.MarketPosition.ToString() );
            
            	
            
            if ( marketPosition == MarketPosition.Flat )
            
            //if (marketPosition.ToString()[0] == 'F' )
            
            	//if (position.MarketPosition == MarketPosition.Flat)
            
            {
            
            //Print ( "2 OnPositionUpdate.MarketPosition=" + "FLAT" );
             
            
            
            PositionStatus = FLAT;
            
            Print ( ToDay (Time[0]) + "," + ToTime(Time[0]) + ",ES," + "Flat" + Closes[ES][0] );
            
            
            
            /*
            
            Print ( "SysPerf.AllTrades.Count=" + SystemPerformance.AllTrades.Count );
            
            Print ( "SysPerf.RTTrades.Count =" + SystemPerformance.RealTimeTrades.Count );
            
            if (SystemPerformance.AllTrades.Count > 0)
            
            {
            
            Trade lastTrade = SystemPerformance.AllTrades[TotalTrades-1];
            
            //Trade lastTrade = SystemPerformance.AllTrades[SystemPerformance.AllTrades.Count - 1];
            
            //Trade firstTrade = Performance.AllTrades.LosingTrades[0];
            
            Print ( "LastTrade was "+ lastTrade.ProfitPoints );
            
            }
            
            */
            
            }
            
            else if (marketPosition == MarketPosition.Long)
            
            //else if (marketPosition.ToString()[0] == 'L' )
            
            	//else if (position.MarketPosition == MarketPosition.Long)
            
            {
            
            Print ( "2 OnPositionUpdate.MarketPosition=" + "LONG" );
            
            
            
            PositionStatus = LONG;
            
            //NumberOfTrades ++;
            
            }
            
            else if (marketPosition == MarketPosition.Short)
            
            //else if (marketPosition.ToString()[0] == 'S' )
            
            	//else if (position.MarketPosition == MarketPosition.Short)
            
            {
            
            Print ( "2 OnPositionUpdate.MarketPosition=" + "SHORT" );
            
            PositionStatus = SHORT;
            
            //NumberOfTrades ++;
            
            }
            
            
            
            }

            Comment


              #7
              Hello sledge,

              Can you please create a working sample script that can duplicate the Unhandled Exception error appearing so we may test on our end?
              Zachary G.NinjaTrader Customer Service

              Comment


                #8
                Originally posted by NinjaTrader_ZacharyG View Post
                Hello sledge,

                Can you please create a working sample script that can duplicate the Unhandled Exception error appearing so we may test on our end?
                Well, I finally saved off my replay results... and started to retest.

                I replayed from 8-31-2015.. nothing...

                I replayed 1 week before ES 09-15 to current.. NOTHING..

                I started a replay from 1/20/2014... results in 18 hours or so (which is impressive considering this is a quad core Intel Atom Z3735F @ 1.33GHz.... It crushes any advanced machinery in NT7 in replay.

                Comment


                  #9
                  Originally posted by NinjaTrader_ZacharyG View Post
                  Hello sledge,

                  Can you please create a working sample script that can duplicate the Unhandled Exception error appearing so we may test on our end?
                  I did an entire 20 months retest and the error was not reproduced.

                  Beats me.

                  Comment


                    #10
                    Hello sledge,

                    Please, let me know if this occurs again. If it does occur, please send both the strategy and your log and trace files to platformsupport [AT] ninjatrader [DOT] com with a link to this thread and my name referenced so I may investigate further.
                    Zachary G.NinjaTrader Customer Service

                    Comment


                      #11
                      Originally posted by NinjaTrader_ZacharyG View Post
                      Hello sledge,

                      Please, let me know if this occurs again. If it does occur, please send both the strategy and your log and trace files to platformsupport [AT] ninjatrader [DOT] com with a link to this thread and my name referenced so I may investigate further.
                      It's happended again. .last 2 nights.

                      On a week old laptop with clean ntb6 install and imported nt8 market replay data... I'm in about my 10th replay or more .....

                      Anyways after seeing it last night, I did this tonight and it happened again. ..

                      1.. connect to replay
                      2.. add a several strategies to es 03-14(chart)
                      3.. start replay
                      4.. add those same strategies to es 06-14 to es 12-15(chart,because we know there are no results in charts like nt7 unless we do this way) and then enable all in strategy tab.

                      That was how I got the error tonight.. night have been how i got it previous night. .

                      Will pay more attention to this. ..and hopefully other people can too

                      Comment


                        #12
                        Hello sledge,

                        I am unable to reproduce this on my end.

                        When utilizing Playback, is Market Replay or Historical selected?

                        Are you able to reproduce this on two charts of the same instrument and contract month? Or, does this only occur when utilizing two different contract months on the same instrument?

                        Is this reliably reproducible on your end with the steps you have provided?
                        Zachary G.NinjaTrader Customer Service

                        Comment


                          #13
                          For what it's worth, I've seen this exact same error when using Playback (B7), maybe 50 times or so (at different times, timeframes, symbols, and for different calendar times/days). I click OK and it goes away, and Playback keeps chugging along (using Historical data).

                          I don't have a fix or specific repro steps, it doesn't affect continued Playback or results. Don't think sending in logs or strats will help either - just pound on Playback for a while and it seems to crop up. I know that may not be a big help, but just thought I'd let you (and NT) know it's not just you.

                          I've been doing a lot of Playback strategy testing over the last few weeks, on NT7 and NT8. Love the Historical tick playback, especially since Market Replay has only 1-second granularity. I'll help track the bugs if I can; the tool, performance results screen, and all that are very nice and insightful. If we can iron out the wrinkles, then great.

                          Comment


                            #14
                            I have not seen it in Windows10 (and I have beat the crap out of this machine with Playback-Market Replay), but on a new Windows7 64bit laptop with only fresh install of NT8B8, I have encountered it once again.

                            I had the same charts up, and ran the same exact strategy. Come to think about it - the results were off by <$1,000, so it may have affected results.




                            Code:
                            ******************* Session Start (Version 8.0.0.8) *******************
                            2016-02-05 22:04:43:455 InstallDir='C:\Program Files (x86)\NinjaTrader 8\'
                            2016-02-05 22:04:43:455 UserDataDir='C:\Users\ninja2015\Documents\NinjaTrader 8\'
                            2016-02-05 22:04:43:455 MachineID='wouldn't you like to know'
                            2016-02-05 22:04:43:455 OS='Microsoft Windows NT 6.1.7601 Service Pack 1'/'Win32NT'
                            2016-02-05 22:04:43:471 Processors=8
                            2016-02-05 22:04:43:471 PhysicalMemory=16384 MB
                            2016-02-05 22:04:43:471 .NET/CLR Version='4.0.30319.42000'/64bit
                            2016-02-05 22:04:43:471 SqlCeVersion='4.0.8482.1'
                            2016-02-05 22:04:43:471 ApplicationTimezone=EST +0 hour(s)
                            2016-02-05 22:04:43:471 LocalTimezone=EST +0 hour(s)
                            2016-02-05 22:04:43:502 DirectX Rendering=HW
                            2016-02-05 22:04:43:502 Deleting temporary files...
                            2016-02-05 22:04:43:877 Copying db and custom assemblies...
                            2016-02-05 22:04:43:986 Loading custom assemblies...
                            2016-02-05 22:04:43:986 Loading C:\Users\ninja2015\Documents\NinjaTrader 8\bin\Custom\NinjaTrader.Custom.dll...
                            2016-02-05 22:04:44:033 Loading C:\Users\ninja2015\Documents\NinjaTrader 8\bin\Custom\NinjaTrader.Vendor.dll...
                            ....
                            Code:
                            2016-02-05 23:02:16:247 (Playback Connection) Cbi.Account.PositionUpdateCallback: instrument='ES 06-14' account='Playback101' avgPrice=1872.75 quantity=10 marketPosition=Long operation=Add
                            2016-02-05 23:02:16:250 (Playback Connection) Cbi.Account.AccountItemCallback: account='Playback101' accountItem=BuyingPower currency=UsDollar value=*****
                            2016-02-05 23:02:16:250 (Playback Connection) Cbi.Account.AccountItemCallback: account='Playback101' accountItem=CashValue currency=UsDollar value=*****
                            2016-02-05 23:02:16:250 (Playback Connection) Cbi.Account.AccountItemCallback: account='Playback101' accountItem=GrossRealizedProfitLoss currency=UsDollar value=*****
                            2016-02-05 23:02:16:250 (Playback Connection) Cbi.Account.AccountItemCallback: account='Playback101' accountItem=RealizedProfitLoss currency=UsDollar value=*****
                            [B]2016-02-05 23:02:17:071 ERROR: Error in realtime market data handling: System.IndexOutOfRangeException: Index was outside the bounds of the array.    at NinjaTrader.NinjaScript.StrategyBase.get_Position()    at NinjaTrader.Core.Globals.FormatCurrency(Double value, StrategyBase strategy)    at NinjaTrader.Gui.NinjaScript.StrategiesGrid.OnRealDataTimerTick(Object sender, EventArgs e)    at NinjaTrader.Cbi.Instrument.<>c__DisplayClass180_0.<OnRealtimeDataTimerElapsed>b__1(SubscribedThread[] threads, Int32 i, RealtimeEvents evts)[/B]
                            2016-02-05 23:02:21:973 (Playback Connection) Cbi.Simulator.Fill1: thread='26' orderId='15756dc480c84dc7b9ff9f4678af67f8' maxFillQuantity='0' price='1879'
                            Attached Files

                            Comment


                              #15
                              Originally posted by Icehouse View Post
                              For what it's worth, I've seen this exact same error when using Playback (B7), maybe 50 times or so (at different times, timeframes, symbols, and for different calendar times/days). I click OK and it goes away, and Playback keeps chugging along (using Historical data).

                              I don't have a fix or specific repro steps, it doesn't affect continued Playback or results. Don't think sending in logs or strats will help either - just pound on Playback for a while and it seems to crop up. I know that may not be a big help, but just thought I'd let you (and NT) know it's not just you.

                              I've been doing a lot of Playback strategy testing over the last few weeks, on NT7 and NT8. Love the Historical tick playback, especially since Market Replay has only 1-second granularity. I'll help track the bugs if I can; the tool, performance results screen, and all that are very nice and insightful. If we can iron out the wrinkles, then great.
                              Can you post which Windows version you are using?

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by Karado58, 11-26-2012, 02:57 PM
                              8 responses
                              14,826 views
                              0 likes
                              Last Post Option Whisperer  
                              Started by Option Whisperer, Today, 09:05 AM
                              0 responses
                              1 view
                              0 likes
                              Last Post Option Whisperer  
                              Started by cre8able, Yesterday, 01:16 PM
                              3 responses
                              11 views
                              0 likes
                              Last Post cre8able  
                              Started by Harry, 05-02-2018, 01:54 PM
                              10 responses
                              3,204 views
                              0 likes
                              Last Post tharton3  
                              Started by ChartTourist, Today, 08:22 AM
                              0 responses
                              6 views
                              0 likes
                              Last Post ChartTourist  
                              Working...
                              X