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 charlesugo_1, 05-26-2026, 05:03 PM
        0 responses
        56 views
        0 likes
        Last Post charlesugo_1  
        Started by DannyP96, 05-18-2026, 02:38 PM
        1 response
        143 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Started by CarlTrading, 05-11-2026, 05:56 AM
        0 responses
        160 views
        0 likes
        Last Post CarlTrading  
        Started by CarlTrading, 05-10-2026, 08:12 PM
        0 responses
        96 views
        0 likes
        Last Post CarlTrading  
        Started by Hwop38, 05-04-2026, 07:02 PM
        0 responses
        276 views
        0 likes
        Last Post Hwop38
        by Hwop38
         
        Working...
        X