Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

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.
    JimNinjaTrader Customer Service

    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 AaronKoRn, Today, 09:49 PM
      0 responses
      6 views
      0 likes
      Last Post AaronKoRn  
      Started by carnitron, Today, 08:42 PM
      0 responses
      8 views
      0 likes
      Last Post carnitron  
      Started by strategist007, Today, 07:51 PM
      0 responses
      9 views
      0 likes
      Last Post strategist007  
      Started by StockTrader88, 03-06-2021, 08:58 AM
      44 responses
      3,975 views
      3 likes
      Last Post jhudas88  
      Started by rbeckmann05, Today, 06:48 PM
      0 responses
      9 views
      0 likes
      Last Post rbeckmann05  
      Working...
      X