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

Re: [amibroker] A closer look at "Expectation" (afl)



PureBytes Links

Trading Reference Links

Thanks a lot for the code. I have archived your message for later use. Great contribution.

Check out the good thread on expectancy back on June 21 and 22 (post no.'s 20006, 20021, 20028, 20029, 20031, 20032, 20033, 20034, 20035, 20038, 20056, 20061, and 20066). I'd like to point out especially post 20056, not because it's mine, but because it provides another way to calculate expectancy that may even be simpler to code than your code. There is an explanation there for why, if you are using position sizing in AB, you cannot use the average win/average loss ratio that AB gives you. Maybe this and the other posts may answer some of the questions you posed. I'll try to answer your questions as best I can:

1. If, by compounded trading methods, you mean pyramiding, you'd have to doit trade by trade and accumulate everything. That's why normalizing to risk may make it easier. Mark provided a simple Excel spreadsheet displaying Tharp's method of calculating E (see post 20066). You just add up all your R-multiples to give you your present expectancy. 

2. Yes, results SHOULD be different for different lengths of trading history. After all, the longer you trade, the more data you will have along with more wins and losses upon which to calculate expectancy. The more data you have, the better off you are.

3. Yes, results will be affected by single large wins or losses. But, that's real life. I don't think you'll ever get a nice normal distribution of trading profits in any system. You will experience a large R-multiple profit or loss occasionally. I believe that's a truism.

4. Time in market and trade durations should have nothing to do with expectancy. You can calculate expectancy for short term trading systems as well as long term systems. There is no 'time' term in the equation. 

5. Volatility is not considered by the expectancy calculation, but it is inyour trading system. If you are using a volatility-based system, volatility will have a huge effect on your trading results, which eventually affectsexpectancy indirectly.

6. System rating based on expectancy and your equity curve is a good idea. The higher expectancy, the better the system.

7. It shouldn't matter what the Pay-off ratio uses in its calculation. If your average win is $1000/trade and your average loss if $500/trade, your payoff ratio is still 2, so your average win is 2 while your average loss is 1.  

8. If the stock's price changes from 100 to 5 (presumably, you mean via themarket, not via splits), you should be going short during that time. So, your equity curve should still be increasing as the stock price declines. Expectancy is determined by winning and losing trades, not by price. 

Hope this helps clear up some points. Good thread.

Al Venosa
----- Original Message ----- 
From: Herman van den Bergen 
To: Amibroker@xxxx Com 
Sent: Saturday, October 19, 2002 2:41 PM
Subject: [amibroker] A closer look at "Expectation" (afl)


Hello,

Thanks to William for posting the math formula, attached an afl version. I am not sure if this formula falls under MM or system development however Expectation can be quite easy incorporated into a system as a simple indicator or screen. Might be worthwhile trying.

See chart below. Some first thoughts and questions:

1) the results will be different for fixed and compounded trading methods, for which is this formula?
2) the results will be different for different length of data history
3) the results will be dependent on size of profits, simple averages can be swayed by single large profits.
4) time in market should be a factor, so should L&S trade durations.
5) Volatility is not considered.
6) imho, system ratings should be based on a moving Equity window which contains a significant number of trades.
7) shouldn't the Pay-Off ratio use normalized values, percent trade profit?
8) The stock's price can change from $100 to $5, this formula doesn't account for that.

Perhaps there is a more complete formula out there that we can code? If you use this formula to trade by you might want to play with the attached code. You could test it on different Range settings and note how the results change, try it on some of your trading systems and different stocks.

thanks for your participation, I invite further comments.
Best regards,
Herman.



