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

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 traderqz, Today, 12:06 AM
              10 responses
              18 views
              0 likes
              Last Post traderqz  
              Started by algospoke, 04-17-2024, 06:40 PM
              5 responses
              46 views
              0 likes
              Last Post NinjaTrader_Jesse  
              Started by arvidvanstaey, Today, 02:19 PM
              1 response
              6 views
              0 likes
              Last Post NinjaTrader_Zachary  
              Started by mmckinnm, Today, 01:34 PM
              3 responses
              5 views
              0 likes
              Last Post NinjaTrader_ChelseaB  
              Started by f.saeidi, Today, 01:32 PM
              2 responses
              9 views
              0 likes
              Last Post f.saeidi  
              Working...
              X