Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Wrong position display if Exit On Session Close

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

    Wrong position display if Exit On Session Close

    A strategy enabled outside of session trading hours will display incorrect position data if it used the Exit On Session Close method.

    Strategy conditions:
    Trading hours: RTH
    Exit on Session Close: checked
    Strategy code: "Managed" order commands are within the "On Bar Update" method
    Enable the strategy outside of the RTH session hours. During the historical run up, the strategy closes its position by the "Exit On Session Close" method.

    Bug: The Control Panel "Strategy" tab incorrectly displays the enabled strategy as "in position" rather than flat. The "Positions" tab correctly shows the account as flat.

    Although, the displayed "Strategies" position will automatically clear to flat upon the start of the next session, it is in error until it does.

    #2
    Hello Camdo, and thank you for your report.

    I wasn't quite able to see the same thing on my end that you were reporting on yours. This is the procedure I used. Could you try this procedure out on your end? If there is no change in behavior on your end, no action will be needed at this time, and you can expect this to be resolved with the next release of NinjaTrader. If you are unable to reproduce the behavior you saw previously, could you revise my steps as needed and report back? Thank you for helping to improve NinjaTrader

    1. Visit Tools -> Trading Hours and create a session that ends 5 minutes from now
    2. Enable the attached KeepOpen strategy
      1. Start behavior : Immediately submit, synchronize account
      2. Exit on session closed : checked
      3. Exit on session closed seconds : 30
      4. Trading hours : your prepared session template
      5. Instrument : any that currently trades. I used FDAX 03-17.

    3. Wait 5 minutes

    On my end, following the above procedure, my Position and Acct. Position columns both returned to flat.
    Attached Files
    Jessica P.NinjaTrader Customer Service

    Comment


      #3
      Originally posted by NinjaTrader_JessicaP View Post
      Hello Camdo, and thank you for your report.

      I wasn't quite able to see the same thing on my end that you were reporting on yours. This is the procedure I used. Could you try this procedure out on your end? If there is no change in behavior on your end, no action will be needed at this time, and you can expect this to be resolved with the next release of NinjaTrader. If you are unable to reproduce the behavior you saw previously, could you revise my steps as needed and report back? Thank you for helping to improve NinjaTrader

      1. Visit Tools -> Trading Hours and create a session that ends 5 minutes from now
      2. Enable the attached KeepOpen strategy
        1. Start behavior : Immediately submit, synchronize account
        2. Exit on session closed : checked
        3. Exit on session closed seconds : 30
        4. Trading hours : your prepared session template
        5. Instrument : any that currently trades. I used FDAX 03-17.

      3. Wait 5 minutes

      On my end, following the above procedure, my Position and Acct. Position columns both returned to flat.
      Hi Jessica,
      The procedure you outlined needs some modification as follows.
      Enable your strategy "KeepOpen" with the following parameters:
      1. Start behavior : Immediately submit, synchronize account
      2. Exit on session closed : checked
      3. Exit on session closed seconds : 30
      4. Trading hours : CME US Index Futures RTH
      5. Instrument : ES 03-17

      Enable the strategy at a time after the RTH session is closed (11:49 PM ET was my test time)
      Observe the errant position on the strategies page (see attached screen shot). This should be flat, but it shows 1L.

      I did some further testing and found that by modifying the Cme RTH session by deleting days Wednesday Thursday and Friday (leaving only Monday and Tuesday) then the above test will show the correct position. Also deleteing all days except Monday the test would show correct position.

      I have also attached a screen shot of all the strategy parameters.

      Click image for larger version

Name:	170102a.jpg
Views:	1
Size:	154.2 KB
ID:	881579 Click image for larger version

Name:	170102b.jpg
Views:	1
Size:	237.3 KB
ID:	881580
      Last edited by Camdo; 01-02-2017, 11:16 PM.

      Comment


        #4
        Thank you for this additional information.

        I would like to clarify, based on your suggested modification, that you can not cause this same behavior on your end with a session template you create, and that this behavior is restricted only to the CME US Index Futures RTH template? Were you able to try with any other built-in templates? If you have tested with a user created session template, could you let me know what days and hours you set up?

        I will be trying with the template you recommended after market close and will report back when I have more information.
        Jessica P.NinjaTrader Customer Service

        Comment


          #5
          Originally posted by NinjaTrader_JessicaP View Post
          Thank you for this additional information.

          I would like to clarify, based on your suggested modification, that you can not cause this same behavior on your end with a session template you create, and that this behavior is restricted only to the CME US Index Futures RTH template? Were you able to try with any other built-in templates? If you have tested with a user created session template, could you let me know what days and hours you set up?

          I will be trying with the template you recommended after market close and will report back when I have more information.
          I made a custom session template, MyTest, with session hours between 8:00 AM and 10:00 AM (see attached picture)
          Test time is Tuesday 10:46 AM (session is closed)
          Test strategy: KeepOpen with parameters same as previous posts
          pass = position displays flat, fail = position displays 1L
          days included in session template:
          Mon = pass
          Mon+Tues = fail
          Mon+Tues+Wed = fail
          Mon+Tues+Wed+Thur = fail
          Mon+Tues+Wed+Thur+Fri = fail
          Click image for larger version