------=_NextPart_001_0085_01C27754.4009FDB0
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.2719.2200" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV>Herman,</DIV>
<DIV>&nbsp;</DIV>
<DIV>Thanks a lot for the code. I have archived your message for later use. 
Great contribution.</DIV>
<DIV>&nbsp;</DIV>
<DIV>Check out the good thread on expectancy back on June 21 and 22 (post no.'s 
20006, 20021, 20028, 20029, 20031, 20032, 20033, 20034, 20035, 20038, 
20056,&nbsp;20061, and 20066). I'd like to point out especially post 20056,not 
because it's mine, but because it provides another way to calculate expectancy 
that may even be simpler to code than your code. There is an explanation there 
for why, if you are using position sizing in AB, you cannot use the average 
win/average loss ratio that AB gives you. Maybe this and the other posts may 
answer some of the questions you posed. I'll try to answer your questions as 
best I can:</DIV>
<DIV>&nbsp;</DIV>
<DIV>1. If, by compounded trading methods, you mean pyramiding, you'd have to do 
it trade by trade and accumulate everything. That's why normalizing to riskmay 
make it easier. Mark provided a simple Excel spreadsheet displaying Tharp's 
method of calculating E (see post 20066). You just add up all your R-multiples 
to give you your present expectancy. </DIV>
<DIV>&nbsp;</DIV>
<DIV>2. Yes, results SHOULD be different for different lengths of trading 
history. After all, the longer you trade, the more data you will have alongwith 
more wins and losses upon which to calculate expectancy. The more data you have, 
the better off you are.</DIV>
<DIV>&nbsp;</DIV>
<DIV>3. Yes, results will be affected by single large wins or losses. But, 
that's real life. I don't think you'll ever get a nice normal distribution of 
trading profits in any system. You will experience a large R-multiple profit or 
loss occasionally. I believe that's a truism.</DIV>
<DIV>&nbsp;</DIV>
<DIV>4. Time in market and trade durations should have nothing to do with 
expectancy. You can calculate expectancy for short term trading systems as well 
as long term systems. There is no 'time' term in the equation. </DIV>
<DIV>&nbsp;</DIV>
<DIV>5. Volatility is not considered by the expectancy calculation, but it is in 
your trading system. If you are using a volatility-based system, volatilitywill 
have a huge effect on your trading results, which eventually affects expectancy 
indirectly.</DIV>
<DIV>&nbsp;</DIV>
<DIV>6. System rating based on expectancy and your equity curve is a good idea. 
The higher expectancy, the better the system.</DIV>
<DIV>&nbsp;</DIV>
<DIV>7. It shouldn't matter what the&nbsp;Pay-off ratio uses in its calculation. 
If your average win is $1000/trade and your average loss if $500/trade, your 
payoff ratio is still 2, so your average win is 2 while&nbsp;your average loss 
is 1. &nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV>8. If the stock's price changes from 100 to 5 (presumably, you mean via the 
market, not via splits), you should be going short during that time. So, your 
equity curve should still be increasing as the stock price declines. Expectancy 
is determined by winning and losing trades, not by price. </DIV>
<DIV>&nbsp;</DIV>
<DIV>Hope this helps clear up some points. Good thread.</DIV>
<DIV>&nbsp;</DIV>
<DIV>Al Venosa</DIV>
<BLOCKQUOTE dir=ltr 
style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
<DIV style="FONT: 10pt arial">----- Original Message ----- </DIV>
<DIV 
style="BACKGROUND: #e4e4e4; FONT: 10pt arial; font-color: black"><B>From:</B> 
<A title=psytek@xxxx href="mailto:psytek@xxxx";>Herman vanden 
Bergen</A> </DIV>
<DIV style="FONT: 10pt arial"><B>To:</B> <A title=amibroker@xxxxxxxxxx 
href="mailto:Amibroker@x... Com">Amibroker@xxxx Com</A></DIV>
<DIV style="FONT: 10pt arial"><B>Sent:</B> Saturday, October 19, 2002 2:41 
PM</DIV>
<DIV style="FONT: 10pt arial"><B>Subject:</B> [amibroker] A closer lookat 
"Expectation" (afl)</DIV>
<DIV><BR></DIV>
<DIV><FONT face=Arial size=2><SPAN 
class=660435416-19102002>Hello,</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN 
class=660435416-19102002></SPAN></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2><SPAN class=660435416-19102002>Thanks to William 
for posting the math formula, attached an afl version.&nbsp;I am not sureif 
this formula falls under MM or system development however&nbsp;Expectation 
can&nbsp;be quite easy incorporated into a system as a simple indicator or 
screen. Might be worthwhile trying.</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN 
class=660435416-19102002></SPAN></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2><SPAN class=660435416-19102002>See chart below. 
Some first thoughts and questions:</SPAN></FONT><FONT face=Arial size=2><SPAN 
class=660435416-19102002></SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN 
class=660435416-19102002></SPAN></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2><SPAN class=660435416-19102002>1)&nbsp;the 
results will be different for fixed and compounded trading methods, for which 
is this formula?</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN 
class=660435416-19102002>2)&nbsp;</SPAN></FONT><FONT face=Arial size=2><SPAN 
class=660435416-19102002>the results will be&nbsp;different for different 
length of data history</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN class=660435416-19102002>3) the results 
will be&nbsp;dependent on size of profits, simple averages can be swayed by 
single large profits.</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN class=660435416-19102002>4) timein market 
should be a factor, so should L&amp;S trade durations.</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN class=660435416-19102002>5) Volatility is 
not considered.</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN class=660435416-19102002>6) imho, system 
ratings should be based on a moving Equity window which contains a significant 
number of trades.</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN class=660435416-19102002>7) shouldn't the 
Pay-Off ratio use normalized values, percent trade profit?</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN class=660435416-19102002>8) The stock's 
price can change from $100 to $5, this formula doesn't account for 
that.</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN 
class=660435416-19102002></SPAN></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2><SPAN class=660435416-19102002>Perhapsthere is a 
more complete formula out there that we can code? </SPAN></FONT><FONT 
face=Arial size=2><SPAN class=660435416-19102002>If you use this formula to 
trade by you might want to play with the attached code. You could test iton 
different Range settings and note how the results change, try it on some of 
your trading systems and different stocks.</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN 
class=660435416-19102002></SPAN></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2><SPAN class=660435416-19102002>thanks for your 
participation, I invite further comments.</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN class=660435416-19102002>Best 
regards,</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN 
class=660435416-19102002>Herman.</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN 
class=660435416-19102002></SPAN></FONT>&nbsp;</DIV>
<DIV><IMG 
src="cid:008301c27775$c70fb6d0$6401a8c0@xxxx";></DIV></BLOCKQUOTE></BODY></HTML>

------=_NextPart_001_0085_01C27754.4009FDB0--

Attachment: Description: ""