Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Dynamic stop loss and target profit

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

    Dynamic stop loss and target profit

    Hello!
    I am building a strategy from a custom indicator. The indicator works fine. The strategy also, when:
    I have the target profit as well as the stop loss predefined like 10 ticks for example in “Inputs and variables”. In “Stops and targets”, I set the target and stop loss using inputs declared in “Inputs and variables”. The back test here is a success.

    Now I want to have my stop loss and target profit set dynamically, placing:
    the target profit for each entry X ticks above the signal bar for longs and X ticks below the signal bar for shorts and
    the stop loss one tick below the signal bar for longs and one tick above the signal bar for shorts.

    In “Do the following”, I have:

    HTML Code:
    EnterLong();
    ProfitTarget = (High[0] + (X*TickSize));
    StopLoss = (Low[0] - (1*TickSize));
    In “Stops and Targets” I have nothing.
    When I am backtesting, the analyser show the chart where I can realized that a trade terminates when another trade takes place. I am not able to see @Target Profit” like when it is static.
    I would really appreciate if anyone could advises how to fix this problem.

    Thanks!

    #2
    Hi Stan, thanks for posting. The stops and target section can not accept dynamic values from OnBarUdpate you will need to set up your stop and target using Exit orders within one of your sets. There is an example here:


    Kind regards,
    ​​​​​​​-ChrisL

    Comment


      #3
      Many thanks Chris L for your reply.

      I will dig deeper in and revert to you if I have another problem.

      Thanks!

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by NullPointStrategies, Today, 05:17 AM
      0 responses
      44 views
      0 likes
      Last Post NullPointStrategies  
      Started by argusthome, 03-08-2026, 10:06 AM
      0 responses
      124 views
      0 likes
      Last Post argusthome  
      Started by NabilKhattabi, 03-06-2026, 11:18 AM
      0 responses
      65 views
      0 likes
      Last Post NabilKhattabi  
      Started by Deep42, 03-06-2026, 12:28 AM
      0 responses
      42 views
      0 likes
      Last Post Deep42
      by Deep42
       
      Started by TheRealMorford, 03-05-2026, 06:15 PM
      0 responses
      46 views
      0 likes
      Last Post TheRealMorford  
      Working...
      X