Name:	170103a.jpg
Views:	1
Size:	253.0 KB
ID:	881585

          Comment


            #6
            Thank you for this additional information, Camdo. I have confirmed this behavior on my end. When you enable a strategy after hours, it will in fact place a trade, even if you have set up your strategy to close your position when the session ends. Since this behavior is consistent with NinjaTrader 7, I have sumbitted the following feature request to the product management team.

            When strategies are enabled after hours with Exit on Session Closed checked, this user would like strategies to wait until the session begins again to submit new orders

            I will follow up with more information as soon as it's available. If the feature requests already exists, a vote will be added to it.


            Please let us know if there are any other ways we can help.
            Jessica P.NinjaTrader Customer Service

            Comment


              #7
              Originally posted by NinjaTrader_JessicaP View Post
              Thank you for this additional information, Camdo. I have confirmed this behavior on my end. When you enable a strategy after hours, it will in fact place a trade, even if you have set up your strategy to close your position when the session ends. Since this behavior is consistent with NinjaTrader 7, I have sumbitted the following feature request to the product management team.

              When strategies are enabled after hours with Exit on Session Closed checked, this user would like strategies to wait until the session begins again to submit new orders

              I will follow up with more information as soon as it's available. If the feature requests already exists, a vote will be added to it.


              Please let us know if there are any other ways we can help.
              Hi Jessica, I am glad you were able to reproduce the symptoms.
              If you check the "Positions" tab you will see that there is no position, so an entry was not made. I think the position you see on the "Strategies" tab is a leftover from the closed session. Exit On Close is not updating the "Strategies" tab display.


              A second issue not yet discussed but somewhat related is that after the RTH session closes, the P/L data is lost. This is true on Chart Trader and Strategies tab. NT7 held the P/L display until the start of the next session or midnight (not sure which) or until the strategy was disabled. From a users's standpoint, that is more useful and convenient.

              Comment


                #8
                Thanks for following up, it looks like we may have more work to do. When I use a pre-release version of Ninja, I actually do see a position in the positions tab. There are no leftover orders; my copy can flatten correctly on session end. Could I ask you to revisit this thread after the next Ninja release and report back as to whether this is the case for you?

                I am investigating the P/L differences and will report back shortly.
                Jessica P.NinjaTrader Customer Service

                Comment


                  #9
                  I have submitted a feature request to the product management team for the following feature :

                  This user would like the day's realized PnL in the Strategy's tab to not be reset until the beginning of the next session, even if the strategy exits on session close

                  I will follow up with more information as soon as it's available. If the feature requests already exists, a vote will be added to it.


                  Please let us know if there are any other ways we can help.
                  Jessica P.NinjaTrader Customer Service

                  Comment


                    #10
                    With regard to delaying after-hours submitted orders until the start of the next trading day, this feature is being reviewed by the product management team and has been assigned the following unique tracking ID

                    SFT-1842

                    In the meantime I would highly recommend you use a time filter to prevent unwanted orders in your strategy. Here is an example from the help guide.

                    Code:
                    [FONT=Courier New]
                    // http://ninjatrader.com/support/helpGuides/nt8/en-us/?totime.htm[/FONT]
                    [FONT=Courier New]protected override void OnBarUpdate()
                    {
                    [/FONT][FONT=Courier New][COLOR=#008000]  // Only trade between 7:45 AM and 1:45 PM[/COLOR]
                      [COLOR=#0000ff]if[/COLOR][COLOR=#ffffff] [/COLOR](ToTime(Time[[COLOR=#ff9900]0[/COLOR]])[COLOR=#ffffff] [/COLOR]<[COLOR=#ffffff] [/COLOR][COLOR=#ff9900]74500[/COLOR][COLOR=#ffffff] [/COLOR]||[COLOR=#ffffff] [/COLOR]ToTime(Time[[COLOR=#ff9900]0[/COLOR]])[COLOR=#ffffff] [/COLOR]>[COLOR=#ffffff] [/COLOR][COLOR=#ff9900]134500[/COLOR])
                      {
                         [COLOR=#ffffff][/COLOR]return;
                      }[/FONT]
                    [FONT=Courier New]  [/FONT][FONT=Courier New][COLOR=#008000]// Strategy logic goes here[/COLOR][/FONT]
                    [FONT=Courier New]}[/FONT]


                    Please let us know if there is any other way we can help.
                    Jessica P.NinjaTrader Customer Service

                    Comment


                      #11
                      One other thing I would like to mention is that we were choosing to submit orders immediately as soon as we turn the strategy on. If, instead, you change your strategy's StartBehavior to WaitUntilFlat, this would also prevent this order from triggering.

                      With regard to not resetting PnL, this feature is being reviewed by the product management team and has been assigned the following unique tracking ID


                      SFT-1843


                      Please let us know if there is any other way we can help.
                      Jessica P.NinjaTrader Customer Service

                      Comment

                      Latest Posts

                      Collapse

                      Topics Statistics Last Post
                      Started by rocketman7, Today, 02:12 AM
                      4 responses
                      21 views
                      0 likes
                      Last Post q0t6p5
                      by q0t6p5
                       
                      Started by trilliantrader, 04-18-2024, 08:16 AM
                      7 responses
                      27 views
                      0 likes
                      Last Post NinjaTrader_BrandonH  
                      Started by samish18, 04-17-2024, 08:57 AM
                      17 responses
                      65 views
                      0 likes
                      Last Post NinjaTrader_BrandonH  
                      Started by briansaul, Today, 05:31 AM
                      1 response
                      13 views
                      0 likes
                      Last Post NinjaTrader_Jesse  
                      Started by PaulMohn, Today, 03:49 AM
                      1 response
                      12 views
                      0 likes
                      Last Post NinjaTrader_BrandonH  
                      Working...
                      X