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

RE: [amibroker] The dmi MA, EMA cross and the Prediction theory



PureBytes Links

Trading Reference Links




<SPAN 
class=495304323-25072003>Dimitris,
thanks 
for all your time and effort. I will spend some time analyzing it this week end. 
This has been an interesting thread!
 
Regards, 
Jayson 
<FONT face=Tahoma 
size=2>-----Original Message-----From: Dimitris Tsokakis 
[mailto:TSOKAKIS@xxxxxxxxx]Sent: Friday, July 25, 2003 2:46 
AMTo: amibroker@xxxxxxxxxxxxxxxSubject: [amibroker] The 
dmi MA, EMA cross and the Prediction theory
Yuli, Jason,
in your dmi example, the Buy, Sell conditions 
were
 
Buy=Cross(<FONT 
size=2>EMA(dmi,pds),<FONT 
size=2>MA<FONT 
face="Times New Roman">(dmi,pds1));
Sell=Cross(<FONT 
size=2>MA(dmi,pds1),EMA<FONT 
face=Verdana size=2>(dmi,pds));
 
It is a special case 
of an EMA, MA cross.
The mathematical 
condition for an EMAp, MAk touch is
 <FONT 
face="Times New Roman">
tdmi=((p+1)*<FONT 
size=2>MA<FONT 
size=2>(dmi,k-1)*(k-<FONT 
size=2>1)-k*(p-1<FONT 
size=2>)*EMAp)/(2*k-(p+<FONT 
size=2>1));
 
where tdmi is the tomorrow dmi 
value.
According to the similar predictions 
arguments, the crosses of this tdmi with dmi itself should
anticipate by one bar the actual EMA, 
MA crosses.
You may verify this from the 
code
 
//Dynamic Momentum Index Tushar Chande 
Translated to AFL by Jayson Casavant//Cmo5 
formula<FONT 
face="Times New Roman">
CMO5_1=Sum<FONT 
face="Times New Roman">( IIf<FONT 
face="Times New Roman">( C > <FONT 
size=2>Ref( C, 
-1 ) , ( C - <FONT 
size=2>Ref( C 
,-1 ) ) ,<FONT 
size=2>0 ) ,5<FONT 
face=Verdana size=2> ) ;<FONT 
face="Times New Roman">
CMO5_2=Sum<FONT 
face="Times New Roman">( IIf<FONT 
face="Times New Roman">( C < <FONT 
size=2>Ref( C 
,-1 ) , ( <FONT 
size=2>Ref( C 
,-1 ) - C ) ,<FONT 
size=2>0 ) ,5<FONT 
face=Verdana size=2> );<FONT 
face="Times New Roman">
CMO5=DEMA<FONT 
face="Times New Roman">(100 
* (( CMO5_1 -CMO5_2) /( CMO5_1+CMO5_2)),3<FONT 
face=Verdana size=2>);<FONT 
face=Verdana size=2>//Cmo10 
formula<FONT 
face="Times New Roman">
CMO10_1=Sum<FONT 
face="Times New Roman">( IIf<FONT 
face="Times New Roman">( C > <FONT 
size=2>Ref( C, 
-1 ) , ( C - <FONT 
size=2>Ref( C 
,-1 ) ) ,<FONT 
size=2>0 ) ,10<FONT 
face=Verdana size=2> ) ;<FONT 
face="Times New Roman">
CMO10_2=Sum<FONT 
face="Times New Roman">( IIf<FONT 
face="Times New Roman">( C < <FONT 
size=2>Ref( C 
,-1 ) , ( <FONT 
size=2>Ref( C 
,-1 ) - C ) ,<FONT 
size=2>0 ) ,10<FONT 
face=Verdana size=2> );<FONT 
face="Times New Roman">
CMO10=DEMA<FONT 
face="Times New Roman">(100 
* (( CMO10_1 -CMO10_2) /( CMO10_1+CMO10_2)),<FONT 
size=2>3<FONT 
face="Times New Roman">);<FONT 
face="Times New Roman">//Cmo20 formula<FONT face=Verdana 
size=2>
CMO20_1=Sum<FONT 
face="Times New Roman">( IIf<FONT 
face="Times New Roman">( C > <FONT 
size=2>Ref( C, 
-1 ) , ( C - <FONT 
size=2>Ref( C 
,-1 ) ) ,<FONT 
size=2>0 ) ,20<FONT 
face=Verdana size=2> ) ;<FONT 
face="Times New Roman">
CMO20_2=Sum<FONT 
face="Times New Roman">( IIf<FONT 
face="Times New Roman">( C < <FONT 
size=2>Ref( C 
,-1 ) , ( <FONT 
size=2>Ref( C 
,-1 ) - C ) ,<FONT 
size=2>0 ) ,20<FONT 
face=Verdana size=2> );<FONT 
face="Times New Roman">
CMO20=DEMA<FONT 
face="Times New Roman">(100 
* (( CMO20_1 -CMO20_2) /( CMO20_1+CMO20_2)),<FONT 
size=2>3<FONT 
face="Times New Roman">);<FONT 
face="Times New Roman">// dmi formula<FONT face=Verdana 
size=2>
dmi=((StDev<FONT 
face="Times New Roman">(C,5<FONT 
size=2>)* CMO5)+(StDev<FONT 
face="Times New Roman">(C,10<FONT 
size=2>)* CMO10)+(StDev<FONT 
face="Times New Roman">(C,20<FONT 
face=Verdana size=2>)*<FONT 
face="Times New Roman">
CMO20))/(StDev<FONT 
face="Times New Roman">(C,5<FONT 
size=2>)+StDev<FONT 
face="Times New Roman">(C,10<FONT 
size=2>)+StDev<FONT 
face="Times New Roman">(C,20<FONT 
face=Verdana size=2>));<FONT 
face="Times New Roman">
pds=Optimize<FONT 
face="Times New Roman">("Smoothing"<FONT 
size=2>,10,<FONT 
size=2>1,10<FONT 
size=2>,1<FONT 
face="Times New Roman">);
pds1=Optimize<FONT 
face="Times New Roman">("Trigger 
Line",4,<FONT 
size=2>1,10<FONT 
size=2>,1<FONT 
face="Times New Roman">);
Buy=Cross(<FONT 
size=2>EMA(dmi,pds),<FONT 
size=2>MA<FONT 
face="Times New Roman">(dmi,pds1));
Sell=Cross<FONT 
face="Times New Roman">(MA<FONT 
face="Times New Roman">(dmi,pds1),<FONT 
size=2>EMA<FONT face="Times New Roman" 
size=2>(dmi,pds));
 
