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

Strategy set to enter with 1 order quantity but sometimes it enters with 2

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

    Strategy set to enter with 1 order quantity but sometimes it enters with 2

    I set up a strategy to enter a trade with 1 order quantity. It does what it’s supposed to do but when I enable the strategy again, it will enter with 2 orders. Not sure what is going on…. I always check the order quantity option on Builder and also before enabling a strategy but that still happens

    #2
    Hello rafael_delima86,

    Thanks for your post.

    Before you start-up the strategy for the 2nd time, please check the "Positons" tab of the NinjaTrader control center and verify there are no existing positions.

    What is the start-up behavior of the strategy? By default, it would be "Wait until flat".

    In your strategy do you have conditions that enter long AND exit short as well as enter Short and exit long?

    Are you manually trading on the same instrument and account as the strategy?

    Paul H.NinjaTrader Customer Service

    Comment


      #3
      Hello Paul,
      So my strategy consists of entering a position on Macd crossover, and exit when another crossover occurs.

      Comment


        #4
        Hello rafael_delima86,

        Thanks for your reply.

        What is the start-up behavior of the strategy? By default, it would be "Wait until flat", can you confirm?

        Are you manually trading (at the same time) on the same instrument and account as the strategy?

        Do you have any other exit orders besides the exit on MACD crossover?

        Are you testing on live data, playback with market replay data, or in the strategy analyzer?

        What is the Calculate setting of the strategy?

        Can you provide further information we can assist?
        Paul H.NinjaTrader Customer Service

        Comment


          #5
          Originally posted by NinjaTrader_PaulH View Post
          Hello rafael_delima86,

          Thanks for your reply.

          What is the start-up behavior of the strategy? By default, it would be "Wait until flat", can you confirm?

          Are you manually trading (at the same time) on the same instrument and account as the strategy?

          Do you have any other exit orders besides the exit on MACD crossover?

          Are you testing on live data, playback with market replay data, or in the strategy analyzer?

          What is the Calculate setting of the strategy?

          Can you provide further information we can assist?
          Hey Paul....
          Yes Wait Until Flat is on.
          I do not place any orders manually.
          Aside from ENTER and EXIT on macd crossover, I only have STOP LOSS and Profit Target placed on each entry.
          I am testing on LIVE data.
          Calculate ON BAR CLOSE

          Comment


            #6
            Hello rafael_delima86,

            Thanks for your reply.

            Do you have conditions that enter long on a macd cross and exit short on a macd cross, and then enter short on a macd cross and exitlong on a macd cross?

            Can you post a screenshot of your entry and exit sets?


            To get a screenshot with Windows 7 or newer I would recommend using the Windows Snipping Tool.

            Click here for instructions

            Alternatively to send a screenshot press Alt + PRINT SCREEN to take a screenshot of the selected window. Then go to Start--> Accessories--> Paint, and press CTRL + V to paste the image. Lastly, save as a jpeg file and send the file as an attachment.

            Click here for detailed instruction
            Paul H.NinjaTrader Customer Service

            Comment


              #7
              This is what I came up with...However, on the ENTRIES condition, I believe I am missing a Position.Market Position=Market Position.Flat right?

              Comment


                #8
                Hello rafael_delima86,

                Thanks for your reply.

                I was hoping to see all of the entry and exit sets but I think what you are showing is the issue. When you place an entry order, if there is already a position in the opposite direction, the entry method will automatically issue a market order called "Close Position" and then a second order to leave you in the intended position. If however an Exit order is called at the same time then it too will issue an order in that same direction leaving you with 2 positions.

                Yes, in your entry sets you can add a condition to check that the market position is flat and that will prevent additional orders by the entry.
                Paul H.NinjaTrader Customer Service

                Comment


                  #9
                  Originally posted by NinjaTrader_PaulH View Post
                  Hello rafael_delima86,

                  Thanks for your reply.

                  I was hoping to see all of the entry and exit sets but I think what you are showing is the issue. When you place an entry order, if there is already a position in the opposite direction, the entry method will automatically issue a market order called "Close Position" and then a second order to leave you in the intended position. If however an Exit order is called at the same time then it too will issue an order in that same direction leaving you with 2 positions.

                  Yes, in your entry sets you can add a condition to check that the market position is flat and that will prevent additional orders by the entry.
                  correct, the long entries and short entries are the same...
                  I will add the market position flat on both entries sets, however, do I need to add market position FLAT on exits as well?

                  Comment


                    #10
                    Hello rafael_delima86,

                    Thanks for your reply.

                    For the exits you would not want to check for a flat position. If there is no position, ExiLong and ExitShort perform no function.

                    You could check that for the exitlong that you are is a long market position, and the opposite for the short side.
                    Paul H.NinjaTrader Customer Service

                    Comment


                      #11
                      Thanks Paul....
                      I think it's fixed now, I will test it on live data tomorrow...

                      thanks a bunch!

                      Comment

                      Latest Posts

                      Collapse

                      Topics Statistics Last Post
                      Started by StockTrader88, 03-06-2021, 08:58 AM
                      44 responses
                      3,965 views
                      3 likes
                      Last Post jhudas88  
                      Started by rbeckmann05, Today, 06:48 PM
                      0 responses
                      4 views
                      0 likes
                      Last Post rbeckmann05  
                      Started by rhyminkevin, Today, 04:58 PM
                      4 responses
                      52 views
                      0 likes
                      Last Post dp8282
                      by dp8282
                       
                      Started by iceman2018, Today, 05:07 PM
                      0 responses
                      5 views
                      0 likes
                      Last Post iceman2018  
                      Started by lightsun47, Today, 03:51 PM
                      0 responses
                      8 views
                      0 likes
                      Last Post lightsun47  
                      Working...
                      X