Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

exit half the position

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

    exit half the position

    Dear Ninjatrader

    how / where do I say in the strategy builder (or in the code window) that if a certain condition is met (eg price hits a MA line) I want to exit 0.5 position; and exit another 0.5 of the position after another conditon is met.

    Many thanks

    Jonas

    #2
    Jonas, to be able to do this you would first of all need to scale into a position as shown in this sample - http://www.ninjatrader.com/support/f...ead.php?t=3751

    Comment


      #3
      Hi, hope you don't mind me tagging on a related question.
      I'd like to be able to exit half a strategy position at a target, and leave the other half to be exited at the close. I want a stop (loss) working on the open position at all times, and my original entry is stop market.

      Figured I could enter two differently named LongStop entries, so that I can address the two positions differently for my scaling out

      EnterShortStop(1,IntendedShortEntryPrice,"ShortScalp");
      EnterShortStop(
      1,IntendedShortEntryPrice,"ShortSwing");


      But I'm finding that only the first gets filled when backtesting. Should I be able to get two simultaneous EnterShortStop statements to work, or am I missing something in the entry handling rules?

      I have the following set in the initialise section
      EntriesPerDirection = 1;
      EntryHandling = EntryHandling.UniqueEntries;

      The Control Centre Log reports that
      26/11/2012 20:44:35 Strategy A SellShort stop order placed at '11/03/2009 07:15:00' has been ignored since the stop price is greater than or equal to close price of the current bar. This is an invalid order and subsequent orders may also be ignored. Please fix your strategy.

      but this seems odd, since my strategy analysis starts in early 2008 and there are multiple instances of similar trades before the timestamp cited in the Log message, so may not be related.

      Many thanks

      Comment


        #4
        sorry, ignore my question, just got it working after x hours, realised changing the EntryHandling in the strategy hadn't updated through to overwrite the old setting. Doh!

        Comment


          #5
          Hi Bertrand

          Thanks for the link

          I set everything up as per the demo strategy attached (SampleScaleOut).
          On the chart I see Long 1a [email protected] Long 1b [email protected]. and then exits one after another. So looks like it works. Thanks!
          Question: where can I edit this 100 value?

          Also, I currently have a trailing stop. Once the target is reached for Long 1a, I want to move the stop up to where I entered the market. Looks like trailing stop would protect me better, but I want to know how can I set a stop to where I entered there market after I ext 0.5 of position.
          I hope I was clear enough.

          Comment


            #6
            Hi ionaz, the 100 quantity value would either be set directly in your strategy code in the Enter methods or from the UI strategy parameters (under the Order Properties options > Set Order Qty).

            In the sample below you would see a custom trailing stop created via SetStopLoss that would move to breakeven on your desired level, this can be tied to a partial entry as well via the signal names - http://www.ninjatrader.com/support/f...ead.php?t=3222

            Comment


              #7
              Hi Bertrand

              Many thanks for your reply.

              And when it come to the commission, how am I charged for this type of entry: Long 1a [email protected] Long 1b [email protected] ? I mean, obviously I pay for 200 stocks. But It is represented as 2 different orders and implies that commission is taken for 2 orders whereas I think it should be treated as 1 order. So how does NT treats it, as one or as two?

              Comment


                #8
                Correct Ionaz, if you scale in like this it would be 2 different entry orders then.

                Comment


                  #9
                  Bertrand, let me be more precise. I think when buying there should be 1 order, not 2 from the commission point of view. I mean there are 2 types of commission: for the capacity(%based) and for the # of orders (ie min1$/order). So when I am scalling out, sell 100 stocks, and again 100 stocks after a week, I agree - 2 orders, and I have to pay for them. But when I buy, and can buy 200 in one order, the commission (not the % part, but the min commission) should be for a single order. do you see what I mean? of course if due to market conditions there have to be 2 orders when I enter that's fine, but now it looks artificial from the commission poit of view.

                  What's would be the best/easiest way to set it up so that th min comission is not charged twice when it can be charged once?

                  Many thanks

                  Comment


                    #10
                    Hello ionaz,
                    If you have commissions in mind then I will suggest submitting the orders via the Unmanaged approach. The Unmanaged approach gives complete control on how you submit the orders.

                    However please do note, the unmanaged approach is for advanced programmers and NinjaTrader does not "manage" anything like the Managed approach.
                    JoydeepNinjaTrader Customer Service

                    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