// Prediction of 
actual crosses by D. Tsokakis
p=pds;EMAp=EMA<FONT face=Verdana 
size=2>(dmi,p);<FONT 
face="Times New Roman">
k=pds1;MAk=MA<FONT face=Verdana 
size=2>(dmi,k);<FONT 
face="Times New Roman">
tdmi=((p+1)*<FONT 
size=2>MA<FONT 
size=2>(dmi,k-1)*(k-<FONT 
size=2>1)-k*(p-1<FONT 
size=2>)*EMAp)/(2*k-(p+<FONT 
size=2>1<FONT 
face="Times New Roman">));
Buy1=Cross<FONT 
face="Times New Roman">(t,dmi);Sell1=<FONT 
size=2>Cross<FONT 
face="Times New Roman">(dmi,t);<FONT face=Verdana 
size=2>
Plot(Buy,""<FONT 
size=2>,5,<FONT 
size=2>2);Plot<FONT 
size=2>(Sell,"",<FONT 
size=2>4,2<FONT 
face=Verdana size=2>);<FONT 
face=Verdana size=2>
Plot(Buy1,""<FONT 
size=2>,1,<FONT 
size=2>1);Plot<FONT 
size=2>(Sell1,"",<FONT 
size=2>2,1<FONT face=Verdana 
size=2>);
 
The red [Sell], 
green [Buy] bars are the actual crosses, the white, black smaller bars are the 
respective predictions.
You may see the 
prediction success, although let me doubt about the probable 
use.
The system gave me 
some worse backtesting results, when I tried delay=0 [instead of the regular 
delay=1]
and gave also worse 
results when I tried Buy1/Sell1 instead of Buy/Sell.
Anyway, I hope it 
will be useful for your study.
Dimitris 
Tsokakis
 
 
 Send 
BUG REPORTS to bugs@xxxxxxxxxxxxxSend SUGGESTIONS to 
suggest@xxxxxxxxxxxxx-----------------------------------------Post 
AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx (Web page: <A 
href="">http://groups.yahoo.com/group/amiquote/messages/)--------------------------------------------Check 
group FAQ at: <A 
href="">http://groups.yahoo.com/group/amibroker/files/groupfaq.html 
Your use of Yahoo! Groups is subject to the <A 
href="">Yahoo! Terms of Service. 







Yahoo! Groups Sponsor


ADVERTISEMENT
<img
src="" width=300 height=250 border=0>










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.