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

[amibroker] Re: Round lot size based on position size



PureBytes Links

Trading Reference Links

This function or something similar may do what you want without setting
the RoundLotSize.

-Steve

function ComputeNumShares(price, percentOfEquity, totalEquity)
{
   dollars = totalEquity * (percentOfEquity / 100);
   shares = dollars / price;
   if (shares < 100)
     shares = Round(shares);
   else
   {
     shares /= 100;
     shares = Round(shares);
     shares *= 100;
   }
   return shares;
}


--- In amibroker@xxxxxxxxxxxxxxx, Flávio Veloso <flavso@xxx> wrote:
>
> Hi all.
>
> Is it possible to use different round lot sizes (e.g. by setting
> RoundLotSize variable) depending on the number of shares that are
going
> to be bought/short?
>
> Basically all I want is RoundLotSize = 100 for any position size that
> results in more than 100 shares to be bought/short, and RoundLotSize =
1
> for the rest.
>
> For example:
>
> Number of shares (based on PositionSize): 75
> Use RoundLotSize = 1
> Shares to buy = 75
>
> Number of shares (based on PositionSize): 125
> Use RoundLotSize = 100
> Shares to buy = 100
>
> Number of shares (based on PositionSize): 360
> Use RoundLotSize = 100
> Shares to buy = 300
>
> Anyone doing this? If so, how?
>
> Thanks in advance.
>
> --
> Flávio
>



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

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

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

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

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/

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