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 CarlTrading, 03-31-2026, 09:41 PM
      1 response
      80 views
      1 like
      Last Post NinjaTrader_ChelseaB  
      Started by CarlTrading, 04-01-2026, 02:41 AM
      0 responses
      40 views
      0 likes
      Last Post CarlTrading  
      Started by CaptainJack, 03-31-2026, 11:44 PM
      0 responses
      64 views
      2 likes
      Last Post CaptainJack  
      Started by CarlTrading, 03-30-2026, 11:51 AM
      0 responses
      66 views
      0 likes
      Last Post CarlTrading  
      Started by CarlTrading, 03-30-2026, 11:48 AM
      0 responses
      54 views
      0 likes
      Last Post CarlTrading  
      Working...
      X