Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

BUG - NullReferenceException on SubmitOrderUnmanaged

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

    BUG - NullReferenceException on SubmitOrderUnmanaged

    Submitting an Order using SubmitOrderUnmanaged using a quantity of zero results in an unhandled NullReferenceException and a StackTrace which makes it hard to identify the source of the issue.

    The SubmitOrderUnmanaged method has a very long signature (which is quite poor from an API point of view tbh) and it took me a while to figure out that I had got two of the parameters mixed up and was trying to submit an order for Zero currency. The parameters should be validated and give meaningful error messages if they are not correct rather than causing an unhandled exception further up the stack in the TimeSeries class.





    Enabling NinjaScript strategy 'TruffleHogForex5000/55154578' : On starting a real-time strategy - StartBehavior=ImmediatelySubmit EntryHandling=All entries EntriesPerDirection=100 StopTargetHandling=Per entry execution ErrorHandling=Stop strategy, cancel orders, close positions ExitOnSessionClose=False SetOrderQuantityBy=Strategy ConnectionLossHandling=Recalculate DisconnectDelaySeconds=10 CancelEntriesOnStrategyDisable=False CancelExitsOnStrategyDisable=False Calculate=On each tick IsUnmanaged=True MaxRestarts=4 in 5 minutes
    2000 Intermediate Timeframe Bars have been received. Dispatching to Intermediate Pipeline for processing
    Finished processing Intermediate Timeframe bars
    2000 Higher Timeframe Bars have been received. Dispatching to Higher Pipeline for processing
    Finished processing Higher Timeframe bars
    Submitting Long Trade: OrderDetails: Long Quantity:4589 Entry:1.58846 Stop:1.58752 Target:1.59025
    Submitting Order:
    OrderDetails: Long Quantity:4589 Entry:1.58846 Stop:1.58752 Target:1.59025
    02/10/2015 11:11:58 Strategy 'TruffleHogForex5000/55154578': Entered internal SubmitOrderUnmanaged() method at 02/10/2015 11:11:58: BarsInProgress=0 Action=Buy OrderType=Market Quantity=0 LimitPrice=0 StopPrice=0 SignalName='longentry'
    State has transitioned to termination state
    Disabling NinjaScript strategy 'TruffleHogForex5000/55154578'
    System.NullReferenceException: Object reference not set to an instance of an object.
    at NinjaTrader.NinjaScript.TimeSeries.get_Count()
    at NinjaTrader.NinjaScript.TimeSeries.get_Item(Int32 barsAgo)
    at NinjaTrader.NinjaScript.StrategyBase.SubmitOrderUn managed(Int32 selectedBarsInProgress, OrderAction orderAction, OrderType orderType, Int32 quantity, Double limitPrice, Double stopPrice, String oco, String signalName)
    at NinjaTrader.Custom.MyProjects.TruffleHog.Trading.T radeInitiator.SubmitOrder(OrderDetails details) in c:\Users\kevin\Documents\NinjaTrader 8\bin\Custom\Strategies\__temp_Trading_TradeInitia tor.cs:line 90
    at NinjaTrader.Custom.MyProjects.TruffleHog.Trading.T radeInitiator.InitiateLTFTrade() in c:\Users\kevin\Documents\NinjaTrader 8\bin\Custom\Strategies\__temp_Trading_TradeInitia tor.cs:line 60
    at NinjaTrader.NinjaScript.Strategies.TruffleHogForex 5000.OnBarUpdate() in c:\Users\kevin\Documents\NinjaTrader 8\bin\Custom\Strategies\__temp_TruffleHog_TruffleH ogForex5000.cs:line 299
    The Current Thread ID is 28
    FXCMRatesProxy grabbing Rates

    #2
    Hello reach4thelasers,

    Thank you for reporting.

    Would you mind sending over your Log and Trace files via Help > Email Support?
    Please reference this thread in the e-mail: "http://ninjatrader.com/support/forum/showthread.php?t=78760"

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by pechtri, 06-22-2023, 02:31 AM
    10 responses
    124 views
    0 likes
    Last Post Leeroy_Jenkins  
    Started by judysamnt7, 03-13-2023, 09:11 AM
    4 responses
    59 views
    0 likes
    Last Post DynamicTest  
    Started by ScottWalsh, Yesterday, 06:52 PM
    4 responses
    36 views
    0 likes
    Last Post ScottWalsh  
    Started by olisav57, Yesterday, 07:39 PM
    0 responses
    7 views
    0 likes
    Last Post olisav57  
    Started by trilliantrader, Yesterday, 03:01 PM
    2 responses
    22 views
    0 likes
    Last Post helpwanted  
    Working...
    X