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

Order Management system rejecting requests / failed cancellations

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

    Order Management system rejecting requests / failed cancellations

    Hi,

    quick question on the attached error, I think I *may* have solved by amending the ExitShort and ExitLong methods Ive been using, does the error below ever correspond to the strategy attempting to update a position during stoppages in trading etc?

    My question is essentially, during the market pause when the regular session ends and the extended session begins 3:15pm-3:30pm , how does the strategy handle rejections? Do I need to manually account for this, or should Ninjatrader be aware of this based on the predefined instrument trading hours?

    I want to make sure it copes with this gracefully, as , as you can see in the screenshot, I had a case where an order cancellation failed, which led to a position that was completely unmanaged with no risk management whatsoever on it.

    When I unlocked the strategy and began to develop it further in the Ninjascript editor, I notice the scheme for ExitLong for example was:

    ExitLong(string signalName, string fromEntrySignal);

    I originally had the below:

    ExitLong("<NAME OF THE EXIT HERE>", "<NAME OF THE ENTRYSIGNAL HERE>)

    Ive since amended these to simply :

    ExitLong("<NAME OF ENTRY HERE>);

    as per examples in the NT8 referencebase.

    should I have any other concerns? or does the above cover it? thanks.

    #2
    Hello Conall,

    Thank you for the post.

    By default the strategy will not handle rejections, you will see a popup message and the script disables. You can change this using the settings shown in the following link:



    In regard to ExitLong, that really depends on the use case, you can use it in quite a few ways:

    Code:
    ExitLong()
    ExitLong(int quantity) 
    ExitLong(string fromEntrySignal)
    ExitLong(string signalName, string fromEntrySignal)
    ExitLong(int quantity, string signalName, string fromEntrySignal)
    If what you changed to is working, likely your logic is allowing for that use case. The other overload patterns are there to provide flexibility in case the one you used did not fit in with your design pattern. Some users may need to define quantities that always apply or only use one entry, others use multiple entries and the SignalName system so it really depends on the situation. If you only have 1 entry, you don't need to use a SignalName here, the target is smart to know that when using the overload without the signal name. The overload you were using defined a specific name for the target which makes it easier to find later from OnExecutionUpdate or OnOrderUpdate.



    I look forward to being of further assistance.
    JesseNinjaTrader Customer Service

    Comment


      #3
      Hi Jesse, the problem persists. Ive isolated the problem to how my trailing stop is being handled, see attached. Should I log a ticket for this, or what is the best plan to resolve? I feel like this is as simple as the trailing stop can get, am I overlooking something?

      Only 1 lot is being traded at any one time.

      Variable declarations are setup as below:

      Code:
      protected override void OnStateChange()
              {
                  if (State == State.SetDefaults)
                  {
                      Description                                    = @"DEVPROG";
                      Name                                        = "TurtleSystem1StrategyOriginal";
                      Calculate                                    = Calculate.OnBarClose;
                      EntriesPerDirection                            = 1;
                      EntryHandling                                = EntryHandling.AllEntries;
                      IsExitOnSessionCloseStrategy                = true;
                      ExitOnSessionCloseSeconds                    = 30;
                      IsFillLimitOnTouch                            = false;
                      MaximumBarsLookBack                            = MaximumBarsLookBack.TwoHundredFiftySix;
                      OrderFillResolution                            = OrderFillResolution.High;
                      Slippage                                    = 1;
                      StartBehavior                                = StartBehavior.ImmediatelySubmitSynchronizeAccount;
                      TimeInForce                                    = TimeInForce.Gtc;
                      TraceOrders                                    = false;
                      RealtimeErrorHandling                        = RealtimeErrorHandling.StopCancelClose;
                      StopTargetHandling                            = StopTargetHandling.PerEntryExecution;
                      BarsRequiredToTrade                            = 20;
                      // Disable this property for performance gains in Strategy Analyzer optimizations
                      // See the Help Guide for additional information
                      IsInstantiatedOnEachOptimizationIteration    = true;
                      Trailing_Stop                            = 25.0;
                  }
      Trailing stops are setup as below:


      Code:
      else if (State == State.Configure)
                  {
                      //Sets a trailing stop
                      SetTrailStop(CalculationMode.Ticks, Trailing_Stop);
      
                  }

      Comment


        #4
        Hello Conall,

        Thank you for your reply.

        To continue troubleshooting this specifically I will likely need to review the log and trace files in addition to the script. Can you send an email to platform support [at] ninjatrader.com and attach the strategy along with your log and trace files?



        Please follow the steps below to manually attach your log and trace files to your response so I may investigate this matter further.
        1. Open Windows File Explorer (hotkey = Windows key + E) Then navigate to Documents > 'NinjaTrader 8' folder
        2. Right click on the 'log' and 'trace' folders and select Send To> Compressed (zipped) Folder.
        3. Send the 2 compressed folders as attachments to this email.
        4. Once complete, you can delete these compressed folders.
        Please also include a link to this post in your email.


        I look forward to being of further assistance.
        JesseNinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by bortz, 11-06-2023, 08:04 AM
        47 responses
        1,606 views
        0 likes
        Last Post aligator  
        Started by jaybedreamin, Today, 05:56 PM
        0 responses
        9 views
        0 likes
        Last Post jaybedreamin  
        Started by DJ888, 04-16-2024, 06:09 PM
        6 responses
        19 views
        0 likes
        Last Post DJ888
        by DJ888
         
        Started by Jon17, Today, 04:33 PM
        0 responses
        6 views
        0 likes
        Last Post Jon17
        by Jon17
         
        Started by Javierw.ok, Today, 04:12 PM
        0 responses
        15 views
        0 likes
        Last Post Javierw.ok  
        Working...
        X