Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
Executed as entry even though it is a stop order
Collapse
X
-
Executed as entry even though it is a stop order
I have a trade at Sim account, bought on ES at 4278.75 with a stop of 4277.5. I leave the stop when the market closes at 4 pm, I just trail it until it stops out by itself. I am wondering why the stop is executed as an entry when it is an exit to an open position, the stop order is on GTC. Can someone help me figure this out? Please see the attached as a reference on that trade.Tags: None
-
It's because Ninja's Trade Performance tool is broken. It does NOT always correctly match executions and create the appropriate trades, including calling entries exits and vice versa in some circumstances.
See this post for more details... it is an issue I have been working on for the last year!!
Cheers,
T.
- Likes 1
-
Hello luxurious_04
Thanks for your post.
NinjaTrader does not actually track any trades. It will pair executions together in a FIFO fashion to form trades. Depending on the executions made, and when the report was made (for example, starting the report when you are not in a flat position) can result in mismatched trades.
There is additional discussion about imperfections that can come up in the linked thread. Ultimately, we would want to improve this situation for trades on a live account by getting the trades from the broker, which would get past any pitfalls of trying to pair the trades on our own.
I would like to review your database file with you, along with a screenshot of how you have generated your report. If we look at the executions display, we will be able to piece together how the executions got paired.
To send me your database file, please see below.
Sending in database file
You can do this by going to the Control Center-> Help-> Email Support
Expand 'Other files' and enable 'Database file'.
Please reference the following ticket number in the body of the email: 3160775 ATTN Jim with a link to this thread.
I look forward to hearing from you.Last edited by NinjaTrader_Jim; 06-29-2021, 07:02 AM.JimNinjaTrader Customer Service
Comment
-
Returning to this issue... I can clearly see in my sdf file where Ninja has recorded on a live account, an ENTRY to sell (position was 1 Long) which is designated as "Close"... and then said my position was 1 Short... instead of flat.
In summary, the execution was an exit, not an entry, position after was flat, not short...
and the corresponding extract from the sdf database is this:
I conclude that Ninja is simply writing incorrect data to the database, as the above was a very vanilla pair of buy/sell trades.
I was flat in ZS prior to this report... nothing weird, no excuse for not recording it correctly, which would look like this:
Buy 1 1545.00 Entry 1L Sell 1 1570.75 Exit - Close Buy 1 1567.25 Entry 1L Sell 1 1563.00 Exit - Close
Jim...would love to get some definitive understanding of what NT does, as examples like this (I have many) are making my life as an Addon creator a nightmare!
Cheers,
T.Last edited by tgn55; 07-25-2021, 10:14 PM.
Comment
-
Hello tgn55,
I cannot offer any additional specifics for the trade pairing as the code is all internal parts of the platform. That said, an issue where executions are suspected to be written improperly is something we would like to look into and understand how that issue can be reproduced for analysis.
When I rename my database file to create a new database file and take the trades noted in your screenshots, I get the following in the Trade Performance window and cannot reproduce the symptom. (I am testing on 8.0.24.3.)
Is there a procedure I may follow to reproduce this from a clean database file or using the Playback Connection? You can close NinjaTrader and rename the database file to start again with a clean database file.) If it requires specific trades that are tedious to perform manually, could your prepare a strategy or script that can take the necessary trades?
JimNinjaTrader Customer Service
Comment
-
Hey Jim...
my issue is not immediately with NT's trade pairing... but the execution data in the sdf is exactly what I am using to do my own version of trade pairing... so, yeah, its not entirely off-topic ;-)
My secondary issue is, as you can imagine... it's not easy pairing trades correctly given what I have in my sdf! But... that's part 2 of this little saga ;-)
Put another way... I guess my question is, under what circumstances might NT record what I have in my database? I will examine other instances I have of this type or "strange behaviour"
Cheers,
T.
Comment
-
Hello tgn55,
Any time an order execution is seen, NinjaTrader will log it to the database. NinjaTrader also fetches daily executions upon connection and will log them to the database if they do not already exist. That way if you were disconnected and were trading from another location, you could connect from the other PC at the end of the day to download and log those executions.JimNinjaTrader Customer Service
Comment
-
Hey NinjaTrader_Jim ... sorry I didn't see this reply until just now, thanks for the additional info. It is probably critical for my purposes!
So I went back and analysed both the sdf and my logs when I saw weird stuff... and found some "interesting" things.
First up, the very first instance I looked at indeed was around a disconnect/reconnect. Check.
But then, I dug deeper/further back, looking at a few other anomalies... and this is where it gets scary (for me, wearing my Addon creator hat)
I pulled data from the logs for the two ZS trades/4 executions I show above, and it looks to me very much like the records written in the sdf file are just plain wrong. This bothers me a great deal, since I've been working the last 12 months on "fixing" the broken Trade Performance Trade report...and what I've just seen fills me with despair that it is broken beyond repair!
[There was a disconnect or restart between the first and second executions in my pics above, ie between 5/28 and 6/3]
It appears to me that Ninja simply does not correctly synch up after a disconnect/restart. Result? An Exit is reported as Entry, Position, which is flat is reported as short. All confirmed by studying the logs. No wonder I've been having a tough time producing an accurate trades report from the sdf... when the data I rely on is scrambled! (It looks to me, after just this little analysis, that NT assumes a flat position on startup - which may ultimately be the root cause of all this ??)
Would be happy to continue this discussion via private chat if you prefer, I can show you my analysis. Tried to PM you rather than posting... but it was blocked.
Regards,
T.Last edited by tgn55; 08-12-2021, 06:47 AM.
Comment
-
Hello tgn55,
We moved to using private messages only for necessary forum communication. For example, notifying a User App Share submission author of a submission issue. This is mainly to ensure that inquires are not left in limbo and so that other technicians can assist if another is out.
If you want to work with me more closely, please send me an email to scriptingsupport [at] ninjatrader [dot] com with the text "Attn Jim 3160775" and include a link to this thread.
We should preface some items though:- All database management code is internal platform code. I do not have access to this code to advise on further specifics on how things get added outside of what I shared in post #7. This means that we would technically be in unsupported territory, and you will be mostly on your own
- That said, if you see something that looks off from your level of involvement, that we can illustrate an observable issue with the Trade Performance window, that can also be reproduced with steps, we can proceed as we would if we were reporting any other platform related issue. Scripts that are programmed to demonstrate the issue also would be helpful so we can easily inform QA and Development how to reproduce said issues. (This would need to involve using a strategy rather than injecting database entries into the database file)
JimNinjaTrader Customer Service
Comment
-
OK, thanks Jim I appreciate your support position and limits etc. Your post has, I think, pointed me in the direction of tracking this down... at least, up to the point of understanding how/when the bogus entries in the sdf come into being.
The second issue (well, it started out as the first !!) is my attempts to improve on Ninja's trade pairing stuff... you may recall I've been banging on about this for the last year... about not starting trades with an EXIT... that's where this all began. I thought I had solved it... until further testing unearthed these cases where my solution also broke. So... now I kinda know why... but not at all clear (now) how to resolve it...
Anyway, I'll send more details in email.
PS... I am not and never have injected records into the sdf. I only ever read what is already there. I will try to produce a process that triggers what I believe is wrong and submit to you.
Cheers,
T.
- Likes 1
Comment
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by Tim-c, Today, 08:36 AM
|
4 responses
12 views
0 likes
|
Last Post Today, 02:45 PM | ||
Started by JohnS52, 03-22-2024, 08:06 AM
|
4 responses
28 views
0 likes
|
Last Post
by JohnS52
Today, 02:30 PM
|
||
Started by RaygunWizzle, Yesterday, 08:52 PM
|
2 responses
10 views
0 likes
|
Last Post
by RaygunWizzle
Today, 02:26 PM
|
||
Started by carnitron, 03-25-2024, 01:59 PM
|
11 responses
51 views
0 likes
|
Last Post
by carnitron
Today, 02:18 PM
|
||
Started by Gerik, 12-21-2023, 08:20 AM
|
15 responses
203 views
0 likes
|
Last Post
by Mindset
Today, 02:06 PM
|
Comment