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

Exit on Session Close Error

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

    Exit on Session Close Error

    Hello,

    I began running my strategy today for its first full trading day on MNQ, and at 1PM EST it closed a position on "Exit on Session Close" which is enabled in my strategy, but should be at the end of the futures trading day for EST, not 1pm. How do I resolve this?

    Attached as an image are my settings
    Attached Files
    Last edited by thereyoflite; 05-24-2021, 11:31 AM.

    #2
    Hello thereyoflite,

    Thank you for your post.

    What time zone are you in?

    Was the strategy tested using Live data, the Playback Connection with Market Replay data, or in the Strategy Analyzer?

    Please select the Data Series button and verify what the Trading Hours being used for the Data Series are by sending us a screenshot of the Data Series Properties.

    Also, please send a screenshot of the time zone set for your NinjaTrader platform. This can be found by navigating to Tools > Options > General tab.

    To send a screenshot with Windows 7 or newer I would recommend using the Windows Snipping Tool.

    Click here for instructions

    Alternatively to send a screenshot press Alt + PRINT SCREEN to take a screenshot of the selected window. Then go to Start--> Accessories--> Paint, and press CTRL + V to paste the image. Lastly, save as a jpeg file and send the file as an attachment.

    Click here for detailed instruction

    I look forward to assisting further.
    Brandon H.NinjaTrader Customer Service

    Comment


      #3
      Hello,

      I am in the eastern time zone, and the tests were done in strategy analyzer.
      Requested screenshots are attached
      Click image for larger version

Name:	Screen Shot 2021-05-25 at 4.35.30 PM.png
Views:	286
Size:	222.0 KB
ID:	1157572Click image for larger version

Name:	Screen Shot 2021-05-25 at 4.36.09 PM.png
Views:	293
Size:	401.3 KB
ID:	1157574
      Attached Files

      Comment


        #4
        Hello thereyoflite,

        Thank you for your reply.

        When you ran the backtest, were you connected to a data provider? The Strategy Analyzer would require you to be connected to your data provider's historical data server to grab all the data for that instrument for the current day and would only be able to function on historical data previously loaded the last time you loaded a chart - incoming real time data is not recorded as historical by default.

        Thanks in advance; I look forward to assisting you further.
        Kate W.NinjaTrader Customer Service

        Comment


          #5
          Hello,

          Yes, I was connected to my NinjaTrader connection (registered through Dorman) for futures trading. Please note that I am comparing the same time periods

          Comment


            #6
            Hello thereyoflite,

            Thank you for your reply.

            Please delete your historical data using the instructions provided at the following page of the NinjaTrader Help Guide:

            Removing Historical Data
            • Once the data has been deleted close NinjaTrader. Open the Documents\NinjaTrader 8\db\cache folder. Select all files then right mouse click and select “delete.”
            • Restart NinjaTrader and open a chart for the same time frame as you wish to test in the Strategy Analyzer.
            Once complete, please attempt to re-run the Strategy Analyzer over the same time frame as you were yesterday (i.e. with 5 days to load, ending on 5/25/21). Does the strategy show the exit on session close when you would expect?

            Please let us know if we may be of further assistance.
            Kate W.NinjaTrader Customer Service

            Comment


              #7
              The strategy had no positions open during session close, so there was no "exit on session close." The historical strategy performance is now matching the strategy backtest data over the same time period after resetting historical data as you suggested.
              This has led me to believe that a lot of the issues I am having running my strategy are due to time settings. What time settings do I need to use when opening up my chart before applying my strategy to it, so that it runs on the same time period I am backtesting on?
              I thought this would be done automatically as both strategy analyzer and my charts on which I enable my strategy are both set to MNQ "use instrument settings" for time, which should just be operating off of CME futures trading hours. Is there a way for me to set the time settings myself so that I can be sure both the strategy on the chart, and the backtest in strategy analyzer are using the same trading hours and time zone?

              Thank you

              Comment


                #8
                Hello thereyoflite,

                Thank you for your reply.

                Time zone would be controlled by the Time Zone setting in Options > General and would be the same throughout the platform.

                You can specify a specific trading hours template for a chart in the Data Series window, and for the Strategy Analyzer in the parameters for the backtest. However, if you're using the same instrument, these should not need to be specified.

                If you're now seeing the backtest match the historical strategy performance, it's likely there was simply a caching issue with the data. Should you run into similar issues in the future, deleting the cache should resolve.

                Please let us know if we may be of further assistance to you.
                Kate W.NinjaTrader Customer Service

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by adeelshahzad, Today, 03:54 AM
                5 responses
                32 views
                0 likes
                Last Post NinjaTrader_BrandonH  
                Started by stafe, 04-15-2024, 08:34 PM
                7 responses
                32 views
                0 likes
                Last Post NinjaTrader_ChelseaB  
                Started by merzo, 06-25-2023, 02:19 AM
                10 responses
                823 views
                1 like
                Last Post NinjaTrader_ChristopherJ  
                Started by frankthearm, Today, 09:08 AM
                5 responses
                19 views
                0 likes
                Last Post NinjaTrader_Clayton  
                Started by jeronymite, 04-12-2024, 04:26 PM
                3 responses
                43 views
                0 likes
                Last Post jeronymite  
                Working...
                X