Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Partially close a position : SL & TP update

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

    Partially close a position : SL & TP update

    Hi Guys;

    Using a custom window where user can choose an ATM, I send some market orders.
    When I partial close a position, let's say from 4 QTY to 2, the stop loss and take profit keeps 4 QTY.

    How please may I partial close a position in an Addon without using Strategy base code and update SL & TP with the new position size?

    (e.g partially close passing by chart trader works prefectly, here, I would need a custom button for the partial close)

    Thanks
    Last edited by TradeForge; 02-22-2024, 10:00 AM.

    #2
    Hello TradeForge,

    Thank you for your post.

    Can you please clarify how exactly you are submitting the orders in your AddOn script?

    In an AddOn script, you should use Account.CreateOrder() to create the order to partially close the position and Account.Submit() to submit that order.

    CreateOrder() - https://ninjatrader.com/support/help...reateorder.htm
    Submit() - https://ninjatrader.com/support/helpGuides/nt8/submit.htm

    I look forward to assisting further.

    Comment


      #3
      Hi Gaby;

      Thank your for your answer.

      In fact I already use the methods you mentionned.
      In case the user select a strategy using the visual component, then I start the ATM

      Here the part of the code when I submit an order:
      Click image for larger version

Name:	image.png
Views:	208
Size:	45.4 KB
ID:	1292622

      My issue here it's when an order is taken using the ATM, with a quantity/market size of 4 lots let's say, and if I manlualy close 2 lots, the SL and TP remain 4 Lots instead of 2.
      I would like the SL and TP to be updated with the new position size, by code

      Comment


        #4
        Hello,

        Thank you for your response.

        Can you clarify, are you trying to close these orders manually or by code? Apologies as I'm a little confused since you mentioned doing it manually but also asked how to accomplish this by code.

        Would you be able to provide a reduced test script that demonstrates the behavior?

        Comment


          #5
          Originally posted by TradeForge View Post
          Hi Gaby;

          Thank your for your answer.

          In fact I already use the methods you mentionned.
          In case the user select a strategy using the visual component, then I start the ATM

          Here the part of the code when I submit an order:
          Click image for larger version

Name:	image.png
Views:	208
Size:	45.4 KB
ID:	1292622

          My issue here it's when an order is taken using the ATM, with a quantity/market size of 4 lots let's say, and if I manlualy close 2 lots, the SL and TP remain 4 Lots instead of 2.
          I would like the SL and TP to be updated with the new position size, by code
          Hi TradeForge I would like to know if you find the answer. I really appreciate any help with this.

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by argusthome, 03-08-2026, 10:06 AM
          0 responses
          110 views
          0 likes
          Last Post argusthome  
          Started by NabilKhattabi, 03-06-2026, 11:18 AM
          0 responses
          59 views
          0 likes
          Last Post NabilKhattabi  
          Started by Deep42, 03-06-2026, 12:28 AM
          0 responses
          37 views
          0 likes
          Last Post Deep42
          by Deep42
           
          Started by TheRealMorford, 03-05-2026, 06:15 PM
          0 responses
          41 views
          0 likes
          Last Post TheRealMorford  
          Started by Mindset, 02-28-2026, 06:16 AM
          0 responses
          78 views
          0 likes
          Last Post Mindset
          by Mindset
           
          Working...
          X