Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Problems using multiple ExitLongStop()

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

    Problems using multiple ExitLongStop()

    Hi NT team

    I have a strategy that has multiple market entries and limit entries. I would then like to put in 3 long stop exit orders that sells 1/3 of the position each from all entries.

    Let's assume I had 2 entries from Entry Signal "EntrySignal1" and 1 entry from Entry Signal "EntrySignal2".

    Now I am using these ExitLongStop orders:
    Code:
    ExitOrderCT1 = ExitLongStop(0,false, 1, ExitSTPLevel1,"CTSL1","");
    ExitOrderCT2 = ExitLongStop(0,false, 1, ExitSTPLevel2,"CTSL2","");
    ExitOrderCT3 = ExitLongStop(0,false, 1, ExitSTPLevel3,"CTSL3","");
    The code will only exit orders CTSL1 and CTSL2, but not CTSL3.

    If I changed it to
    Code:
    ExitOrderCT1 = ExitLongStop(0,false, 1, ExitSTPLevel1,"CTSL1","");
    ExitOrderCT2 = ExitLongStop(0,false, 1, ExitSTPLevel2,"CTSL2","");
    ExitOrderCT3 = ExitLongStop(0,false, 1, ExitSTPLevel3,"CTSL3","EntrySignal2");
    it would exit all exitlongstop orders. Now as I do not know how many positions I will buy from both entry signals, but would like to exit all positions via 3 exit orders independently (I really do not care from which entry signal they came from) , how can I achieve this?

    I could name all entry orders the same, but then my multiple enter limit orders will not be executed (because they are labelled the same). If I give unique names to my entry orders, then my exit stop orders will not be executed.

    what do you suggest?

    thank you
    whotookmynickname

    #2
    Hello whotookmynickname,

    You would have to create a unique entry signal name for each of the exit orders that you want to have setup.

    For example if you want 3 exit orders then you will want to have 3 different entry orders each with its own name.

    Happy to be of further assistance.
    JCNinjaTrader Customer Service

    Comment


      #3
      Hi JC,

      I know that this would be the way. However I may have 10 entries using EntrySignal1 and 1 entry using EntrySignal2. I would then only be able to exit 10 positions and 1 positions. This is exactly what I do not want. Due to reduction of slippage I would like to exit ALL positions (again: regardless of the entry signal) evenly spread across 3 exit signals (4, 4 and 3 positions) using 3 stop exit orders. Do you know what I mean?

      So is there a way to overcome this NT limitation?

      whotookmynickname
      Last edited by whotookmynickname; 08-09-2013, 10:49 AM.

      Comment


        #4
        Hello whotookmynickname,

        Let me try to clarify a bit more. This can be done if each entry signal has a unique name like "Long1", "Long2", "Long3".... all the way until "Long10".

        This means that now we have an a position of 10 Long each with a different signal name. Now if you may have 10 different Exit order each using a different from entry signal so that you can control it how you would like.

        Example:
        Code:
        if(MarketPosition.Flat == Position.MarketPosition)
        {
             EnterLong("Long1");
             EnterLong("Long2");
             EnterLong("Long3");
             //...
        }
        
        if(BarsSinceEntry() > 3)
        {
             ExitLong("ExitLong1", "Long1");
             ExitLong("ExitLong2", "Long2");
             ExitLong("ExitLong3", "Long3");
             //...
        }
        Note that you may want to change the EntryHandling to UniqueEntires.
        JCNinjaTrader Customer Service

        Comment


          #5
          Dear JC

          Thank you again. I am/was really aware of all of that information, but this is not what I am looking for. Based on your answer I deem it is not possible to aggregate position from several entry signals and exit them in separate exit orders regardless (!) of their entry order origin, right?

          Your example does not fit what I was looking for because I am entering multiple times (bars) with market and limit orders and I am not sure if for example a "myLimit10" order will be filled. My strategy can have up to 20 entries (10x market per bar update, and 10x limit), so I do not want to have 11 exit orders.

          I mean I know it is possible with ExitLong(), but I am trying to use this format where I have to put in a "from EntrySignal", which I wish I could skip.

          Code:
          ExitOrderCT1 = ExitLongStop(0,false, 1, ExitSTPLevel1,"CTSL1","");
          regards
          whotookmynickname
          Last edited by whotookmynickname; 08-09-2013, 01:31 PM.

          Comment


            #6
            Hello whotookmynickname,

            Can you give me an example of what you are trying to use to enter/exit orders in your strategy and what you would like to happen?
            JCNinjaTrader Customer Service

            Comment


              #7
              Hi JC,

              Here is what my strategy looks and what I would like to achieve:

              1. Strategy checks if condition is oversold
              2. On oversold condition, strategy will enter long market per bar update (if condition still indicates oversold status). On the first oversold condition, it will also enter 10 different, unique limit entry orders (at different prices, all with a unique entry signal label). So, in total, for the first bar update, I submit 11 orders (1 market, and 10 limit orders, thus 11 unique strategy entries), and then only 1 orders for each bar update.
              3. Once the condition is not oversold anymore, the strategy will have accumulated a total position consisting of market orders and limit orders (in this example, let's assume 5 bars oversold = 5 executed market orders, and 4 executed limit order (limit 1 to limit 4). In advance, obviously I do not know how many fills I will get.
              4. Once the condition is not oversold anymore, I would like to exit ALL positions, regardless of their entry signal with a stop sell order ("ExitLongStop"). As I would like to have 3 different stop prices and spread my total accumulated position across 3 different exit orders, I would like to submit 3 orders with even quantities (in my previous example I would have 9 positions, so I would like to exit long stop 3, 3 and 3 all at different stop prices.

              How do I achieve this?


              whotookmynickname.
              Last edited by whotookmynickname; 08-10-2013, 06:20 AM.

              Comment


                #8
                Originally posted by whotookmynickname View Post
                Hi JC,

                Here is what my strategy looks and what I would like to achieve:

                1. Strategy checks if condition is oversold
                2. On oversold condition, strategy will enter long market per bar update (if condition still indicates oversold status). On the first oversold condition, it will also enter 10 different, unique limit entry orders (at different prices, all with a unique entry signal label). So, in total, for the first bar update, I submit 11 orders (1 market, and 10 limit orders, thus 11 unique strategy entries), and then only 1 orders for each bar update.
                3. Once the condition is not oversold anymore, the strategy will have accumulated a total position consisting of market orders and limit orders (in this example, let's assume 5 bars oversold = 5 executed market orders, and 4 executed limit order (limit 1 to limit 4). In advance, obviously I do not know how many fills I will get.
                4. Once the condition is not oversold anymore, I would like to exit ALL positions, regardless of their entry signal with a stop sell order ("ExitLongStop"). As I would like to have 3 different stop prices and spread my total accumulated position across 3 different exit orders, I would like to submit 3 orders with even quantities (in my previous example I would have 9 positions, so I would like to exit long stop 3, 3 and 3 all at different stop prices.

                How do I achieve this?


                whotookmynickname.
                One of the signatures for ExitLongStop() is:
                Code:
                ExitLongStop(int quantity, double stopPrice)
                Why not just use it?

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

                Comment


                  #9
                  Hello whotookmynickname,

                  Thank you for your response.
                  Originally posted by whotookmynickname View Post
                  Now I am using these ExitLongStop orders:
                  Code:
                  ExitOrderCT1 = ExitLongStop(0,false, 1, ExitSTPLevel1,"CTSL1","");
                  ExitOrderCT2 = ExitLongStop(0,false, 1, ExitSTPLevel2,"CTSL2","");
                  ExitOrderCT3 = ExitLongStop(0,false, 1, ExitSTPLevel3,"CTSL3","");
                  The code will only exit orders CTSL1 and CTSL2, but not CTSL3.

                  If I changed it to
                  Code:
                  ExitOrderCT1 = ExitLongStop(0,false, 1, ExitSTPLevel1,"CTSL1","");
                  ExitOrderCT2 = ExitLongStop(0,false, 1, ExitSTPLevel2,"CTSL2","");
                  ExitOrderCT3 = ExitLongStop(0,false, 1, ExitSTPLevel3,"CTSL3","EntrySignal2");
                  it would exit all exitlongstop orders.
                  Getting back to this point in your inquiry; I would like to inquire further on the matter of the third Stop not filling or what I believe to be that it did not fill.

                  So in this case is the position left open and the Stop Order never filled after the price was reached?
                  Were you long 3 when the third Stop was not filled?

                  I look forward to your response.

                  Comment


                    #10
                    Dear Patrick and Koganam

                    I finally used
                    ExitLongStop(int quantity, double stopPrice)
                    I had to do a trick: Put in 1 ExitLongStop order, and upon execution (On Execution), enter the second ExitLongStop, etc. until my position is flat.They do not work simultaneously (3 exit long stop orders), so only one after the other.

                    Comment


                      #11
                      Hello whotookmynickname,

                      I am glad you were able to resolve this matter.

                      Please let me know if I may be of further assistance.

                      Comment

                      Latest Posts

                      Collapse

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