can you please say what should be the syntax for closing atm strategy? I am using button clicked for it.
Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
Close atm strategy
Collapse
X
-
Close atm strategy
Hi,
can you please say what should be the syntax for closing atm strategy? I am using button clicked for it.Tags: None
-
Hello asmmbillah,
Thank you for your post.
To close an ATM Strategy with syntax, you may use AtmStrategyClose(). This method cancels any working orders and closes any open position of a strategy using the default ATM Strategy close behavior. Please see the AtmStrategyClose() Help Guide page linked below for more information.
AtmStrategyClose() - https://ninjatrader.com/support/help...ategyclose.htm
Also, here is a Help Guide link about ATM Strategy close behavior - https://ninjatrader.com/support/help...r_atm_stra.htm
Please let us know if we may further assist.
<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>
-
Thanks for your reply. from the guide I can see you suggest to use
AtmStrategyClose("idValue");
Now while I have multiple positions running using the same atm strategy, how do I close all? And what is "idValue" here?
Comment
-
Hello asmmbillah.
Thank you for your reply.
'idValue' in AtmStrategyClose() refers to the ATM Strategy's unique id generated from GetAtmStrategyUniqueId(). GetAtmStrategyUniqueId() would need to be used to create a unique id for each ATM Strategy you are running. Then AtmStrategyClose would be used to close out of each ATM Strategy using the strategy's unique id.
Please clarify whether you are creating ATM Strategies using ATMStrategyCreate() or if you are wanting to close ATM Strategies from manually placed orders, like by clicking the Close button.
More information may be found in the Help Guide link here - https://ninjatrader.com/support/help...gyuniqueid.htm
Also, here is a Help Guide link about manually closing an ATM Strategy using the Close button - https://ninjatrader.com/support/help...strategies.htm
Please let us know if we may assist further.<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
-
Thanks for your reply. I am using AtmStrategy.StartAtmStrategy(atm.SelectedAtmStrate gy, entryOrder); for entering position. Now with a button click event, I may have multiple instance of the same atm strategy running. but with a separate button's click I am trying to close all open postions including any pending generated by the atm instances. I hope that clarifies.
Comment
-
Hello asmmbillah,
I see this post is in the strategy development section. Is this an AddOn or a Ninjascript strategy?
For a strategy approach, you may use AtmStrategyCreate() for submitting an entry order that will execute a specified ATM Strategy.
Here is a Help Guide link about how AtmStrategyCreate() may be used - https://ninjatrader.com/support/help...tegycreate.htm
Using an AddOn approach, you would need to loop through the account orders and change the limit to fill or submit an order to close the position.
Additionally, you may also call atmStrategy.CloseStrategy() to close the ATM strategy once the target/stop reach an Accepted/Working OrderState. You could, for example, check if "Stop1" belongs to an ATM strategy taking the approach in the DetectAtmEntry example in the forum link below, and if the order is in an Accepted state, calling CloseStrategy from the AtmStrategy will close the ATM strategy.
DetectAtmEntry Example - https://ninjatrader.com/support/foru...ategyid-needed
Also note that the ATM strategy will have a Strategy ID as we see with NinjaScript strategies, that can be used to uniquely identify the strategy. In the example, this strategy can be referenced as stratbase.Id or atmStrategy.Id. This Id is not the same as the Atm Strategy Id that is used in the NinjaScript strategy ATM Strategy Methods.
I look forward to being of further assistance.<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
-
You are seeing this post here as it is for strategy.
I was advised by your colleague here to use StartAtmStrategy(atm.SelectedAtmStrate gy, entryOrder) for this purpose. I am not creating atm strategy within my script, I am simply grabing the existing atm template. I hope that gives you more clarification to review your reply above.
Comment
-
Hello asmmbillah,
Thank you for that information.
If you are not submitting the ATM Strategy through code, it wouldn't be necessary to use StartAtmStrategy() as this method is used to start an ATM Strategy when submitting an entry order through the addon approach.
If you want a list of working ATM Strategies from manually placed entry orders, these can be found from the Account.Orders. The previous DetectAtmEntry example demonstrates this by getting the ATM Strategy from the order.
Here is a Help Guide link about using Account.Orders - https://ninjatrader.com/support/help...rs_account.htm
Let me know if I may be of further assistance.Last edited by NinjaTrader_ChelseaB; 08-10-2020, 12:28 PM.<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
-
thanks for your info.
is AtmStrategyClose("idValue"); idValue and GetAtmStrategyMarketPosition("id") id is same? if no, please advice the difference. and it answer is yes, I am getting error saying it does not exists. Please advice.
Comment
-
Hello asmmbillah,
Thank you for your note.
Are these manually placed entries?
Or,.are they entries placed through ATM Strategy methods?
Or, are they entries placed using the AddOn approach?
AtmStrategyClose("idValue") and GetAtmStrategyMarketPosition("id") do utilize the same atmStrategyId value. It is likely that the message you are getting is due to not having generated a unique ID and used it with AtmStrategyCreate().
Please reference the AtmStrategyCreate() example to see how GetAtmStrategyUniqueId() generates a unique ID to be used in AtmStrategyCreate(). - https://ninjatrader.com/support/help...tegycreate.htm
If they are manually placed orders, it could be that the correct ID isn't being fetched from the Account.Order Strategy.
More information about Account.Order may be found in the Help Guide link here - https://ninjatrader.com/support/help...nt8/?order.htm
I look forward to further assisting.
<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
-
thanks for that info. if I want to use AtmStrategyCreate(), I can see "AtmStrategyTemplate", can you please what it should be or how can I get that within my strategy script?
Comment
-
Hello asmmbillah,
Thank you for your post.
An ATM Strategy may be saved as a template that you can recall later to automatically populate all of the ATM Strategy parameters.
To save your current ATM Strategy parameters in a template:- Open an order entry window and navigate to the ATM Strategy drop-down menu.
- Select the ATM Strategy you want to save from the drop-down menu and click 'edit'.
- Select the Save as Template button
- From the presented file dialog give the template a custom name, for example, AtmStrategyTemplate.
- Select Save.
- Select OK.
Please note, the strategyTemplateName must match the name of the ATM Strategy template exactly in order to work.
Let us know if we may assist further.<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 NullPointStrategies, Yesterday, 05:17 AM
|
0 responses
62 views
0 likes
|
Last Post
|
||
|
Started by argusthome, 03-08-2026, 10:06 AM
|
0 responses
134 views
0 likes
|
Last Post
by argusthome
03-08-2026, 10:06 AM
|
||
|
Started by NabilKhattabi, 03-06-2026, 11:18 AM
|
0 responses
75 views
0 likes
|
Last Post
|
||
|
Started by Deep42, 03-06-2026, 12:28 AM
|
0 responses
45 views
0 likes
|
Last Post
by Deep42
03-06-2026, 12:28 AM
|
||
|
Started by TheRealMorford, 03-05-2026, 06:15 PM
|
0 responses
50 views
0 likes
|
Last Post
|

Comment