Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Exiting position over bought and placed me back into trade?

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

    Exiting position over bought and placed me back into trade?

    Hello,

    Today I was in a short on the ES with 2 contracts. I use an automated strategy that I had/am having developed. My programmer won't get back to me until Monday so I wanted to see if I could get a head start on this by asking here.

    The price action hits the profit target (MIT) but for some reason bought to cover 3 contracts despite being in a 2 contract short position, which means I was then in a long position. What would cause this?

    I had this same strategy running on another chart and all the orders filled exactly as they should.

    Is this a strategy error/bug or something else?

    I've attached the log.

    Click image for larger version  Name:	image.png Views:	1 Size:	7.5 KB ID:	1273946
    Last edited by StrongLikeBull; 10-21-2023, 09:13 PM.

    #2
    any ideas?

    Comment


      #3
      Hello StrongLikeBull,

      Thanks for your post.

      What version of NinjaTrader are you using? Please provide the entire version number. This can be found under Help -> About (Example: 8.?.?.?)​

      Are you using Exit order methods or Set methods for the stops/targets in the script?

      Or, does your strategy use both Exit methods and Set methods?

      Does your strategy call Entry order methods and Exit order methods in the same condition in the script?

      Have you added debugging prints to the strategy to understand exactly how it is behaving and placing orders?

      If not, add prints in the strategy (outside of any conditions) that print the values of every variable used in every condition that places an order along with the time of that bar. Prints will appear in the NinjaScript Output window (New > NinjaScript Output window).

      Also, enable TraceOrders to track orders placed, amended, and canceled and see how they are behaving. The traces display in the NinjaScript Output window.

      ​​​​​​Below is a link to a forum post that demonstrates how to use prints to understand behavior.
      https://ninjatrader.com/support/foru...121#post791121
      <span class="name">Brandon H.</span><span class="title">NinjaTrader Customer Service</span><iframe name="sig" id="sigFrame" src="/support/forum/core/clientscript/Signature/signature.php" frameborder="0" border="0" cellspacing="0" style="border-style: none;width: 100%; height: 120px;"></iframe>

      Comment


        #4
        Originally posted by NinjaTrader_BrandonH View Post
        Hello StrongLikeBull,

        Thanks for your post.

        What version of NinjaTrader are you using? Please provide the entire version number. This can be found under Help -> About (Example: 8.?.?.?)​

        Are you using Exit order methods or Set methods for the stops/targets in the script?

        Or, does your strategy use both Exit methods and Set methods?

        Does your strategy call Entry order methods and Exit order methods in the same condition in the script?

        Have you added debugging prints to the strategy to understand exactly how it is behaving and placing orders?

        If not, add prints in the strategy (outside of any conditions) that print the values of every variable used in every condition that places an order along with the time of that bar. Prints will appear in the NinjaScript Output window (New > NinjaScript Output window).

        Also, enable TraceOrders to track orders placed, amended, and canceled and see how they are behaving. The traces display in the NinjaScript Output window.

        ​​​​​​Below is a link to a forum post that demonstrates how to use prints to understand behavior.
        https://ninjatrader.com/support/foru...121#post791121
        8.1.1.7 64-bit

        Unfortunately I have no idea the answers to the rest of your questions.

        I think the better question would be, why did the same strategy running the same settings and parameters close out of the same exact trade fine on another chart (but same instrument and candle) but this one didn't?

        Comment


          #5
          Hello StrongLikeBull,

          Thanks for your notes.

          Ultimately, debugging steps would have to be taken to understand exactly how the strategy behaved and placed trades on the chart. Since the script is not created by NinjaTrader we cannot say for certain how the logic in the script is working.

          Your developer could add debugging prints to the script and test it to see exactly how their logic in the script is behaving when orders are being placed. This will allow them to narrow down the behavior to see what exactly in the code could have caused this behavior.

          If the developer has questions about debugging their logic, they could contact support[at]ninjatrader[dot]com.
          <span class="name">Brandon H.</span><span class="title">NinjaTrader Customer Service</span><iframe name="sig" id="sigFrame" src="/support/forum/core/clientscript/Signature/signature.php" frameborder="0" border="0" cellspacing="0" style="border-style: none;width: 100%; height: 120px;"></iframe>

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by argusthome, 03-08-2026, 10:06 AM
          0 responses
          86 views
          0 likes
          Last Post argusthome  
          Started by NabilKhattabi, 03-06-2026, 11:18 AM
          0 responses
          48 views
          0 likes
          Last Post NabilKhattabi  
          Started by Deep42, 03-06-2026, 12:28 AM
          0 responses
          29 views
          0 likes
          Last Post Deep42
          by Deep42
           
          Started by TheRealMorford, 03-05-2026, 06:15 PM
          0 responses
          32 views
          0 likes
          Last Post TheRealMorford  
          Started by Mindset, 02-28-2026, 06:16 AM
          0 responses
          67 views
          0 likes
          Last Post Mindset
          by Mindset
           
          Working...
          X