Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

How to "merge" position order to one handle on the chart

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

    How to "merge" position order to one handle on the chart

    Hi,

    I am currently working on a script placing multiple orders on the chart. When I place on order, an ATM-Strategy is attached with a stop and a take profit.

    When placing more than one order, I would like to "merge" these multiple order to one handler on the chart, like when clicking multiple times on "buy" on Charttrader, for example.

    I got a hotkey programmed, moving the stop to a defined position. After that I want to be able to drag the stop(s) manually. I currently modify the orders by the Account.Change() function.

    I was looking for a field in the order object to achieve what I want, but I don't know whether this is the correct approach

    EDIT:
    I create the orders with Account.CreateOrder() and then submit them via Account.Submit()

    EDIT2:
    I also attach an AtmStrategy with NinjaTrader.NinjaScript.AtmStrategy.StartAtmStrate gy(), but it does not matter wheter I attach the same or a different strategy here. The orders are not displayed as "stacked" in the chart. But when "adding" another order with the Charttrader, the new order gets stacked to the last order placed by the script, NOT based on the AtmStrategy but to the prie level of the last placed orders.
    Last edited by mbwh1989; 07-27-2022, 02:44 AM.

    #2
    Hello mbwh1989,

    When creating ATM's using code that would be how they display in the chart. The chart trader tracks and manages ATM's in its own way when submitting orders manually. When a script submits it the chart traders mainly just tracking the orders and supplying the handles/X button for each order so it can be managed.

    Comment


      #3
      Thank you very much for your reply, Jesse!

      I ended up with something like this:

      Code:
      if(selectedAtmStrategy.Executions.Count < 1) {
      NinjaTrader.NinjaScript.AtmStrategy.StartAtmStrate gy(selectedAtmStrategy, limitOrder);
      }
      
      else {
      selectedAtmStrategy.ManageOrder(limitOrder);
      }
      I found, that if I select the same AtmStrategy in the AtmStrategySelector in the Charttrader-Gui and submit a second order with this same atmStrategy via "ManageOrder", they will get displayed as stacked. I currently track, whether it is the first time an atmStrategy gets used by the "Executions"-length and otherwise submit for manage, but I would really appreciate a comment on that approach since it does not seem the best for me... It just works right now, but I am unsure how safe this is.

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by argusthome, Yesterday, 10:06 AM
      0 responses
      17 views
      0 likes
      Last Post argusthome  
      Started by NabilKhattabi, 03-06-2026, 11:18 AM
      0 responses
      16 views
      0 likes
      Last Post NabilKhattabi  
      Started by Deep42, 03-06-2026, 12:28 AM
      0 responses
      14 views
      0 likes
      Last Post Deep42
      by Deep42
       
      Started by TheRealMorford, 03-05-2026, 06:15 PM
      0 responses
      9 views
      0 likes
      Last Post TheRealMorford  
      Started by Mindset, 02-28-2026, 06:16 AM
      0 responses
      36 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Working...
      X