Welcome to NexusFi: the best trading community on the planet, with over 150,000 members Sign Up Now for Free
Genuine reviews from real traders, not fake reviews from stealth vendors
Quality education from leading professional traders
We are a friendly, helpful, and positive community
We do not tolerate rude behavior, trolling, or vendors advertising in posts
We are here to help, just let us know what you need
You'll need to register in order to view the content of the threads and start contributing to our community. It's free for basic access, or support us by becoming an Elite Member -- see if you qualify for a discount below.
-- Big Mike, Site Administrator
(If you already have an account, login at the top of the page)
Once you have the collection, how do you extract information like the instrument traded, the position either long or short and the number of contracts? I have very little experience with collections.
Once you have the collection, how do you extract information like the instrument traded, the position either long or short and the number of contracts? I have very little experience with collections.
Print("Instrument = " + Instrument.MasterInstrument.Name);
Print("Am I long, short or flat? " + Position.MarketPosition.ToString());
Print("How many contracts am I holding? " + Position.Quantity);
Can you also show me where to find on the MSDN site references to the Collections used by NinjaTrader? There are several and I'm really not sure which one to focus on.
Also, in the attached figure, can you tell me how to find only the most recent entry for a specific instrument?
Can you also show me where to find on the MSDN site references to the Collections used by NinjaTrader? There are several and I'm really not sure which one to focus on.
Also, in the attached figure, can you tell me how to find only the most recent entry for a specific instrument?
I really appreciate your help.
regards,
taddypole....
The collections used by Ninjatrader are created by Ninjatrader, so you won't find them on the MSDN site. I don't know any central place that lists all of Ninjatraders collections. You just need to spend a lot of time in the "Ninjascript" section of the NT7 help guide.
As for finding the most recent execution, sorry, but you will probably have to use a foreach statement. The other possibility is a LINQ query but that's more complicated to explain how to do. I've never had a need to do what you are trying to do so I can't tell you off the top of my head but I could probably figure it out.
Yeah, and you could keep track of the last trade as the event is fired with a class-level variable so you wouldn't have to search or foreach through any collections to find the last execution.