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

Re: [amibroker] Equity conditions (Perfect system )



PureBytes Links

Trading Reference Links

Hello Listes,

How is this for a perfect system. load into AA, set your settings,
trades long and short.

//Perfect system
//created by Anthony Faragasso for use as a comparsion to developed
systems to find
//the efficiency of the developed system
//Note: Do not trade this system

MaxGraph=8;
//Swing High: High is >= prior 5 periods and High is >= preceding 5
periods.
pdsHigh=7;//Optimize("pdsHigh",6,3,10,1);
swhigh=H==Peak(H,pdsHigh);// AND H==Ref(Peak(H,pdsHigh),pdsHigh);

//Swing Low: Low is <= prior 5 periods and Low is <= preceding 5periods.

pdsLow=6;//Optimize("pdsLow",6,3,10,1);
swLow=L==Trough(L,pdsLow);//AND L==Ref(Trough(L,pdsLow),pdsLow);

barcolor=IIf(swhigh,4,IIf(swlow,5,1));

Graph0=C;
Graph0BarColor=ValueWhen(barcolor !=0,barcolor);
Graph0Style=64;

//Graph1=ValueWhen(swhigh,H);
//Graph2=ValueWhen(swlow,L);
//Graph1Style=Graph2Style=1;

Title=Name()+" "+" SwingHigh and Resistance =
"+"("+WriteVal(ValueWhen(swhigh,H),1.2)+")"+"....."+"SwingLow and
Support ="+"("+WriteVal(ValueWhen(swlow,L),1.2)+")";

/********************************/

Buy=swlow;
Sell=swhigh;
Short=Sell;
Cover=Buy;
Buy=ExRem(Buy,Sell);Sell=ExRem(Sell,Buy);
Short=ExRem(Short,Cover);Cover=ExRem(Cover,Short);

/***************************************************/
Filter=(Buy>0AND V > 100000 AND C>10) OR( Sell>0 AND V > 100000 AND C >
10);
AddColumn(Buy,"Buy");AddColumn(Sell,"Sell");
AddColumn(C,"close");AddColumn(V,"volume");

Hope this helps
Anthony

Listes trading wrote:

> Another interesting way to take decision on the equity curve is to
> compare it with the equity produced by a "perfect system".Let's write
> a perfect system that trades all the tops and bottoms and compute the
> composite equity of this system:Buy = TroughBars(L,2)==0;Short =
> PeakBars(H,2)==0;Sell = Short; Cover =
> Buy;AddToComposite(Equity(),"Perfect equity","X",3);Then compute the
> composite equity of your system.
>
> You can build an indicator that measures the correlation between your
> system and the perfect system:
>
> MySystem = Foreign("My system equity","C");
>
> Perfect = Foreign("Perfect equity","C");
>
> Corr = Correlation(MySystem,Perfect,100);
>
> GraphXSpace = 5;
>
> Graph0 = Corr; Graph0Style = 1+4; Graph0Color = 3;
>
> Graph1 = 0.5; Graph1Style = 1; Graph1Color = 2;
>
> Graph2 = -0.5; Graph2Style = 1; Graph2Color = 2;
>
> Title = "Correlation between equity my system and perfect system";
>
> Correlation more than 0.5 means that the system is following the
> performance of the perfect system.
>
> Waz
>
> -----Original Message-----
>
> From: Herman van den Bergen [mailto:psytek@x...]
> Sent: mardi 30 juillet 2002 13:24
> To: amibroker@xxxxxxxxxxxxxxx
> Subject: RE: [amibroker] Equity conditions applied to
> trading systems
>
> Thanks Dimitris, for this interesting post. You end your
> post with: "The code seem to operate, although I do not feel
> so safe adding new trading rules after the Equity line.Any
> opinions/ideas/improvements/comments ?"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 system to simulate our regular trade and one day to
> respond to our secondary system. This would be for a
> reversal system.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). This is not an uncommon technique. A
> search on the 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:
> http://store.traders.com/-v10-c10-trading-pdf.html
> http://www.sirtrade.com/equity.htm
> http://www.libertyresearch.com/book1.htm
> http://www.activetradermag.com/article_index_strategy.htm#Sept2000
> or http://www.activetradermag.com/tocs/toc0900.htm
> http://www.purebytes.com/archives/omega/1998/msg01851.htmlAnd
> you say: "Shall we ALWAYS improve a trading system
> performance with this method ?" 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.Take care,Herman.
>
> -----Original Message-----
> From: Dimitris Tsokakis
> [mailto:TSOKAKIS@x...]
> Sent: Tuesday, July 30, 2002 2:39 AM
> To: amibroker@xxxxxxxxxxxxxxx
> Subject: [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 EMAand 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 system
> Blevel =13;
> Slevel =85;
>
> tOcci=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);
>
> hort=ExRem(Short,Cover);Cover=ExRem(Cover,Short);E1=Equity();EM40=MA(E1,40);
>
> // Equity condition
> COND=E1>EM40;
> XB=Flip(Buy,Sell);// preserve the original buy
> till the next sell
> XS=Flip(Sell,Buy);
> XSH=Flip(Short,Cover);// preserve the original
> Short till the next Cover
> XCO=Flip(Cover,Short);
> // Descending and ascending equity cross
> conditions
> DESCR=Cross(EM40,E1);
> ASCCR=Cross(E1,EM40);
> // the new trading rules
> // How to begin a trade
> Buy=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);
> // How to stop a trade
> Sell=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 so safe 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 Tsokakis
>
> Your use of Yahoo! Groups is subject to the Yahoo!
> Terms of Service.
>
> Your use of Yahoo! Groups is subject to the Yahoo! Terms of
> Service.
>
>
> Yahoo! Groups Sponsor
ADVERTISEMENT

>
> Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.