This is occurring on MarketReplay. Any help is appreciated.
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
ATMStratgeyClose only Closing Stop.
Collapse
X
-
ATMStratgeyClose only Closing Stop.
When using the ATMStrategyClose(atmStratgeyId) method, only my stop is being cancelled. Both the target and entry remain. That's about the last situation I wanna see in real life
This is occurring on MarketReplay. Any help is appreciated.Last edited by efagerstrom; 03-03-2017, 11:58 AM.Tags: None
-
Hello efagerstrom,
Thank you for writing in.
I am unable to replicate on our end when connected in replay. I've attached a sample strategy I used to test on a crude oil chart of 2 second interval.
Stops and Targets are not submitted until the entry order is filled, thus it is not clear what you mean by the target and entry remain but the stop is canceled.
Could you please provide more information on the behavior you are seeing and if you'd like, a copy of the script so we can test on our end?
I look forward to your reply.Attached FilesAlan P.NinjaTrader Customer Service
-
Thank you for your response AlanP!
I will review your code and see if I can glean anything from it. In my scenario, I reposition the target and stop using AtmStrategyChangeStopTarget() after the initial placements have been made. I do this with all of my ATM Strategy trades and it works fine.
I did do a printout of my atmStrategyId at the time it was created and another one just before the cancelation request and they are identical. I would expect the cancelation to cancel the entire strategy rather than any individual part of it, and my understanding is that that expectation is correct. However, only the stop is cancelled. The trade is still open and the target and entry remain unchanged.
I will send relevant snippets of my code for your review as soon as I am able. Thanks again for your response!
Comment
-
AlanP...after reviewing the code you were kind enough to send, I am sensing that your code was written for NinjaTrader 8 since many of the namespaces you included seem not to be available in my codebase (among other things). Is that possible? Please confirm.
Comment
-
Hello efagerstrom,
Yes, I apologize I wrote that for NT8.
Regarding your statement, The trade is still open and the target and entry remain unchanged, I'm confused as your stop and target are submitted after your entry is filled, thus I'm not sure I understand the issue you are having exactly.
If you could provide more information on what you're seeing along with the full code I can take a look. If you'd prefer to email a copy, send to platformsupport[at]ninjatrader[dot]com with Attn: Alan P in the Subject line. Also within the email please include a link to this thread, and the files.
I look forward to your reply.Alan P.NinjaTrader Customer Service
Comment
-
I can send you the entire script. However, I am using 3rd party indicators, so I wouldn't expect you to be able to run it.
What I mean is that I submit my trade (a market order). The entry, target and stop are placed. After placement, I adjust the target and stop. I continue to modify that target and stop throughout the trade.
When one of my trade rules require that I exit the trade, I execute the AtmStrategyClose(atmStrategyId). Once executed, only the stop is cancelled. The sound file, "Order Cancelled" is heard, and only the stop disappears. The original entry and the target both remain on the chart.
I'm sure that sounds crazy, but that is what's happening. I was excited to see the error code that might have been returned but disappointed to find I would need NinjaTrader 8 to run your code
Comment
-
Hello efagerstrom,
In order for you’re a profit target and stop loss to be placed your entry order would have to be filled.
The way AtmStrategyClose works in NT7, is that your stop is canceled and your profit target is moved to the market, which then closes your position. To demonstrate this I suggest you connect to the simulated data feed, open a superdom, create a simple ATM strategy, place a trade so the stop and profit target are submitted. Now, click the close button on the super dom and look at your orders tab on the control center. You’ll see the closing orders name is Target1 and your Stop1 has been canceled.
I would suggest adding print statement to your strategy and confirm this script isn’t placing multiple orders, or another script isn’t placing orders as well. I’ve provided a link to a youtube video which covers an example of using prints to understand behavior:
Dive into manipulating C# code from within an unlocked NinjaScript strategy using the NinjaScript Editor.NinjaTrader 7 is an award winning end to end online ...
I’ve provided a link covering debugging which you may find helpful.
Debugging: http://ninjatrader.com/support/forum...ead.php?t=3418
Please let us know if you need further assistance.Alan P.NinjaTrader Customer Service
Comment
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by kaywai, 09-01-2023, 08:44 PM
|
5 responses
601 views
0 likes
|
Last Post Today, 12:32 AM | ||
Started by xiinteractive, 04-09-2024, 08:08 AM
|
6 responses
22 views
0 likes
|
Last Post Today, 12:31 AM | ||
Started by Pattontje, Yesterday, 02:10 PM
|
2 responses
17 views
0 likes
|
Last Post
by Pattontje
Yesterday, 11:49 PM
|
||
Started by flybuzz, 04-21-2024, 04:07 PM
|
17 responses
230 views
0 likes
|
Last Post
by TradingLoss
Yesterday, 11:45 PM
|
||
Started by agclub, 04-21-2024, 08:57 PM
|
3 responses
17 views
0 likes
|
Last Post
by TradingLoss
Yesterday, 11:42 PM
|
Comment