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 condorhero, Today, 09:28 PM
      0 responses
      5 views
      0 likes
      Last Post condorhero  
      Started by MaraAnkh, Today, 08:44 PM
      0 responses
      6 views
      0 likes
      Last Post MaraAnkh  
      Started by wooofad, Today, 05:38 PM
      0 responses
      7 views
      0 likes
      Last Post wooofad
      by wooofad
       
      Started by caacapital, Today, 10:10 AM
      2 responses
      18 views
      0 likes
      Last Post caacapital  
      Started by DiverG20, Today, 10:23 AM
      0 responses
      23 views
      0 likes
      Last Post DiverG20  
      Working...
      X