Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Reversing Position

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

    Reversing Position

    My question is in regards to reversing positions.

    Say for example I am Long 5 contracts. I then want to add a strategy that will reverse my position if necessary, therefore Short 5 contracts and vice-versa if necessary. I never want my position to be greater than 5 contracts.

    Initially I have gong Long 5 contracts via the Orders tab.

    Under Options I have clicked on "Immediately submit live working historical orders"/
    On the Strategy tab I have clicked:

    My Input: 1
    Enabled: True
    Entries per direction: 5
    Entry handling: All Entries
    Sync: False
    Default quantity: 5
    Set order quantity: by default quantity

    Using these options or some other set it seems I am not getting my desired result of either being Long 5 or Short 5.

    If I am Long 5 and the next signal is also Long I will be Long 10.
    If I am Long 5 and the next signal is Short then I will become Flat. The following signal if Short will make me Short 5, and then Short 10...

    Please advise on how I can only be Long or Short 5 and for the Strategy to produce a signal when there should be a reversal in my position.

    Thank you

    #2
    It would probably help to post some of your code.

    Comment


      #3
      Hello Scarlett09,

      If you do not feel comfortable posting some of your code, you can you send a toy* NinjaScript code replicating the behavior so that I may look into this to support [at] ninjatrader [dot] com with the subject line: ATTN: JC and in the body of the email reference this thread.

      You can either Export it as a Source File using the step from our Help Guide at the link below or just send the ".cs" file that is going to be located in the (My) Documents -> NinjaTrader 7 -> bin -> Custom -> Strategy folder.
      http://www.ninjatrader.com/support/h...tml?export.htm


      Happy to be of further assistance.

      *Toy - basically a stripped down version of code that isn't necessarily the whole logic; making it easier to identify lines of code.
      JCNinjaTrader Customer Service

      Comment


        #4
        Hi,

        In order to test this out as often as I can I'm just using the Strategy Wizard with the following:

        Close [0] > Close [1] then Long
        Close [0] < Close [1] then Short

        with Default 1 and min 1.

        Comment


          #5
          Hello Scarlett09,

          Using the Managed Approach, which is what is used by the Strategy Wizard it will automatically reverse your position if the Enter() method is called. For Example: if you are 10 Short and EnterLong() for 5 contracts is call NinjaTrader will automatically enter an order to fill your 10 short orders and then place another order for 5 Long.

          This is a link to our Help Guide that goes over the different Order Methods.
          http://www.ninjatrader.com/support/h...er_methods.htm

          Please note that with your order with your EntryHandling your position size can be up to 25, since 5 orders per entry and 5 entries per direction.
          http://www.ninjatrader.com/support/h...ryhandling.htm

          Let us know if we can be of further assistance.
          JCNinjaTrader Customer Service

          Comment


            #6
            Hi,

            I understand the Managed Approach, this is what I am expecting to happen but in reality it is not working.

            As I said in my example, I am 5 Short. If a reversal signal is produced I want to be 5 Long. If the signal remains Short I still want to be 5 Short. Not an additional 5 Short to total 10 Short.

            So my question remains, how do you recommend doing this? Please advise on how I can only be Long or Short 5 and for the Strategy to produce a signal when there should be a reversal in my position.

            How would you set up a Strategy to work so that the Managed Approach works correctly?

            Comment


              #7
              Hello Scarlett09,

              Please set your EntriesPerDirect = 1. So that with your default quantity set to 5, NinjaTrader will submit one order for 5 contracts in one direction only, meaning that if another order is triggered for the same direction NinjaTrader will ignore it.

              The following link to our Help Guide goes over EntryHandling that you may view for more details.
              http://www.ninjatrader.com/support/h...ryhandling.htm

              Let us know if we can be of further assistance.
              JCNinjaTrader Customer Service

              Comment


                #8
                If I am using the following:

                Entries per direction: 5

                Then why am I Long or Short 10, then 15, then 20 and 25?

                I only want to be Long 5 or Short 5. No mas or less, ever.

                All I keep doing here is repeating my first question.
                If I use one of the samples I'm getting the same result, do I need a new NT?

                Comment


                  #9
                  Originally posted by Scarlett09 View Post
                  If I am using the following:

                  Entries per direction: 5

                  Then why am I Long or Short 10, then 15, then 20 and 25?

                  I only want to be Long 5 or Short 5. No mas or less, ever.

                  All I keep doing here is repeating my first question.
                  If I use one of the samples I'm getting the same result, do I need a new NT?
                  Entries Per Direction is different from Quantity...Quantity is the amount of contracts/shares/lots per trade, Entries is the number of trades.

                  Comment

                  Latest Posts

                  Collapse

                  Topics Statistics Last Post
                  Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                  0 responses
                  647 views
                  0 likes
                  Last Post Geovanny Suaza  
                  Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                  0 responses
                  368 views
                  1 like
                  Last Post Geovanny Suaza  
                  Started by Mindset, 02-09-2026, 11:44 AM
                  0 responses
                  108 views
                  0 likes
                  Last Post Mindset
                  by Mindset
                   
                  Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                  0 responses
                  571 views
                  1 like
                  Last Post Geovanny Suaza  
                  Started by RFrosty, 01-28-2026, 06:49 PM
                  0 responses
                  573 views
                  1 like
                  Last Post RFrosty
                  by RFrosty
                   
                  Working...
                  X