I've been trying to develop an automatic position size within my code and the way I intend to program this is by taking the available amount in cash of my account and dividing by the contract price to see how many contracts I am able to enter with.
For instance, let's say I have $5000 in my account and each contract costs $700, hence the number of contracts would be 5000/700 = 7 contracts.
I know how to get the cash value of the account by using Account.Get(AccountItem.CashValue, Currency.UsDollar), but then how can I get the price of each contract for a particular instrument and use this value as a divisor for the cash?
Thanks a lot,
Eddie
Comment