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 NullPointStrategies, Today, 05:17 AM
      0 responses
      46 views
      0 likes
      Last Post NullPointStrategies  
      Started by argusthome, 03-08-2026, 10:06 AM
      0 responses
      126 views
      0 likes
      Last Post argusthome  
      Started by NabilKhattabi, 03-06-2026, 11:18 AM
      0 responses
      66 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