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

How to figure out the reason of strategy disabling?

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

    How to figure out the reason of strategy disabling?

    Hello.
    I am encountering strategy disabling on the remote PC.
    It happens after several trades.
    Here what I see in log:

    02/18/2020 09:05:26.322 NinjaScript Custom log: try-catch triggered: error message: Object reference not set to an instance of an object.
    02/18/2020 09:05:26.302 Position Instrument='ES 03-20' Account='U2863734' Average price=0 Quantity=0 Market position=Long Operation=Remove

    02/18/2020 09:05:26.276 Order Order='105028328/U2863734' Name='shrt_sl_5' New state='Accepted' Instrument='ES 03-20' Action='Buy' Limit price=0 Stop price=3392.75 Quantity=1 Type='Stop Market' Time in force=GTC Oco='5February 18, 2020_111_0.835745280532048' Filled=0 Fill price=0 Error='No error' Native error=''

    02/18/2020 09:05:26.214 Order Order='a8fa79f56bf2447bb00ee9b8670ad97b/U2863734' Name='shrt_sl_5' New state='Submitted' Instrument='ES 03-20' Action='Buy' Limit price=0 Stop price=3392.75 Quantity=1 Type='Stop Market' Time in force=GTC Oco='5February 18, 2020_111_0.835745280532048' Filled=0 Fill price=0 Error='No error' Native error=''

    02/18/2020 09:05:26.158 Default Disabling NinjaScript strategy 'Tester/191722611'
    02/18/2020 09:05:26.146 NinjaScript Custom log: [3, ES 03-20] State.Termination
    02/18/2020 09:05:26.134 NinjaScript NinjaScript strategy 'Tester/191722611' submitting order


    The error shown in the very first row happened after strategy was disabled (I suppose, it something in State.Termination, when various objects may be already disposed).
    The same is in logs.

    Is there any way to detect the reason why strategy becomes disabled?

    Can I do something to distinguish these reasons:
    - manual disabling the strategy on chart;
    - manual disabling the strategy in ControlCenter grid;
    - disabling the strategy because of run-time errors;
    - disabling the strategy because of disconnection;
    - disabling of the strategy because of the wrong order price;
    - ... any other cool adventures ?

    Thank you.
    fx.practic
    NinjaTrader Ecosystem Vendor - fx.practic

    #2
    Hello fx.practic,

    From the error it shows something you used was null so that would be a good start at locating the problem to locate objects you have used which can be null.

    I can also see you have some custom logging mentioning a try/catch. That would also be a good place to start looking, or also completely remove that and allow NinjaTrader to just handle the exception. Generally we do not suggest using try/catch as that may allow the script to continue execution beyond the error causing difficulty in locating it.

    Is there any way to detect the reason why strategy becomes disabled?
    That would generally just be the error you see output in the log or ninjascript output window, in this case it is because of a null object. .Object reference not set to an instance of an object.

    Can I do something to distinguish these reasons:
    - manual disabling the strategy on chart;
    - manual disabling the strategy in ControlCenter grid;
    - disabling the strategy because of run-time errors;
    - disabling the strategy because of disconnection;
    - disabling of the strategy because of the wrong order price;
    - ... any other cool adventures ?

    Not necessarily, if the strategy is disabled you will only see that it was terminated. The only areas you could further explore in these items would be a connection loss or a rejected order, those have specific overrides and options. Other errors that physically disable the strategy will just try to call its terminated state.

    Please let me know if I may be of further assistance.



    JesseNinjaTrader Customer Service

    Comment


      #3
      Thank you, Jesse. The answer is clear.
      fx.practic
      NinjaTrader Ecosystem Vendor - fx.practic

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by Irukandji, Today, 04:58 AM
      0 responses
      0 views
      0 likes
      Last Post Irukandji  
      Started by fitspressoburnfat, Today, 04:25 AM
      0 responses
      2 views
      0 likes
      Last Post fitspressoburnfat  
      Started by Skifree, Today, 03:41 AM
      1 response
      4 views
      0 likes
      Last Post Skifree
      by Skifree
       
      Started by usazencort, Today, 01:16 AM
      0 responses
      1 view
      0 likes
      Last Post usazencort  
      Started by kaywai, 09-01-2023, 08:44 PM
      5 responses
      604 views
      0 likes
      Last Post NinjaTrader_Jason  
      Working...
      X