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

Re: [amibroker] Rounder Lot Size



PureBytes Links

Trading Reference Links

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
> liberte@xxxxxxxxxxxxx
>
>
>
>
>
>
>
> 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
>
>
>


------------------------ Yahoo! Groups Sponsor --------------------~--> 
GFT Forex Trading Accounts As low as $250 with up to 400:1 Leverage. Free Demo.
http://us.click.yahoo.com/lpv1TA/jlQNAA/U1CZAA/GHeqlB/TM
--------------------------------------------------------------------~-> 

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

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

<*> 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/