[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[amibroker] Position Size Problem when backtesting with Round Lot Size = 1



PureBytes Links

Trading Reference Links

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.




------------------------------------

**** IMPORTANT PLEASE READ ****
This group is for the discussion between users only.
This is *NOT* technical support channel.

TO GET TECHNICAL SUPPORT send an e-mail directly to 
SUPPORT {at} amibroker.com

TO SUBMIT SUGGESTIONS please use FEEDBACK CENTER at
http://www.amibroker.com/feedback/
(submissions sent via other channels won't be considered)

For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/

Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/amibroker/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/amibroker/join
    (Yahoo! ID required)

<*> To change settings via email:
    mailto:amibroker-digest@xxxxxxxxxxxxxxx 
    mailto:amibroker-fullfeatured@xxxxxxxxxxxxxxx

<*> To unsubscribe from this group, send an email to:
    amibroker-unsubscribe@xxxxxxxxxxxxxxx

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/