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

[amibroker] Re: MAcross, EMAcross Prediction [some recent examples]



PureBytes Links

Trading Reference Links

For example, I tried Jayson dmi formula from Jan2001 till now.

//Dynamic Momentum Index Tushar Chande Translated to AFL by Jayson 
Casavant
//Cmo5 formula
CMO5_1=Sum( IIf( C > Ref( C, -1 ) , ( C - Ref( C ,-1 ) ) ,0 ) ,5 ) ;
CMO5_2=Sum( IIf( C < Ref( C ,-1 ) , ( Ref( C ,-1 ) - C ) ,0 ) ,5 );
CMO5=DEMA(100 * (( CMO5_1 -CMO5_2) /( CMO5_1+CMO5_2)),3);
//Cmo10 formula
CMO10_1=Sum( IIf( C > Ref( C, -1 ) , ( C - Ref( C ,-1 ) ) ,0 ) ,10 ) ;
CMO10_2=Sum( IIf( C < Ref( C ,-1 ) , ( Ref( C ,-1 ) - C ) ,0 ) ,10 );
CMO10=DEMA(100 * (( CMO10_1 -CMO10_2) /( CMO10_1+CMO10_2)),3);
//Cmo20 formula
CMO20_1=Sum( IIf( C > Ref( C, -1 ) , ( C - Ref( C ,-1 ) ) ,0 ) ,20 ) ;
CMO20_2=Sum( IIf( C < Ref( C ,-1 ) , ( Ref( C ,-1 ) - C ) ,0 ) ,20 );
CMO20=DEMA(100 * (( CMO20_1 -CMO20_2) /( CMO20_1+CMO20_2)),3);
// dmi formula
dmi=((StDev(C,5)* CMO5)+(StDev(C,10)* CMO10)+(StDev(C,20)*
CMO20))/(StDev(C,5)+StDev(C,10)+StDev(C,20));
pds=Optimize("Smoothing",10,5,40,1);
pds1=Optimize("Trigger Line",4,5,40,1);
// The regular cross condirion
Buy1=Cross(EMA(dmi,pds),MA(dmi,pds1));
Sell1=Cross(MA(dmi,pds1),EMA(dmi,pds));
p=pds;EMAp=EMA(dmi,p);
k=pds1;MAk=MA(dmi,k);
tdmi=((p+1)*MA(dmi,k-1)*(k-1)-k*(p-1)*EMAp)/(2*k-(p+1));
// The prediction cross condition
Buy2=Cross(tDMI,dmi);Sell2=Cross(dmi,tDMI);
Plot(Buy1,"",5,2);Plot(Sell1,"",4,2);
Plot(Buy2,"",1,1);Plot(Sell2,"",2,1);
// Select the best buy/sell condition
t1=Optimize("t1",1,1,2,1);
t2=Optimize("t2",1,1,2,1);
Buy=IIf(t1==1,buy1,buy2);
Sell=IIf(t2==1,sell1,sell2);

^NDX regular cross condition had an optimal +20%
With t1=1, t2=2 the total net profit was +63%.
^NDX seems to prefer the regular buy and the predicted sell
For the same period, CSCO regular performance was +54%.
With t1=2, t2=1 was +63%.
It is better for CSCO to anticipate the Buy signal and keep the 
regular Sell.
In a few words, you have more alternatives when you know in advance 
the upcoming Moving Average cross.
Dimitris Tsokakis
--- In amibroker@xxxxxxxxxxxxxxx, "DIMITRIS TSOKAKIS" <TSOKAKIS@xxxx> 
wrote:
> Gedi,
> The actual cross has only one choice: To Buy/Sell at next bar Open 
> [You can not even Buy/Sell at todays Close, many times the cross is 
> not known the last 10mins...]
> With the Prediction theory you have more chances, since you "know" 
> the upcoming cross one day before.
> So, you have one whole day to select the best price, from H to L, 
> plus the usual next bar open.
> It doesnt mean that delay=0 is the golden solution of *any* trading 
> system.
> See, for example, the dmi code at
> http://groups.yahoo.com/group/amibroker/message/44991
> It works better for delay=1 than delay=0, consequently the 
prediction 
> does not help [at least for the selected Optimisation values].
> For some other systems it is good to use the prediction for Buy and 
> the regular cross for the Sell etc
> Try the alternatives with
> buy1=the regular buy;
> sell1=the regular sell;
> buy2=the prediction buy;
> sell2=the prediction sell,
> t1=optimize("t1",1,1,2,1);t2=optimize("t2",1,1,2,1);
> buy=iif(t1==1,buy1,buy2);
> sell=iif(t2==1,sell1,sell2);
> and similar selection for Short/Cover
> Dimitris Tsokakis
> 
> --- In amibroker@xxxxxxxxxxxxxxx, "telecheck1" <telecheck1@xxxx> 
> wrote:
> > Hi Dimitris ,
> > 
> > I backtested the prediction as:
> > Buy=Cross(C,tClose);
> > Sell=Cross(tClose,C);
> > 
> > It works very good while entering a position but less effective 
on 
> > exit.
> > 
> > Have you any idea what should be the Short and Cover?
> > 
> > Thanks,
> > Gedi


------------------------ Yahoo! Groups Sponsor ---------------------~-->
Buy Ink Cartridges & Refill Kits for Your Epson at Myinks.com
Free shipping on orders $50 or more to the US and Canada.
http://www.c1tracking.com/l.asp?cid=5705&lp=home/epson.asp
http://us.click.yahoo.com/brYXfA/_xWGAA/ySSFAA/GHeqlB/TM
---------------------------------------------------------------------~->

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 http://docs.yahoo.com/info/terms/