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
Entries per Direction and Exits
Collapse
X
-
Hello bigsurftrader,
Thank you for writing in.
I have put together a sample strategy which assigns an order object to 3 different enter long methods, then within OnOrderUpdate, assigns a order object to the profit target and stop loss submitted as part of each entry. Then within OnBarUpdate you can check the OrderState of each order object to determine specificly if an entry position is open or closed.
After putting this together I realized it sounds like you already found this solution. I am unaware of another alternative to this approach.
Please let us know if you need further assistance.Attached Files
Leave a comment:
-
More information:
1) A trade set gets triggered by a signal. So, all orders are sent on the same bar on bar open
2) It appears that NT submits orders individually, so if there are 3 "market" long orders NT treats them as 3 separate orders; however...
3) When all three trades get closed out at the same time they are closed as a single order
I have working solution for this by using OnOrderUpdate where I can filter "orderState=Filled" and then determine which trades, individually, got closed -- but, was wondering if there was a cleaner solution to what I"m looking for.
Leave a comment:
-
Entries per Direction and Exits
Hi -
I have a strategy that creates up to 4 orders per signal in a direction (long or short), a trade set for long or short signals. Each order (trade) has its own unique identifier (i.e. BarNumber+n+L or BarNumber+N+S where "n" is 1, 2, 3 or 4).
A trade "closes" when it's stopped out, profit target hit, or a counter signal is generated.
Ok, so here's my question...
Is there a way to identify the individual trade when it "closes"? I've noticed that closed trades are either individually closed (i.e. stopped out or profit target achieved) -- and/or closed out together in one bundle, on one trade order (i.e. if 4 long trades then all 4 are closed out -- or sometimes 3 of 4, etc...).
I've looked into OnExecutionUpdate and OnOrderUpdate to see if I can identify the entry signals to the exit signals, but trades can be individually closed or closed in a group.
I have an external database that I've setup to log all entries and exits and I'm trying to tie the trade pairs together for reporting purposes.
Thanks,
Big SurfLast edited by bigsurftrader; 03-08-2017, 09:36 AM.
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by aussugardefender, Today, 01:07 AM
|
0 responses
1 view
0 likes
|
Last Post Today, 01:07 AM | ||
Started by pvincent, 06-23-2022, 12:53 PM
|
14 responses
238 views
0 likes
|
Last Post
by Nyman
Today, 12:47 AM
|
||
Started by TraderG23, 12-08-2023, 07:56 AM
|
9 responses
383 views
1 like
|
Last Post
by Gavini
Today, 12:29 AM
|
||
Started by oviejo, Today, 12:28 AM
|
0 responses
1 view
0 likes
|
Last Post
by oviejo
Today, 12:28 AM
|
||
Started by pechtri, 06-22-2023, 02:31 AM
|
10 responses
125 views
0 likes
|
Last Post Today, 12:03 AM |
Leave a comment: