Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Testing strategies for months and just came across this situation

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

    Testing strategies for months and just came across this situation

    Hi folks,

    Ok. I have been testing 5-10 strategies for a couple months now and all is good but I came across a condition of fast-moving markets where stops were trying to be placed above or be market but they could not be because the market was moving so fast. Namely...this started triggering exactly at 8:30 am est during the CPI release. As a result, it also started canceling all orders and shutting down/disabling the strategies too. See this example 10-second clip of notices https://www.screencast.com/t/FERxUfRx This is extremely rare from what I have observed but when it happens it can cause decent losses because it does not continue trading to recover but just shuts down the strategy.

    What are some methods I might employ with Strategy Builder to not allow the strategies to disable but continue working to place trades per the strategy during those kinds of conditions? What do people normally do other than not trading the strategies during news events of course?

    What are our options to try to mitigate this?

    Or, comments and ideas etc on how others adapt for these kinds of situations?

    I am working to make the strategy self adapt without my presence ultimately (i.e. non-attended).



    Greg

    #2
    Hello Greg,

    Thanks for your note.

    What you have experienced is the strategy's RealtimeErrorHandling behavior kicking in when an order is rejected. The default behavior is Stop Cancel Close, which means if an order is rejected, the strategy will stop/disable, cancel any remaining orders, and then close any open positions. Using the Strategy Builder, this behavior may not be adjusted. You could try using wider stops/targets that are further from the market price if you plan to trade in times of high volume and volatility in order to avoid rejections for being on the wrong side of the market. Otherwise, you would need to unlock the strategy and code it manually in the NinjaScript Editor to change the RealtimeErrorHandling. For more information about RealtimeErrorHandling, please see the help guide page here:


    As noted on that page, user defined rejection handling is advanced and should only be addressed by experienced programmers. If you change the error handling from the default setting, it requires programming your own rejection/error handling in OnOrderUpdate().

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

    Comment


      #3
      NinjaTrader_Emily Thanks. Can you please ask the devs to allow to change this using Strategy Builder? I mean I can unlock it but then I can not quickly edit it as I want on the fly in the Strategy Builder and would be locked into editing code direct on other things. It seems like it would be a logical and easy thing to allow us to change (they could put a double or triple check on it to be sure the user wants to overide). Thoughts?

      Comment


        #4
        Hello birdog,

        You can set the Real-time Error Handling in the Default Properties screen of the Strategy Builder.
        Last edited by KonstantinosNT; 02-15-2023, 09:33 AM.

        Comment


          #5
          Hello KonstantinosNT,

          Thank you for your note.

          Greg, I apologize for the inaccurate information. It is correct that you may change the Real-time error handling in the Default Properties screen:


          That being said, although you may change it from the Strategy Builder you should still do so at your own discretion; as I mentioned previously, "If you change the error handling from the default setting, it requires programming your own rejection/error handling in OnOrderUpdate()." When you are using the Strategy Builder, you do not have the option to add logic to OnOrderUpdate() so you may not add your own rejection handling. This would still require an unlocked script in the NinjaScript Editor to add your own handling of rejections.

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

          Comment


            #6
            NinjaTrader_Emily Thanks for the correction. Ok. Understood. That being said, could you ask the devs to consider allowing it in the Strategy Builder in the future so we do not have to switch between locking and unlocking if and when we choose to stay in the Strategy Builder?

            I will test it though regardless with what we have.

            Thanks also KonstantinosNT Do you have a any other ideas/thoughts regarding rejection/error handling if using it with only the Strategy Builder as well perhaps?



            Greg

            Comment


              #7
              Hello Greg,

              Thank you for your reply.

              Just to clarify, there is no option to switch between locking and unlocking; once a script from the Strategy Builder is unlocked to edit in the NinjaScript Editor, it can no longer be locked again to use in the Strategy Builder. RealtimeErrorHandling is something you may adjust from the Strategy Builder. If you are requesting the ability to define custom rejection handling, that requires the OnOrderUpdate() method which is too complex to add to the Strategy Builder. It requires advanced order handling which is not possible through the layout of the Strategy Builder. The Strategy Builder is intended for non-programmers and for simple to medium complexity types of strategies. As such, the Strategy Builder has limitations and boundaries to help ensure that the code produced will compile and run within the managed order side.

              Please let us know if we may be of further assistance.

              Comment


                #8
                NinjaTrader_Emily There is. I have to to make a copy of it and unlock and do changes and then go back to my non-unlocked version and do the same etc. That is what I meant. That is what I would like to avoid having to do going back and forth like that. Thanks though. Ok.

                Comment


                  #9
                  NinjaTrader_Emily On this if I choose this option instead of the middle one https://www.screencast.com/t/dcRDGJisR0 would that allow for the original errors I explained above to not happen during those conditions? If so, I can test it more...I just want to be sure my test is a reasonable assumption first.

                  Comment


                    #10
                    Hello Greg,

                    Thank you for your note.

                    With the option "Stop strategy, cancel orders, close positions, ignore order rejections" this means that if an order is rejected, no additional action will be taken. The help guide defines this option as "Will perform default behavior on all errors except order rejections." If there are any error messages, then the strategy will stop, cancel, close. The messages you got previously were about an OCO ID that can't be reused, which were error rejections and would be ignored. The orders could still potentially be rejected with the third option, but the strategy will remain enabled if an order is rejected.

                    Please let us know if we may be of further assistance.

                    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