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 NullPointStrategies, Yesterday, 05:17 AM
    0 responses
    54 views
    0 likes
    Last Post NullPointStrategies  
    Started by argusthome, 03-08-2026, 10:06 AM
    0 responses
    130 views
    0 likes
    Last Post argusthome  
    Started by NabilKhattabi, 03-06-2026, 11:18 AM
    0 responses
    70 views
    0 likes
    Last Post NabilKhattabi  
    Started by Deep42, 03-06-2026, 12:28 AM
    0 responses
    44 views
    0 likes
    Last Post Deep42
    by Deep42
     
    Started by TheRealMorford, 03-05-2026, 06:15 PM
    0 responses
    49 views
    0 likes
    Last Post TheRealMorford  
    Working...
    X