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

RE: [amibroker] Equity conditions applied to trading systems



PureBytes Links

Trading Reference Links


<FONT face=Verdana color=#800000 
size=2>Another interesting way to take decision on the equity curve is to 
compare it with the equity produced by a "perfect system".
<FONT face=Verdana color=#800000 
size=2>Let's write a perfect system that trades all the tops and bottoms and 
compute the composite equity of this system:
<FONT 
size=2> 
<FONT 
size=2>Buy = <FONT 
color=#3cb371>TroughBars(<FONT 
color=#ff0000>L,<FONT 
color=#282828>2)==<FONT 
color=#282828>0;
<FONT color=#0000ff 
size=2> 
<FONT 
size=2>Short = <FONT 
color=#3cb371>PeakBars(<FONT 
color=#ff0000>H,<FONT 
color=#282828>2)==<FONT 
color=#282828>0;
<FONT color=#0000ff 
size=2> 
<FONT 
size=2>Sell = <FONT 
color=#ff0000>Short; <FONT 
color=#ff0000>Cover = <FONT 
color=#ff0000>Buy;
<FONT color=#0000ff 
size=2> 
<FONT 
size=2>AddToComposite<FONT 
color=#0000ff>(Equity<FONT 
color=#0000ff>(),"<SPAN 
class=173335811-30072002>Perfect equity"<FONT 
color=#0000ff>,"X"<FONT 
color=#0000ff>,3<FONT 
color=#0000ff>);

<FONT face=Verdana 
color=#800000 size=2>Then compute the composite equity of your 
system.
<FONT face=Verdana 
color=#800000 size=2>You can build an indicator that measures the correlation 
between your system and the perfect system:<FONT 
color=#0000ff>
MySystem =<FONT 
color=#3cb371>Foreign(<FONT 
color=#ff00ff>"My 
system equity",<FONT 
color=#ff00ff>"C");
Perfect = 
Foreign("Perfect equity","C");
Corr = Correlation(<SPAN 
class=173335811-30072002>MySystem,<SPAN 
class=173335811-30072002>Perfect,100);
GraphXSpace = 
5;<FONT 
color=#ff0000>
Graph0= Corr; 
Graph0Style = <FONT 
color=#282828>1+<FONT 
color=#282828>4; <FONT 
color=#ff0000>Graph0Color = <FONT 
color=#282828>3;<FONT 
color=#ff0000>
Graph1= 
0.5; <FONT 
color=#ff0000>Graph1Style = <FONT 
color=#282828>1; <FONT 
color=#ff0000>Graph1Color = <FONT 
color=#282828>2;<FONT 
color=#ff0000>
Graph2= 
-0.5; <FONT 
color=#ff0000>Graph2Style = <FONT 
color=#282828>1; <FONT 
color=#ff0000>Graph2Color = <FONT 
color=#282828>2;<FONT 
color=#ff0000>
Title = 
"Correlation between equity <SPAN 
class=173335811-30072002>my system and <SPAN 
class=173335811-30072002>perfect system"<FONT 
color=#0000ff>;
<SPAN 
class=173335811-30072002>Correlation 
more than 0.5 means that the system is following the performance of the perfect 
system.
<FONT face=Verdana 
color=#800000 size=2>Waz

<FONT face=Tahoma 
size=2>-----Original Message-----<FONT 
face=Verdana color=#800000> 
<FONT face=Tahoma 
size=2> From: Herman van 
den Bergen [mailto:psytek@xxxx]Sent: mardi 30 juillet 2002 
13:24To: amibroker@xxxxxxxxxxxxxxxSubject: RE: 
[amibroker] Equity conditions applied to trading systems
<FONT face=Arial color=#0000ff 
size=2>Thanks Dimitris, for this interesting post. You end your post with: 
"The codeseem to 
operate, although I do not feel so safe adding new trading rules after the 
Equity line. 
Any opinions/ideas/improvements/comments 
?"
<SPAN 
class=850233510-30072002><FONT 
color=#0000ff><SPAN 
class=850233510-30072002> 
<SPAN 
class=850233510-30072002>Why do you think this way? What is so special about 
the Equity() formula? It is just an other way of juggling the numbers. But we 
have to be careful with delays; we only know the equity at the end of our 
trade ...so there is a two day delay: one day for our primary systemto 
simulate our regular trade and one day to respond to our secondary system. 
This would be for a reversal system.
<SPAN 
class=850233510-30072002> 
<SPAN 
class=850233510-30072002>There is no difference between processing the price 
arrays with an Equity() or any other indicator like RSI() , or who knows what. 
A trading system can be used like a "filter". I think we discussed this before 
here or on the DLL list where i posted a prototype hbEquity() DLL some 
time ago that has a feedback argument (I can email you a copy if you like). 

