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

NT sell order below limit end of day

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

    NT sell order below limit end of day

    Hi,

    I am testing my automated trading with a self coded strategy.
    Everything seems to run fine with one exception:
    NT is executing sell orders for several instruments at the end of the day.
    The sell is executed below the set limit, so sold with a loss (or less profit).
    The sell orders are set to GTC and Limit and the limit price has not been reached.
    The sell orders are executed 17:30, 1 hour before my set trading hours closing time 18:30.

    What is causing this sell order execution?
    What is a possible solution?

    Thanks for your support!

    Frank

    #2
    Hello Frank,

    To confirm, you have a strategy that has orders that are filling when no valid fill prices have been received after the time of the order submission, is this correct?

    For a sell limit this would mean no bid prices were received at or below the limit price any after the time the order was submitted. (A limit fills at the specified price or better. A lower bid price would be a better price and the order would fill at that bid price instead of at the limit price)

    Are these real-time orders or historical?

    If these are real-time are these live to a broker or on the Sim101?

    What Trading hours template is used for the chart or for the strategy instance?

    Do you have reduced script that demonstrate the behavior?
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Hi Chelsea, thanks for your support.

      Originally posted by NinjaTrader_ChelseaB View Post
      Hello Frank,

      To confirm, you have a strategy that has orders that are filling when no valid fill prices have been received after the time of the order submission, is this correct?

      Frank: yes, this is correct


      For a sell limit this would mean no bid prices were received at or below the limit price any after the time the order was submitted. (A limit fills at the specified price or better. A lower bid price would be a better price and the order would fill at that bid price instead of at the limit price)

      Frank: how is a lower price a better price?
      I understand 'limit' as follows:
      Buying: this is the max, everything equal or below is better and will be executed.
      Selling: this is the min, everythin equal or above is better and will be executed.
      Starting the order, nothing happens (as the price is below the limit), which is good.
      Then, end of the day, the price is still below the limit and gets executed anyhow.

      Are these real-time orders or historical?
      Frank: Real time.

      If these are real-time are these live to a broker or on the Sim101?
      Frank: Real time data. Testing on Sim101.

      What Trading hours template is used for the chart or for the strategy instance?
      Frank: Euronext CET Index Futures RTH

      Do you have reduced script that demonstrate the behavior?
      Frank: SubmitOrderUnmanaged(instrumentIndex(order.Instrum ent.MasterInstrument.Name)+1, OrderAction.Sell, OrderType.Limit, quantity, sellPrice, sellPrice, "", "AKMI"+order.Instrument.MasterInstrument.Name+"Sel lOrder");
      }
      Looking forward to your response.
      Thanks
      Frank

      Comment


        #4
        Hello frankrood,

        Thank you for your response.

        Does your strategy have 'IsExitOnSessionCloseStrategy' enabled?
        Please let me know if you have any questions.

        Comment


          #5
          Hi Patrick,

          Print IsExitOnSessionCloseStrategy gives me 'false' so it seems to be disabled.

          Do you have any idea why my sell orders are executed end of the day below the limit price.

          Thanks,
          Frank

          Comment


            #6
            Hello frankrood,

            Thank you for your response.

            If the strategy is not set to exit on the session close then I would not expect the behavior you details.

            Please send me your log and trace files so that I may look into what occurred.

            You can do this by going to the Control Center-> Help-> Email Support

            Ensuring 'Log and Trace Files' is checked will include these files. This is checked by default.

            Please list 'ATTN: Patrick H' in the subject line and reference this thread in the body of the email.

            I look forward to assisting you further.

            Comment


              #7
              Thanks PatrickH,

              I sent the log file from the NT application.
              Thanks for your help.

              Kind regards
              Frank

              Comment


                #8
                The issue has been resolved in the following way:


                The sell limit order was triggered by a bid-price spike occurring shortly after the end of day time. This spike only lasted for a few ticks and thus was not visible on our early analysations of the graph (as we did not look at tick level). Therefore, we thought that the sell limit order was triggered at a price that did not correspond with the set limit.



                The data feed we use originates from Internet Brokers Traders WorkStation (TWS). If we open a chart in TWS we do not see the same price spike as we see in NT. Also, the chart in TWS stops at 17:30 exactly (EOD) while the price spike in NT takes place at around 17:31 or later. From this we conclude that the price spike does not actually occurs in the data but is somehow made up by NinjaTraders simulation engine. This is also confirmed by the fact that a live sell limit order placed via NinjaTrader to TWS is not actually filled.


                If you encounter random spikes in your data, NinjaTrader recommends you to turn on 'Real-time tick filter', especially when your automated strategy places orders based on the data. Further information can be found here: https://ninjatrader.com/support/helpGuides/nt8/en-us/?real_time_tick_filter.htm. Sadly, this did not solve our problem because the spike consists of multiple ticks and somehow this is not filtered correctly (reason unknown).


                In conclusion, it is evident that the problem only affects the simulation account and poses no threat to live trading. However, this means that using the simulation account does not give an accurate representation of how the automated strategy would behave while trading live. If simulation is very important to you, a possible workaround is cancelling all sell orders before the spike happens, and resubmitting them in the morning.

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by Javierw.ok, Today, 04:12 PM
                0 responses
                2 views
                0 likes
                Last Post Javierw.ok  
                Started by timmbbo, Today, 08:59 AM
                2 responses
                10 views
                0 likes
                Last Post bltdavid  
                Started by alifarahani, Today, 09:40 AM
                6 responses
                40 views
                0 likes
                Last Post alifarahani  
                Started by Waxavi, Today, 02:10 AM
                1 response
                18 views
                0 likes
                Last Post NinjaTrader_LuisH  
                Started by Kaledus, Today, 01:29 PM
                5 responses
                15 views
                0 likes
                Last Post NinjaTrader_Jesse  
                Working...
                X