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

[amibroker] Re: DMI problem



PureBytes Links

Trading Reference Links

It is strange.
The huge dmi in
dmi=((StDev(C,5)* CMO5)+(StDev(C,10)* CMO10)+(StDev(C,20)*CMO20))/
(StDev(C,5)+StDev(C,10)+StDev(C,20));
is not because of some very small denominator [usual reason], but is 
due to a huge numerator.
In this numerator, the huge is the CMO5 and in
CMO5=DEMA(100 * (( CMO5_1 -CMO5_2) /( CMO5_1+CMO5_2)),3);
we do not have very small denominator, the whole 100 * (( CMO5_1 -
CMO5_2) /( CMO5_1+CMO5_2)) is cool, the DEMA(...,3) makes the huge 
value.
You should cancel CMO5 from the formula, or limit it in the [-
100,100] interval.
So, replace the first lines with
//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);
CMO5=IIf(CMO5>100,99,CMO5);
CMO5=IIf(CMO5<-100,-99,CMO5);
//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);
CMO10=IIf(CMO10>100,99,CMO10);
CMO10=IIf(CMO10<-100,-99,CMO10);

//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);
CMO20=IIf(CMO20>100,99,CMO20);
CMO20=IIf(CMO20<-100,-99,CMO20);

Now we have just a few problems with 8308, 5406 and 1861.
I noticed that there are also some EMA(dmi,pds) {empty} values !!!!!!!
I give up, Jason should look at the formula again !!!
Dimitris Tsokakis

--- In amibroker@xxxxxxxxxxxxxxx, "DIMITRIS TSOKAKIS" <TSOKAKIS@xxxx> 
wrote:
> I run the same for the ^N225 database and [!!] many examples 
appeared.
> Let me search please and revert.
> Dimitris Tsokakis
> --- In amibroker@xxxxxxxxxxxxxxx, "DIMITRIS TSOKAKIS" 
<TSOKAKIS@xxxx> 
> wrote:
> > Yuki,
> > I added to your formula
> > Filter=1;
> > AddColumn(Highest(EMA(DMI,PDS)),"DMIh");
> > AddColumn(Lowest(EMA(DMI,PDS)),"DMIl");
> > AddColumn(Highest(MA(DMI,PDS1)),"TRIGGERh");
> > AddColumn(Lowest(MA(DMI,PDS1)),"TRIGGERl");
> > and explored for the n=1 last quotations the whole N100 database 
> from 
> > Jan2000 till now.
> > No value was found out of the [-100,100] range.
> > [101*900 different bars]
> > Dimitris Tsokakis
> > --- In amibroker@xxxxxxxxxxxxxxx, Yuki Taga <yukitaga@xxxx> wrote:
> > > I attach two charts, both displaying DMI as described by Jason:
> > > 
> > >  //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=Param("Smoothing",3,1,10,1);
> > > pds1=Param("Trigger Line",5,1,10,1);
> > > 
> > > Plot(EMA(dmi,pds),"Dynamic Momentum Index",colorDarkGreen,1);
> > > Plot(MA(dmi,pds1),"trigger",colorRed,1);
> > > 
> > > Buy=Cross(EMA(dmi,pds),MA(dmi,pds1));// AND Trend;
> > > Sell=Cross(MA(dmi,pds1),EMA(dmi,pds));// AND NOT (Trend);
> > > PlotShapes(IIf(Buy,shapeUpArrow,shapeNone) ,colorBrightGreen);
> > > PlotShapes(IIf(Sell,shapeDownArrow,shapeNone),colorRed);
> > > 
> > > What is the difference in these two DMI plots?  I simply 
scrolled 
> > the
> > > screen one date to the right.
> > > 
> > > I have this problem with several stocks, but the date that the
> > > indicator goes haywire on is not the same for any of them.  I 
also
> > > cannot find anything wrong with the data on the date that the
> > > indicator goes nuts.  It is data that is right in line with both
> > > price and volume, not extraordinary in any way.  But the 
indicator
> > > becomes worthless, suddenly.
> > > 
> > > Can anyone clue me in here?
> > > 
> > > Yuki


------------------------ Yahoo! Groups Sponsor ---------------------~-->
Buy Ink Cartridges or Refill Kits for Your HP, Epson, Canon or Lexmark
Printer at Myinks.com. Free s/h on orders $50 or more to the US & Canada. http://www.c1tracking.com/l.asp?cid=5511
http://us.click.yahoo.com/l.m7sD/LIdGAA/qnsNAA/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/