Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Notification on StopCancelClose

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

    Notification on StopCancelClose

    Hello,
    I'd like to get notified say via:
    Code:
    SendMail()
    , when a running strategy is terminated for any reason, via the default:
    Code:
    RealtimeErrorHandling.StopCancelClose;
    Thanks for your help!

    #2
    Hello aaadetos,

    Thanks for your message.

    SendMail must be called from State.Realtime, so I may suggest the following:
    1. Set RealtimeErrorHandling to IgnoreAllErrors
    2. In OnOrderUpdate, check for orders that reach a state of OrderState.Terminated or if the order returns an error ErrorCode other than ErrorCode.NoError. (This will trap rejections and order errors so we can Stop the Strategy, Cancel Orders, and Close Positions as would be done with RealtimeErrorHandling.StopCancelClose.)
    3. When the order error or rejection is trapped, call SendMail(), and then call CloseStrategy()
    This will allow the strategy to call SendMail while still in State.Realtime, and then go back to the standard CloseStrategy behaviors.

    SendMail() - https://ninjatrader.com/support/help.../?sendmail.htm

    CloseStrategy() - https://ninjatrader.com/support/help...sestrategy.htm

    OnOrderUpdate() - https://ninjatrader.com/support/help...rderupdate.htm

    We look forward to assisting.

    Comment


      #3
      Thanks Jim

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by NullPointStrategies, Today, 05:17 AM
      0 responses
      41 views
      0 likes
      Last Post NullPointStrategies  
      Started by argusthome, 03-08-2026, 10:06 AM
      0 responses
      124 views
      0 likes
      Last Post argusthome  
      Started by NabilKhattabi, 03-06-2026, 11:18 AM
      0 responses
      64 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
      46 views
      0 likes
      Last Post TheRealMorford  
      Working...
      X