I encountered something similar with end of day data from IB, though it was giving me 100 or 0 shares. Here's my relevant code with my hack of a fix.
RoundLotSize = 100; CommissionPerSharePerLeg = 0.01; SlippagePerSharePerLeg = 0.025; ShortPrice = Close - SlippagePerSharePerLeg - CommissionPerSharePerLeg; /* Close should be Mid (average of Bid and Ask), but IB doesn't supply that data end of day. */ PositionSize = ShortPrice * 100 + 0.01; /* Perhaps due to AB's rounding, the additional penny is required to generate a trade every day. */ Warm regards, David On Mon, May 31, 2010 at 2:35 PM, stevemajors <[email protected]> wrote: > > > I am having a problem getting a consistent number of shares to be > calculated using 1 minute data from IB and the formula: > > PositionSize = Close*100. > > I get some cases where there are 100 shares shown but other cases the > number of shares are purchased varies from 49 to 32 to 79. Any suggestions? > > Thanks > > >
