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

Need Clarification on this issue

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

    Need Clarification on this issue


    For the stop order you would need to debug your code to only access valid (defined) index value for the trace error you posted -

    2010-01-15 12:40:47:871 Index was out of range. Must be non-negative and less than the size of the collection.
    Parameter name: index

    Bertrand

    Could you please be more specific, I'm not following you here? I'm not indexing anything (no multitimeframe, no mutli instruments). What does this Index value refer to?

    #2
    Bertrand has left for the day however, the exception simply means that you tried to access a collection with an index number that is outside of the number of items in the collection.

    See this Tip for a better explanation - http://www.ninjatrader-support2.com/...ead.php?t=3170

    If this does not help, let us know and Bert will be back on Monday.
    RayNinjaTrader Customer Service

    Comment


      #3
      Ray

      Here is the problem from earlier that I'm wresling with that I hope you can shead some light on:

      I'm programming a bracket order manager where I'm looking to submit separate BuyStopLoss (long) and SellStopLoss (Short) orders. I have an Iorder defined for order type. However, the system is generating an error when I submit the secod stoploss order. It's clearly possible to have two working stoploss orders as I can do this of off chart trader. So how can I create two working stoploss orders?

      2010-01-15 12:40:47:652 (IB) Cbi.Connection.ProcessEventArgs.OrderStatusEventAr gs: Order='793d9c8e4f26401c8a34d21547a53d87/Sim101' Name='STPLong2010-01-15 12:40:47.574' New State=Initialized Instrument='6B 03-10' Action=Buy Limit price=0 Stop price=1.6259 Quantity=1 Type=Stop Filled=0 Fill price=0 Error=NoError Native error=''
      2010-01-15 12:40:47:668 (IB) Cbi.Order.Update1: oldid='793d9c8e4f26401c8a34d21547a53d87' Order='793d9c8e4f26401c8a34d21547a53d87/Sim101' Name='STPLong2010-01-15 12:40:47.574' New State=Initialized Instrument='6B 03-10' Action=Buy Limit price=0 Stop price=1.6259 Quantity=1 Type=Stop Filled=0 Fill price=0 Error=NoError Native error=''
      2010-01-15 12:40:47:683 (IB) Cbi.Order.Submit: Order='793d9c8e4f26401c8a34d21547a53d87/Sim101' Name='STPLong2010-01-15 12:40:47.574' State=Initialized Instrument='6B 03-10' Action=Buy Limit price=0 Stop price=1.6259 Quantity=1 Strategy='AMKTassassin2' Type=Stop Tif=Gtc Oco='' Filled=0 Fill price=0 Token='15adb90273304a849b729e9af791f7c0' Gtd='12/1/2099 12:00:00 AM'
      2010-01-15 12:40:47:683 (IB) Cbi.Simulator.Submit: Order='793d9c8e4f26401c8a34d21547a53d87/Sim101' Name='STPLong2010-01-15 12:40:47.574' State=Initialized Instrument='6B 03-10' Action=Buy Limit price=0 Stop price=1.6259 Quantity=1 Strategy='AMKTassassin2' Type=Stop Tif=Gtc Oco='' Filled=0 Fill price=0 Token='15adb90273304a849b729e9af791f7c0' Gtd='12/1/2099 12:00:00 AM'
      2010-01-15 12:40:47:683 (IB) Cbi.Connection.ProcessEventArgs.OrderStatusEventAr gs: Order='15adb90273304a849b729e9af791f7c0/Sim101' Name='STPLong2010-01-15 12:40:47.574' New State=PendingSubmit Instrument='6B 03-10' Action=Buy Limit price=0 Stop price=1.6259 Quantity=1 Type=Stop Filled=0 Fill price=0 Error=NoError Native error=''
      2010-01-15 12:40:47:683 (IB) Cbi.Order.Update1: oldid='793d9c8e4f26401c8a34d21547a53d87' Order='15adb90273304a849b729e9af791f7c0/Sim101' Name='STPLong2010-01-15 12:40:47.574' New State=PendingSubmit Instrument='6B 03-10' Action=Buy Limit price=0 Stop price=1.6259 Quantity=1 Type=Stop Filled=0 Fill price=0 Error=NoError Native error=''


      2010-01-15 12:40:47:777 in OnUnhandledThreadException
      2010-01-15 12:40:47:871 ********* exception trapped *********
      2010-01-15 12:40:47:871 Index was out of range. Must be non-negative and less than the size of the collection.
      Parameter name: index
      2010-01-15 12:40:47:871 at System.Collections.ArrayList.get_Item(Int32 index)
      at NinjaTrader.Indicator.TimeSeriesHelper.get_Item(In t32 barsAgo)
      at NinjaTrader.Strategy.StrategyBase.PlaceOrder(Int32 selectedBarsInProgress, Boolean liveUntilCancelled, Action action, OrderType orderType, Int32 quantity, Double limitPrice, Double stopPrice, String signalName, String fromEntrySignal, String oco, Boolean simStop)
      at NinjaTrader.Strategy.StrategyBase.EnterShortStop(I nt32 barsInProgressIndex, Boolean liveUntilCancelled, Int32 quantity, Double stopPrice, String signalName)
      at NinjaTrader.Strategy.AMKTassassin2.InputAlert_Plac eBrac****rderHandler(Object sender, EventArgs e)
      at NinjaMKTAssassin2.NinjaToFrom.button35_Click(Objec t sender, EventArgs e)
      at System.Windows.Forms.Control.OnClick(EventArgs e)
      at System.Windows.Forms.Button.OnClick(EventArgs e)
      at System.Windows.Forms.Button.OnMouseUp(MouseEventAr gs mevent)
      at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
      at System.Windows.Forms.Control.WndProc(Message& m)
      at System.Windows.Forms.ButtonBase.WndProc(Message& m)
      at System.Windows.Forms.Button.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)
      2010-01-15 12:40:48:011 (IB) Cbi.OrderStatusEventArgs.Process: Order='793d9c8e4f26401c8a34d21547a53d87/Sim101' Name='STPLong2010-01-15 12:40:47.574' New State=Initialized Instrument='6B 03-10' Action=Buy Limit price=0 Stop price=1.6259 Quantity=1 Type=Stop Filled=0 Fill price=0 Error=NoError Native error=''
      2010-01-15 12:40:48:027 (IB) Cbi.OrderStatusEventArgs.Process: Order='15adb90273304a849b729e9af791f7c0/Sim101' Name='STPLong2010-01-15 12:40:47.574' New State=PendingSubmit Instrument='6B 03-10' Action=Buy Limit price=0 Stop price=1.6259 Quantity=1 Type=Stop Filled=0 Fill price=0 Error=NoError Native error=''
      2010-01-15 12:40:48:199 (IB) Cbi.Connection.ProcessEventArgs.OrderStatusEventAr gs: Order='15adb90273304a849b729e9af791f7c0/Sim101' Name='STPLong2010-01-15 12:40:47.574' New State=Accepted Instrument='6B 03-10' Action=Buy Limit price=0 Stop price=1.6259 Quantity=1 Type=Stop Filled=0 Fill price=0 Error=NoError Native error=''
      2010-01-15 12:40:48:199 (IB) Cbi.Order.Update1: oldid='15adb90273304a849b729e9af791f7c0' Order='15adb90273304a849b729e9af791f7c0/Sim101' Name='STPLong2010-01-15 12:40:47.574' New State=Accepted Instrument='6B 03-10' Action=Buy Limit price=0 Stop price=1.6259 Quantity=1 Type=Stop Filled=0 Fill price=0 Error=NoError Native error=''
      2010-01-15 12:40:48:199 (IB) Cbi.OrderStatusEventArgs.Process: Order='15adb90273304a849b729e9af791f7c0/Sim101' Name='STPLong2010-01-15 12:40:47.574' New State=Accepted Instrument='6B 03-10' Action=Buy Limit price=0 Stop price=1.6259 Quantity=1 Type=Stop Filled=0 Fill price=0 Error=NoError Native error=''

      Comment


        #4
        boreland, it doesn't look like you're trying to access an array.. the call stack almost makes it look like the error comes from the order submission itself. Would you mind posting the code that generates the error either here on the forum or in an email to support @ ninjatrader . com attention 'thread 24760'? I would like to further analyze this. Thank you.
        AustinNinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by DT215, 01-14-2023, 07:59 PM
        4 responses
        132 views
        1 like
        Last Post NinjaTrader_BrandonH  
        Started by ETFVoyageur, Yesterday, 12:52 AM
        2 responses
        32 views
        0 likes
        Last Post NinjaTrader_BrandonH  
        Started by Skifree, Yesterday, 02:50 PM
        1 response
        12 views
        0 likes
        Last Post NinjaTrader_Kimberly  
        Started by owen5819, Yesterday, 02:24 PM
        2 responses
        16 views
        0 likes
        Last Post NinjaTrader_BrandonH  
        Started by ETFVoyageur, Yesterday, 10:13 PM
        2 responses
        20 views
        0 likes
        Last Post NinjaTrader_BrandonH  
        Working...
        X