• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

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.



    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 tgordon78, Today, 07:09 AM
      1 response
      7 views
      0 likes
      Last Post NinjaTrader_PatrickG  
      Started by xasser, 05-29-2020, 02:17 PM
      6 responses
      57 views
      0 likes
      Last Post NinjaTrader_Jim  
      Started by weav74, Today, 07:36 AM
      0 responses
      2 views
      0 likes
      Last Post weav74
      by weav74
       
      Started by billythekid72, Today, 07:10 AM
      2 responses
      6 views
      0 likes
      Last Post billythekid72  
      Started by Gav_G, 05-28-2020, 01:23 PM
      3 responses
      19 views
      0 likes
      Last Post NinjaTrader_Jim  
      Working...
      X