Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Some positions not exiting on close

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

    Some positions not exiting on close

    I have an intraday strategy, running on perhaps a dozen symbols. I have two versions of the strategy, one coded for use on historical data (implementing a secondary data stream) and the other coded for use on real time data. Once in a while, in an apparently random fashion, a position or part position will not exit on close. Of course, I have all the strategies set to Exit on Close. I have even been able to duplicate this on historical data for some days.

    I found a work-around, but want to get it fixed properly. These are all stocks, running on the US Equities RTH session template. If I temporarily switch to Use Instrument Session, then switch back to US Equities RTH, the positions now show closed and plot thusly on the chart.

    I'm guessing there is something subtle in the session templates I don't understand, but can't figure it out. I have tried something longer than 30 seconds on close, up to several minutes, which didn't change anything.

    #2
    coolmoss,

    Could you go to Tools > Instrument manager > Find an instrument you are using > Click it > Go to "Edit" > Check the "Session template" field and then report a handful to me? Do they appear correct?
    Adam P.NinjaTrader Customer Service

    Comment


      #3
      Hi Adam,

      Some are set to 24/7, others to US Equities RTH. Seems like the first step is to get them all set the same. I know for sure one of the symbols that did NOT close on exit also had Session template set to US Equities RTH. I'm thinking they should all be set to 24/7, as some stocks do trade outside RTH hours and I want all that data.

      So, just to clarify: if I have the instrument set up (in instrument manager) to 24/7, and am running a strategy in chart that has US Equities RTH as session template, then in theory close on exit should be effected at the equities session close?

      Thanks much for your help.

      Comment


        #4
        coolmoss,

        If a strategy is attached to a chart, it should be using whatever session template you have on the chart. If you use the strategies tab instead for strategies you can set which session template to use.

        If you use Default 24/7 it wouldn't necessarily exit according to regular trading hours since it would be using this session template.

        Could you clarify on how are you using the strategies and session templates?
        Adam P.NinjaTrader Customer Service

        Comment


          #5
          Adam,

          I have the instrument setup as 24/7 (in instrument manager) and the chart is setup with US Equities RTH. This should be, logically, a correct way to do it.

          If not, please let me know how I can collect all the data for an instrument (24/7) and run a strategy from a chart on a different session template with Exit on Close. Thanks.

          Comment


            #6
            coolmoss,

            The chart session template would override the default one setup in the instrument manager so you wouldn't get the other session template data necessarily.

            The easiest way to get your chart to operate with more data, but have a strategy working on a different session template would be to use the "Strategies" tab. You can right click in here, add a strategy, then assign it a session template to use. Meanwhile, on your chart you can use an entirely different session template.

            Please let me know if I may assist further.
            Adam P.NinjaTrader Customer Service

            Comment


              #7
              Hi Adam,

              I think somewhere along the way I confused you. I'm not trying to operate with more data. I have a chart, using the RTH session template, and it has a strategy in it. The strategy is set to Close On Exit. Most of the time, the close on exit is executed. But sometimes it's not. That is the problem.

              The only reason I mentioned other sessions is because that's how I could effect a historical strategy to close on exit correctly. To reitterate: the strategy is set to close on exit but the chart did not plot any close on exit trade nor did a close on exit trade show up in the perf report. If I manually change the session template in the chart to something different, apply it, then immediately switch back to my original session, then the exit on close correctly shows.

              So, I guess my original question still stands: what's causing the exit on close to sometimes not work? This is a big issue for me because it's not just happening on historical data. It's happening on live data. It's also happening on more than just one strategy script. It looks to me like it has to do with some subtlty regarding how and in what places session templates are set.

              Comment


                #8
                Here's a bit of an update. It really looks like some sort of bug to me, because positions are being help beyond the close by several instruments, running different strategies, and on different instrument session templates.

                I am able to effect the close on exit the next morning by hitting F5, but when the chart first opens and the strategy is first enabled, there is no exit on close.

                Please help, this is major issue as we deploy more and more instruments automatically.

                Thanks.

                Comment


                  #9
                  The only reason I mentioned other sessions is because that's how I could effect a historical strategy to close on exit correctly. To reitterate: the strategy is set to close on exit but the chart did not plot any close on exit trade nor did a close on exit trade show up in the perf report. If I manually change the session template in the chart to something different, apply it, then immediately switch back to my original session, then the exit on close correctly shows.
                  Before you mentioned that this happens live? Or does it only happen with historical trades that are displayed on the chart?

                  What sort of strategy are you using? Is it the managed approach, unmanaged approach, or with ATM's?
                  Adam P.NinjaTrader Customer Service

                  Comment


                    #10
                    Adam,

                    It happens with live and historical trades. The strategies are Managed approach only, no ATM's are involved.

                    Comment


                      #11
                      Coolmoss,

                      I have found a relevant post that could help you resolve your issue.

                      Support for the development of custom automated trading strategies using NinjaScript.


                      Please let me know if I may assist further.
                      Adam P.NinjaTrader Customer Service

                      Comment

                      Latest Posts

                      Collapse

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