Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

SetStopLoss does not trigger

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

    SetStopLoss does not trigger

    Below is a print out of each bar in a trade. The "Bar" is High[0], Low[0], Close[0], then the "Pos" is MarketPosition, then date/time. On 1/29 at 4:00PM I set a stop: SetStopLoss( 800, false ); This is printed out as "VStop set to: 800". You can see on 2/1/2016 at 10:30AM the position is still "Long" while the low of the bar is 1016.3 which should have hit the stop! I found this problem in live trading where I had my broker enter the same stop manually in my account and it hit while NT did not!

    Hist: Bar: 1022, 1003.2, 1016.3, Pos: Flat, Date: 1/29/2016 10:30:00 AM

    Hist: Bar: 1021.1, 1015.1, 1017.9, Pos: Flat, Date: 1/29/2016 11:30:00 AM
    Hist: EnterLong: 838, 1017.9, 1/29/2016 11:30:00 AM

    Hist: Bar: 1023.8, 1013.8, 1021.4, Pos: Long, Date: 1/29/2016 12:30:00 PM

    Hist: Bar: 1022.2, 1017.7, 1020.3, Pos: Long, Date: 1/29/2016 1:30:00 PM

    Hist: Bar: 1021.9, 1016.9, 1021.7, Pos: Long, Date: 1/29/2016 2:30:00 PM

    Hist: Bar: 1025.3, 1019.6, 1024.9, Pos: Long, Date: 1/29/2016 3:30:00 PM

    Hist: Bar: 1033.8, 1023.6, 1033.7, Pos: Long, Date: 1/29/2016 4:00:00 PM
    1/29/2016 4:00:00 PM: Hist: VStop set to: 800

    2/1/2016 10:30:00 AM: Hist: VStop set to: 800
    Hist: Bar: 1025.4, 1016.3, 1023.1, Pos: Long, Date: 2/1/2016 10:30:00 AM

    2/1/2016 10:30:00 AM: Hist: VStop set to: 800
    Hist: ExitLong: 838, 1023.1, 2/1/2016 10:30:00 AM
    Hist: TF ExitLong-PP: 838, 1023.1, 2/1/2016 10:30:00 AM


    Hist: Bar: 1028.2, 1020.9, 1026.4, Pos: Flat, Date: 2/1/2016 11:30:00 AM

    #2
    Originally posted by tradetree View Post
    You can see on 2/1/2016 at 10:30AM the position is still "Long" while the low of the bar is 1016.3 which should have hit the stop!
    Which instrument?
    What bartype and interval?
    How many contracts?
    NT7 or NT8?

    Could you be more succinct why you think it should have hit the stop?
    I mean, can you provide a better description of your issue by explaining more of your question?

    I started to take a crack at understanding your post, but found that I was having to make too many assumptions ...

    Comment


      #3
      I couldn't figure it out myself either.

      Comment


        #4
        Hello tradetree,

        Thank you for your post.

        I would like to investigate the order and ensure that the order was placed and working at the expected price at the expected time.

        I will need your log and trace files which do contain sensitive information.

        Please send an email to platformsupport [at] ninjatrader [dot] com. In the email, please include a link to this forum thread.
        Chelsea B.NinjaTrader Customer Service

        Comment


          #5
          Originally posted by bltdavid View Post
          Which instrument?
          What bartype and interval?
          How many contracts?
          NT7 or NT8?

          Could you be more succinct why you think it should have hit the stop?
          I mean, can you provide a better description of your issue by explaining more of your question?

          I started to take a crack at understanding your post, but found that I was having to make too many assumptions ...
          The instrument is TF, bartype is candlestick, 60 minute interval, single contract on NT7. It was during the trading day, but on historical bars. The reason it should have hit the stop is that the SetStopLoss was set to $800. The TF closed up $1,600 when I set the stop to $800. Now perhaps my understanding of SetStopLoss is wrong so I can't set a profit stop, only a loss stop?
          Last edited by tradetree; 02-08-2016, 12:20 PM.

          Comment


            #6
            Hello tradetree,

            SetStopLoss() will set a stop loss. If your entry was a buy order and the position was a long position, the stop loss would need to be set to a price lower than the current bid price.

            SetProfitTarget() will set a profit target. If your entry was a buy order and the position was a long position, the profit target would need to be set to a price higher than the current bid price.
            http://ninjatrader.com/support/helpG...ofittarget.htm
            Chelsea B.NinjaTrader Customer Service

            Comment


              #7
              Originally posted by tradetree View Post
              Now perhaps my understanding of SetStopLoss is wrong so I can't set a profit stop, only a loss stop?
              This part may be easy. The answer is: your vocabulary is wrong. It is not a profit 'stop' but a profit 'target'. A stop order is not used for profit targets, so don't say 'profit stop'. Limit orders are used for profit targets, not stop orders. To think in terms of a 'profit stop' will muddy your understanding too much.

              So, use 'SetStopLoss' for stop loss, yes ...

              For profit targets, use 'SetProfitTarget', which sets a limit order.

              [And yes, you can, and should, use both at the same time.]

              Read here:

              Comment


                #8
                Ok, so let's work out the semantics. Here is a link to Investopedia for our vocabulary, as all of our vocabulary has been wrong (as I'll explain):


                I used the term "StopLoss" because I could not find the stop order I was trying to use. So here is the sequence:
                1) EnterLong at 1017.9 on the TF, with a stoploss set to $1000 (if TF goes below 1007.9 it will exit at market).
                2) TF goes up to a close of 1033.6
                3) I then want to protect my profit. In this case I want to illiminate my stoploss order and instead put a stop order to exit at market if TF goes below 1025.9.

                This is commonly called a "Stop order". It doesn't matter if it is for a loss or not. Is this clearer now?

                Edit: BTW, I tried setting a negative SetStopLoss to achieve this simple trade type of a stop order and it exited at the entry price, effectively taking my stop order as though it was set to entry. That makes me think SetStopLoss is only for stop orders that are less than or equal to entry. Why?
                Last edited by tradetree; 02-08-2016, 01:39 PM.

                Comment


                  #9
                  Originally posted by tradetree View Post
                  Ok, so let's work out the semantics. Here is a link to Investopedia for our vocabulary, as all of our vocabulary has been wrong (as I'll explain):


                  I used the term "StopLoss" because I could not find the stop order I was trying to use. So here is the sequence:
                  1) EnterLong at 1017.9 on the TF, with a stoploss set to $1000 (if TF goes below 1007.9 it will exit at market).
                  2) TF goes up to a close of 1033.6
                  3) I then want to protect my profit. In this case I want to illiminate my stoploss order and instead put a stop order to exit at market if TF goes below 1025.9.

                  This is commonly called a "Stop order". It doesn't matter if it is for a loss or not. Is this clearer now?

                  Edit: BTW, I tried setting a negative SetStopLoss to achieve this simple trade type of a stop order and it exited at the entry price, effectively taking my stop order as though it was set to entry. That makes me think SetStopLoss is only for stop orders that are less than or equal to entry. Why?
                  No, it is not clearer.

                  When you are in a LONG position:
                  A stop order by definition is entered below current price. If you enter a stop order with a price above current price it will be rejected. Sure, a stop order may be moved to a higher price as the current price rises -- this is a trailing effect and is often used to protect profits -- but the key to understanding is that stop order is always always ALWAYS below the current price, never above it. When a stop order is first set, it serves as a loss protection. If you move it higher to protect profits, sure it may be hit, and yes the position may be closed without loss -- but in the beginning, when you first set the order, it was loss protection order, so it is called a stop loss, and it uses a order type of 'stop' because the stop order must always be entered at a price below current price.

                  SHORT positions are reversed: A stop order must always be higher than current price.

                  Carefully reread that Investopedia article. It does not reveal the entire story of the limitations of the stop order. If a stop order is exiting a position for a profit, as I think the article alludes to, then this is only because the stop order was moved (aka, to achieve a trailing effect) to protect that profit. The article fails to tell you that stop order must be entered at price below current price.

                  So, again, I implore you, re-orient your thinking to 'profit target'.

                  A profit target uses a limit order, not a stop order.

                  Do you see why? You're asking NT to exit your trade as soon as you have $800 profit, right? Well, NT cannot use a stop order to achieve that, since a stop order must be set to a price that is always below current price. NT uses a limit order, which sits there above current price waiting to be hit (very similar to a stop order).

                  The key difference you need to accept is this:

                  For a long position:
                  Stop orders are always resting at a price below current price.
                  Limit orders are always resting at a price above current price.

                  The article you cite omits lots of these important details.

                  You need to retrain yourself to think in terms of 'profit target'.

                  Comment


                    #10
                    bltdavid, we are still not on the same page, but I appreciate your sticking with me on this. I thought if I gave you a specific example that we could get in sync. Here is my example again:

                    1) EnterLong at 1017.9 on the TF, with a stoploss set to $1000 (if TF goes below 1007.9 it will exit at market).
                    2) TF price goes up to a close of 1033.6
                    3) I then want to protect my profit. In this case I want to illiminate my stoploss order and instead put a stop order to exit at market if TF goes below 1025.9.

                    The TF market price in step two goes up to 1033.6. In step 3 I want to protect profit, so I set a sell stop at 1025.9. This is below the current price, and will not be rejected. It is not a limit order, as I'm not trying to sell, but protect. A limit is only used when you wish to attempt to catch a price, as it is not guaranteed. A market order is guaranteed to sell at the market, so not at a specific price, but whatever the market will give.

                    So once the TF has hit 1033.6, I want to sell only if the TF goes down again below 1025.9. I hope that is clear?

                    Now I talked to NT tech support and I discovered the issue. The problem is that you have to switch to:
                    SetStopLoss( CalculationMode.Price, stopPrice );

                    The currency based SetStopLoss only is for losses. The price based stoploss is for profit protection. Now I know you don't like my term "profit protection" but it is the best term I have to express what I'm trying to achieve. I am trying to set a lower stop exit price.

                    Comment


                      #11
                      If you reissue setstoploss with currency, I'd imagine that it would be at the current (new)level, and would still be your profit protection ?
                      (Never tried)

                      Comment


                        #12
                        Originally posted by sledge View Post
                        If you reissue setstoploss with currency, I'd imagine that it would be at the current (new)level, and would still be your profit protection ?
                        (Never tried)
                        No, that is what caused all this confusion. I've been trading with stop losses for years, but when I tried to use a currency for profit protection, it just set a stop loss at break even!

                        Comment


                          #13
                          Hello tradetree,

                          Both SetStopLoss() and SetProfitTarget() have the currency overload available.

                          SetProfitTarget(double currency)


                          SetStopLoss(double currency)


                          The currency overload allows the profit target or stop loss to be set based on an amount of loss or profit. This would be a calculation based on the tick size multiplied by the point value multiplied by the quantity.
                          This also is calculated from the entire position and cannot be applied to specific trades.


                          When using CalculationMode.Price, this will place the order at the exact price. This is not a calculated distance but a literal price the order will be placed at.



                          With your script, may I confirm if you are trying to place a stop loss or if you are trying to place a profit target?

                          If you are using CalculationMode.Price, what is the value of the variable you are supplying as the price (stopPrice)?

                          If you print the value of stopPrice before the value is used in the call to SetStopLoss, is this value that appears in the Output window different that the price the order is submitted to? (Showing in the Orders tab when it is submitted?)

                          What is the price the stop is submitted at?
                          What is the price of the stopPrice value?

                          Is the SetStopLoss call being called before or after the entry order is placed? This is important as SetStopLoss cannot be unset. If this is set to a value after the entry is placed, it will continue to hold its previous value when a new order is submitted.
                          Chelsea B.NinjaTrader Customer Service

                          Comment


                            #14
                            Originally posted by tradetree View Post
                            The price based stoploss is for profit protection. Now I know you don't like my term "profit protection" but it is the best term I have to express what I'm trying to achieve. I am trying to set a lower stop exit price.
                            Actually, I love that term. It is used correctly and makes perfect sense.

                            What you are really doing is: instead of eliminating the stop order set by your first call to SetStopLoss(1000, false), the second call to SetStopLoss actually moves the existing stop order already created. And that was the problem, this second call to SetStopLoss did not move the stop order to protect your profit as you were expecting.

                            Apparently, SetStopLoss requires a CalcluationMode in order to move the stop order.

                            [That is news to me, but I don't use SetStopLoss at all. I prefer ExitLongStop and ExitShortStop for managed mode.]

                            I think you have found a grave deficiency in the NT7 documentation regarding this aspect of SetStopLoss.

                            As far as being on the same (or different page), I think we're on the same page perfectly fine.

                            Your use of the stop order to protect your profit is perfect. Your term 'profit stop' is misleading and I don't recommend you use that -- I mean, it's still the same stop order whether it is protecting yourself from a loss or protecting a profit (as you pointed out).

                            I think the idea around here is more this: a stop order which is first placed as a stop loss starts out as a semantic thing, but as soon you move that same stop order to protect profit (aka, you move the stop order to guarantee profit for that position) the semantics of the 'stop loss' concept migrate more to 'profit protection' or 'protective stop', which is exactly as you indicate -- but all the while under the hood there has only ever been one stop order with your broker, it just gets moved to a different price (which is always below current price) per your code.

                            Quite frankly, I've never used or heard the term 'profit stop' so that term threw me. It was almost like you wanted to differentiate between 2 different kinds of stop orders (the stop loss order and the profit stop order) when no such differentiation exists.

                            Comment


                              #15
                              bltdavid, I think we are on the same page now! And I believe there is a documentation problem with the SetStopLoss method. Yet I am not sure NinjaTrader_ChelseaB is on the same page.

                              I agree with you that I could set the stop with ExitLongStop. Perhaps everyone uses that and this is why the documentation for SetStopLoss is lacking? - Don't know, but I think we are making good progress with this.

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by andrewtrades, Today, 04:57 PM
                              1 response
                              5 views
                              0 likes
                              Last Post NinjaTrader_Manfred  
                              Started by chbruno, Today, 04:10 PM
                              0 responses
                              4 views
                              0 likes
                              Last Post chbruno
                              by chbruno
                               
                              Started by josh18955, 03-25-2023, 11:16 AM
                              6 responses
                              436 views
                              0 likes
                              Last Post Delerium  
                              Started by FAQtrader, Today, 03:35 PM
                              0 responses
                              7 views
                              0 likes
                              Last Post FAQtrader  
                              Started by rocketman7, Today, 09:41 AM
                              5 responses
                              19 views
                              0 likes
                              Last Post NinjaTrader_Jesse  
                              Working...
                              X