Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

How to set up SetProfitTarget and also SetStopLoss in one trade

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

    How to set up SetProfitTarget and also SetStopLoss in one trade

    Hello

    you told me that SetProfitTarget and SetStopLoss are OCO orders, so once proftitarget is set, the stoploss can not be set.

    I would like to ask you.. is there any way how I could set ProfitTarget and ALSO StopLoss for my trade?

    P.S.: why nobody is responding on my another thread?


    The problem is still not solved

    #2
    zooinek, to clarify - SetProfitTarget and SetStopLoss create OCO orders, which means if your target executes, the associated stop placed for the position is cancelled (as it would not have a 'job' then anymore, position closed).

    Once the position is open and both the profit target and stop loss are still working, you can for sure set one to a new value by recalling the command for this position in the OnBarUpdate() code portion, you should also ensure to reset those to a default value when you're flat -



    We'll check into the other thread shortly.

    Comment


      #3
      So does it mean that I can set StopLoss and ProfitTarget everytime I do EnterLong?
      Because every my entry has different stoploss and profittarget as the other entries.
      So can I use setstoploss and setprofittarget methods everytime when I use EnterLong?

      I understand that when I am already in position (and the position has stoploss 30ticks) and I will use SetStopLoss(10 ticks) the stoploss will "recalculate" for 10tick for the position.
      But I am not sure if it is ok to use SetStopLoss function and SetProfitTarget function (both of them) everytime I am using new EnterLong.. ?

      Comment


        #4
        Yes, the StopLoss and ProfitTarget values can be dynamic (for example based on ATR, prior swing high / low, indicator values etc) in the OnBarUpdate(), just reset to a static default value in ticks when you're flat with the strategy like shown in the sample.

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Geovanny Suaza, 02-11-2026, 06:32 PM
        0 responses
        649 views
        0 likes
        Last Post Geovanny Suaza  
        Started by Geovanny Suaza, 02-11-2026, 05:51 PM
        0 responses
        370 views
        1 like
        Last Post Geovanny Suaza  
        Started by Mindset, 02-09-2026, 11:44 AM
        0 responses
        109 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by Geovanny Suaza, 02-02-2026, 12:30 PM
        0 responses
        573 views
        1 like
        Last Post Geovanny Suaza  
        Started by RFrosty, 01-28-2026, 06:49 PM
        0 responses
        576 views
        1 like
        Last Post RFrosty
        by RFrosty
         
        Working...
        X