Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Trailing Stop after X pips profit

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

    Trailing Stop after X pips profit

    Hi there, I would like to program the following SL condition using the Strategy Builder (not coding, as I want to retain ability to modify my strategy in the GUI).

    Upon open trade

    SET stop 20 pips

    If current bar close > 5 pips above entry (for LONG, or 5 pips below entry for SHORT)

    SET trailing stop 10 pips

    How could I accomplish this? Appreciate if anybody could help. Essentially, I want conditional trailing stop conditions like with the manual trader but without coding them.. can that be done with some boolean logic?

    #2
    Hi Oracletrades,
    I don't think it is possible to send a stop order (20 pips) AND a (conditional) trailing stop order (10 pips only if market moved > 5 pips) to the market using the Strategy Builder.
    However, if you accept
    i) to manage your stop(s) internally,
    ii) to send the Exit order to the market only after the respective Stop condition is met (e.g. Close[0] < TrailingStop),
    iii) the (resulting) delay between Exit condition being met and the Exit execution at the next candle (or tick),
    it can be accomplished using the StrategyBuilder ONLY.

    User Inputs (int): 1) SL_Pips, 2) ActivateTrail_Pips, 3) TrailSL_Pips.
    User variables (double): 1) Initial_SL, 2) TrailActivateLevel, 3) TrailStop.

    If you are Long and BarsSinceEntryExecution = 1,
    i) set Initial_SL to the Execution Price (e.g. Open [1]) - SL_Pips.
    ii) set TrailActivateLevel to Execution Price (e.g. Open[1]) + ActivateTrail_Pips,
    Then, check if the TrailingStop price needs to be updated while you are long.
    If Price (e.g. Close[0] > TrailActivateLevel AND(!) Price (e.g. (Close[0]) - TrailSL_Pips > TrailStop,
    i) set/update TrailStop to Price (e.g. Close(0]) - TrailSL_Pips.
    Then, just check, if the Price (e.g. Close[0] is smaller than either i) Initial_SL or ii) TrailStop. If Yes, send an exit order to the market AND(!) reset Initial_SL, TrailActivateLevel and TrailStop. Attached, see an illustrative example (print to Output Window) using SL of 200, ActivateTrail of 50 and TrailSL of 100.
    NT-Roland
    Attached Files

    Comment


      #3
      Hello Oracletrades, thanks for your post.

      It's not possible to have a conditional stop loss from the builder using the stop and target section. You would need to unlock the strategy and do set an initial stop loss of 20 pips, then check the condition withing OnBarUpdate and call SetStopLoss once again to set it at the new level. Or you can do this manually with exit orders as NT-Roland describes (I did not test this though, so it would need to be developed and tested).

      Best regards.

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by NullPointStrategies, Today, 05:17 AM
      0 responses
      52 views
      0 likes
      Last Post NullPointStrategies  
      Started by argusthome, 03-08-2026, 10:06 AM
      0 responses
      130 views
      0 likes
      Last Post argusthome  
      Started by NabilKhattabi, 03-06-2026, 11:18 AM
      0 responses
      70 views
      0 likes
      Last Post NabilKhattabi  
      Started by Deep42, 03-06-2026, 12:28 AM
      0 responses
      43 views
      0 likes
      Last Post Deep42
      by Deep42
       
      Started by TheRealMorford, 03-05-2026, 06:15 PM
      0 responses
      47 views
      0 likes
      Last Post TheRealMorford  
      Working...
      X