Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Entry at open

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

    #31
    Originally posted by NinjaTrader_Josh View Post
    tjendra,

    No. Those orders are not from what you evaluated at market open. Those are coming from whatever you had left over before. You need to cancel your working orders.

    Please go back to your code and use TraceOrders = true to see when your order is being submitted. Then all you have to do is not submit that order or cancel that order and it will be gone.
    I will try that. What if it shows the order was submitted at market open? Is that possible if CalculateOnBarClose is set to True?

    Comment


      #32
      tjendra,

      An order submitted with CalculateOnBarClose = true gets filled on the next bar. Not possible to have an order filled at market open from a submission at market open when using CalculateOnBarClose = true. The order has to have come from before market open. It was likely generated on the last bar before the new session and filled on the market open because that is the next tradeable location.
      Josh P.NinjaTrader Customer Service

      Comment


        #33
        Originally posted by NinjaTrader_Josh View Post
        The order has to have come from before market open. It was likely generated on the last bar before the new session and filled on the market open because that is the next tradeable location.
        What you said here is exactly what I think happened. But doesn't stopping the strategy and restarting it stop this from happening? There should be no carry over trade from the last trading day given all strategies would have stopped at the end of the trading session.

        Comment


          #34
          Stopping a strategy and restarting it just means the strategy goes and recalculates everything again. If it saw a submission at the end that was not explicitly cancelled by the strategy then it will try and place that in.

          A. Don't submit that order
          B. Cancel that order explicitly in the strategy
          Josh P.NinjaTrader Customer Service

          Comment


            #35
            Originally posted by NinjaTrader_Josh View Post
            Stopping a strategy and restarting it just means the strategy goes and recalculates everything again. If it saw a submission at the end that was not explicitly cancelled by the strategy then it will try and place that in.

            A. Don't submit that order
            B. Cancel that order explicitly in the strategy
            How do I implement A or B solution in the strategy? Do I test using IOrder objects at 4pm? If you can provide some advice, it would be very helpful. Thanks.

            Comment


              #36
              The first step is to figure out exactly what the scenario is. To do this you need to use TraceOrders = true and see what the outputs are around the switch from market close to a new market open. Then you can tailor a solution when you figure out what exactly is happening.
              Josh P.NinjaTrader Customer Service

              Comment


                #37
                Originally posted by NinjaTrader_Josh View Post
                The first step is to figure out exactly what the scenario is. To do this you need to use TraceOrders = true and see what the outputs are around the switch from market close to a new market open. Then you can tailor a solution when you figure out what exactly is happening.
                If all that's happening is that the strategy wanted to enter long/short after evaluating the strategy at the 4:00pm bar without knowing that the session will end after 4:00pm?

                All I want to do here is cancel any pending order that still exists after 4:00pm so that it doesn't execute on market open.

                Comment


                  #38
                  Yes. Or you can stop your strategy when 4PM hits.

                  Code:
                  if (ToTime(Time[0]) > 160000)
                       return;
                  You may even need to return before that last bar too with >=.
                  Josh P.NinjaTrader Customer Service

                  Comment


                    #39
                    Originally posted by NinjaTrader_Josh View Post
                    Yes. Or you can stop your strategy when 4PM hits.

                    Code:
                    if (ToTime(Time[0]) > 160000)
                         return;
                    You may even need to return before that last bar too with >=.
                    Thanks, I think your solution should work. I will need to place this code

                    if (ToTime(Time[0]) >= 160000)
                    return;

                    right in the beginning of OnBarUpdate() right? So that it doesn't evaluate the 4pm bar.

                    This shouldn't affect the Exit on close orders right?

                    Comment


                      #40
                      Correct. Exit on Close will not be influenced.
                      Josh P.NinjaTrader Customer Service

                      Comment

                      Latest Posts

                      Collapse

                      Topics Statistics Last Post
                      Started by David Hill, 07-18-2024, 07:41 AM
                      4 responses
                      27 views
                      0 likes
                      Last Post David Hill  
                      Started by aban1alpha, Today, 02:01 PM
                      0 responses
                      5 views
                      0 likes
                      Last Post aban1alpha  
                      Started by jaybedreamin, Today, 01:08 PM
                      0 responses
                      5 views
                      0 likes
                      Last Post jaybedreamin  
                      Started by Rheiverson, 07-18-2024, 04:28 PM
                      2 responses
                      19 views
                      0 likes
                      Last Post Rheiverson  
                      Started by p1kn1t, Today, 11:32 AM
                      0 responses
                      13 views
                      0 likes
                      Last Post p1kn1t
                      by p1kn1t
                       
                      Working...
                      X