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

Re: The D-ratio and its application



PureBytes Links

Trading Reference Links

Greg,
There is NO use of future data in any part of the code.
[My check says 8 future data...]
You should ask Tomasz, when back from his trip.
DT
--- In amibroker@xxxx, "greg" <greg.bean@xxxx> wrote:
> Dimitris,
> 
> When I use check button in AA I get a message about needing 24 
future quotes to run the formula. Do you think this afl is only going 
to work in backtests and not in a real-time situation?
> 
> Greg
> ----- Original Message ----- 
> From: Dimitris Tsokakis 
> To: amibroker@xxxx 
> 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*/
> 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.
> 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*/
> R=500*(H-L)/(H+L);
> Z=Optimize("Z",20,5,20,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");
> AddColumn(RRRmaxC,"HIGHEST DEMA D-ratio C");
> AddColumn(RRRminF,"LOWEST DEMA D-ratio F");
> D1=Optimize("D1",13,RRRminF,RRRminF+0.5*(RRRmaxC-RRRminF),1);
> D2=Optimize("D2",17,RRRminF+0.5*(RRRmaxC-RRRminF),RRRmaxC,1);
> F1=RRR>=D2;F2=RRR<=D1;
> Sell=F2;Buy=F1;
> Buy=ExRem(Buy,Sell);Sell=ExRem(Sell,Buy);
> Short=Sell;Cover=Buy;
> Short=ExRem(Short,Cover);Cover=ExRem(Cover,Short);
> 
> For your indicator builder use the 
> /*D-ratio graph*/
> 
> R=500*(H-L)/(H+L);
> Z=Optimize("Z",20,5,20,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;
> D1=Optimize("D1",13,RRRminF,RRRminF+0.5*(RRRmaxC-RRRminF),1);
> D2=Optimize("D2",17,RRRminF+0.5*(RRRmaxC-RRRminF),RRRmaxC,1);
> F1=RRR>=D2;F2=RRR<=D1;
> Sell=F2;Buy=F1;
> Buy=ExRem(Buy,Sell);Sell=ExRem(Sell,Buy);
> Short=Sell;Cover=Buy;
> Short=ExRem(Short,Cover);Cover=ExRem(Cover,Short);
> Plot(R,"D-ratio",1,1);Plot(RRR,"DEMA D-ratio",7,8);
> Plot(D2,"Buy Level",5,1);Plot(D1,"Sell Level",4,1);
> 
> 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]
> 
> 
> 
> 
> Yahoo! Groups Sponsor 
> ADVERTISEMENT
> 
> 
> 
> 
> Your use of Yahoo! Groups is subject to the Yahoo! Terms of 
Service.