Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Unmanaged Approach: Can't find stop loss order

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

    Unmanaged Approach: Can't find stop loss order

    My strategy uses unmanaged approach.

    In realtime/live, and I can find the stop loss order by id or name "stop loss."
    But in strategy analyzer, my stop loss update method always says it cannot find the current stop loss order.
    Example: "Warning: Unable to find current stop loss order. OrderId: NT-00001-2182"

    Also when I try Print($"Total Orders: {Orders.Count}"); it just shows there are 0 orders even though the strategy should still have a stop loss order open. I'm not sure what is going on. As a result, my strategy has one position open until it's forced closed by the market closing.

    How can I manage/update my stop loss order in a way that will be compatible with strategy analyzer?

    Do I need to manage an order object locally? Looks like docs say so, but I had not noticed so far since it worked great on sim/live trading. "It is critical to assign an Order object to keep track of your order or else you will not be able to identify it in your code later since there is no signal tracking when using Unmanaged order methods. Please be aware of the following information about Order objects:"
    Last edited by iantriestrading; 09-19-2024, 01:37 PM.

    #2
    Hello iantriestrading,

    Unfortunately, I'm not understanding what is your code.

    Can you please create a reduced test script with just the code specific to this inquiry (and no other logic)?

    To export a NinjaTrader 8 NinjaScript so this can be shared and imported by the recipient do the following:
    1. Click Tools -> Export -> NinjaScript Add-on...
    2. Click the 'add' link -> check the box(es) for the script(s) and reference(s) you want to include
    3. Click the 'Export' button
    4. Enter the script name in the value for 'File name:'
    5. Choose a save location -> click Save
    6. Click OK to clear the export location message
    By default your exported file will be in the following location:
    • (My) Documents/NinjaTrader 8/bin/Custom/ExportNinjaScript/<export_file_name.zip>
    Below is a link to the help guide on Exporting NinjaScripts.


    Once exported, please attach the file as an attachment to your reply.


    "Do I need to manage an order object locally? Looks like docs say so, but I had not noticed so far since it worked great on sim/live trading. "It is critical to assign an Order object to keep track of your order or else you will not be able to identify it in your code later since there is no signal tracking when using Unmanaged order methods. Please be aware of the following information about Order objects:""

    You can assign an order object to a variable from OnOrderUpdate().
    Chelsea B.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by NullPointStrategies, Today, 05:17 AM
    0 responses
    19 views
    0 likes
    Last Post NullPointStrategies  
    Started by argusthome, 03-08-2026, 10:06 AM
    0 responses
    119 views
    0 likes
    Last Post argusthome  
    Started by NabilKhattabi, 03-06-2026, 11:18 AM
    0 responses
    63 views
    0 likes
    Last Post NabilKhattabi  
    Started by Deep42, 03-06-2026, 12:28 AM
    0 responses
    41 views
    0 likes
    Last Post Deep42
    by Deep42
     
    Started by TheRealMorford, 03-05-2026, 06:15 PM
    0 responses
    45 views
    0 likes
    Last Post TheRealMorford  
    Working...
    X