Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Exit on session close

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

    Exit on session close

    Hi, even though i deactivated the exitonSessionClose it still exit on session close. What can it be?


    Click image for larger version

Name:	Immagine 2022-04-10 121317.jpg
Views:	308
Size:	163.6 KB
ID:	1197158

    #2
    Hey Alessio,

    If you are in any open positions in a backtest, and the backtest finishes it will show you exit on session close with your current open positions which is basically a way of showing unrealized profit.

    If you were running that strategy live it would still be in a position.


    I build useful software systems for financial markets.

    Generate automated strategies in NinjaTrader : www.stratgen.io

    Comment


      #3
      That's not it or I would have just one exit on session close, not 5 also it uses wrong day for the backtest. I selected 15/3 to 21/3 and it opens position from the 8/3 to the 11/3 Click image for larger version  Name:	gwergweg.jpg Views:	0 Size:	851.7 KB ID:	1197182

      Comment


        #4
        Originally posted by AlessioCianini12 View Post
        That's not it or I would have just one exit on session close, not 5 also it uses wrong day for the backtest. I selected 15/3 to 21/3 and it opens position from the 8/3 to the 11/3 Click image for larger version Name:	gwergweg.jpg Views:	0 Size:	851.7 KB ID:	1197182
        It shows 5 because you have different entry prices, NinjaTrader separates by Entry Prices and by Entry name.

        Comment


          #5
          Hello AlessioCianini12,

          JakeOfSpades is correct in that in the Strategy Analyzer, any open positions are exited on the last historical bar automatically so that the trade information can be included with the results. If there are multiple entry orders with unique signal names, these would all be individual trades exited by an exit on close order.

          Regarding the dates, is perhaps a stale results page?
          Can you close this Strategy Analyzer, open a new analyzer window, select these settings, and reproduce this behavior?
          Are there errors appearing on the Log tab of the Control Center?



          Chelsea B.NinjaTrader Customer Service

          Comment


            #6
            Hi, there is no error in the log, also in the strategy I created a method that closes all the position after 17.30, in playback works perfectly, in the analyzer debugging it, it doesn't show any problem with the calculation, therefore I don't understand what is going on. Why it stops after the 11 of march, why it doesn't go for also the other days? I have downloaded all the historical data so it's not a problem related to it.. Can i send my code to someone to try it? thanks

            Comment


              #7
              Hello AlessioCianini12,

              You would need to debug the script using Print() and TraceOrders to understand the behavior.

              Below is a link to a forum post that demonstrates using Print() and TraceOrders to understand behavior.


              If you start by printing the time of the bar, you can verify that the data is being processed after March 11th.

              If you print the values in the conditions, you can verify why these evaluate as true or false.

              If you enable TraceOrders you can see when orders are being submitted, ignored, rejected, or cancelled.


              I would not be able to debug your script on your behalf. This thread will remain open for any community members that would like to debug your work as convenience to you.

              Unfortunately, in the support department at NinjaTrader it is against our policy to create, debug, or modify, code or logic for our clients. Further, we do not provide C# programming education services or one on one educational support in our NinjaScript Support department. This is so that we can maintain a high level of service for all of our clients as well as our associates.

              That said, we are happy to answer any questions you may have about NinjaScript if you decide to code this yourself. We are also happy to assist with finding resources in our help guide as well as simple examples, and we are happy to assist with guiding you through the debugging process to assist you with understanding unexpected behavior.

              You can also contact a professional NinjaScript Consultant who would be eager to create or modify this script at your request or assist you with your script. The NinjaTrader Ecosystem has affiliate contacts who provide educational as well as consulting services. Please let me know if you would like our NinjaTrader Ecosystem team follow up with you with a list of affiliate consultants who would be happy to create this script or any others at your request or provide one on one educational services.
              Chelsea B.NinjaTrader Customer Service

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by NullPointStrategies, Yesterday, 05:17 AM
              0 responses
              70 views
              0 likes
              Last Post NullPointStrategies  
              Started by argusthome, 03-08-2026, 10:06 AM
              0 responses
              143 views
              0 likes
              Last Post argusthome  
              Started by NabilKhattabi, 03-06-2026, 11:18 AM
              0 responses
              76 views
              0 likes
              Last Post NabilKhattabi  
              Started by Deep42, 03-06-2026, 12:28 AM
              0 responses
              47 views
              0 likes
              Last Post Deep42
              by Deep42
               
              Started by TheRealMorford, 03-05-2026, 06:15 PM
              0 responses
              51 views
              0 likes
              Last Post TheRealMorford  
              Working...
              X