Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
Attach ATM orders to chart drawn line
Collapse
X
-
Attach ATM orders to chart drawn line
Hi, I want to build a drawing tool, I believe, that will allow me to attach trades to the level that I draw on the chart. Basically, if I draw a line, I want to have the ability to attach an ATM order to that specific line. From what I understand, the reason you can’t attach an order to the line from the drawing tools area is because of the PLOTS function, is that correct? What would be the most efficient way to accomplish this? Would it be a drawing tool, strategy, or indicator? I’d appreciate some sort of outline on what I’d need to do. I hoped there would be something in the ecosystem but I had no luck. Thanks.
Tags: None
-
Hello Ymcapital,
Thanks for your post.
To clarify, are you wanting to submit an entry order with an ATM Strategy template attached to control protective orders?
If so, ATM Strategy templates do not have the ability to specify that the ATM target/stop orders are attached to an indicator or drawing tool on the chart window. You would have to specify the distance away that you want to have the profit target and stop loss order from the entry order. For example, you could specify 10 ticks from the entry.
ATM Strategy Templates: https://ninjatrader.com/support/help...parameters.htm
If you want to submit protective orders to a specific value, such as a drawing tool value on the chart, you could consider creating a custom NinjaScript strategy that places Exit orders (ex: ExitLongLimit()/ExitLongStopLimit()) for the profit target and stop loss orders.
The DrawObjects collection could be used to get the price of the drawing object on the chart and then you could pass the value of the drawing object in for the limit price of the Exit method. This way, the exit method is placed at the same value that the drawing object is at.
See the help guide documentation below for more information and sample code.
DrawObjects: https://ninjatrader.com/support/help...rawobjects.htm
DrawingTool Properties: https://ninjatrader.com/support/help...rawingtool.htm
Managed Approach Order Methods: https://ninjatrader.com/support/help...d_approach.htm
<span class="name">Brandon H.</span><span class="title">NinjaTrader Customer Service</span><iframe name="sig" id="sigFrame" src="/support/forum/core/clientscript/Signature/signature.php" frameborder="0" border="0" cellspacing="0" style="border-style: none;width: 100%; height: 120px;"></iframe>
-
I have a drawing tool right now that I can draw diagnal lines on the chart using this indicator and I can attach orders to these lines. I can also attach stop losses to these lines and using the on bar update, if the slope of the line is positive, that stop (or entry) obviously moves up. If the slope of that line is negative, the stop (or entry) moves down as well. This is what I'm looking for without all the headache and hassle of having to input coordinates for the length and slope of the lines. I want to create a line drawing tool that's as simple as drawing a line on the chart using the drawing tool where you pick two points on the graph and the line just connects the two X,Y coordinates to give you a line. You don't have to calculate the slope, enter the numerical starting time and ending time of that line, it's just automatic. I want that ease of use but to have the functionality this indicator gives me where I can attach ATM orders to that given line but is that just not possible? Is it not possible to make a tool that simple with that capability?
Comment
-
Hello Ymcapital,
Thanks for your notes.
You mentioned this is a DrawingTool and you mentioned this is an Indicator, to clarify, is this a custom NinjaScript DrawingTool file or is this a custom NinjaScript Indicator file?
Is this a custom DrawingTool or Indicator script that you created or was this custom DrawingTool or Indicator script created by a third-party developer?
Note that a custom NinjaScript DrawingTool file cannot submit orders to an instrument.
Further, if you were creating a custom DrawingTool script then you must define the start anchor and end anchor of the line being drawn. See the 'Lines' DrawingTool file in the NinjaScript Editor window for an example of this.
To view the Line DrawingTool script, open a New > NinjaScript Editor, open the DrawingTools folder, and double-click on the 'Lines' file.
A NinjaScript Indicator or Strategy would need to be created if you want to submit orders to an instrument.
You could use the Account class to submit orders in a custom NinjaScript Indicator using the <Account>.CreateOrder() and <Account>.Submit() methods.
Account class: https://ninjatrader.com/support/help...ount_class.htm
CreateOrder(): https://ninjatrader.com/support/help...reateorder.htm
Submit(): https://ninjatrader.com/support/help...nt8/submit.htm
The Managed Approach, Unmanaged Approach, or Account class could be used to submit orders from a NinjaScript strategy. Note that if you want to submit an order that uses an ATM Strategy Template to control the protective stop/target orders then you would have to use Atm Strategy Methods in a custom NinjaScript strategy.
Managed Approach: https://ninjatrader.com/support/help...d_approach.htm
Unmanaged Approach: https://ninjatrader.com/support/help...d_approach.htm
Atm Strategy Methods: https://ninjatrader.com/support/help...gy_methods.htm
Further, note that ATM Strategy templates as seen in Chart Trader do not have the ability to specify that the ATM target/stop orders are attached to an indicator or drawing tool on the chart window.<span class="name">Brandon H.</span><span class="title">NinjaTrader Customer Service</span><iframe name="sig" id="sigFrame" src="/support/forum/core/clientscript/Signature/signature.php" frameborder="0" border="0" cellspacing="0" style="border-style: none;width: 100%; height: 120px;"></iframe>
Comment
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by Geovanny Suaza, 02-11-2026, 06:32 PM
|
0 responses
556 views
0 likes
|
Last Post
|
||
|
Started by Geovanny Suaza, 02-11-2026, 05:51 PM
|
0 responses
324 views
1 like
|
Last Post
|
||
|
Started by Mindset, 02-09-2026, 11:44 AM
|
0 responses
101 views
0 likes
|
Last Post
by Mindset
02-09-2026, 11:44 AM
|
||
|
Started by Geovanny Suaza, 02-02-2026, 12:30 PM
|
0 responses
545 views
1 like
|
Last Post
|
||
|
Started by RFrosty, 01-28-2026, 06:49 PM
|
0 responses
547 views
1 like
|
Last Post
by RFrosty
01-28-2026, 06:49 PM
|

Comment