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

Multiple SetStopLoss & SetProfitTarget Orders Combine

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

    Multiple SetStopLoss & SetProfitTarget Orders Combine

    Trying to place multiple long orders with each having its own unique stop loss and take profit target. Once placed I can see separate SL and TP orders but somehow with quantity of combined orders. Please see the attached screenshot and parts of the strategy code below. Every SL and TP is having 3000 quantity instead of 1000 each.

    Please advise how can this be resolved. Thanks.

    Code:
    if (State == State.SetDefaults)
    {
    EntryHandling = EntryHandling.UniqueEntries;
    StopTargetHandling = StopTargetHandling.ByStrategyPosition;
    }
    
    if (Position.MarketPosition == MarketPosition.Flat {
    SetStopLoss("orderLong1", CalculationMode.Currency, 500, false);
    SetStopLoss("orderLong2", CalculationMode.Currency, 600, false);
    SetStopLoss("orderLong3", CalculationMode.Currency, 700, false);
    
    SetProfitTarget("orderLong1", CalculationMode.Currency, 250);
    SetProfitTarget("orderLong2", CalculationMode.Currency, 450);
    SetProfitTarget("orderLong3", CalculationMode.Currency, 650);
    
    EnterLong(1000, "orderLong1");
    EnterLong(1000, "orderLong2");
    EnterLong(1000, "orderLong3");
    }
    Click image for larger version

Name:	2022-07-15_20-37-58.jpg
Views:	208
Size:	89.5 KB
ID:	1208646
    Last edited by singjay; 07-15-2022, 07:57 PM.

    #2
    Hi singjay, thanks for posting. Its the StopTargetHandling setting you have. Set it to StopTargetHandling.PerEntryExecution to match the quantity of each entry execution.

    Kind regards,
    -ChrisL
    Chris L.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by SteveReiza, Today, 12:51 AM
    0 responses
    1 view
    0 likes
    Last Post SteveReiza  
    Started by Kraken29, Today, 12:14 AM
    0 responses
    5 views
    0 likes
    Last Post Kraken29  
    Started by LarryLSwanson, Yesterday, 11:52 PM
    0 responses
    1 view
    0 likes
    Last Post LarryLSwanson  
    Started by rbeckmann05, Yesterday, 07:42 PM
    1 response
    7 views
    0 likes
    Last Post bltdavid  
    Started by BottomShark77, Yesterday, 10:35 PM
    0 responses
    3 views
    0 likes
    Last Post BottomShark77  
    Working...
    X