Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

SetStopLoss() and SetProfitTarget() are not following my strategy logic

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

    SetStopLoss() and SetProfitTarget() are not following my strategy logic

    Hello NT Team,

    for each position I open, I automatically a TP and SL orders using SetStopLoss() and SetProfitTarget() BUT, if for reason the TP and SL are canceled, the strategy can NOT re-put them back.

    This is the code I use

    Code:
    if(PositionAccount.Quantity > 0)
    {
    SetStopLoss() // I set it properly here don't worry :)
    SetProfitTarget() // here as well :)
    }
    the above code snippet is inside OnBarUpdate() but if I manually cancel TP or SL, the strategy doesn't re-put them even the position is still open and the if(PositionAccount.Quantity > 0) is still valid, can you tell me why plz ? and how to fix this ?

    Thank you

    #2
    Hello MohammedAmine,

    Thank you for your reply.

    If you manually cancel the profit target or stop loss I would expect the strategy to not recognize that these have been cancelled - strategies are self contained and manually trading or modifying strategy orders would not affect what the strategy has calculated for its orders/position. You should not be trading manually or manually modifying strategy orders on the same instrument a strategy is running on.

    Please let us know if we may be of further assistance to you.

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by CarlTrading, 05-11-2026, 05:56 AM
    0 responses
    56 views
    0 likes
    Last Post CarlTrading  
    Started by CarlTrading, 05-10-2026, 08:12 PM
    0 responses
    33 views
    0 likes
    Last Post CarlTrading  
    Started by Hwop38, 05-04-2026, 07:02 PM
    0 responses
    195 views
    0 likes
    Last Post Hwop38
    by Hwop38
     
    Started by CaptainJack, 04-24-2026, 11:07 PM
    0 responses
    359 views
    0 likes
    Last Post CaptainJack  
    Started by Mindset, 04-21-2026, 06:46 AM
    0 responses
    280 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Working...
    X