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

Strategy suddenly stopping

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

    Strategy suddenly stopping

    Hi,

    In some of my backtest cases, the execution of a strategy will suddenly stop. I'm wondering if it's related to RealtimeErrorHandling.

    Here's what I see in my debugging output:

    2/28/2008 7:00:00 AM Entered internal SetStopTarget() method: Type=Stop FromEntrySignal='' Mode=Price Value=15.75 Currency=0 Simulated=False
    2/28/2008 7:00:00 AM Amended stop order: Order='NT-00001/Back101' Name='Stop loss' State=Working Instrument='ABH' Action=Sell Limit price=0 Stop price=15.75 Quantity=100 Strategy='ProtectDown' Type=Stop Tif=Gtc Oco='NT-00000' Filled=0 Fill price=0 Token='18121809b90642918fd6e5d11c8401a4' Gtd='12/1/2099 12:00:00 AM'
    2/28/2008 7:00:00 AM Entered internal PlaceOrder() method at 2/28/2008 7:00:00 AM: Action=Sell OrderType=Market Quantity=0 LimitPrice=0 StopPrice=0 SignalName='' FromEntrySignal=''
    2/28/2008 7:00:00 AM Cancelled pending exit order, since associated position is closed: Order='NT-00001/Back101' Name='Stop loss' State=Working Instrument='ABH' Action=Sell Limit price=0 Stop price=15.75 Quantity=100 Strategy='ProtectDown' Type=Stop Tif=Gtc Oco='NT-00000' Filled=0 Fill price=0 Token='18121809b90642918fd6e5d11c8401a4' Gtd='12/1/2099 12:00:00 AM'
    I acknowledge there's probably a bug in my code here, since I shouldn't ExitLongAtLimit() and ExitLong() within the same bar... but the response is a little odd.

    I get this one last call in my OnOrderUpdate handler:
    Received cancelled order: Order='NT-00001/Back101' Name='Stop loss' State=Cancelled Instrument='ABH' Action=Sell Limit price=0 Stop price=15.75 Quantity=100 Strategy='ProtectDown' Type=Stop Tif=Gtc Oco='NT-00000' Filled=0 Fill price=0 Token='18121809b90642918fd6e5d11c8401a4' Gtd='12/1/2099 12:00:00 AM'
    ... and then the execution has simply stopped. OnBarUpdate is no longer called.

    I know the docs for RealTimeErrorHandling mentions stopping the strategy (by default) if there is a rejected order... what about during back-testing? What if there's an error in exits as in this case? Could it be the cause for the strategy simply "ending"?

    #2
    And there are no errors in the Control Center log tab just to double check?
    RayNinjaTrader Customer Service

    Comment


      #3
      You're a pro, Ray... that's exactly the issue.

      "Reference not set to an instance of an object." I don't really see how that could be happening, but I'll double check.

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by Segwin, 05-07-2018, 02:15 PM
      14 responses
      1,789 views
      0 likes
      Last Post aligator  
      Started by Jimmyk, 01-26-2018, 05:19 AM
      6 responses
      837 views
      0 likes
      Last Post emuns
      by emuns
       
      Started by jxs_xrj, 01-12-2020, 09:49 AM
      6 responses
      3,293 views
      1 like
      Last Post jgualdronc  
      Started by Touch-Ups, Today, 10:36 AM
      0 responses
      13 views
      0 likes
      Last Post Touch-Ups  
      Started by geddyisodin, 04-25-2024, 05:20 AM
      11 responses
      63 views
      0 likes
      Last Post halgo_boulder  
      Working...
      X