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.
    JimNinjaTrader Customer Service

    Comment


      #3
      Thanks Jim

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by yeikson89, Today, 02:53 PM
      2 responses
      10 views
      0 likes
      Last Post yeikson89  
      Started by sdauteuil, Today, 01:06 PM
      1 response
      11 views
      0 likes
      Last Post NinjaTrader_Jim  
      Started by trumpy, 03-09-2017, 02:11 PM
      30 responses
      3,224 views
      0 likes
      Last Post foxthorn  
      Started by shani77, Today, 09:58 AM
      1 response
      24 views
      0 likes
      Last Post NinjaTrader_Eleanore  
      Started by cjanau, Yesterday, 11:07 AM
      1 response
      31 views
      0 likes
      Last Post NinjaTrader_ThomasC  
      Working...
      X