I should explain that the number of shares (aka the lot size) will be a
multiple of this rounding size.  So if you only set RoundLotSize to 100, you
will get 100 as the lowest unit, then all multiples above that: 200, 300,
400, 500, 600, 700, etc.  Using my code for rounding, you will still get
multiples of this rounding size, but when it reaches the next larger unit,
the rounding size goes up.  So the sequence would be 5, 10, 20, 30, 40, 50,
100, 200, 300, 400, 500, 1000, 2000, etc.  Hmm, I bet there is a simpler way
to code this as a single computation.

dan

On Friday 28 April 2006 07:38 pm, liberte721 wrote:
> In order to round the number of shares in your trade to the rounder
> numbers that people typically use (e.g. 100, 500, 1000), you have to
> set the RoundLotSize variable to a different number based on the
> value of the stock and your position size.  I wrote the following
> little bit of script that I include at the end of other scripts.
>
> It assumes PositionSize is always a positive number (rather than the
> negative percentage variation).
>
> lotSize = PositionSize / BuyPrice;
> RoundLotSize =
>       Iif( lotSize / 1000 > 1, 1000,
>       Iif( lotSize / 500 > 1, 500,
>       Iif( lotSize / 100 > 1, 100,
>       Iif( lotSize / 50 > 1, 50,
>       Iif( lotSize / 10 > 1, 10,
>         5
>       )))));
>
> dan
> [EMAIL PROTECTED]
>
>
>
>
>
>
>
> Please note that this group is for discussion between users only.
>
> To get support from AmiBroker please send an e-mail directly to
> SUPPORT {at} amibroker.com
>
> For other support material please check also:
> http://www.amibroker.com/support.html
>
>
> Yahoo! Groups Links
>
>
>


Please note that this group is for discussion between users only.

To get support from AmiBroker please send an e-mail directly to
SUPPORT {at} amibroker.com

For other support material please check also:
http://www.amibroker.com/support.html





SPONSORED LINKS
Investment management software Real estate investment software Investment property software
Software support Real estate investment analysis software Investment software


YAHOO! GROUPS LINKS




Reply via email to