• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Strategy Builder - How to Set Multiple Stop Losses for Short/Long positions

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

    Strategy Builder - How to Set Multiple Stop Losses for Short/Long positions

    Hello.

    I am trying to set multiple levels of stop losses in Strategy Builder.

    The logic would be as follows:

    if ( Close[0] >= Position.AveragePrice + L1TriggerTicksFromEntry * TickSize )
    // Set stop loss using L1StopLossInTicks
    if ( Close[0] >= Position.AveragePrice + L2TriggerTicksFromEntry * TickSize )
    // Set stop loss using L1StopLossInTicks
    if ( Close[0] >= Position.AveragePrice + L3TriggerTicksFromEntry * TickSize )
    // Set TRAIL stop using TrailStopTicks

    I know this can be done using hard coding, but I would like to accomplish this using Strategy Builder.

    Also, I would like to accomplish the opposite for a Short position. However, in Strategy Builder, when I try to change the condition to Close[0] <= Position.AveragePrice - L1TriggerTicksFromEntry * TickSize, the "-" is not available when changing "Arithmetic" to "Ticks" on the offset, so it always offsets by ADDING the ticks to the price.

    Thank you for any/all assistance.

    #2
    Hello shawnynicole,

    Thanks for your post and welcome to the NinjaTrader Forums!

    The strategy builder does not permit the use of a dynamic SetStopLoss. The SetStopLoss, in the strategy builder, is set within State.Configure and as such it cannot be set to work with dynamic (changing) variables. An alternative would be to instead place, for example when long, a SellStop order below the current price.

    If you wanted to use the SetStopLoss() method as you described, then it could only be done in a coded Ninjascript strategy.

    You cannot use the SetStopLoss() and the SetTrailStop() on the same order in the strategy builder or in Ninjascript code. If coded that way, the trail stop is simply ignored. Please see the notes in both:
    https://ninjatrader.com/support/help...etstoploss.htm
    https://ninjatrader.com/support/help...ttrailstop.htm

    You are correct regarding the ability to negate a user-defined variable and I will check into that to see if that is something we should change. I will update this thread when i have further information. In the meantime, you can create additional variables that are set to a negative number of ticks (for your short side entries). When you add a negative number it is the same as subtraction.
    Paul H.NinjaTrader Customer Service

    Comment


      #3
      Thank you for your reply.

      Can you please clarify for me which function I would use to accomplish placing a SellStop order for the long position? If the function to use is different for code vs Strategy Builder, can you please specify both?

      Thank you.

      Comment


        #4
        Hello shawnynicole,

        Thanks for your reply.

        In the action section of the strategy builder you would select "exit long position by a stop order" or "exit long position by a stop limit order".
        Please see, "How to exit a market position" here: https://ninjatrader.com/support/help...s/?actions.htm

        In Ninjascript, these would be:

        ExitLongStopMarket(): https://ninjatrader.com/support/help...stopmarket.htm
        ExitLongStopLimit(): https://ninjatrader.com/support/help...gstoplimit.htm
        Paul H.NinjaTrader Customer Service

        Comment


          #5
          Hello shawnynicole,

          Just to follow-up.

          Regarding, "...(strategy builder) the ability to negate a user-defined variable...".

          After an internal review, it was determined that this should be a feature request. I have submitted a feature request on your behalf. The request is assigned as SFT-3039, "User defined variables to be negated to accomplish subtraction".

          The feature request does not mean that it will or will not be implemented but will be routinely reviewed and tracked by program management.
          Paul H.NinjaTrader Customer Service

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by wishing, Today, 03:21 PM
          0 responses
          4 views
          0 likes
          Last Post wishing
          by wishing
           
          Started by crazyhorse2393, Today, 03:09 PM
          0 responses
          7 views
          0 likes
          Last Post crazyhorse2393  
          Started by forextrader2003, Today, 02:55 PM
          1 response
          8 views
          0 likes
          Last Post NinjaTrader_PatrickG  
          Started by Sank1, Today, 01:58 PM
          1 response
          7 views
          0 likes
          Last Post NinjaTrader_PatrickG  
          Started by GARZONJ, Today, 12:50 PM
          3 responses
          11 views
          0 likes
          Last Post NinjaTrader_Jim  
          Working...
          X