Thanks!
Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
How to retrieve BarsArray[index] inside of OnExecution function?
Collapse
X
-
How to retrieve BarsArray[index] inside of OnExecution function?
Inside of the OnExecution() or OnOrderUpdate() functions, what it the best way to retrieve the BarsArray index of the instrument being traded? (This is inside of a multiple instrument strategy, and I'm trying to coordinate my entries/stops lists)
Thanks!Tags: None
-
Originally posted by kbeary33 View PostInside of the OnExecution() or OnOrderUpdate() functions, what it the best way to retrieve the BarsArray index of the instrument being traded? (This is inside of a multiple instrument strategy, and I'm trying to coordinate my entries/stops lists)
Thanks!
The easiest on the other hand, is to simply use the IOrder name. Give the IOrders names that reflect the BarsArray, then check the corresponding name of the IOrder that is the subject of the event.
-
Great, thanks very much.
I had been doing something similar:
- I have a list of IOrder entries that I use to track all of my entries, and I was manually iterating through it to see if the instruments matched:
Code:protected override void OnExecution(IExecution execution) { ... foreach (KeyValuePair<int, IOrder> pair in currentOrders.longEntries) { if(pair.Value.Name == execution.Order.Name) { (...do something....) } } }
' "Entry" + BarsArray[instrumentIndex].Instrument.FullName + "-" + CurrentBar '
I would like to maintain that, since it makes it really easy to track which instruments are typically successful for each market type.
I guess what I was really asking is whether there is a way to directly expose the BarsArray index using some property of the execution. Is that possible, or is iterating through the list the only way?
Comment
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by Gibranes, Today, 10:05 AM
|
5 responses
21 views
0 likes
|
Last Post Today, 01:55 PM | ||
Started by love2code2trade, Today, 01:45 PM
|
0 responses
3 views
0 likes
|
Last Post Today, 01:45 PM | ||
Started by 09try, 03-29-2024, 01:27 PM
|
9 responses
81 views
0 likes
|
Last Post
by ntcat
Today, 01:16 PM
|
||
Started by ninza33, Today, 06:28 AM
|
4 responses
17 views
0 likes
|
Last Post
by ninza33
Today, 12:38 PM
|
||
Started by ScottWalsh, Yesterday, 04:29 PM
|
4 responses
18 views
0 likes
|
Last Post Today, 12:00 PM |
Comment