PureBytes Links
Trading Reference Links
|
Remember that this is calculated on the backtest open equity so you need to
check the equity curve from the backtest chart.
if current equity is $25,000
Equity risk is 2% ($500)
Buyprice is $10
Trade risk $0.50
Trade size becomes 2*10/0.5 = 40% of equity, ie 1000 shares
Working out as num shares
Risk = 25000*0.02 = 500
num shares = 500 / 0.50 = 1000 shares
.
--
Cheers
Graham
AB-Write >< Professional AFL Writing Service
Yes, I write AFL code to your requirements
http://www.aflwriting.com
On 03/11/06, wadebullock <wadebullock@xxxxxxxxx> wrote:
>
> Hi Graham,
>
> Thanks for the reply. I'm trying to positionsize based on current
> backtest equity. Prior to starting this thread, I had tried the
> formula you sent, positionsize = -2 * buyprice/IPS;.
>
> Starting with the first symbol of a portfolio backtest, this seemed
> to do the job. But found that for some reason the number of shares
> were always more than what they should be, if compared to my hand
> calculation.
>
> Since your reply, that formula still gives me more shares than what I
> expect, however, if I backtest just the one symbol (the first of the
> portfolio backtest) the number of shares are correct! Not sure what
> to make of it or how to fix it.
>
> I hope all of that makes sense. Any suggestions?
>
> Thanks!
>
> Wade
>
> --- In amibroker@xxxxxxxxxxxxxxx, Graham <kavemanperth@xxx> wrote:
> >
> > Are you trying to size the trades based on current backtest Equity,
> instead
> > of starting equity, with 2% risk and the stoploss?
> >
> > positionsize = -2 * buyprice/IPS;
> >
> > or if based on 7000 starting capital only
> >
> > positionsize = 0.02 * Capital * buyprice/IPS;
> >
> > --
> > Cheers
> > Graham
> > AB-Write >< Professional AFL Writing Service
> > Yes, I write AFL code to your requirements
> > http://www.aflwriting.com
> >
> >
> > On 02/11/06, wadebullock <wadebullock@xxx> wrote:
> > >
> > > Hi there!
> > > I'm trying to develop a daytrading system(daily bars only) that
> buys
> > > on the open and sells on the close and also uses a modified
> variation
> > > of Tharps ATR position sizing technique..
> > >
> > > So far I've been unable to figure out what I need to do
> > > in order for the backtester to update my "Capital" after a trade.
> As
> > > is, each trade, as the code would indicate only, uses only the
> $7000.
> > >
> > > I've spent a lot of time trying to figure out what I need to do
> and
> > > have tried a lot of differnt things but can't seem to get it (not
> > > much of a coder here). I'm guessing I need to use a loop of some
> > > sort??? Any push in the right direction would be greatly
> > > appreaciated.
> > >
> > > Wade
> > >
> > >
> > > Filter = ...
> > >
> > > Cond1 = Open < (Ref (Close, -2) - X);
> > > BuyStop = Open;
> > > Buy = Cond1 AND Ref( Filter, -1) AND High > BuyStop;
> > > BuyPrice = Max(BuyStop, Open);
> > >
> > > SellStop = Open - (ATR (10) * 0.3);
> > > Sell = Low < SellStop OR Close;
> > > SellPrice = Max( SellStop, Close );
> > >
> > > SetOption("MaxOpenPositions", 1 );
> > > SetOption("InitialEquity", 7000 );
> > > SetOption("AllowPositionShrinking", False );
> > >
> > > IPS = ATR (10) * 0.3; //initial protective stop
> > > Capital = 7000;
> > > BuyingPower = Capital * 2;
> > > Risk = 0.02 * Capital;
> > > PositionSize = Min ((Risk/IPS)*BuyPrice, (BuyingPower/BuyStop)
> > > *BuyPrice);
> > >
> > >
> > >
> > >
> > > 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
> > >
> > > 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 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
>
>
>
>
>
Content-Description: "AVG certification"
No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.1.409 / Virus Database: 268.13.27/517 - Release Date: 11/3/2006
|