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

[amibroker] A new method



PureBytes Links

Trading Reference Links




Except the Equity values, we need the Equity progress as time 
goes by. 
A stock may be highly profitable for 6 months, two years 
ago and presents high Equity value in a 3-year period, 
but it may be a loser the last year.
For this study we may establish some Inspection Points, 
equally distributed in the test period and check the relative Equity 
progress.
The code is divided into 4 parts.
1. Introduction
START=DateNum()==1000601 ;Plot(5000,"",1,1);
My data begin on Jan2000. The majority of the 
indicators I use are well defined the first 6 months. June1, 2000 is a good 
starting point .
The 5000 line is placed below the initial Equity 10000, many 
stocks have loosing periods and it is used to align the IP digits.
per=100;EVENT=BarsSince(START)%per==0;The IPs will be 
placed every 100 bars for the inspection EVENT. The distance of each IP from the 
starting date is a multiple of 100.
2. The trading system
CMO5 with threshold d=58 was selected for the 
examples.Long&Short trades are included, the system is almost always in the 
market.
3. The Indicator builder 
part
Scan and backtest the stock [or the database] for all 
quotations. Hit Equity button and you will automatically have a new IB pane 
with
the Equity, the B&H yellow line and the IPs counter on the 
same graph. If you place your cursor on IP6 you may read the respective 
Equity
and B&H value.
4. The AA part.
Explore the stock [or the database] for all 
quotations.
The 
Filter=event; 
will check only the IP dates.
The 1st column is the name of the stock, the 2nd is the IP 
dates
The 3rd column is the IP number [from 0 to 8 in the 
example]
The 4th column[E34] is the Equity value for the respective 
IP.
We see for APOL 21,830 on 1/6/2000, 28900 on 23/10/2000 
etc.
The 5th column[Progress 2 IPs ago] checks per IP the % of the 
Equity progress 2 IPs ago.
The 8th IP is compared to the 6th, the 7th is compared to the 
5th etc.
The two first IPs are without comparison.
The 6th column[3 IPS ago] checks per IP the % progress of 
the Equity compared to the IP 3 IPs ago.
The comparison will be continued 
until the progress of the last IP related to the first.
We read in APOL last row, last column 314.64. The  Equity 
for IP8 is 90,518.73, the Equity for IP0 is 21,830.66
and the progress is 90,518.73/21,830.66=4.1464 or 314.64%, 
which gives the gain if the Entry is IP0 and the Exit is IP8. 
For easy reading, positive progress has green background and 
negative progress has red.
 
// The progress of the Equity curve, by D. 
Tsokakis, Nov2003
START=DateNum()==1000601 
;Plot(5000,"",1,1);per=100;EVENT=BarsSince(START)%per==0;// 
The trading 
systemP=5;X5=100*((Sum(IIf(C>Ref(C,-1),(C-Ref(C,-1)),0),P))-(Sum(IIf(C<Ref(C,-1),(Ref(C,-1)-C),0),P)))/((Sum(IIf(C>Ref(C,-1),(C-Ref(C,-1)),0),P)+(Sum(IIf(C<Ref(C,-1),(Ref(C,-1)-C),0),P))));d=Optimize("d",58,10,80,1);Sell=Cross(x5,d);Buy=Cross(-D,X5);Buy=ExRem(Buy,Sell);Sell=ExRem(Sell,Buy);Short=Cross(D,X5);Cover=Buy;// 
the Indicator builder 
partE34=Equity(1,0);z=Cum(event);Counter=Cum(EVENT)%10;shape=IIf(Counter==1,shapeDigit0,IIf(Counter==2 
,shapeDigit1,IIf(Counter==3 ,shapeDigit2,IIf(Counter==4 
,shapeDigit3,IIf(Counter==5 ,shapeDigit4,IIf(Counter==6 
,shapeDigit5,IIf(Counter==7 ,shapeDigit6,IIf(Counter==8 
,shapeDigit7,IIf(Counter==9 
,shapeDigit8,shapeDigit9)))))))));PlotShapes(shape*EVENT,colorBlack,0,Graph0,0);dcounter=1+Cum(Counter==1 
AND Ref(Counter,-1)==0);dshape=IIf(dCounter==1,shapeNone,IIf(dCounter==2 
,shapeDigit1,IIf(dCounter==3 ,shapeDigit2,IIf(dCounter==4 
,shapeDigit3,IIf(dCounter==5 ,shapeDigit4,IIf(dCounter==6 
,shapeDigit5,IIf(dCounter==7 ,shapeDigit6,IIf(dCounter==8 
,shapeDigit7,IIf(dCounter==9 
,shapeDigit8,shapeDigit9)))))))));PlotShapes(dshape*event,colorBlack,0,Graph0,10);// 
The Automatic Analysis 
partAddColumn(z-1,"IP",1.0,colorBlack,colorOrange);
<FONT 
size=2>AddColumn(E34,"E34");for(IPsAgo=2;IPsAgo<LastValue(z);IPsAgo=IPsAgo+1){Progress=100*(-1+E34/ValueWhen(event,E34,IPsAgo+1));AddColumn(Progress,WriteIf(IPsAgo==2,"Progress 
","")+WriteVal(IPsAgo,1.0)+" IPs 
ago",1.2,colorBlack,IIf(Progress>0,colorBrightGreen,colorRed));}Filter=event;
 
In every cell of this AA matrix we read the % progress of the 
Equity in comparison to the previous IPs [in the example per=100 means we check 

200 bars ago, 300 bars ago etc]
Let us have a first taste of the matrix info:
*APOL is full of green cells. At any 
IP the correlation to any previous IP is positive. The first column presents the 
progress related to 2IPs ago.
It was +129.10% back on March2001, +58.16% <FONT 
size=2>on Oct2002 and just a +5.19% on Aug2003, compared to the Equity 200 bars 
ago.
[Time for a red cell in the next inspection ???]
*The tough question for APOL is already a fact for 
BEAS. 
The last IP has red cells, compared to the 2IPs ago, 3IPS ago, 
4IPS ago and 5IPS ago [500 bars ago]
*APCC was a horrible example for CMO5, 
it was steadily a loser from IP0 to IP6.
The last IP8 is 97.12% profitable for the last 200 bars and 
34.86% profitable for the last 300 bars.
The preference of APOL or APCC is not an easy question. 

A recent trader would enjoy almost a double price with APCC 
and only a 5% with the top APOL.
*BGEN has some CMO5 problems the last 
3 IPs. The small +3.24% [IP5, column 2IPs ago] was quite informative for BGEN 
future movements...
*INTC is not good the last 400 bars 
[The small +3.83 at the IP4 anticipated a red future...]
The last -9.50% is an indication for positive IPs 
soon.
*INTU has some good CMO5 news. After 
the decline of the "2IPs ago" column [66%, 39%, 13%, 2%] a new +46% came to 
change the perspectives .
I think we may "read" a lot of informations from this 
matrix.
Dimitris Tsokakis






Yahoo! Groups Sponsor


  ADVERTISEMENT 









Send BUG REPORTS to bugs@xxxxxxxxxxxxx
Send SUGGESTIONS to suggest@xxxxxxxxxxxxx
-----------------------------------------
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 the Yahoo! Terms of Service.



Attachment:
d1.gif

Attachment: Description: "Description: GIF image"