Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

ExitLongLimit and System.IndexOutOfRangeException

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

    ExitLongLimit and System.IndexOutOfRangeException

    Hello all,
    our ts works fine except this situation.
    If connection go down and after a few minute go up, if we call ExitLongLimit we receive an System.IndexOutOfRangeException.
    Here an example about instruction

    double dblExitPrice= somevalue;

    ExitLongLimit(0,true,1,dblExitPrice,this.Name + "_ExitLongLimit","");

    We noted this, if we remove a strategy and after re-add it, problem doesn't happen

    Complete Error was:
    System.IndexOutOfRangeException: Indice oltre i limiti della matrice.
    in NinjaTrader.Strategy.StrategyBase.PlaceOrder(Int32 selectedBarsInProgress, Boolean liveUntilCancelled, OrderAction action, OrderType orderType, Int32 quantity, Double limitPrice, Double stopPrice, String signalName, String fromEntrySignal, String oco, Boolean simStop)
    in NinjaTrader.Strategy.StrategyBase.ExitLongLimit(In t32 barsInProgressIndex, Boolean liveUntilCancelled, Int32 quantity, Double limitPrice, String signalName, String fromEntrySignal)
    in NinjaTrader.Strategy.TS_Break_DAX_2_6.Trade_Enter( String Tipo, String NomeEntrata)

    What can we do?
    Thank you

    #2
    Hello Simone,

    What are the results of the exception message when running try catch blocks on this line:

    Ryan M.NinjaTrader Customer Service

    Comment


      #3
      Originally posted by NinjaTrader_RyanM View Post
      Hello Simone,

      What are the results of the exception message when running try catch blocks on this line:

      http://www.ninjatrader.com/support/f...ead.php?t=9825

      I already used "try and catch" and print the Message in the output..
      I post you the Message in italian because we are using an italian os..
      We don't found nothing In the log of ninja, but using TraceOrders=True, before the error, in the output we noted:

      Entered internal PlaceOrder() method at 15/12/2010 19.17.18: BarsInProgress=0 Action=Sell OrderType=Limit Quantity=1 LimitPrice=7013,5 StopPrice=0 SignalName='TS_Break_DAX_2_6_ExitLongLimit' FromEntrySignal=''

      And after

      System.IndexOutOfRangeException: Indice oltre i limiti della matrice.
      in NinjaTrader.Strategy.StrategyBase.PlaceOrder(Int32 selectedBarsInProgress, Boolean liveUntilCancelled, OrderAction action, OrderType orderType, Int32 quantity, Double limitPrice, Double stopPrice, String signalName, String fromEntrySignal, String oco, Boolean simStop)
      in NinjaTrader.Strategy.StrategyBase.ExitLongLimit(In t32 barsInProgressIndex, Boolean liveUntilCancelled, Int32 quantity, Double limitPrice, String signalName, String fromEntrySignal)
      in NinjaTrader.Strategy.TS_Break_DAX_2_6.Trade_Enter( String Tipo, String NomeEntrata)

      Thank you

      Comment


        #4
        Is there any improvement if you don't use this.Name in this statement?
        Ryan M.NinjaTrader Customer Service

        Comment


          #5
          Originally posted by NinjaTrader_RyanM View Post
          Is there any improvement if you don't use this.Name in this statement?
          Considering that we have a lot of strategies running at the same time, we use "this.name" to differentiate orders..I will try to use instead of "this.name" a constant..
          This is a bug?
          After I will send you a feedback..

          Comment


            #6
            Thanks for checking into that. I'll try on my side here as well. Please provide the steps needed to see an issue with this statement. Is it anytime this statement is called after a disconnect / reconnect or does the strategy have to be setup a certain way?
            Ryan M.NinjaTrader Customer Service

            Comment


              #7
              Originally posted by NinjaTrader_RyanM View Post
              Thanks for checking into that. I'll try on my side here as well. Please provide the steps needed to see an issue with this statement. Is it anytime this statement is called after a disconnect / reconnect or does the strategy have to be setup a certain way?
              In the option we used Handling=KeepRunning..
              One consideration: the error explain us that we used an index outside array, but this.Name is only a property!

              Thank you

              Comment


                #8
                Simone, is there any stripped down version of the strategy we could run here on our end to reproduce and look into?

                Thanks,
                BertrandNinjaTrader Customer Service

                Comment


                  #9
                  Hello there,

                  Could this thread be solved? Would be very helpful to hear about the reason for the error here.
                  I have currently a pretty similar problem with this index out of range error happening in ExitLongStop/ExitShortStop also within PlaceOrder().

                  Thx, Peter

                  Comment


                    #10
                    Hi Peter,

                    The error is a generic one when accessing objects that don't exist. Can you share what you're using and we will give a run here?
                    Ryan M.NinjaTrader Customer Service

                    Comment


                      #11
                      Ryan,

                      Thx I am trying to solve that topic already with Brett on another thread. Let's keep it there:


                      Just thought my error is very similar to this one, not sure anymore...

                      Best, Peter

                      Comment


                        #12
                        Originally posted by NinjaTrader_Bertrand View Post
                        Simone, is there any stripped down version of the strategy we could run here on our end to reproduce and look into?

                        Thanks,

                        Hi,
                        To replicate problem, I create a new strategy for you.
                        I'm using FDAX with AMP connection, timeframe 1 minute

                        Please follow next steps.
                        1) open strategy and change datEnter with now +5min and datExit with now+10 min and after build strategy
                        2) close NT
                        3) run NT
                        4) connect data
                        5) enable strategy
                        6) wait as soon ts will be in position (1 Long + 1 Stoploss)
                        7) disconnect data
                        8) reconnect data
                        9) enable ts
                        10) after few minutes, when datetime of pc>=datExit, TS will send ExitLongLimit. This operation will generate except that will be displayed in the window output

                        If you retried omitting 7/8/9 step..all work fine

                        please check
                        thank you
                        Attached Files

                        Comment


                          #13
                          Thanks Simone. Will test this on Monday when there is a live feed to work from. I will also need all the strategy settings at run time as well as under tools > Options > Strategies > NinjaScript tab. Screenshots of these two would be helpful.
                          Ryan M.NinjaTrader Customer Service

                          Comment


                            #14
                            Originally posted by NinjaTrader_RyanM View Post
                            Thanks Simone. Will test this on Monday when there is a live feed to work from. I will also need all the strategy settings at run time as well as under tools > Options > Strategies > NinjaScript tab. Screenshots of these two would be helpful.
                            In attached you can find screenshoot
                            Thanks
                            Attached Files

                            Comment


                              #15
                              Thanks again for the details Simone, will test this next week on live data and update you then on our findings - thanks for the patience and enjoy your weekend.
                              BertrandNinjaTrader Customer Service

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by sidlercom80, 10-28-2023, 08:49 AM
                              173 responses
                              2,363 views
                              0 likes
                              Last Post jeronymite  
                              Started by Mindset, Today, 10:38 PM
                              0 responses
                              7 views
                              0 likes
                              Last Post Mindset
                              by Mindset
                               
                              Started by JesseOffshore, Today, 09:40 PM
                              0 responses
                              4 views
                              0 likes
                              Last Post JesseOffshore  
                              Started by WHICKED, 04-26-2024, 12:56 PM
                              4 responses
                              141 views
                              0 likes
                              Last Post WHICKED
                              by WHICKED
                               
                              Started by ezrollin, 02-26-2022, 11:14 PM
                              7 responses
                              207 views
                              0 likes
                              Last Post kenz987
                              by kenz987
                               
                              Working...
                              X