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

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.

    JesseNinjaTrader Customer Service

    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 geddyisodin, Yesterday, 05:20 AM
      7 responses
      45 views
      0 likes
      Last Post NinjaTrader_Gaby  
      Started by gbourque, Today, 06:39 AM
      2 responses
      5 views
      0 likes
      Last Post gbourque  
      Started by cre8able, Yesterday, 07:24 PM
      1 response
      13 views
      0 likes
      Last Post NinjaTrader_ChelseaB  
      Started by cocoescala, 10-12-2018, 11:02 PM
      6 responses
      939 views
      0 likes
      Last Post Jquiroz1975  
      Started by cmtjoancolmenero, Yesterday, 03:58 PM
      1 response
      18 views
      0 likes
      Last Post NinjaTrader_Gaby  
      Working...
      X