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 NullPointStrategies, Yesterday, 05:17 AM
        0 responses
        62 views
        0 likes
        Last Post NullPointStrategies  
        Started by argusthome, 03-08-2026, 10:06 AM
        0 responses
        134 views
        0 likes
        Last Post argusthome  
        Started by NabilKhattabi, 03-06-2026, 11:18 AM
        0 responses
        75 views
        0 likes
        Last Post NabilKhattabi  
        Started by Deep42, 03-06-2026, 12:28 AM
        0 responses
        45 views
        0 likes
        Last Post Deep42
        by Deep42
         
        Started by TheRealMorford, 03-05-2026, 06:15 PM
        0 responses
        50 views
        0 likes
        Last Post TheRealMorford  
        Working...
        X