I'm using the latest version of NT8 (8.0.18.0) 64-bit. I just installed it on a fresh system last week.
I've lost several hours trying to relearn how to access initial margin for the current instrument in a strategy ninjascript.
I write most of my code in Visual Studio. I'm using VS2019.
In the past I've used the following to get an InstrumentRisk object:
var mi = Instrument.MasterInstrument; return Account.Risk.ByMasterInstrument[mi];
So I looked around everywhere trying to figure out the right way to do this.
Turns out it just wasn't showing up in intellisense in Visual Studio so I spent another hour or two trying to fix Visual Studio.
Then I learned about the EditorBrowsable attribute:
[EditorBrowsable(EditorBrowsable.Never)]
Then I discovered that the Account.Risk property in NT is now decorated with the above attribute. (UPDATE: It was in previous versions, too, actually.)
OK. So turns out the problem is not Visual Studio either.
But this leaves me with some questions:
1) Why not Advanced instead of Never. If Advanced, then I could still uncheck "Hide Advanced Members" in Visual Studio 2019 settings, which is checked by default. But now, with Never, there is no way (that I can find) to make the properties visible in Intellisense.
2) Why did NInjaTrader do this? Is there another preferred way to get access to the risk information for the instrument? Are you planning to remove these properties in the future?
Thanks for your help.
Comment