I am using GetAccountValue() to define the cash amount for each instrument.
The following code is working for most instruments, however, as you can see on the screenshot there are some instruments, which use the default position size of 100 contracts. Any ideas what is wrong with my code?
protected override void OnStartUp()
{
Dquantity = (GetAccountValue(AccountItem.BuyingPower)*0.4 / 30);
Print(Instrument.FullName+": Cash amount available for shares is"+Dquantity);
}
protected override void OnBarUpdate()
{
if (Bars.FirstBarOfSession && FirstTickOfBar)
{
Print ("The date is:" + String.Format("{0:d/M/yyyy HH:mm:ss}", Time[0]) + "and now is:" + DateTime.Now.ToString());
Dquantity = (GetAccountValue(AccountItem.BuyingPower)*0.4 / 30);
Print(Instrument.FullName+": Buying-Power is "+GetAccountValue(AccountItem.BuyingPower));
Print(Instrument.FullName+": Cash amount available for shares is "+Dquantity);
}
Best regards,
Pascal


Comment