Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Pyramiding orders

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

    Pyramiding orders

    Hi,

    I've been trying for a couple days to enter a position, immediately set a stop loss and profit target, then if the position is up enough, add a second contract and modify the existing stop loss and profit target to account for my new average price and quantity. I can't seem to get it working correctly though. Usually my problem is that my stop and profit target quantities never update to reflect the fact that I am now holding two (or more) contracts. They always execute with a quantity of one.

    Can you point me towards some documentation or some code samples (preferable) that describe how to do this in NT8?

    If possible, I assuming using managed orders is preferable. Additionally, I'd like the orders to actually exist as Stop Market or Stop Limit OCO orders vs my code monitoring and just creating market orders on the fly as conditions dictate.

    #2
    Hello NickyD,

    Thanks for opening the thread.

    SetProfitTarget() and SetStopLoss() will create their own unique exits, so I may suggest to follow the Advanced Order Handling rules of the Managed Approach so you can use Order objects to track your orders, and then you can use OnExecutionUpdate() to update your bracketed Profit Target and Stop Loss orders. These orders would then have to be submitted from the Exit methods for easy assignment to an Order object.

    The Managed Approach does not offer OCO through its entry and exit conditions, but the logic can be programmed in OnOrderUpdate().

    If you want to utilize OCO, you can use the Unmanaged Approach.

    I'll include a link to a reference sample that demonstrates using Order objects, OnOrderUpdate() and OnExecutionUpdate(). I'll also include an Unmanaged example and some openly available documentation on the Advanced Order Handling rules to provide further direction managing your orders as you desire.

    SampleOnOrderUpdate (Please see documentation herein) - https://ninjatrader.com/support/foru...ead.php?t=7499

    Advanced Order Handling - https://ninjatrader.com/support/help...#TheOrderClass

    ChangeOrder() - https://ninjatrader.com/support/help...hangeorder.htm

    Unmanaged Approach - https://ninjatrader.com/support/help...d_approach.htm

    Please let me know if I may be of further assistance.
    Attached Files

    Comment


      #3
      This got me to where I wanted to be, especially using the ChangeOrder().

      Thanks for the thorough response!

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by NullPointStrategies, Yesterday, 05:17 AM
      0 responses
      56 views
      0 likes
      Last Post NullPointStrategies  
      Started by argusthome, 03-08-2026, 10:06 AM
      0 responses
      133 views
      0 likes
      Last Post argusthome  
      Started by NabilKhattabi, 03-06-2026, 11:18 AM
      0 responses
      73 views
      0 likes
      Last Post NabilKhattabi  
      Started by Deep42, 03-06-2026, 12:28 AM
      0 responses
      45 views
      0 likes
      Last Post Deep42
      by Deep42
       
      Started by TheRealMorford, 03-05-2026, 06:15 PM
      0 responses
      49 views
      0 likes
      Last Post TheRealMorford  
      Working...
      X