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

Re: [amibroker] Re: PositionSize Variable - Help - Inexplicable Results



PureBytes Links

Trading Reference Links

Hello,

1. Correct.
To apply position size expressed in shares use:

NumberOfShares = .....
TradePrice = IIF( buy, BuyPrice, ShortPrice );
PositionValue = TradePrice * NumberOfShares ;

2. Almost correct.
If "allow shrininking" is OFF - once equity drops below value
requested by PositionSize - trades would be listed in the trade list
but ZERO shares would be traded - so in fact trade will not occur.

3. Correct (if points commissions used)

Best regards,
Tomasz Janeczko
amibroker.com
----- Original Message ----- 
From: "Mark Allen" <mpa@xxxx>
To: <amibroker@xxxxxxxxxxxxxxx>
Sent: Tuesday, October 22, 2002 3:02 AM
Subject: RE: [amibroker] Re: PositionSize Variable - Help - Inexplicable Results


> Hi Nick,
> 
> Excuse me for butting in here, for I am not anywhere near as
> knowledgable as those who have so far replied to your query, but am
> also interested in understanding the issues involved. It seems to me
> there may well be some basic misconceptions occurring regarding your
> use of PositionSize in AFL, which I describe below (inviting
> corrections to any errors of my own):
> 
> 1) In AB, PositionSize = dollar amount (eg, "Positionsize = 10000;")
> or a percentage of equity (eg, "Positionsize = -10;" defines
> Positionsize as 10% of Initial Equity), not number of shares. This
> alone may cause a huge variance in the results you see when comparing
> the use of to non-use of the Positionsize variable in your tests. The
> results returned from the use of PositionSize defined as a number of
> shares (so much smaller than it should be because the dollar value has
> been devided by the share's close value) cannot be compared to the
> Backtester's default use of total Initial Equity (as a dollar value).
> 
> 2) In Backtester Settings, the accompanying Allow PositionSize
> Shrinking switch may also affect your results, depending on whether
> your equity dips below the Positionsize declared in your AFL. If it is
> OFF, the tester will continue to apply trades to the value of
> Positionsize with non-existent equity.
> 
> 3) As returns shrink through the use of money management
> (Positionsize), the impact of commissions and brokerage can be much
> greater, turning reasonably profitable but small theoretical trades
> into real losses.
> 
> If all of the above were to affect your tests at the same time, I'm
> sure the result could be as devastating as those you describe.
> 
> I apologise if my observations are incorrect and I am but muddying the
> waters, but hopefully some clarity will arise soon.
> 
> Regards,
> 
> Mark
> 
> 
> 
> > -----Original Message-----
> > From: n94612 [mailto:nkm@x...]
> > Sent: Tuesday, 22 October 2002 8:02 AM
> > To: amibroker@xxxxxxxxxxxxxxx
> > Subject: [amibroker] Re: PositionSize Variable - Help - Inexplicable
> > Results
> >
> >
> > Hello Ken,
> >
> > Thanks for the quick reply.
> >
> > I did do many repeated runs with many varied position sizes and
> > repeated runs with the postionsize commented out.
> >
> > While I understand and agree with your statements, what I'm not
> > getting is :
> >
> > If AB uses your total equity on each trade ( if you don't use
> > PositionSize) then, if you DO use PositionSize and set the
> > number of
> > shares to TotalEquity/Close, then the results of the two
> > runs should
> > be identical, but in all my tests, they are not. I do not
> > understand
> > why this is so. I must conclude that I am either suffering a
> > misunderstanding, making an error, or there is a problem with
> > PositionSize implementation.
> >
> > Have you tested this yourself? Does it work OK for you?
> >
> > Again, thanks for your input and lightning response.
> >
> > Regards,
> >
> > Nick Molchanoff
> >
> >
> > --- In amibroker@xxxx, "Ken Close" <closeks@xxxx> wrote:
> > > This explanation is correct.
> > >
> > > If you do not have a positionsize statement in, and your
> > system "works" -
> > > has a positive expectancy, and you set the report to show every
> > trade, you
> > > soon see that you are investing more and more on each trade. You
> > might do
> > > this in real life, but I do not. When I put in the positionsize
> > amount, it
> > > is a realistic amount that I would place on each trade.
> > I make it
> > stay the
> > > same for every trade, but of course it can vary.
> > >
> > > Run the test with the positionsize line commented out, then again
> > with it
> > > in, and of course you see a big decrease in total profits
> > (percent
> > or
> > > absolute). Which one would you actually trade?
> > >
> > > Ken
> > >
> > > -----Original Message-----
> > > From: akaloustian [mailto:ara1@x...]
> > > Sent: Monday, October 21, 2002 4:50 PM
> > > To: amibroker@xxxx
> > > Subject: [amibroker] Re: PositionSize Variable - Help -
> > Inexplicable
> > > Results
> > >
> > >
> > > The position size limits your profita as it is decreased.
> > >
> > > The %profits are computed based on total starting equity.
> > >
> > > So if your starting equity is $100K and positionsize = $20K gives
> > you
> > > a profit of $10K, that becomes 10% return.
> > >
> > > If you remove position size, each trade uses all of the capital
> > > available, so the return will be significantly higher.
> > >
> > > Check your setting to see your starting amount available
> > >
> > > Ara
> > >
> > > --- In amibroker@xxxx, "n94612" <nkm@xxxx> wrote:
> > > > I've been studying position sizing / money management
> > for about a
> > > > month or two now, and have been following most of the recent
> > > postings
> > > > on Money Management with great interest. My understanding is
> > > > increasing, but I have been having some inexplicable results in
> > > some
> > > > backtests and explorations that I have been running as learning
> > > tools
> > > > regarding position sizing, and I sure could use some help or
> > input:
> > > >
> > > > Like some others of you out there, I noticed that whenever I add
> > > > position-sizing code to any of my experimental systems, the
> > percent
> > > > gain drops WAY down.
> > > >
> > > > For example, in one particular test using a Dip-Buying algorithm
> > > > translated from Wealth-Script, the results were +18.54 with no
> > > > position size statement in the code and only +0.07% with Tharp's
> > > > volatility based stops set at a generous 5% of total equity.
> > > > Lowering the % of TE to the recommended 1 or 2% resulted in
> > further
> > > > degradation of results, (1% : -0.02%loss and 2%: +0.00%
> > negligible
> > > > gain.) This did not surprise me as I had already
> > read that many
> > > of
> > > > you had the same or similar experiences with severely impacted
> > > gains
> > > > in your own backtests that also were resultant from adding
> > position
> > > > sizing.
> > > >
> > > > However, I then determined to try to get an idea at what
> > percentage
> > > > of total equity risked with Tharps volatility, WOULD the results
> > > come
> > > > near to those obtained with no position sizing. That's when I
> > > > discovered that it made almost no difference whether %TE risked
> > was
> > > > 0.1%, 0.2% or whatever, even at 10%, 25%, 33%, 50% and 100% of
> > > total
> > > > equity risked, the results were still enormously
> > degraded compared
> > > to
> > > > those without explicitly coded position-sizing. That just didn't
> > > > sound right to me.
> > > >
> > > > Growing suspicious, I then proceeded to test a wide range of
> > fixed-
> > > > dollar-amount sizings, and fixed-share-amount sizings, all with
> > > > similarly degraded overall results as the
> > Volatilty-based sizings.
> > > > I found it made no significant difference whatsoever
> > what position
> > > > sizing scheme or formula I employed -- What I found was...
> > > >
> > > > ---As soon as the PositionSize variable is added to the code,
> > the
> > > > percentage gain results decrease dramatically. All of
> > which leads
> > > me
> > > > to wonder...
> > > >
> > > > 1) What is the default for position size used in AmiBroker's
> > > backtest
> > > > calculations when the variable is NOT declared? Anybody know?
> > > >
> > > > --I don't think it's total equity from Settings because I tested
> > > for
> > > > that -- when I use the PositionSize variable using
> > "capital/close"
> > > > (total equity as position size) the results are still way down
> > > (over
> > > > 95% down) from teh non-declared sizing results, and if
> > that is so,
> > > > how can the non-declared sizings result in such better gains? It
> > > > doesn't make sense.
> > > >
> > > > 2) Why can't these non-position sizing results be approximated
> > > using
> > > > ANY position-sizing formula when the variable IS
> > declared? I have
> > > > been wracking my brain on this, to no avail.
> > > >
> > > > Anybody else tried anything like this? If so, did you
> > notice the
> > > > same thing. I mean, I can ceratinly see where capping
> > ones risk
> > to
> > > a
> > > > small percentage of total equity, and the resulting inevitable
> > > > decrease in position sizes, especially for very volatile issues,
> > > must
> > > > have SOME negative impact on profits and backtest results; Less
> > > Risk-
> > > > Less Profit; it's the price of insuring against
> > catastrophic loss,
> > > > and would be more pronounced the shorter the hold-time of the
> > > system,
> > > > but this effect should not occur with fixed-share or
> > fixed-dollar
> > > > sizings, at least not to the same degree. And, it seems to me,
> > > that
> > > > at SOME parameter range, the results using the "PositionSize"
> > > > variable should approach and eventually approximate the
> > default(no
> > > > explicitly declared position size variable) gain
> > percentages. But
> > > > apparently, judging from the results of my own testing anyway,
> > this
> > > > is not occuring, so how are the better results without position
> > > size
> > > > declaration even possible?
> > > >
> > > > I'm baffled. Please anybody, help, comment, question, share
> > > insights.
> > > >
> > > > If anyone out there gets interested enough to take the time and
> > > > trouble to test some of their systems - not necessarily with
> > Tharp-
> > > > style volatility based position sizing - but with a similar wide
> > > > variety of simpler, more "vanilla" share-based or dollar-amount-
> > > based
> > > > sizings, I'd sure love to hear what you find out.
> > > >
> > > > I'm hoping that this is some error or misunderstanding
> > on my part
> > > and
> > > > not a problem inherent in the the PositionSize variable
> > > > implementation, but on the off-chance I've
> > inadvertantly uncovered
> > > a
> > > > glitch of some sort, it'd be a good thing to get to the
> > bottom of
> > > it.
> > > >
> > > >
> > > > Respectfully,
> > > >
> > > > Nick Molchanoff
> > >
> > >
> > >
> > > Post AmiQuote-related messages ONLY to: amiquote@xxxx
> > > (Web page: http://groups.yahoo.com/group/amiquote/messages/)
> > >
> > > Check group FAQ at:
> > > http://groups.yahoo.com/group/amibroker/files/groupfaq.html
> > >
> > > Your use of Yahoo! Groups is subject to
> > http://docs.yahoo.com/info/terms/
> >
> >
> > ------------------------ Yahoo! Groups Sponsor
> > ---------------------~-->
> > Is your business paying to much?
> > Affordable insurance and benefits packages for Less.
> > http://us.click.yahoo.com/jCP0DB/E.mEAA/jd3IAA/GHeqlB/TM
> > ------------------------------------------------------------
> > ---------~->
> >
> > Post AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx
> > (Web page: http://groups.yahoo.com/group/amiquote/messages/)
> >
> > Check group FAQ at:
> > http://groups.yahoo.com/group/amibroker/files/groupfaq.html
> >
> > Your use of Yahoo! Groups is subject to
> > http://docs.yahoo.com/info/terms/
> >
> >
> 
> 
> 
> Post AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx 
> (Web page: http://groups.yahoo.com/group/amiquote/messages/)
> 
> Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html 
> 
> Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/ 
> 
> 
>