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