This code is 100% unsupported, but it'll get you going in the right direction:Quote from frostengine:
If I could get a "full view" of account holdings within NinjaTrader, I would be able to at least have rapid response to the issue occurring. Ninjatrader shows my positions correctly outside of the strategy, so obviously NT has this info. But does not seem its available to developers.
Another approach would be to write something to connect to MB Trading directly for this info.
I have considered switching platforms,however switching to Multicharts would be very difficult,there is a lot of code to port over. Would take longer than the free trial allows,which leaves me very little time to get it working and tested to ensure I don't have issues with that platform as well.
I could also fix by changing from MB Trading,but at the size I am trading, no other broker would allow me to test on small size such as this as efficiently.
protected override void OnBarUpdate()
{
if (CurrentBar == 0)
{
foreach (Account acct in Cbi.Globals.Accounts)
{
if (acct.Positions != null)
{
PositionCollection positions = acct.Positions;
foreach (Position pos in positions)
{
Print(pos.Account.Name + " " + pos.Instrument + " " + pos.MarketPosition + " " + pos.Quantity + " " + pos.AvgPrice);
}
}
}
}
}
It has been a while, but when I was considering getting MultiCharts I was able to get my trial period extended to 60 days (30 + an additional 30). You might give them a call or an email and see what they have to say.Quote from frostengine:...I have considered switching platforms,however switching to Multicharts would be very difficult,there is a lot of code to port over. Would take longer than the free trial allows,which leaves me very little time to get it working and tested to ensure I don't have issues with that platform as well..
Quote from auspiv:
This code is 100% unsupported, but it'll get you going in the right direction:
Code:protected override void OnBarUpdate() { if (CurrentBar == 0) { foreach (Account acct in Cbi.Globals.Accounts) { if (acct.Positions != null) { PositionCollection positions = acct.Positions; foreach (Position pos in positions) { Print(pos.Account.Name + " " + pos.Instrument + " " + pos.MarketPosition + " " + pos.Quantity + " " + pos.AvgPrice); } } } } }