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

Re: [amibroker] The D-ratio and its application



PureBytes Links

Trading Reference Links


Dimitris,
 
This is a really great presentation. I haven't studied 
it in detail yet, but it looks very organized and has a lot of explanatory 
notes. I appreciate the time you have taken to explain this. Where else could I 
get an education like this?  Thanks.
 
Greg
<BLOCKQUOTE 
>
----- Original Message ----- 
<DIV 
>From: 
Dimitris 
Tsokakis 
To: <A title=amibroker@xxxxxxxxxx 
href="">amibroker@xxxxxxxxxxxxxxx 
Sent: Monday, June 24, 2002 6:01 AM
Subject: [amibroker] The D-ratio and its 
application

A. Definition
The D-ratio is defined as
D-ratio = 500*(H-L)/(H+L)
To avoid sudden spikes but keep the line properties, it is 
useful to consider a fast moving average like 
DEMA(D-ratio,5), which usually oscillates in the [0,100] 
region.
Slightly negative values or values above 100 may appear, but 
not frequently.
B. Range
The range of D-ratio and its DEMA comes from the 
Exploration
/*D-ratio range*/
<FONT 
size=2>R=500*(H-L)/(H+L);Z=5;RRR=DEMA(R,Z);Rmin=LastValue(Lowest(R));RminF=floor(LastValue(Lowest(R)))+1;Rmax=LastValue(Highest(R));RmaxC=ceil(LastValue(Highest(R)))-1;RRRmin=LastValue(Lowest(RRR));RRRminF=floor(LastValue(Lowest(RRR)))+1;RRRmax=LastValue(Highest(RRR));RRRmaxC=ceil(LastValue(Highest(RRR)))-1;Filter=1;AddColumn(R,"D-ratio");AddColumn(RRR,"DEMA 
D-ratio");AddColumn(Rmax,"HIGHEST D-ratio");AddColumn(Rmin,"LOWEST 
D-ratio");AddColumn(RRRmax,"HIGHEST DEMA 
D-ratio");AddColumn(RRRmin,"LOWEST DEMA D-ratio");
 
Explore for the n=1 last quotation.<FONT 
size=2>For N100 stocks, the ,"HIGHEST DEMA D-ratio" varies from 23 to 95 and 
the 
"LOWEST DEMA D-ratio" from 2 to 10.
C. Applications
The D-ratio or its smoothed form may give interesting 
trading systems.
Search various low levels for the Sell level D1 and various 
high levels for the Buy Level D2.
You may search the optimal D1, D2 following the 
optimization
/*D-ratio optimized trading system*/<FONT 
size=2>
R=500<FONT 
face="Times New Roman">*(H-L)/(H+L);
Z=Optimize(<FONT 
size=2>"Z",20<FONT 
size=2>,5,<FONT 
size=2>20,5<FONT face=Verdana 
size=2>);<FONT 
face="Times New Roman">
RRR=DEMA<FONT 
face="Times New Roman">(R,Z);
Rmin=LastValue<FONT 
size=2>(Lowest(R));RminF=<FONT 
size=2>floor(LastValue<FONT 
size=2>(Lowest(R)))+<FONT 
size=2>1<FONT 
face="Times New Roman">;
Rmax=LastValue<FONT 
size=2>(Highest(R));RmaxC=<FONT 
size=2>ceil(LastValue<FONT 
size=2>(Highest(R)))-<FONT 
size=2>1<FONT 
face="Times New Roman">;
RRRmin=LastValue<FONT 
size=2>(Lowest<FONT 
size=2>(RRR));RRRminF=floor<FONT 
size=2>(LastValue(<FONT 
size=2>Lowest(RRR)))+1<FONT 
face=Verdana size=2>;<FONT 
face="Times New Roman">
RRRmax=LastValue<FONT 
size=2>(Highest<FONT 
size=2>(RRR));RRRmaxC=ceil<FONT 
size=2>(LastValue(<FONT 
size=2>Highest(RRR)))-1<FONT 
face=Verdana size=2>;<FONT 
face="Times New Roman">
Filter=1<FONT 
face="Times New Roman">;<FONT 
face="Times New Roman">
AddColumn(R,"D-ratio"<FONT 
face=Verdana size=2>);<FONT 
face=Verdana size=2>
AddColumn(RRR,"DEMA 
D-ratio"<FONT 
face="Times New Roman">);<FONT 
face="Times New Roman">
AddColumn(Rmax,"HIGHEST 
D-ratio"<FONT 
face="Times New Roman">);<FONT 
face="Times New Roman">
AddColumn(Rmin,"LOWEST 
D-ratio"<FONT 
face="Times New Roman">);<FONT 
face="Times New Roman">
AddColumn(RRRmax,"HIGHEST DEMA 
D-ratio"<FONT 
face="Times New Roman">);<FONT 
face="Times New Roman">
AddColumn(RRRmin,"LOWESTDEMA 
D-ratio"<FONT 
face="Times New Roman">);<FONT 
face="Times New Roman">
AddColumn(RRRmaxC,"HIGHEST DEMA 
D-ratio C"<FONT 
face="Times New Roman">);<FONT 
face="Times New Roman">
AddColumn(RRRminF,"LOWEST DEMA 
D-ratio F"<FONT 
face="Times New Roman">);
D1=Optimize(<FONT 
size=2>"D1",13<FONT 
size=2>,RRRminF,RRRminF+0.5<FONT 
size=2>*(RRRmaxC-RRRminF),1<FONT face=Verdana 
size=2>);<FONT 
face="Times New Roman">
D2=Optimize(<FONT 
size=2>"D2",17<FONT 
size=2>,RRRminF+0.5<FONT 
size=2>*(RRRmaxC-RRRminF),RRRmaxC,1<FONT 
face=Verdana size=2>);
F1=RRR>=D2;F2=RRR<=D1;
Sell=F2;Buy=F1;<FONT 
face="Times New Roman">
Buy=ExRem<FONT 
size=2>(Buy,Sell);Sell=ExRem<FONT face=Verdana 
size=2>(Sell,Buy);
Short=Sell;Cover=Buy;<FONT 
face="Times New Roman">
Short=ExRem<FONT 
size=2>(Short,Cover);Cover=ExRem<FONT face=Verdana 
size=2>(Cover,Short);
 
For your indicator builder use the 
/*D-ratio graph*/
 <FONT 
face="Times New Roman">
R=500<FONT 
face="Times New Roman">*(H-L)/(H+L);
Z=<FONT 
face="Times New Roman">Optimize("Z",20,5,20,5);<FONT 
face=Verdana size=2>
RRR=DEMA<FONT 
face="Times New Roman">(R,Z);
Rmin=LastValue<FONT 
size=2>(Lowest(R));RminF=<FONT 
size=2>floor(LastValue<FONT 
size=2>(Lowest(R)))+<FONT 
size=2>1<FONT 
face="Times New Roman">;
Rmax=LastValue<FONT 
size=2>(Highest(R));RmaxC=<FONT 
size=2>ceil(LastValue<FONT 
size=2>(Highest(R)))-<FONT 
size=2>1<FONT 
face="Times New Roman">;
RRRmin=LastValue<FONT 
size=2>(Lowest<FONT 
size=2>(RRR));RRRminF=floor<FONT 
size=2>(LastValue(<FONT 
size=2>Lowest(RRR)))+1<FONT 
face=Verdana size=2>;<FONT 
face="Times New Roman">
RRRmax=LastValue<FONT 
size=2>(Highest<FONT 
size=2>(RRR));RRRmaxC=ceil<FONT 
size=2>(LastValue(<FONT 
size=2>Highest(RRR)))-1<FONT 
face=Verdana size=2>;<FONT 
face=Verdana size=2>
D1=Optimize(<FONT 
size=2>"D1",13<FONT 
size=2>,RRRminF,RRRminF+0.5<FONT 
size=2>*(RRRmaxC-RRRminF),1<FONT face=Verdana 
size=2>);<FONT 
face="Times New Roman">
D2=Optimize(<FONT 
size=2>"D2",17<FONT 
size=2>,RRRminF+0.5<FONT 
size=2>*(RRRmaxC-RRRminF),RRRmaxC,1<FONT 
face=Verdana size=2>);
F1=RRR>=D2;F2=RRR<=D1;
Sell=F2;Buy=F1;<FONT 
face="Times New Roman">
Buy=ExRem<FONT 
size=2>(Buy,Sell);Sell=ExRem<FONT face=Verdana 
size=2>(Sell,Buy);
Short=Sell;Cover=Buy;<FONT 
face="Times New Roman">
Short=ExRem<FONT 
size=2>(Short,Cover);Cover=ExRem<FONT face=Verdana 
size=2>(Cover,Short);<FONT 
face=Verdana size=2>
Plot(R,"D-ratio"<FONT 
size=2>,1,<FONT 
size=2>1);Plot<FONT 
size=2>(RRR,"DEMA D-ratio"<FONT 
size=2>,7,<FONT 
size=2>8<FONT 
face="Times New Roman">);<FONT 
face="Times New Roman">
Plot(D2,"Buy Level"<FONT 
size=2>,5,<FONT 
size=2>1);Plot<FONT 
size=2>(D1,"Sell Level",<FONT 
size=2>4,1<FONT face=Verdana 
size=2>);
 
Do not forget to 
replace above default values for Z, D1, D2 with your optimization 
results.
In general, 
when the DEMA(D-ratio) is below the red line the stock is Sell [or Short]and 

above the green line it is Buy [or Cover]
You may see INTC example in the att. gif.
[for [Z=5, D1=13, D2=17] the % Net profit exceeds +800% from Jan 
2000]
 Your 
use of Yahoo! Groups is subject to the <A 
href="">Yahoo! Terms of Service.