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

Cancelled order due to end of session handling

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

    Cancelled order due to end of session handling

    Dear all,

    I've got the following situation:

    - I'm starting a strategy with strategy not being flat at the moment of starting

    - NinjaScript option on starting a real-time strategy is set to "Wait until flat before executing live"

    - Exit on close is set to true

    Now, when the strategy is trying to close the position an unexpected error comes up:

    04.09.2008 19:14:41 Entered internal PlaceOrder() method at 04.09.2008 19:14:41: Action=Sell OrderType=Market Quantity=0 LimitPrice=0 StopPrice=0 SignalName='' FromEntrySignal=''

    04.09.2008 19:14:41 Cancelled order due to end of session handling: BarsInProgress=0: Order='NT-00494/Sim101' Name='Sell' State=Working Instrument='FDAX 09-08' Action=Sell Limit price=0 Stop price=0 Quantity=0 Strategy='KaVe2191B' Type=Market Tif=Gtc Oco='' Filled=0 Fill price=0 Token='751025c0e81246fabb56a1b9721c7ce2' Gtd='01.12.2099 00:00:00'

    Why is this error triggered? End of session of the FDAX would be hours later?

    brima

    #2
    What is your chart's session end time set at? You have Exit on close set to 30 seconds?
    Josh P.NinjaTrader Customer Service

    Comment


      #3
      Yes, Order Handling/Exit on close seconds is set to 30.

      Comment


        #4
        Chart session end time? The only reason the Exit on Close order would kick in is if it is approaching the session end time defined by either the strategy or the chart.
        Josh P.NinjaTrader Customer Service

        Comment


          #5
          Chart session end time is not explicitly set - I open the chart with File/New/Chart with start date is today and last date is today.

          Strategy doesn't define a session end time either, because Order Handling/Exit on close seconds is set to 30.

          But: as soon as I start the strategy in real-time with no position opened on historical data which means being flat when starting - everything works as expected ...

          Comment


            #6
            Chart session end is set after you open the chart. Right click on the chart and click Properties.

            To confirm: you did NOT receive an Exit on Close order correct?
            Josh P.NinjaTrader Customer Service

            Comment


              #7
              It says
              Session begins 00:00 and Session ends 00:00

              I did not get an Exit on Close order. And I only got the two lines of messages as mentioned above in the output window as I set "TraceOrders = true" in the Initialize() method.

              And in the log there are no errors reported at all.

              Comment


                #8
                Ok. I understand the situation now. I will get back to you after I do some testing.
                Josh P.NinjaTrader Customer Service

                Comment


                  #9
                  The message you got is only induced when both of these conditions are met:
                  • if it is the last bar of the day
                  • and ExitOnClose = true or Time in Force = Day
                  Josh P.NinjaTrader Customer Service

                  Comment


                    #10
                    1st condition "it is the last bar of the day" is false as error time was around 19 o'clock

                    2nd condition "ExitOnClose = true" is true

                    But this means that only one condition is true and thus the message should not be induced as: false and true is false.

                    What do you think? Is it possible that the 1st condition is true and if yes, how could that happen?

                    Comment


                      #11
                      Baffles me too. If you are able to reproduce this consistently let us know.
                      Josh P.NinjaTrader Customer Service

                      Comment


                        #12
                        Okay, I had this problem yesterday and today and if I'm able to reproduce it tomorrow, I'll be back then ...

                        Comment


                          #13
                          If you hit it. Keep all of your output logs too. That will be useful for investigating the issue. Thanks.
                          Josh P.NinjaTrader Customer Service

                          Comment


                            #14
                            I hit it again and I'm able to reproduce consistently.

                            My output log:

                            ----------------------------------------------
                            05.09.2008 10:28:52 Entered internal PlaceOrder() method at 05.09.2008 10:28:52: Action=Sell OrderType=Market Quantity=0 LimitPrice=0 StopPrice=0 SignalName='' FromEntrySignal=''
                            Exitlong
                            6184,5
                            ----------------------------------------------
                            05.09.2008 10:28:52 Cancelled order due to end of session handling: BarsInProgress=0: Order='NT-00050/Sim101' Name='Sell' State=Working Instrument='FDAX 09-08' Action=Sell Limit price=0 Stop price=0 Quantity=0 Strategy='KaVe2191B' Type=Market Tif=Gtc Oco='' Filled=0 Fill price=0 Token='e0f0854d524e40008dcbfdcd179aa0c5' Gtd='01.12.2099 00:00:00'
                            6184,5
                            05.09.2008 10:28:53
                            -----------------------------------------------

                            Moreover the same conditions as mentioned above in my yesterday's postings.

                            Exit on Close is set to true but no session end specified neither in the chart properties nor in the strategy itself.

                            Comment


                              #15
                              brima,

                              You are on minute charts? Can you check the timestamp for these bars:
                              • bar before 5/9/08 10:28:52
                              • bar after 5/9/08 10:28:52
                              Josh P.NinjaTrader Customer Service

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by pmachiraju, 11-01-2023, 04:46 AM
                              8 responses
                              148 views
                              0 likes
                              Last Post rehmans
                              by rehmans
                               
                              Started by mattbsea, Today, 05:44 PM
                              0 responses
                              5 views
                              0 likes
                              Last Post mattbsea  
                              Started by RideMe, 04-07-2024, 04:54 PM
                              6 responses
                              33 views
                              0 likes
                              Last Post RideMe
                              by RideMe
                               
                              Started by tkaboris, Today, 05:13 PM
                              0 responses
                              5 views
                              0 likes
                              Last Post tkaboris  
                              Started by GussJ, 03-04-2020, 03:11 PM
                              16 responses
                              3,282 views
                              0 likes
                              Last Post Leafcutter  
                              Working...
                              X