Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Strategies Ignore Exit On Close setting

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

    Strategies Ignore Exit On Close setting

    I'm wonder if this is a bug or if I'm doing something wrong... I'm currently using NT 7.0.21 (Free version), trying to test an intraday strategy before going live.

    Currently I'm running into this problem. I'm setting up the strategy to run the next day. It's currently after market close (12:30 MST). The session template for the instrument (NG) is set correctly (2:30pm EST - which is 12:30 MST, my time).

    The historical fills* are not observing the "Exit On Close" setting in the strategy, causing all sorts of inconsistencies in the strategy. If the strategy thinks there's a an open position come the morning, it will not execute properly in the morning...but I need the data from previous days for a 200 period EMA.

    Jeremy

    *** Note: It looks like only the last Exit On Close is being ignored. Previous exit on closes are filling historically.
    Attached Files
    Jeremytang
    NinjaTrader Ecosystem Vendor - Shark Indicators

    #2
    Hello Jeremy,

    Thank you for the report. Can you also attach a screenshot of your strategy settings and indicate which time zone you're in?
    Ryan M.NinjaTrader Customer Service

    Comment


      #3
      My time zone is MST.

      I've attached the strategy settings and the options settings.
      Attached Files
      Jeremytang
      NinjaTrader Ecosystem Vendor - Shark Indicators

      Comment


        #4
        I'm working on testing this here and will let you know as soon as I have more information. Thank you for your patience.
        Ryan M.NinjaTrader Customer Service

        Comment


          #5
          Hi Jeremy,

          I wasn't able to see the same thing. Could you check your NG session template? Click Tools > instrument manager > Search NG 10-10 > Edit

          What is session template listed here? I tested with NymexEnergy RTH.

          If you're still not seeing this exit on close, use TraceOrders = true; in your Initialize() and check the output (Tools > Output Window). Copy and paste output around session close into thread and we can look into further.
          Ryan M.NinjaTrader Customer Service

          Comment


            #6
            It's set at NymexEnergy RTH. Output window did not show anything on the trace as I'm doing this after the market close, and there are no trades to speak of, just historical ones.

            To reproduce this error:

            Wait 'til the market is closed (like right now)
            Open up a new chart of NG 10-10 on the 5 min.
            Right click it, add strategy: SampleMACrossOver, say 5 for the Fast MA, 10 for slow MA

            Note that the strategy is highlighted yellow in the strategy window... (even though it should be flat right now from an "Exit On Close").

            Also note that the chart does not have an Exit on close order. In this case last entry was a short one at open of the 12:15 bar.
            Attached Files
            Jeremytang
            NinjaTrader Ecosystem Vendor - Shark Indicators

            Comment


              #7
              Jeremy, thanks for reporting in - we're looking into a related issue and will follow up once the investigation has been completed.

              Thanks for your support

              Comment


                #8
                Fixed for historical trades, but not live trades

                Hi,

                It appears the latest beta version (22) has solved this problem for historical trades... however now it is not Exiting On Close in a live trading environment.
                Jeremytang
                NinjaTrader Ecosystem Vendor - Shark Indicators

                Comment


                  #9
                  Thanks for the update, JeremyTang. Does this happen only with a live account or do you mean any real-time trading? Are there any other factors you can think of that will help us setup a case to try this here?
                  Ryan M.NinjaTrader Customer Service

                  Comment


                    #10
                    I'm not sure if it doesn't happen on the simulated account, I'll test it on Monday. But for sure on the live account (submitting real orders to the broker) when running a strategy set for Close on Exit.

                    I'll see if I can narrow down when or when it doesn't occur.

                    Jeremy
                    Jeremytang
                    NinjaTrader Ecosystem Vendor - Shark Indicators

                    Comment


                      #11
                      I was incorrect in stating previously that this bug no longer affected historical orders... it's still there in build 22.

                      If you look at my post on: 09-23-2010, 05:29 PM, you can easily recreate this bug.

                      Jeremy
                      Jeremytang
                      NinjaTrader Ecosystem Vendor - Shark Indicators

                      Comment


                        #12
                        Hi Jeremy,

                        I've been trying to reproduce this but so far everything works as expected. Can you try with SampleMACrossover strategy and let us know your results?

                        What I've been doing is setting up custom session tempaltes that end soon after you start the strategy.
                        Ryan M.NinjaTrader Customer Service

                        Comment


                          #13
                          Update: I think I may have figured out the condition where this happens. If you alter the strategy code, compile it and then start using it.

                          Looks like as soon as you nuke the strategy (ie: kill the chart), and redo it everything is ok.

                          Also other weird things tend to happen when you are in this state. The strategies will correctly show the updated parameters if you changed any since the previous compile. When I did this and tried to change "Sync Account position", it did not change and remained at it's original value.

                          Jeremy
                          Last edited by Jeremytang; 11-08-2010, 08:18 AM.
                          Jeremytang
                          NinjaTrader Ecosystem Vendor - Shark Indicators

                          Comment


                            #14
                            Hello Jeremy,

                            There have been a couple updates since you originally reported the issues. Please make sure you are on RC1 (7.0.23).

                            Let us know the steps to see the issue, and the specific strategy used. If you can reproduce using SampleMovingAverage crossover, please let us know.

                            Reapplying a strategy to a chart is a new instance. Any code changes are not reflected upon running instances. You need to remove and reapply the strategy (or right click > reload NinjaScript), after making any code changes.
                            Ryan M.NinjaTrader Customer Service

                            Comment


                              #15
                              Ok I figured it out... It has nothing to do with changing the code. It happens if you run a a strategy for a full day and then disable it, and then you try to enable and run it for the next day.

                              Ryan: Yes I'm running RC1 (7.0.23)

                              Steps to reproduce:

                              1) Before market open, create a 5 min chart of any instrument.
                              2) Create a SampleMovingAverage strategy in live trading mode. Run it for one full day. Allow it to exit on close.
                              3) Disable the strategy and close NT.
                              4) Next day before market open: Open NT and re-enable the strategy

                              You'll notice that the Exit On Close order is not observed in the historical trades, and if you're unlucky and had "Sync Account Position" with "Submit Orders Immediately"... you'll find that sudden sinking in the pit of your stomach.
                              Jeremytang
                              NinjaTrader Ecosystem Vendor - Shark Indicators

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                              0 responses
                              636 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
                              571 views
                              1 like
                              Last Post RFrosty
                              by RFrosty
                               
                              Working...
                              X