Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

How can I add a stop loss order once price has moved X pips?

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

    How can I add a stop loss order once price has moved X pips?

    I have created a simple strategy that I would like to create a stop loss triggering function.

    A simple example of what I'm trying to input:
    "when price increases by 5 pips from our entry price, place a stop loss at our entry price"

    Of course, I thought of using the trailing stop feature; however, using this the stop will keep trailing the higher the price goes and not stay put at the entry price.

    Is something like this possible to add using the strategy wizard or will it require actual coding?

    #2
    Hello turbro21,

    Absolutely. You will need a condition to detect the price has moved 5 ticks.

    For example:

    if (Position.MarketPosition == MarketPosition.Long && Close[0] >= Position.AvgPrice + 5 * TickSize)

    This condition would trigger when the position is long and the price has risen 5 ticks or greater from the entry price.

    Then you can place a stop with SetStopLoss or an exit order like ExitLongStopLimit().
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Originally posted by NinjaTrader_ChelseaB View Post
      Hello turbro21,

      Absolutely. You will need a condition to detect the price has moved 5 ticks.

      For example:

      if (Position.MarketPosition == MarketPosition.Long && Close[0] >= Position.AvgPrice + 5 * TickSize)

      This condition would trigger when the position is long and the price has risen 5 ticks or greater from the entry price.

      Then you can place a stop with SetStopLoss or an exit order like ExitLongStopLimit().

      Hi Chelsea,

      Thank you for your response. Will this change need to be made directly within the code or can I do it through the wizard?

      Comment


        #4
        Hello,

        This type of logic can be done in the wizard as well, you would be using the Offset property in this case. I have attached two images, one for the total condition in the builder. The second details how you can set the Offset value.

        World's leading screen capture + recorder from Snagit + Screencast by Techsmith. Capture, edit and share professional-quality content seamlessly.

        World's leading screen capture + recorder from Snagit + Screencast by Techsmith. Capture, edit and share professional-quality content seamlessly.


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

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Mindset, 04-21-2026, 06:46 AM
        0 responses
        88 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by M4ndoo, 04-20-2026, 05:21 PM
        0 responses
        134 views
        0 likes
        Last Post M4ndoo
        by M4ndoo
         
        Started by M4ndoo, 04-19-2026, 05:54 PM
        0 responses
        68 views
        0 likes
        Last Post M4ndoo
        by M4ndoo
         
        Started by cmoran13, 04-16-2026, 01:02 PM
        0 responses
        118 views
        0 likes
        Last Post cmoran13  
        Started by PaulMohn, 04-10-2026, 11:11 AM
        0 responses
        67 views
        0 likes
        Last Post PaulMohn  
        Working...
        X