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, 03-31-2026, 09:41 PM
    1 response
    80 views
    1 like
    Last Post NinjaTrader_ChelseaB  
    Started by CarlTrading, 04-01-2026, 02:41 AM
    0 responses
    40 views
    0 likes
    Last Post CarlTrading  
    Started by CaptainJack, 03-31-2026, 11:44 PM
    0 responses
    63 views
    2 likes
    Last Post CaptainJack  
    Started by CarlTrading, 03-30-2026, 11:51 AM
    0 responses
    63 views
    0 likes
    Last Post CarlTrading  
    Started by CarlTrading, 03-30-2026, 11:48 AM
    0 responses
    54 views
    0 likes
    Last Post CarlTrading  
    Working...
    X