Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

How to place two orders with different stop loss & profit targets

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

    How to place two orders with different stop loss & profit targets

    Hi,

    I am developing a strategy which will place two separate orders given a set of entry conditions, the orders will be:
    • Order 1: Enter long with 1 contract, a 10 tick stop loss and a 20 tick profit target
    • Order 2: Enter long with 1 contract, a 30 tick stop loss and a 100 tick profit target

    I am coding this in NinjaScript but I am not able to get the code to execute two orders, the first is placed but the second is ignored.

    In OnStateChange() I have...
    Code:
    [INDENT]else if (State == State.Configure)[/INDENT][INDENT=2]{[/INDENT][INDENT=3]SetStopLoss(@"First", CalculationMode.Ticks, 10, false);[/INDENT][INDENT=3]SetProfitTarget(@"First", CalculationMode.Ticks, 20);[/INDENT][INDENT=3]SetStopLoss(@"Second", CalculationMode.Ticks, 30, false);[/INDENT][INDENT=3]SetProfitTarget(@"Second", CalculationMode.Ticks, 100);[/INDENT][INDENT=2]}[/INDENT]
    In OnBarUpdate() when my entry conditions are true I have...

    Code:
    [INDENT]if (entry conditions == true)[/INDENT][INDENT=2]{[/INDENT][INDENT=3]EnterLong(1, @"First");
    EnterLong(1, @"Second");[/INDENT][INDENT=2]}[/INDENT]
    Can you provide any guidance on why my second order isn't executing.

    Many thanks,

    Neil

    #2
    I have resolved this query...I changed the EntryHandling to EntryHandling.UniqueEntries and it works now.

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Mindset, 04-21-2026, 06:46 AM
    0 responses
    88 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by M4ndoo, 04-20-2026, 05:21 PM
    0 responses
    135 views
    0 likes
    Last Post M4ndoo
    by M4ndoo
     
    Started by M4ndoo, 04-19-2026, 05:54 PM
    0 responses
    68 views
    0 likes
    Last Post M4ndoo
    by M4ndoo
     
    Started by cmoran13, 04-16-2026, 01:02 PM
    0 responses
    119 views
    0 likes
    Last Post cmoran13  
    Started by PaulMohn, 04-10-2026, 11:11 AM
    0 responses
    69 views
    0 likes
    Last Post PaulMohn  
    Working...
    X