Hi All,
I am in the process of completing a simulator which records trades taken
discretionarily and then performs a "backtest" on these trades in order
to give you a performance result. Here is an example of the code with
one trade on SPY:
TO BE RUN ON 1 MINUTE DATABASE / SPY on a daterange containing
06/02/2008
SetTradeDelays(0,0,0,0);
SetOption("AccountMargin",1);
SetOption("InitialEquity",10000);
SetOption("PriceBoundChecking",0);
Buy=Short=Sell=Cover=0;
ShortPrice = 134.60;
PositionSize = 2961.20;
Short= IIf(Name() == "SPY" AND DateNum() == 1080206 AND TimeNum() ==
105000,1,0);
CoverPrice = 134.98;
Cover= IIf(Name() == "SPY" AND DateNum() == 1080206 AND TimeNum() ==
110000,1,0);
The problem is this: I would like to reflect a Quantity of 22 shares @
134.60 in this occasion. Since AB accepts PositionSize as a $ amount and
not Quantity I specify a position size of 22*134.60 = 2961.20
If I set the backtester settings to Round Lot Size = 1, I get 21 shares
instead of 22.
If I set the backtester settings to Round lot Size = 0 (allow
fractions), I get a size of 22, without fractions, as the price of
2961.20 is exactly divisble by 134.60.
Any ideas as to why this would happen? This "less 1 share" does not
occur all the time. I was wondering if there is anything else I should
be doing in order to ensure the exact number of shares is reflected.
regards,
eToke.