Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

I think its a bug

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

    I think its a bug

    Hi,
    I think there is a bug in NT internal fill.
    The situation is like this:
    1. I put a longStop order above the market.
    2. There is a gap on the next bar.
    3. My entry is filled after the OnBarUpdate with the open price of the next bar.
    4. In OnExecution I want to place a stop loss order. The price of this order is higher than the high of the current bar, but 30 ticks lower then the entry price (opening of the next bar).
    The order is rejected.

    #2
    Hello,

    Thanks for your note.

    Can you please run this test again with Trace Orders = true and then also Print() the submitted price of the order and let me know what this is so that I can further assist.

    Please paste in the relevant section of the output window and the stop price that was submitted at.






    I look forward to assisting you further.
    BrettNinjaTrader Product Management

    Comment


      #3
      Hello,

      Also, is this with backtesting or Realtime?

      Calculate On Bar Close = True or False?


      I look forward to assisting you further.
      BrettNinjaTrader Product Management

      Comment


        #4
        Hi Bret,
        Attached is the trace.
        Of course it was in backtest. Although NT is a great platform, but to know the next bars opening price in real time I don't think even NT can do.
        Attached Files

        Comment


          #5
          Hello,

          Do you get the same error if you widen the stop loss a little more?


          I look forward to assisting you further.
          BrettNinjaTrader Product Management

          Comment


            #6
            Of course no. If the stop is below the current bar it executes. But in my strategy I put a stop loss 30 ticks behind the entry, and because the entry was many many ticks above the current bar (a gap) and was calculated on the next bars open, that maid the problem

            Comment


              #7
              Baruch,

              Do you by chance have a sample strategy you could send to support at ninjatrader dot com this is occuring on? Rference this forum post in the email if you do.

              I look forward to assisting you further.
              BrettNinjaTrader Product Management

              Comment


                #8
                Do you by chance have a sample strategy you could send to support at ninjatrader dot com this is occuring on?
                Hi Bret,
                Of course I don't have a sample strategy on hand!
                But I prepared one. You just say to it when you want to enter. (Date+Time).
                You need to put it on a PIT session so there will be gaps. You put date+time for the last bar in session and if the next bar is gaped up you put true in "GapUp" else false.
                Then if the stop will be above current bar high for short or below for long, it will be placed. If not it will not.
                I look for it in VS. You can do it however you like.
                Attached Files

                Comment


                  #9
                  Hello,

                  I was able to alter this code a little bit and get it too occur. I have found where the issue is.

                  I have sent into development and I'm awaiting response.

                  Thanks for your patience.
                  BrettNinjaTrader Product Management

                  Comment


                    #10
                    Hello,

                    Here is the information from my product manager: This is on our list for discussion on the next version of NinjaTrader. However as it is their is no resolution to this Unfortuantely.

                    There is no separation where you can say
                    1. Have open price
                    2. Entry filled
                    3. Now submit stop loss based off of that entry fill
                    4. Now get the remaining HLC

                    Since everything comes in as OHLC, that means that 5/9 open order had to get “processed” during the 5/7 close event. We can’t “open” up a new bar yet for 5/9 for this processing because opening that up would come with the complete OHLC and effectively jump over all that HLC price action which may have impact on what gets filled. This means though if you had to send that order at the close of 5/7 your stop price may very well get rejected based off of 5/7 bar’s data.

                    Workarounds are:
                    1. Don’t submit orders on last bar of session
                    2. Resubmit the stop again afterwards bearing in mind that this would mean 1 bar where the stop is not in place. Recognize and accept that this is a backtest only concern due to insufficient data granularity
                    BrettNinjaTrader Product Management

                    Comment


                      #11
                      Thanks Brett,
                      can you explain how to do that:
                      1. Don’t submit orders on last bar of session
                      In other words, how do I know its the last bar? My problem is on shorted then usual days. (Half holiday)

                      Comment


                        #12
                        Hello,

                        if (Bars.LastBarOfSession)
                        {
                        // This is the last bar of the session
                        }

                        You mentioned holiday however, this would not work on holidays this is something that is on our list to add into a future version of NinjaTrader however.

                        Let me know if I can be of further assistance.
                        BrettNinjaTrader Product Management

                        Comment


                          #13
                          Here is the information from my product manager: This is on our list for discussion on the next version of NinjaTrader. However as it is their is no resolution to this Unfortuantely.

                          There is no separation where you can say
                          1. Have open price
                          2. Entry filled
                          3. Now submit stop loss based off of that entry fill
                          4. Now get the remaining HLC

                          Since everything comes in as OHLC, that means that 5/9 open order had to get “processed” during the 5/7 close event. We can’t “open” up a new bar yet for 5/9 for this processing because opening that up would come with the complete OHLC and effectively jump over all that HLC price action which may have impact on what gets filled. This means though if you had to send that order at the close of 5/7 your stop price may very well get rejected based off of 5/7 bar’s data.
                          I thought for a long time if to suggest an obvious solution, and finally decided to do so.
                          Instead of issuing the entry order on the close of the bar, you need to hold it and issue it on the open of the next bar!
                          It will also be closer to real live trading, because at least on time bars you know about a close of a bar only after you have a tick for the next bar, so after the open of a new bar. Even for not time bars (tick, volume, etc) and even if you close a bar without opening a new bar if you issue the order at close it will be executed at the open (on the next tick).

                          Baruch

                          Comment


                            #14
                            Hello,

                            Thanks for posting. This is exactly the issue and resolution. However currently there is no seperation of this in the simulator to be able to easily do this and any change here can have untold ammount of unforseen issues without proper testing and verification of the change with the simulator. Therefor we are aware of this and looking into this for the next version of NinjaTrader. However I would not expect on it being added soon.

                            Thanks for posting again!
                            BrettNinjaTrader Product Management

                            Comment

                            Latest Posts

                            Collapse

                            Topics Statistics Last Post
                            Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                            0 responses
                            637 views
                            0 likes
                            Last Post Geovanny Suaza  
                            Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                            0 responses
                            366 views
                            1 like
                            Last Post Geovanny Suaza  
                            Started by Mindset, 02-09-2026, 11:44 AM
                            0 responses
                            107 views
                            0 likes
                            Last Post Mindset
                            by Mindset
                             
                            Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                            0 responses
                            569 views
                            1 like
                            Last Post Geovanny Suaza  
                            Started by RFrosty, 01-28-2026, 06:49 PM
                            0 responses
                            572 views
                            1 like
                            Last Post RFrosty
                            by RFrosty
                             
                            Working...
                            X