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 judysamnt7, 03-13-2023, 09:11 AM
|
4 responses
53 views
0 likes
|
Last Post
by DynamicTest
Today, 08:25 PM
|
||
Started by ScottWalsh, Today, 06:52 PM
|
4 responses
33 views
0 likes
|
Last Post
by ScottWalsh
Today, 07:40 PM
|
||
Started by olisav57, Today, 07:39 PM
|
0 responses
5 views
0 likes
|
Last Post
by olisav57
Today, 07:39 PM
|
||
Started by trilliantrader, Today, 03:01 PM
|
2 responses
19 views
0 likes
|
Last Post
by helpwanted
Today, 07:25 PM
|
||
Started by cre8able, Today, 07:24 PM
|
0 responses
6 views
0 likes
|
Last Post
by cre8able
Today, 07:24 PM
|
Comment