Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

A strategy with multiple profit targets and the effect on commissions

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

    A strategy with multiple profit targets and the effect on commissions

    Hi all,
    I have a simple strategy I would like to implement via a strategy (not an ATM).
    In my strategy I enter the trade with 3 different take profit targets and one stop-loss.
    Per my understanding I need to use 3 orders in order to implement this strategy.
    My broker commissions depend on the stock quantities I trade. For the sake of simplicity let assume my commissions are:
    1 cent per stock for quantify <= 100
    1/2 cent per stock for quantify >100
    My Questions:
    1. If I use the "managed approach" for writing a strategy, will my commission be 300 cents in case I stopped out (i.e. 100*3. This, since there are three different S.L orders, each for 100 stocks)? or does NT aggregate the SL of the three orders (i.e. in that case my lose would be 200 cents (100 cent + 0.5*200).
    2. Is the only alternative to overcome this issue is by using the "Unmanaged approach" for writing this strategy? (Though this introduces other programmatic complexity)?
    Is there any other alternative?

    I'd appreciate your comments
    Ron

    #2
    rmaron,

    You can enter a single order for 300 shares for example, then sell 100 of them at a time using short positions and as such you should be able to avoid the commission at least when purchasing the shares. You would need to program all this in yourself however, as the managed approach typically uses entrance signals to tie entrance to exit, and also will close long positions and enter short positions when you use EnterShort() after an EnterLong() for example.

    The unmanaged approach gives you more control over orders and will let you bypass most of the rules for the managed approach.

    Please let me know if I may assist further.
    Last edited by NinjaTrader_AdamP; 12-28-2011, 03:12 PM.
    Adam P.NinjaTrader Customer Service

    Comment


      #3
      Originally posted by rmaron View Post
      Hi all,
      I have a simple strategy I would like to implement via a strategy (not an ATM).
      In my strategy I enter the trade with 3 different take profit targets and one stop-loss.
      Per my understanding I need to use 3 orders in order to implement this strategy.
      My broker commissions depend on the stock quantities I trade. For the sake of simplicity let assume my commissions are:
      1 cent per stock for quantify <= 100
      1/2 cent per stock for quantify >100
      My Questions:
      1. If I use the "managed approach" for writing a strategy, will my commission be 300 cents in case I stopped out (i.e. 100*3. This, since there are three different S.L orders, each for 100 stocks)? or does NT aggregate the SL of the three orders (i.e. in that case my lose would be 200 cents (100 cent + 0.5*200).
      2. Is the only alternative to overcome this issue is by using the "Unmanaged approach" for writing this strategy? (Though this introduces other programmatic complexity)?
      Is there any other alternative?

      I'd appreciate your comments
      Ron
      You will have to test it out, but the documentation implies that you can enter with one order for 300 and scale out 100 at a time.

      Comment


        #4
        Thank you Adam and koganam for the quick responses

        As you both suggested, I used the "ExitLong" command to scale out my position.
        However, this brought up another issue:

        When I enter a trade, I use the SetStopLoss command. Obviously, the stop loss is set for the number of stocks I originally entered (i.e. 300 stocks).

        After using the ExistLong command for the first 100 shares, the stoploss doesn’t get updated and its quantity is still set to 300 stocks (i.e. instead of 200).

        My questions:
        1. Is there a way to update the stop loss with the updated amount of stocks the trade left with?
        2. Which parameter keeps the updated quantity of stocks in a trade (i.e. How to retrieve that information).

        Thank you in advanced.

        Ron

        Comment


          #5
          Hi Ron,

          For scaling out in a managed strategy you must first scale in, with distinct entry names. SetStopLoss() can be set for either the whole position, or a specific one using a signal name. Below is the basic structure that could be used for this, and reference sample on scaling out is available here:


          Code:
          protected override void Initialize()
          {
          SetStopLoss("entry1", CalculationMode.Ticks, 10, false);
          SetStopLoss("entry2", CalculationMode.Ticks, 10, false);
          }
          
          
          protected override void OnBarUpdate()
          {
              if(entryConditions) //conditions that determine an entry
              {
              EnterLong(1, "entry1");
              EnterLong(1, "entry2");
              }
          
              if(marketExit) //conditions that determine a market exit
              {
              ExitLong("entry1");
              }
          
          }


          }
          Last edited by NinjaTrader_RyanM1; 01-04-2012, 11:33 AM.
          Ryan M.NinjaTrader Customer Service

          Comment


            #6
            Hi Ryan,

            Your suggestion to use multiple entry commands brings me back to the issue I opened this thread in the first place: Having to pay more comissions due to multiple stop orders in case I'm stopped out (see below).

            Just to recap: My goal is to have a strategy with one entry and then to scale out (i.e. take profits) in different profit levels. At the same time, I would like to maintain a stop loss command which I want to make sure its quantity is in synch with the position I have in the market.

            Would you please clarify the following:
            1. In case my strategy uses multiple entry commands and the StopAndTargetSubmission is set to "ByStrategyPosition" - Will NT aggreagete the multiple stoploss orders to one stoploss order (remember that I use the same stoploss price). Thus my commission will be as if I sent only one stop loss order?
            2. Would you please further clarify the "ByStrategyPosition" value (I read the documentation, but still I'm not sure I understood it correctly).


            Ron
            Last edited by rmaron; 01-04-2012, 05:03 AM.

            Comment


              #7
              1. In case my strategy uses multiple entry commands and the StopAndTargetSubmission is set to "ByStrategyPosition" - Will NT aggreagete the multiple stoploss orders to one stoploss order (remember that I use the same stoploss price). Thus my commission will be as if I sent only one stop loss order?
              2. Would you please further clarify the "ByStrategyPosition" value (I read the documentation, but still I'm not sure I understood it correctly).
              Rmaron,

              ByStrategyPosition will prevent multiple commissions from being charged. The issue here is that your take profits won't be staggered using the SetProfitTarget() like you want using this method. Using Ryans suggestion with ByStrategyPosition, you could use this method + ExitLong/ExitShort at predefined levels with signal names to get a similar effect. Please keep in mind however these "take-profits" will not be known by your broker so its possible if you have a disconnection there will be nothing known on their end to exit trades when it climbs to these levels.

              Setting ByStrategyPosition is done by setting the "Stop & target submission" property which can be accessed when running a strategy live via the UI.

              Please let me know if I may assist further.
              Adam P.NinjaTrader Customer Service

              Comment


                #8
                Hi Adam & Ryan,

                I used your suggestion, however, instead of the EnterLong command I use the EnterLongStopLimitCommand as follows:

                orderId1 = EnterLongStopLimit(0, true , 200, limitPrice, stopPrice , "Entry1");
                orderId2 = EnterLongStopLimit(
                0, true , 100, limitPrice, stopPrice , "Entry2");

                where limitPrice and stopPrice are some parameters I set.

                Unfortunately, order 'orderId2' isn't created (and stays NULL).

                Do you have any idea why?

                Regards,
                Ron

                Comment


                  #9
                  Hi Ron,

                  I apologize - ByStrategyPosition property would not work in this case. It is designed for partial fills, and not stop losses split up from multiple entry signals.

                  To accomplish what you want will require the unmanaged approach. With this you can enter and exit orders exactly as you want. Thanks for working through this, and sorry for any confusion.

                  For your latest post, the second order may not be submitted based on EntryHandling and EntriesPerDirection properties. To allow both orders submitted change EntryHandling to UniqueEntries.
                  Last edited by NinjaTrader_RyanM1; 01-04-2012, 11:55 AM.
                  Ryan M.NinjaTrader Customer Service

                  Comment


                    #10
                    Will this work?

                    Code:
                    protected override void OnBarUpdate()
                    {
                        if(entryConditions) //conditions that determine an entry
                        {
                            EnterLong(300, "entry");
                        }
                        if(targetOneExit) //conditions that determine a T1 exit
                        {
                            ExitLong(100, "T1", "entry");
                        }
                        // .... exit for all targets 
                        if(lastTarget) //conditions that determine a last target exit
                        {
                            ExitLong("T(n)", "entry");
                        }
                        if(StopLossKissed) //conditions that determine trailing stop loss
                        {
                    	ExitLong("SL", "entry");
                        }
                    }

                    Comment


                      #11
                      Hello cdjindia,

                      If you want to scale out you will have to use 3 different entry order names instead of just one like in Ryan_M's example in Post #5.

                      So that way you will have something like "Entry1", "Entry2", etc...

                      Happy to be of further assistance.
                      JCNinjaTrader Customer Service

                      Comment


                        #12
                        JC

                        Approach posted in thread 5, only executes one of the entry orders in Strategy Analyzer.

                        I use EnterLongStopLimit ... function with Buy Stop keeping it live for next few bars unless it is filled. If it does not get filled in next n bars, I cancel the order. All that works fine.

                        Position.Quantity does not automatically get reduced if I use Exit... method and pass in some quantity. But if I call Exit method without Quantity, it handles left over correctly.

                        Comment


                          #13
                          Originally posted by cdjindia View Post
                          JC

                          Approach posted in thread 5, only executes one of the entry orders in Strategy Analyzer.

                          I use EnterLongStopLimit ... function with Buy Stop keeping it live for next few bars unless it is filled. If it does not get filled in next n bars, I cancel the order. All that works fine.

                          Position.Quantity does not automatically get reduced if I use Exit... method and pass in some quantity. But if I call Exit method without Quantity, it handles left over correctly.
                          To make multiple entries, you have to adjust EntriesPerDirection.

                          ref: http://www.ninjatrader.com/support/h...rdirection.htm

                          Comment


                            #14
                            Originally posted by koganam View Post
                            To make multiple entries, you have to adjust EntriesPerDirection.

                            ref: http://www.ninjatrader.com/support/h...rdirection.htm
                            koganam

                            Thanks! Yes, Now 2 orders show up in back test and one of them survives only 1 bar whereas second one survives few bars to go and hit either tgt or stop loss.

                            In both cases, regardless of what was hit, Exit name column in Trades tab says "Profit Target".

                            Code:
                            private double offset = 3;
                            private double TgtDistance = 50;
                            private double SLDistance = 15;
                            private int t1q = 50;
                            private int t2q = 50;
                            
                            if (CurrentBar > (triggerBar + 3))
                            {
                            if(entryOrder1 != null) 
                            {
                            CancelOrder(entryOrder1);
                            return;
                            }
                            if(entryOrder2 != null) 
                            {
                            CancelOrder(entryOrder2);
                            return;
                            }
                            }
                            
                            if (tradeEntry) 
                            {
                            entryOrder1 = EnterShortStopLimit(0, true, t1q, SellStop - offset, SellStop, "S1");
                            entryOrder2 = EnterShortStopLimit(0, true, t2q, SellStop - offset, SellStop, "S2");
                            
                            SetTrailStop("S1", CalculationMode.Price, SLDistance, false);
                            SetTrailStop("S2", CalculationMode.Price, SLDistance, false);
                            
                            SetProfitTarget("S1", CalculationMode.Price, SellStop - TgtDistance);
                            SetProfitTarget("S2", CalculationMode.Price, SellStop + 2 * TgtDistance);
                            }

                            Comment


                              #15
                              Originally posted by cdjindia View Post
                              koganam

                              Thanks! Yes, Now 2 orders show up in back test and one of them survives only 1 bar whereas second one survives few bars to go and hit either tgt or stop loss.

                              In both cases, regardless of what was hit, Exit name column in Trades tab says "Profit Target".

                              Code:
                              private double offset = 3;
                              private double TgtDistance = 50;
                              private double SLDistance = 15;
                              private int t1q = 50;
                              private int t2q = 50;
                              
                              if (CurrentBar > (triggerBar + 3))
                              {
                              if(entryOrder1 != null) 
                              {
                              CancelOrder(entryOrder1);
                              return;
                              }
                              if(entryOrder2 != null) 
                              {
                              CancelOrder(entryOrder2);
                              return;
                              }
                              }
                              
                              if (tradeEntry) 
                              {
                              entryOrder1 = EnterShortStopLimit(0, true, t1q, SellStop - offset, SellStop, "S1");
                              entryOrder2 = EnterShortStopLimit(0, true, t2q, SellStop - offset, SellStop, "S2");
                              
                              SetTrailStop("S1", CalculationMode.Price, SLDistance, false);
                              SetTrailStop("S2", CalculationMode.Price, SLDistance, false);
                              
                              SetProfitTarget("S1", CalculationMode.Price, SellStop - TgtDistance);
                              SetProfitTarget("S2", CalculationMode.Price, SellStop + 2 * TgtDistance);
                              }
                              Orders issued by Set() methods cannot be named: they use the defaults. Check again.

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                              0 responses
                              639 views
                              0 likes
                              Last Post Geovanny Suaza  
                              Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                              0 responses
                              366 views
                              1 like
                              Last Post Geovanny Suaza  
                              Started by Mindset, 02-09-2026, 11:44 AM
                              0 responses
                              107 views
                              0 likes
                              Last Post Mindset
                              by Mindset
                               
                              Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                              0 responses
                              569 views
                              1 like
                              Last Post Geovanny Suaza  
                              Started by RFrosty, 01-28-2026, 06:49 PM
                              0 responses
                              572 views
                              1 like
                              Last Post RFrosty
                              by RFrosty
                               
                              Working...
                              X