Developing a strategy, I want to get values from the sim account.
I have been looking for this information in help guide and support forum, but still I can not get values....
I tried to code that, getting information from support forum and help guide.
In my code I write:
...
private Account myAccount;
private double winlosstoday;
...
if (State == State.SetDefaults)
{...
Calculate = Calculate.OnPriceChange;
....
....
lock (Account.All)
myAccount = Account.All.FirstOrDefault(a => a.Name == "Sim101");
}
protected override void OnBarUpdate()
{
...
....
winlosstoday = myAccount.Get(AccountItem.RealizedProfitLoss, Currency.UsDollar);
if( winlosstoday < -300)
Print(" RealizedPofitLoss:"+ myAccount.Get(AccountItem.RealizedProfitLoss, Currency.UsDollar));
.......
}
But when I Print the value of RealizedProfitLoss, It always is zero!!!!
How can I get correctly AccountItem values from the "sim101" account???
Comment