Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Entering Short Trades Bug

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

    Entering Short Trades Bug

    Hey guys ive got a bug in my code. It sometimes generates short trades even though there is no line coded "entershort" what might be the cause of this? Is there a way to prevent it entering short trades within a strategy?

    #2
    Elitetradernyc,

    Can you provide a copy of the script that you are working with?

    Are you using the managed or unmanaged approach?
    Cal H.NinjaTrader Customer Service

    Comment


      #3
      Hi, what do you mean by managed versus unmanaged? I can provide you with some code snippets. I have checked to make sure exit # of shares is not > position.quantity but that does not help.

      I am using something like:
      if certain conditions are true:
      EnterLong(myNumbContracts/2, "Long Side " + tradeNo);

      I also have another long entry, with maximum of 2 at one time.

      Then I'm scaling out the position

      Like ExitLong(numbscaleout);

      If a stop is hit, then i just use:
      ExitLong();

      I have two stopout conditions that both have exitlongs.

      Comment


        #4
        Elitetradernyc,

        Based off what you are telling me you are using the Managed Approach for the orders.

        With the managed approach the only way to have a short position being submitted is to have one of the EnterShort methods being processed.

        You can do a search for your code by opening the editor window, Tools -> Edit NinjaScript -> Strategy and press Ctrl + F and type in EnterShort

        In order to assist with debugging you would need to send me the script either via Email or attach here in the forum.

        Email me at support[at]ninjatrader[dot]com with a reference to this post.
        Cal H.NinjaTrader Customer Service

        Comment


          #5
          Hi sir, as weird as it seems, there is no "Entershort" within the code. I did have one but it was commented and it still enters short trades even without the commented one. Is it possible that my strategy or NT copy is corrupted?

          Comment


            #6
            Elitetradernyc,

            At this point, I would ask that you send me your script to support[at]ninjatrader[dot]com so that I may test it out on my end and review the code.

            Please reference this post in the body
            Cal H.NinjaTrader Customer Service

            Comment


              #7
              I forwarded you the strategy as requested.

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by Geovanny Suaza, 02-11-2026, 06:32 PM
              0 responses
              558 views
              0 likes
              Last Post Geovanny Suaza  
              Started by Geovanny Suaza, 02-11-2026, 05:51 PM
              0 responses
              324 views
              1 like
              Last Post Geovanny Suaza  
              Started by Mindset, 02-09-2026, 11:44 AM
              0 responses
              101 views
              0 likes
              Last Post Mindset
              by Mindset
               
              Started by Geovanny Suaza, 02-02-2026, 12:30 PM
              0 responses
              545 views
              1 like
              Last Post Geovanny Suaza  
              Started by RFrosty, 01-28-2026, 06:49 PM
              0 responses
              547 views
              1 like
              Last Post RFrosty
              by RFrosty
               
              Working...
              X