Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

SetStopLoss for manual entry or an existing position

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

    SetStopLoss for manual entry or an existing position

    Good morning .

    I am writing a strategy that needs to assume an existing account position upon startup and then place a stop loss and profit target order around the existing position.

    protected override void OnBarUpdate()
    {
    SetStopLoss(CalculationMode.Currency, 500);
    SetProfitTarget(CalculationMode.Currency, 500);​
    }

    The problem is SetStopLoss() and SetProfitTarget() do not execute around the adopted account position upon strategy startup.​ Is there any way to set a loss stop for entry order placed manually or by another sttategy ?

    Thanks in advance !

    #2
    Hello judysamnt7,

    Below is a link to an example of adopting an account position.


    Unfortunately, using set methods will not work in this manner as there isn't an entry order for the strategy to attach to. The unmanaged approach is used as this allows for placing protective exit orders without an entry.
    Chelsea B.NinjaTrader Customer Service

    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