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

Stop price can't be changed below the market

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

    Stop price can't be changed below the market

    Good day!

    Dear support, plese help me with this error:
    Playback101, Stop price can't be changed below the market. affected Order: BuyToCover 1 StopMarket @ 1668,1
    Strategy '******' submitted an order that generated the following error 'Unable to change order'. Strategy has sent cancel requests, attempted to close the position and terminated itself.

    *If it is possible, can you show how to fix this type of errors inside strategy builder? My coding skills is near 0
    **I cannot ignore this erreor, because it just continue comming.
    ***Calculation mode: On each tick.
    ****For target i can use MIT orders (it fixes orders rejections when there is a gap on the market, and price jups above the targets), BUT, i cannot use MIT for exit, because it just continue enter/exit to the market on each tick (kind a loop)

    Target condition:

    Target orders:
    Click image for larger version

Name:	Screenshot_1.png
Views:	907
Size:	5.9 KB
ID:	1091824

    Stop condition:

    Stop orders:



    Please, help! I really do not know what to do with that....

    #2
    Hello Againmain1,

    Thank you for your note.

    I would like to take a look at the full code for the strategy and see the behavior you're experiencing on my end. Could you export the strategy from Tools > Export > NinjaScript Add On? Please ensure the box to export as a compiled assembly is not checked or I will not be able to review your code. Please attach the resulting .Zip file to your reply.

    Thanks in advance; I look forward to assisting you further.
    Kate W.NinjaTrader Customer Service

    Comment


      #3
      Hello Againmain1,

      Thank you for your strategy files.

      You mentioned you were using this in Playback - so that I can best try to reproduce to see what occurred, what instrument, interval, bar type, etc are you using in playback, and for what date(s)? How many days to load were you using on the chart?

      Thanks in advance; I look forward to assisting you further.
      Kate W.NinjaTrader Customer Service

      Comment


        #4
        Der Kate,

        It doesn't matter But just to be clear:

        Playback: YM (06)
        Data range: from 16.03 to 26.03 (10 days)
        Historical data to load: 10 days
        Bartypes: Renko (6)

        *Same error appers on each market. I've tested GC / YM / NQ at same data range and bar types.
        **My thinking is because of volatility of the market..
        ***I've tried to get rid of this error by adding to conditions for stop order this: Close(0)>=CurrentStopPrice, but still, sometimes strategy cannot handle the gaps on the market and same error showing up
        I really hope that we will find the solution together... And i hope that i will be able to implement it via StrategyBuilder

        Comment


          #5
          Hello Againmain1,

          Thank you for your reply.

          You're correct, this is due to market volatility and there isn't really a way to 100% avoid this occurring, as in volatile markets the market could move so far and fast that this would occur. In the Strategy Builder, your only real way to reduce how often this occurs would be to place your stop loss further from the current price.

          If you were to unlock your code and manually add logic, you could change the strategy to use StopCancelCloseIgnoreErrors for its error handling; you could then capture the rejection in OnOrderUpdate, and then either try to resubmit the stop at a different price or submit an exit order to close the position. This would require knowledge of NinjaScript, however, and cannot be done in the Strategy Builder.

          You can find more information about real time error handling for strategies here, along with an example of capturing the rejection:


          Please let us know if we may be of further assistance to you.
          Kate W.NinjaTrader Customer Service

          Comment


            #6
            Dear Kate,

            Thank you for your reply and assistance.

            I have another question, due to your answer (kind a solution, based on what you said, but again, it will not get rid of 100% this occurring.)

            I wanted to ask your opinion about that.

            If i will add to my strategy this:

            Set 1:
            Click image for larger version  Name:	Screenshot_1.png Views:	0 Size:	15.4 KB ID:	1091918
            Set 2:
            Click image for larger version  Name:	Screenshot_2.png Views:	0 Size:	15.1 KB ID:	1091919

            In theory, this solution will be similar to what you suggested, and ideally I should get rid of 80% of the errors. Is this solution possible and will it not create a double entry into the position? (reversal entry)

            I want to know your opinion.

            Looking forward, to hearing from you!

            Comment


              #7
              Hello Againmain1,

              Thank you for your reply.

              While this may reduce the number of issues you have, you may still run into the same issue. The close price may still be above the current price when the stop market orders are submitted, and move below it before the orders are accepted by the exchange.

              The best way to avoid the error would still be to unlock the code and catch the rejection in on order update, then submit an alternate order as in my previous post, or to move the stops farther from the current price.

              Please let us know if we may be of further assistance to you.
              Kate W.NinjaTrader Customer Service

              Comment


                #8
                Got you

                Thanks!

                For now i think it will be as a temporary solution, that i've sent in previous post.

                P.s. If I will open the code, can this issue be fixed with ctrl+c - ctrl+v ? xD I can do that )))

                Comment


                  #9
                  Hello Againmain1,

                  Thank you for your reply.

                  The samples we provide are intended to give you further direction to move forward, and are not intended to be used for copy and paste purposes.

                  If you are interested in having the code written for you, I can have a representative of our EcoSystem reach out with more information on NinjaScript consultants who will be happy to do so.

                  Please let us know if we may be of further assistance to you.
                  Last edited by NinjaTrader_Kate; 03-27-2020, 09:00 AM.
                  Kate W.NinjaTrader Customer Service

                  Comment


                    #10
                    Thanks for your assistance!)

                    I will contact you when i'll be ready to reach your consultants

                    Have a good day!

                    Comment

                    Latest Posts

                    Collapse

                    Topics Statistics Last Post
                    Started by cre8able, Today, 03:20 PM
                    0 responses
                    5 views
                    0 likes
                    Last Post cre8able  
                    Started by Fran888, 02-16-2024, 10:48 AM
                    3 responses
                    47 views
                    0 likes
                    Last Post Sam2515
                    by Sam2515
                     
                    Started by martin70, 03-24-2023, 04:58 AM
                    15 responses
                    114 views
                    0 likes
                    Last Post NinjaTrader_Jesse  
                    Started by The_Sec, Today, 02:29 PM
                    1 response
                    7 views
                    0 likes
                    Last Post NinjaTrader_Jesse  
                    Started by jeronymite, 04-12-2024, 04:26 PM
                    2 responses
                    31 views
                    0 likes
                    Last Post NinjaTrader_BrandonH  
                    Working...
                    X