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 CarlTrading, 03-31-2026, 09:41 PM
    1 response
    67 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Started by CarlTrading, 04-01-2026, 02:41 AM
    0 responses
    36 views
    0 likes
    Last Post CarlTrading  
    Started by CaptainJack, 03-31-2026, 11:44 PM
    0 responses
    60 views
    1 like
    Last Post CaptainJack  
    Started by CarlTrading, 03-30-2026, 11:51 AM
    0 responses
    62 views
    0 likes
    Last Post CarlTrading  
    Started by CarlTrading, 03-30-2026, 11:48 AM
    0 responses
    53 views
    0 likes
    Last Post CarlTrading  
    Working...
    X