Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Order Entry Problem

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

    Order Entry Problem

    I have a strategy developed and tested the logic using the output window to print messages at certain points so i could make sure things were happening at the correct time. I'm satisfied that I have the logic right and so I inserted EnterLong() into the location in my code right before the place where I output to the output window that a long position has taken place. The message to the output window happens exactly when it's supposed to but the EnterLong() happens at bar open a bar later. This doesn't make sense to me. Seems that the EnterLong() should happen at any point that I tell it to rather than waiting until barclose. I tried setting
    CalculateOnBarClose =
    false; as well as true. Can you point me in the right direction?

    Thanks,
    Mike

    #2
    Mike,

    This is expected behaviour. Your strategy evaluates on the close of each bar, and then submits an order which is then live on the next bar. This is always true in a backtest and true real-time if CalculateOnBarClose is set to true.

    If set to false, then it will evaluate within a bar (real-time) only if an order is filled, the execution is plotted on the bar based on the execution time stamp.
    RayNinjaTrader Customer Service

    Comment


      #3
      That's the kind of behavior I expected as well or at least what you described. That's not what I'm seeing. I have calculateonbarclose set to false. When my strat finds an entry, my code prints a message to the output window telling me what the entry was and this is done correctly. With CalculateOnBarClose set to false based on your answer it seems to me that the order should also be placed at that same time. However, it isn't. The order is placed at the open of the next bar.

      By the way, I'm describing what happens during the live market.

      Also, when I start the strategy an order shows up on the chart for buytocover stp. it just sits there. is this normal?

      Thanks,
      Mike

      Comment


        #4
        Mike can you confirm with us which version of NinjaTrader you are on?

        Normally, if CalculateOnBarClose = false in real-time, the order will be submitted whenever your entry condition evaluated to true. Now this does not mean you will be filled, it just means it will be submitted.

        I suggest you use TraceOrders to determine what is going on with your orders.

        In regards to orders that are showing up when you start a strategy, it is because of the simulated strategy position. Please review this tip for a further discussion. http://www.ninjatrader-support.com/v...ead.php?t=4033
        Josh P.NinjaTrader Customer Service

        Comment


          #5
          Thanks Josh...

          I am using version 6.0.1000.6

          I'm sure that I have something just a bit off. Now that you guys have confirmed what I thought the behavior should be, I'll go over my code again to make sure there isn't something I overlooked.

          Thanks again,
          Mike

          Comment


            #6
            No problem. Let us know if we can assist you in any other way after you run through your analysis.
            Josh P.NinjaTrader Customer Service

            Comment


              #7
              Mike.... Can you post your code....I am interested in seeing what the problem is..... Thanks!

              Comment


                #8
                thanks edgeliner...if figured out what the problem was and took care of. however, please don't ask me what it was because i don't specifically remember. but, the bottom line is that it was a logic error.

                thanks again,
                Mike

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                0 responses
                598 views
                0 likes
                Last Post Geovanny Suaza  
                Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                0 responses
                343 views
                1 like
                Last Post Geovanny Suaza  
                Started by Mindset, 02-09-2026, 11:44 AM
                0 responses
                103 views
                0 likes
                Last Post Mindset
                by Mindset
                 
                Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                0 responses
                556 views
                1 like
                Last Post Geovanny Suaza  
                Started by RFrosty, 01-28-2026, 06:49 PM
                0 responses
                555 views
                1 like
                Last Post RFrosty
                by RFrosty
                 
                Working...
                X