Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Identify if an order has an associated stop loss

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

    Identify if an order has an associated stop loss

    Hello,

    Is it possible in Ninjascript to identify if a position has an associated stop loss order? I use a stop loss in some instances and not in some. If I knew whether a particular position has an associated stop loss, I can do things differently. For example, maybe I would like to set a stop limit order at a point when I feel I could get the best price for the position. If the position has an associated stop order, the exit<>stoplimit orders are rejected. Due to the asynchronous nature of the feedback (of rejection of the order), it is too late for me to do anything about it. I tried keeping track of this in global variables, etc., but that is poor programming and source of bugs. Instead, if there was a way to ask the position object itself whether there is an associated stop loss and the stop loss price, one can determine next steps much more easily.

    Thanks.

    PR

    #2
    Hello,

    Yes, this is possible by using the IOrder class.

    Please see our Reference Sample on Monitoring Stop-Loss and Profit Target orders:

    MatthewNinjaTrader Product Management

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by SalmaTrader, 07-07-2026, 10:26 PM
    0 responses
    47 views
    0 likes
    Last Post SalmaTrader  
    Started by CarlTrading, 07-05-2026, 01:16 PM
    0 responses
    22 views
    0 likes
    Last Post CarlTrading  
    Started by CaptainJack, 06-17-2026, 10:32 AM
    0 responses
    15 views
    0 likes
    Last Post CaptainJack  
    Started by kinfxhk, 06-17-2026, 04:15 AM
    0 responses
    21 views
    0 likes
    Last Post kinfxhk
    by kinfxhk
     
    Started by kinfxhk, 06-17-2026, 04:06 AM
    0 responses
    23 views
    0 likes
    Last Post kinfxhk
    by kinfxhk
     
    Working...
    X