Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

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 Jonafare, 12-06-2012, 03:48 PM
      5 responses
      3,986 views
      0 likes
      Last Post rene69851  
      Started by Fitspressorest, Today, 01:38 PM
      0 responses
      2 views
      0 likes
      Last Post Fitspressorest  
      Started by Jonker, Today, 01:19 PM
      0 responses
      2 views
      0 likes
      Last Post Jonker
      by Jonker
       
      Started by futtrader, Today, 01:16 PM
      0 responses
      8 views
      0 likes
      Last Post futtrader  
      Started by Segwin, 05-07-2018, 02:15 PM
      14 responses
      1,792 views
      0 likes
      Last Post aligator  
      Working...
      X