Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Catch event if position was closed by StopLoss

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

    Catch event if position was closed by StopLoss

    How can i get a signal/event if position was closed by triggered StopLoss?
    How can i detected this?


    cheers,
    Phil

    #2
    Hello PWidera,

    Thanks for your post.

    You can check for the execution name in OnExecutionUpdate(). https://ninjatrader.com/support/help...tionupdate.htm

    If you are using the SetStopLoss method, the execution name would be "Stop loss"

    Example of use:

    protected override void OnExecutionUpdate(Execution execution, string executionId, double price, int quantity, MarketPosition marketPosition, string orderId, DateTime time)
    {
    if (execution.Name == "Stop loss") // note, name syntax must be precise.StopLoss or Stop Loss or stop loss is not Stop loss
    Print(execution.ToString());
    // do something
    }


    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by NullPointStrategies, Yesterday, 05:17 AM
    0 responses
    65 views
    0 likes
    Last Post NullPointStrategies  
    Started by argusthome, 03-08-2026, 10:06 AM
    0 responses
    139 views
    0 likes
    Last Post argusthome  
    Started by NabilKhattabi, 03-06-2026, 11:18 AM
    0 responses
    75 views
    0 likes
    Last Post NabilKhattabi  
    Started by Deep42, 03-06-2026, 12:28 AM
    0 responses
    45 views
    0 likes
    Last Post Deep42
    by Deep42
     
    Started by TheRealMorford, 03-05-2026, 06:15 PM
    0 responses
    50 views
    0 likes
    Last Post TheRealMorford  
    Working...
    X