Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

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.
    Kate W.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by llanqui, 04-28-2024, 03:53 AM
    5 responses
    29 views
    0 likes
    Last Post NinjaTrader_BrandonH  
    Started by cmtjoancolmenero, 04-29-2024, 03:40 PM
    18 responses
    57 views
    0 likes
    Last Post cmtjoancolmenero  
    Started by llanqui, Today, 11:13 AM
    0 responses
    2 views
    0 likes
    Last Post llanqui
    by llanqui
     
    Started by ETFVoyageur, 04-30-2024, 06:05 PM
    9 responses
    65 views
    0 likes
    Last Post ETFVoyageur  
    Started by llanqui, 04-28-2024, 10:32 AM
    9 responses
    36 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Working...
    X