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

RE: [amibroker] Limit number of shares per symbol?



PureBytes Links

Trading Reference Links

You can do it two ways
1. Custom Backtester - which does keep the no of shares for you. just use backtester object to find the open position until it matches the symbol and then you can read the current shares in trade
2. Another way is to keep the share size yourself, using the following
buysize = shares * (buy == 1 || buy == sigscalein) // shares is an array of buy size
sellsize = shares *(sell || buy == sigscaleout) // you have to make sure that shares has  correct value when sell = 1
holding = cum(buysize) - cum(sellsize);
if you dont know what shares to sell when there is a sell signal then
sellsize = shares * (buy == sigscalout)
and  just add the following after holding is defined.
sellsize = iif(sell, holding, sellsize); // so all in holding are sold , this is defining sellsize the second time;
holding = cusm(buysize) - cum(sellsize); // doing it once more.


From: amibroker@xxxxxxxxxxxxxxx [mailto:amibroker@xxxxxxxxxxxxxxx] On Behalf Of cstrader
Sent: Wednesday, 10 September 2008 11:44 AM
To: amibroker@xxxxxxxxxxxxxxx
Subject: Re: [amibroker] Limit number of shares per symbol?

Well, OK, I see that.  But what if I try to scale in using sigscalein?  I guess I need to know how to determine the current number of owned shares in the symbol in order to determine how many more I can buy.  Is there a variable that specifies the current number of owned shares?
 
 
 
 
----- Original Message -----
From: Paul Ho
Sent: Tuesday, September 09, 2008 9:34 PM
Subject: RE: [amibroker] Limit number of shares per symbol?

if shares is what you normally work out to be what you buy
shares = .....
setpositionsize(min(shares, 500), spsShares);


From: amibroker@xxxxxxxxxps.com [mailto:amibroker@yahoogroups.com] On Behalf Of cstrader
Sent: Wednesday, 10 September 2008 10:22 AM
To: amibroker@xxxxxxxxxps.com
Subject: [amibroker] Limit number of shares per symbol?

Dumb question I'm sure, but what's the best way to limit the maximum number
of shares per symbol in the backtester?

(for instance, only allow a maximum of 500 shares even if there's cash for
more)

Thanks

__._,_.___

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




Your email settings: Individual Email|Traditional
Change settings via the Web (Yahoo! ID required)
Change settings via email: Switch delivery to Daily Digest | Switch to Fully Featured
Visit Your Group | Yahoo! Groups Terms of Use | Unsubscribe

__,_._,___