Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

SetProfitTarget() and SetStolLoss() are containing double nbr of contracts

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

    SetProfitTarget() and SetStolLoss() are containing double nbr of contracts

    Hello NT Team,

    I use
    Code:
    StopTargetHandling = StopTargetHandling.ByStrategyPosition;
    but still if I execute a large number of contracts MIT we could get 2 separated executions

    Assuming I enter LONG with 50 contracts, then I get it on 2 executions 17 and 33, now I have this code

    Code:
    if (PositionAccount.Quantity == 50) // I try here to prevent setting any TP or SL unless I fully execute my entire quantity
    {
        SetProfitTarget(CalculationMode.Ticks, ProfitTargetLevel, true);
        SetStopLoss(CalculationMode.Ticks, (Convert.ToInt32(StopLossLevel/TickSize)));
    }
    but whenever I have the initial LONG order partially filled and split on 2 executions, I get 2 Take profit and 2 Stop Loss that later are submitting for quantity change, and then becoming (50 x 2) so I endup with 50 LONG contracts open, but in TP Level I have 100 contracts, and in SL Level I have 100 contracts.

    Usually the system is setting only 1 TP and SL for the entire open position no ?

    how to solve this problem, it happens ONLY when I have partial fills

    Thank you

    #2
    Hello MohammedAmine,

    Thanks for your post.

    The Set methods should only need to be called once, before associated entry order is submitted, to prep NinjaTrader to submit target/stop once that entry is filled. The Set methods should not be used multiple times and should not be called again when you are in a position, unless you wanted to update that stop and target. (For example auto breakeven, auto trail behaviors)

    Please keep the above in mind, and elaborate on how else you are using the Set methods, or any other Exit method. If you can share a small example showing what you are doing, that can help as well.

    We look forward to assisting.

    Comment


      #3
      Thnx man, I really appreciate, I added both methods before Entering the positions and it worked fine Thnx again

      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