Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Dual-Session "Exit on Close"

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

    Dual-Session "Exit on Close"

    Hi guys-

    What does NinjaTrader consider to be "session close" if the session resembles the CBOT Agricultural electronic trading hours session (as seen in the screenshot)?

    I have verified that my strategy is set to "exit on close", yet I have here a position that was entered at 2:13:57 PM and not closed by the 2:15:00 session close.
    Attached Files

    #2
    Update

    My position apparently closed itself in between sessions. Here's a screen shot.

    Here's the associated log file info:

    Code:
    4/27/2011 5:58:36 PM|1|32|Order='d4c4c872383f48e5b6b4fbfb4ce8b581/SimAGRICULTURE' Name='Target Order' New state=Filled Instrument='ZC 07-11' Action=Sell Limit price=761.25 Stop price=0 Quantity=9 Type=Limit Filled=9 Fill price=771 Error=NoError Native error=''
    4/27/2011 5:58:36 PM|1|32|Order='5971e29e454d443e894bb73dbadff86e/SimAGRICULTURE' Name='Stop Order' New state=PendingCancel Instrument='ZC 07-11' Action=Sell Limit price=0 Stop price=757.75 Quantity=9 Type=Stop Filled=0 Fill price=0 Error=NoError Native error=''
    4/27/2011 5:58:36 PM|1|16|Execution='0774f22212c043ef9f4839ecf0dd870a' Instrument='ZC 07-11' Account='SimAGRICULTURE' Exchange=Default Price=771 Quantity=9 Market position=Short Operation=Insert Order='d4c4c872383f48e5b6b4fbfb4ce8b581' Time='4/27/2011 5:58:36 PM'
    4/27/2011 5:58:36 PM|1|64|Instrument='ZC 07-11' Account='SimAGRICULTURE' Avg price=771 Quantity=0 Market position=Long Operation=Remove Currency=Unknown
    4/27/2011 5:58:36 PM|1|32|Order='5971e29e454d443e894bb73dbadff86e/SimAGRICULTURE' Name='Stop Order' New state=Cancelled Instrument='ZC 07-11' Action=Sell Limit price=0 Stop price=757.75 Quantity=9 Type=Stop Filled=0 Fill price=0 Error=NoError Native error=''
    4/27/2011 5:59:23 PM|1|32|Order='a4bd5babfff14f7291e8d93a9e015319/SimENERGY' Name='RB 06-11_Long_3/22/2011 2:05:36 PM_1' New state=PendingCancel Instrument='RB 06-11' Action=Buy Limit price=2.9866 Stop price=0 Quantity=1 Type=Limit Filled=0 Fill price=0 Error=NoError Native error=''
    4/27/2011 5:59:24 PM|1|32|Order='a4bd5babfff14f7291e8d93a9e015319/SimENERGY' Name='RB 06-11_Long_3/22/2011 2:05:36 PM_1' New state=Cancelled Instrument='RB 06-11' Action=Buy Limit price=2.9866 Stop price=0 Quantity=1 Type=Limit Filled=0 Fill price=0 Error=NoError Native error=''
    4/27/2011 5:59:45 PM|1|128|Exit on close handling for strategy 'CRGMomentumSystemFixed' started.
    Let me know what you guys think about this.
    Attached Files

    Comment


      #3
      cgeorgan,

      Your log output shows your order simply filled the target order at the target price prior to the close and so you were closed before session close. The last line in your output is when the ExitOnClose handling kicks in. 15 seconds before the close because you likely have ExitOnCloseSeconds set to 30.

      Code:
      4/27/2011 5:59:45 PM|1|128|Exit on close handling for strategy 'CRGMomentumSystemFixed' started.
      ExitOnClose does not care you have multiple segments. It treats each segment as a session and will be triggered at the end of each segment. You can see this behavior very easily by creating a strategy that does the following:
      Code:
      if (Bars.FirstBarOfSession)
           EnterLong();
      Use that code and then running it on a chart with ExitOnClose = true you can see it enters a new position at the beginning of every session segment because it gets closed at the end of every segment defined by your session template.
      Josh P.NinjaTrader Customer Service

      Comment


        #4
        Hmm

        Josh-

        You'll notice the session closed at 1:15 CST (2:15 EST).

        The session was not set to open until 6:00 CST (7 PM EST).

        How can I get a closing fill when the session is not open?

        Comment


          #5
          Please add prints to your strategy for every OnBarUpdate's timestamp and see what exactly it is processing between those times.

          Edit: Also, please add print outs for the "out" objects from Bars.Session.GetNextBeginEnd() on all those OnBarUpdate()s. How do those outputs read?
          Josh P.NinjaTrader Customer Service

          Comment


            #6
            Hmm

            See attached screenshot.

            It was not processing any last trades, bids or asks.

            Other ideas?
            Attached Files

            Comment


              #7
              cgeorgan,

              Looking at the Historical Data Manager would not provide any information as to what the strategy was doing during those times. That would be trying to reason out what the strategy is doing through deduction, but we already know the strategy isn't following any deductible rules so it is a matter of finding out what rules it is following. To do so we will need output while the strategy was running in real-time to be able to analyze. Especially that Bars.Session.GetNextBeginEnd() part.

              Please print every event's timestamp along with the sessionBegin/End. Might even need to add printout to OnMarketData() as well to see if those were triggering while OnBarUpdate() was not.

              Thinking about it, lets go ahead and print the Bars.Session.TemplateName too.
              Josh P.NinjaTrader Customer Service

              Comment


                #8
                Originally posted by NinjaTrader_Josh View Post
                cgeorgan,

                Looking at the Historical Data Manager would not provide any information as to what the strategy was doing during those times. That would be trying to reason out what the strategy is doing through deduction, but we already know the strategy isn't following any deductible rules so it is a matter of finding out what rules it is following. To do so we will need output while the strategy was running in real-time to be able to analyze. Especially that Bars.Session.GetNextBeginEnd() part.

                Please print every event's timestamp along with the sessionBegin/End. Might even need to add printout to OnMarketData() as well to see if those were triggering while OnBarUpdate() was not.

                Thinking about it, lets go ahead and print the Bars.Session.TemplateName too.
                Josh,

                Unfortunately, there's just no way I'm going to do this. I have a ton of strategies running as it is, and the amount of information I'm outputting for my own purposes is already taxing to my system. Outputting bar updates - based on the structure of the strategy - is beyond what I'm willing to dedicate to this bug, and that's assuming that it will even come up again (that is, an entry trigger 30 seconds before a session close, and then an exit order in between sessions).

                If there's other information I can provide, I'll be more than happy to help, as I have done in the past. However, this bug affects you (NT) more than it affects me (why? Because in real life, you cannot get an execution from the CME when it is closed...it's something you can only do in NT's simulator).

                I can tell you this - the strategy was enabled when the entry execution ran, and it was enabled when the session closed, but the strategy was not running when the target execution occurred. The orders were out there (in simulator land), but no strategy was driving what happened (all were disabled).

                Perhaps in the future another individual will run into the same problem, or the bug will rear it's head for me and I'll be able to trap it better.

                Kind Regards,
                CG

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                0 responses
                668 views
                0 likes
                Last Post Geovanny Suaza  
                Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                0 responses
                377 views
                1 like
                Last Post Geovanny Suaza  
                Started by Mindset, 02-09-2026, 11:44 AM
                0 responses
                110 views
                0 likes
                Last Post Mindset
                by Mindset
                 
                Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                0 responses
                575 views
                1 like
                Last Post Geovanny Suaza  
                Started by RFrosty, 01-28-2026, 06:49 PM
                0 responses
                580 views
                1 like
                Last Post RFrosty
                by RFrosty
                 
                Working...
                X