<SPAN 
class=850233510-30072002> 
<SPAN 
class=850233510-30072002>This is not an uncommon technique. A search onthe 
net for "Trading the Equity Curve" will show that this was done many years 
ago. Here are some link that could be followed up 
on:
<SPAN 
class=850233510-30072002>  <A 
href="">http://store.traders.com/-v10-c10-trading-pdf.html 
<SPAN 
class=850233510-30072002>  <A 
href="">http://www.sirtrade.com/equity.htm<FONT 
color=#000000> 
<SPAN 
class=850233510-30072002>  <A 
href="">http://www.libertyresearch.com/book1.htm<FONT 
color=#000000> 
<SPAN 
class=850233510-30072002>  <A 
href="">http://www.activetradermag.com/article_index_strategy.htm#Sept2000<FONT 
color=#000000> <FONT 
color=#0000ff>or
<SPAN 
class=850233510-30072002>     <A 
href="">http://www.activetradermag.com/tocs/toc0900.htm
<SPAN 
class=850233510-30072002>  <A 
href="">http://www.purebytes.com/archives/omega/1998/msg01851.html
<SPAN 
class=850233510-30072002> 
<SPAN 
class=850233510-30072002>And you say:  
"Shall 
we ALWAYS improve a trading system performance with this method ?<SPAN 
class=850233510-30072002>" 

<SPAN 
class=850233510-30072002><SPAN 
class=850233510-30072002> 
<SPAN 
class=850233510-30072002><SPAN 
class=850233510-30072002>Absolutely: YES. The trouble comes, just like with a 
trend following system when your equity moves horizontal; lots of whipsaws. So 
the design problems are exactly the same as with any other trading system. In 
fact you should be able to redefine the OHLC arrays with the Equity 
and develop a trading system for it, the usual 
way.
<SPAN 
class=850233510-30072002><SPAN 
class=850233510-30072002> 
<SPAN 
class=850233510-30072002><SPAN 
class=850233510-30072002>Take 
care,
<SPAN 
class=850233510-30072002><SPAN 
class=850233510-30072002>Herman.
<SPAN 
class=850233510-30072002><SPAN 
class=850233510-30072002> 

<FONT face=Tahoma 
size=2>-----Original Message-----From: Dimitris Tsokakis 
[mailto:TSOKAKIS@xxxx]Sent: Tuesday, July 30, 2002 2:39 
AMTo: amibroker@xxxxxxxxxxxxxxxSubject: [amibroker] 
Equity conditions applied to trading systems
Here is an attempt to use Equity conditions and redefine 
trading rules.
The system applies the original trading rules only when 
the Equity line is above its 40-day EMA 
and stops [with the appropriate order] any trade when 
the Equity line falls below its 40-day EMA.
It begins a new trade, the one that the original system 
would apply this day, when the Equity line crosses ascending its 40-day 
EMA
 
// the original trading 
systemBlevel =13;Slevel 
=85;StOcci=100*(CCI(6)-LLV(CCI(6),14))/(HHV(CCI(6),14)-LLV(CCI(6),14));stocci=MA(stocci,5);Buy=Cross(STOCCI,BLEVEL);Sell= 
Cross(STOCCI, Slevel); Short = Sell;Cover = 
Buy;Buy=ExRem(Buy,Sell);Sell=ExRem(Sell,Buy);Short=ExRem(Short,Cover);Cover=ExRem(Cover,Short);
E1=Equity();EM40=MA(E1,40);<FONT 
color=#ff0000>// Equity 
conditionCOND=E1>EM40;XB=Flip(Buy,Sell);// preserve the 
original buy till the next 
sellXS=Flip(Sell,Buy);XSH=Flip(Short,Cover);// preserve theoriginal 
Short till the next CoverXCO=Flip(Cover,Short);<FONT 
size=2>// Descending and ascending equity cross 
conditionsDESCR=Cross(EM40,E1);ASCCR=Cross(E1,EM40);<FONT 
size=2>// the new trading rules// How to begin a 
tradeBuy=COND*Buy OR (ASCCR*XB);// {original 
buy  when E1>EM40} OR {a new buy when an ascending cross 
occur}  Short=COND*Short OR (ASCCR*XSH);<FONT 
color=#ff0000>// How to stop a tradeSell=COND*Sell OR 
(DESCR*XB);// {original sell  when E1>EM40} 
OR { a new sell when an ascending cross occur}  
Cover=COND*Cover OR (DESCR*XSH);
 
The code seem to operate, although I do not feel sosafe 
adding new trading rules after the Equity line.
Any opinions/ideas/improvements/comments ?
Shall we ALWAYS improve a trading system performance with 
this method ?
Dimitris TsokakisYour use of 
Yahoo! Groups is subject to the <A 
href="">Yahoo! Terms of Service. 
Your 
use of Yahoo! Groups is subject to the <A 
href="">Yahoo! Terms of Service.