I've noticed some odd behavior out of the sim accounts. In this case, I'm trying to run a number of strategies which use variable position sizing, based on the amount of buying power currently available in an account.
Here, I've set the accounts up as you'd see in the attachment. Then, I use code that determines whether or not this is a "live" trade (i.e. not a backtest), and will query the buying power available to the account in calculations to determine position size:
positionSize = liveOnly ? (int)Convert.ToDouble((GetAccountValue(AccountItem.BuyingPower) * KellySizingCriterion())/(Instrument.MasterInstrument.Margin)): (int)Convert.ToDouble((localAccountSize * KellySizingCriterion())/(Instrument.MasterInstrument.Margin));
You can see here that even though this is a $250k account, somehow the logic managed to accumulate $556,875k worth of initial margin (I should note that every instrument has the correct margin requirements all set independently via Instrument Manager). Instead of saying "Zero" buying power, apparently I have 3 times the buying power that my account is even worth, even though I'm holding on to futures contracts whose required margin is twice the size of my portfolio.
Is this a problem with sim accounts? Is there a setting I'm using incorrectly here?
Comment