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!
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
NinjaTrader
Is it possible to have finer control over an order submitted via AtmStrategyCreate()?
Collapse
X
-
Is it possible to have finer control over an order submitted via AtmStrategyCreate()?
I found from the documentation that the level of control over an order submitted via AtmStrategyCreate() is somewhat limited. For instance, to close a non-terminal-state order submitted by AtmStrategyCreate(), AtmStrategyClose() would cancel any open orders on the active instrument/account. This is problematic as unrelated orders would be affected. It seems that there is no way to work with the actual Order object. Is there a way to achieve finer control over the order so that I can, in the fore-mentioned case for instance, be able to close only the submitted order? -
Hello mbesha,
Without knowing what logic you were using it would be hard to understand the outcome you described. In general an ATM controlled from NinjaScript requires very specific coding and use of string ID's, if something was mixed up in the logic it certainly could produce unknown results when calling the ATM methods.
It is currently not possible to have better control over an ATM strategy in general. The point of the ATM is to have limited control because an outside strategy(ATM) controls the target orders instead of you or your NinjaScript strategy. For what you are asking you would be better off using either the Managed or Unamanged approach so you have full control over the orders. ATM's are only intended to be started and then work on their own so if you need to do other actions with the targets an ATM is not a good choice for that use case.
I look forward to being of further assistance.
JesseNinjaTrader Customer Service
-
Originally posted by mbesha View PostI found from the documentation that the level of control over an order submitted via AtmStrategyCreate() is somewhat limited. For instance, to close a non-terminal-state order submitted by AtmStrategyCreate(), AtmStrategyClose() would cancel any open orders on the active instrument/account. This is problematic as unrelated orders would be affected.
Isn't the behavior affecting "unrelated orders" confined entirely within the Strategy executing the AtmStrategyClose?
I mean, any manual orders and any orders created by other running Strategies would not be affected by that AtmStrategyClose, correct?
A careful reading of the documentation implies the answer is "yes" for both questions, since it says,
"Cancels any working orders and closes any open position of a strategy ..."
My point is, the OP has said,
Originally posted by mbesha View PostAtmStrategyClose() would cancel any open orders on the active instrument/account.
It seems like what the OP is saying is AtmStrategyClose cancels more open orders than it is supposed to.
mbesha, for the same instrument/account, is AtmStrategyClose also cancelling your open orders submitted manually?
Comment
-
Originally posted by bltdavid View PostA careful reading of the documentation implies the answer is "yes" for both questions, since it says,
"Cancels any working orders and closes any open position of a strategy ..."
to assume "strategy" is referring to an automated Strategy written in NinjaScript ...
To me, the documentation says it will only affect the orders of the Strategy calling it ... am I wrong?
Comment
-
Hello bltdavid,
I would not want to try and go further into what may be happening without more specific details first. To reiterate the question that was asked:
It seems that there is no way to work with the actual Order object. Is there a way to achieve finer control over the order so that I can, in the fore-mentioned case for instance, be able to close only the submitted order?
Please let me know if I may be of additional assistance.JesseNinjaTrader Customer Service
Comment
-
Originally posted by bltdavid View Post
The documentation, being annoying sparse on details, does not say "of an ATM strategy", so we are left
to assume "strategy" is referring to an automated Strategy written in NinjaScript ...
To me, the documentation says it will only affect the orders of the Strategy calling it ... am I wrong?
Comment
-
Originally posted by NinjaTrader_Jesse View PostHello mbesha,
Without knowing what logic you were using it would be hard to understand the outcome you described. In general an ATM controlled from NinjaScript requires very specific coding and use of string ID's, if something was mixed up in the logic it certainly could produce unknown results when calling the ATM methods.
Comment
-
Hello mbesha,
Is it possible to use it to find a specific order from Account.Orders and thus make a link from the ATMStrategy to an Order object?
Is there a specific feature you wanted to from the ATM over one of the other approaches? If you can provide more detail on what you want to do with the order overall I can try to provide links to other related resources to help toward that.
I look forward to being of further assistance.
JesseNinjaTrader Customer Service
Comment
-
Originally posted by NinjaTrader_Jesse View PostIs there a specific feature you wanted to from the ATM over one of the other approaches? If you can provide more detail on what you want to do with the order overall I can try to provide links to other related resources to help toward that.
Originally posted by NinjaTrader_Jesse View PostNot in any supported/suggested ways no, the ATM orders are not designed to be accessed individually like the other order handling approaches.
Comment
-
Originally posted by mbesha View PostAs I mentioned previously, I want to be able to cancel an order submitted by ATMStrategyCreate() and it should be able to do so without affecting any other open orders in the account. I did not find this specific feature as ATMStrategyClose() seems to affect others orders in the account as well.
is a seriously aggravating 'gotcha' when working with the NinjaTrader 7 ATM api's.
Why?
Because the NT7 documentation for AtmStrategyClose lies to you.
Jesse, there is no need to speculate. It is clear to anyone who uses AtmStrategyClose in their
code that NT7 AtmStrategyClose documentation does not document the behavior they experience.
Btw, I don't think NT8 is much better in this department.
mbesha, the problem is -- neither NT7 or NT8 have an API for the Close behavior you want.
How so? Let's look at NT8, where the documentation says this,
"(the left mouse button will close the current position and cancel any working orders associated
with the instrument/account combination and the middle mouse button (scroll wheel) will close the
selected active ATM Strategy position only)"
Just like NT7, the AtmStrategyClose in NT8 performs left mouse button behavior.
The real problem is this:
Neither NT7 or NT8 have an API that performs the middle mouse button behavior.
A feature request should be submitted to NT8 for the addition of an API to perform the
middle mouse button behavior to close the active ATM Strategy position only.
Jesse, can you do that?
- Likes 1
Comment
-
Hello mbesha,
I have tested the AtmStrategyClose() and I am finding that positions opened from manual orders that are not submitted to an active Atm Strategy are not being cancelled by AtmStrategyClose().
Below is a link to a video of the test.
https://drive.google.com/file/d/1geY...w?usp=drivesdk
bltdavid,
I will request that the help guide for NinjaTrader 7 be changed to specifically state: 'Cancels any working orders and closes any open position of an Atm Strategy...' to clarify.
With NinjaTrader 7, any usage of the Account is not supported or documented.
Below is a link to a forum post that has some undocumented code you may find helpful.
http://www.ninjatrader.com/support/f...2&postcount=33
With NinjaTrader 8, using the Account is supported and there is a way to find a working Atm Strategy from an Account Order. I do have an example script of this if you would like this.
With the middle mouse behavior, this will only close the selected active Atm Strategy.
With the AtmStrategyClose() this will only close the Atm Strategy created by the script with that Atm Strategy ID as demonstrated in the video above. It will not close an Atm Strategy that is selected in the Atm Strategy drop-down of any trade window such as Chart Trader or SuperDOM, if that Atm Strategy is not the Atm created by the script.
Are you asking for a NinjaScript Atm Strategy method that will look at the focused window and close the Atm Strategy that is manually selected in the trade window?Last edited by NinjaTrader_ChelseaB; 01-29-2020, 12:29 PM.Chelsea B.NinjaTrader Customer Service
Comment
-
Thanks, ChelseaB!
Excellent video, it was very helpful, I stand corrected, thank you very much for making that.
The key element I had been missing (apparently, for several years ) is where you said this,
"if that Atm Strategy is not the Atm created by the script".
I shall retreat back to my cave ..
Comment
-
Originally posted by NinjaTrader_ChelseaB View PostI have tested the AtmStrategyClose() and I am finding that positions opened from manual orders that are not submitted to an active ATM Strategy are not being cancelled by AtmStrategyClose().
...
With the AtmStrategyClose() this will only close the Atm Strategy created by the script with that Atm Strategy ID as demonstrated in the video above.
Comment
-
Hello mbesha,
The AtmStrategyClose() will close a strategy by ID. This is ID is generated by GetAtmStrategyUniqueId(). This ID will be unique each time its called. For each chart running the script, a different ID is going to be used so the NinjaScript Strategy will only be closing the Atm Strategy created with that ID.Chelsea B.NinjaTrader Customer Service
Comment
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by cre8able, Today, 05:53 PM
|
1 response
10 views
0 likes
|
Last Post
by cre8able
Today, 08:20 PM
|
||
Started by johnMoss, 03-04-2024, 01:53 PM
|
3 responses
47 views
0 likes
|
Last Post
by AndyM
Today, 06:13 PM
|
||
Started by algospoke, Today, 06:01 PM
|
0 responses
8 views
0 likes
|
Last Post
by algospoke
Today, 06:01 PM
|
||
Started by Wessel, 03-23-2024, 02:37 PM
|
3 responses
25 views
0 likes
|
Last Post Today, 04:58 PM | ||
Started by martini, Yesterday, 04:45 PM
|
4 responses
32 views
0 likes
|
Last Post
by martini
Today, 04:48 PM
|
Comment