Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Question about SetTrailStop (CalculationMode.Percent, "#")

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

    Question about SetTrailStop (CalculationMode.Percent, "#")

    How does the SetTrailStop CalculationMode.Percent works? I couldn't find anything specific for Percent in the help Section.

    Let say that I have a Trailing stop with a calculation mode of 50%. How does the system know where to place the Trailing stop? Based on what? The opening price of the Bar? The price with which I entered?

    Thanks.

    #2
    Avg entry offset by 50% of that price. Then it will use the high or low of a bar less the original offset amount.
    RayNinjaTrader Customer Service

    Comment


      #3
      Would it be correct to say that the original offset amount = original entry price?

      Comment


        #4
        Original entry price can be found by Position.AvgPrice the moment you acquire your position. If you don't want to store that value then you can do calculations based on your SetTrailStop but that is just more work in my opinion.
        Josh P.NinjaTrader Customer Service

        Comment


          #5
          Well I think I found out why SetTrailStop() with the Percent mode doesn't work with YM. I'm trying to use a 10% trailing stop with YM. Apparently, NT is multiplying YM's entry price (i.e. 10500) by 10% and coming up with 1050 ticks/points and using that as an offset. No offense, but that is not a good way for that to work.

          A percent trailing stop should answer the question: "As a trade moves in my favor, what percent of the open profit am I willing to give back?".

          Example: I enter on the close of this bar. The next bar moves to a high that is 10 ticks in my favor, but it then retreats 2 ticks to close 8 ticks in my favor. If SetTrailStop() is set to 10%, it should exit on that bar with 9 ticks of profit.

          So what is the easiest way to get this to work in the manner described?

          Thx.

          Originally posted by NinjaTrader_Ray View Post
          Avg entry offset by 50% of that price. Then it will use the high or low of a bar less the original offset amount.

          Comment


            #6
            Brooksrimes,

            To clarify: There is different behavior here depending on running real time versus using this statement in a backtest.

            SetTrailStop when used in real time will trail the last traded price by the specified percentage. If price retreats, it won't lower the value of your order to fit this. It will remain at the highest value prior to retreating.

            You can use the print statement below to get a similar value to your trail stop. This will match closely with the price for your stop order unless the market starts moving in the direction of your order.

            For Long Positions:
            Code:
             
            Print (Instrument.MasterInstrument.Round2TickSize (Close[0] * (1 - .trailStopPercentage)));
            Last edited by NinjaTrader_RyanM1; 09-14-2010, 10:11 AM.
            Ryan M.NinjaTrader Customer Service

            Comment


              #7
              Right now I'm backtesting so I need this to work for that.

              <SetTrailStop when used in real time will trail the last traded price by the specified percentage.>

              I still contend that is not a good way for it to work. It should be a percent of the maximum open profit. The percentage should NOT be multiplied by price. That makes a huge difference if you are dealing with a symbol that trades at $5 vs $500. It also gets into volatility considerations. The trailing percentage should be the percent of the open profit you are willing to give up.

              <Print (Instrument.MasterInstrument.Round2TickSize (Close[0] * (1 - .trailStopPercentage)));>

              Appreciate the suggestion but it won't work for the reasons above. Plus for longs it would have to use High not Close. And it can't just be on a standalone bar basis. If the last bar was a long up bar that closed at the high and the next bar starts retreating and hits the trailing percentage, then it would need to exit at that price.

              Originally posted by NinjaTrader_RyanM View Post
              Brooksrimes,

              To clarify: There is different behavior here depending on running real time versus using this statement in a backtest.

              SetTrailStop when used in real time will trail the last traded price by the specified percentage. If price retreats, it won't lower the value of your order to fit this. It will remain at the highest value prior to retreating.

              You can use the print statement below to get a similar value to your trail stop. This will match closely with the price for your stop order unless the market starts moving in the direction of your order.

              Code:
               
              Print (Instrument.MasterInstrument.Round2TickSize (Close[0] * (1 - .trailStopPercentage)));

              Comment


                #8
                Thanks. I've clarified my post to indicate it would only apply to long positions.

                Thank you for the suggestions. You may want to consider submitting order methods with ExitLongStop() and ExitShortStop(), and custom program the price level and trailing behavior you're after.
                Ryan M.NinjaTrader Customer Service

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by wzgy0920, 04-20-2024, 06:09 PM
                2 responses
                26 views
                0 likes
                Last Post wzgy0920  
                Started by wzgy0920, 02-22-2024, 01:11 AM
                5 responses
                32 views
                0 likes
                Last Post wzgy0920  
                Started by wzgy0920, Yesterday, 09:53 PM
                2 responses
                49 views
                0 likes
                Last Post wzgy0920  
                Started by Kensonprib, 04-28-2021, 10:11 AM
                5 responses
                192 views
                0 likes
                Last Post Hasadafa  
                Started by GussJ, 03-04-2020, 03:11 PM
                11 responses
                3,234 views
                0 likes
                Last Post xiinteractive  
                Working...
                X