Announcement

Collapse
No announcement yet.

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.



    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 NullPointStrategies, Today, 05:17 AM
      0 responses
      44 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
      65 views
      0 likes
      Last Post NabilKhattabi  
      Started by Deep42, 03-06-2026, 12:28 AM
      0 responses
      42 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