NAME
Math::Business::DMI - Technical Analysis: Directional Movement Index (aka ADX)
SYNOPSIS
use Math::Business::DMI;
my $dmi = new Math::Business::DMI;
$dmi->set_days(14);
# alternatively/equivilently
my $dmi = new Math::Business::DMI(14);
# or to just get the recommended model ... (14)
my $dmi = Math::Business::DMI->recommended;
my @data_points = (
[ 5, 3, 4 ], # high, low, close
[ 6, 4, 5 ],
[ 5, 4, 4.5 ],
);
# choose one:
$dmi->insert( @data_points );
$dmi->insert( $_ ) for @data_points;
my $adx = $dmi->query; # ADX
my $pdi = $dmi->query_pdi; # +DI
my $mdi = $dmi->query_mdi; # -DI
# or
my ($pdi, $mdi, $adx) = $dmi->query;
if( defined $adx ) {
print "ADX: $adi.\n";
} else {
print "ADX: n/a.\n";
}
RESEARCHER
The ADX/DMI was designed by J. Welles Wilder Jr circa 1978.
The +DI and -DI signals measure the force of directional changes. When the +DI crosses above the -DI it may indicate that it's time to buy and when the -DI crosses above the +DI it may be time to sell.
The ADX tries to combine the two. It may indicate the strength of the current trend (but not it's direction). When it moves above 20 it may be the beginning of a trend and when it falls below 40, it may be the end of it.
The DMI uses the ATR to try to measure volatility.
NOTE: The +DI, -DI and ADX returned by this module are probabilities ranging from 0 to 1. Most sources seem to show the DMI values as numbers from 0 to 100. Simply multiply the three tuple by 100 to get this result.
my @DMI = map { 100*$_ } = $dmi->query;
AUTHOR
Paul Miller <jettero@cpan.org>
I am using this software in my own projects... If you find bugs, please please please let me know.
I normally hang out on #perl on freenode, so you can try to get immediate gratification there if you like. irc://irc.freenode.net/perl
There is also a mailing list with very light traffic that you might want to join: http://groups.google.com/group/stockmonkey/.
COPYRIGHT
Copyright (c) 2010 Paul Miller
LICENSE
This module is free software. You can redistribute it and/or modify it under the terms of the Artistic License 2.0.
This program is distributed in the hope that it will be useful, but without any warranty; without even the implied warranty of merchantability or fitness for a particular purpose.
[This software may have had previous licenses, of which the current maintainer is completely unaware. If this is so, it is possible the above license is incorrect or invalid.]
THANKS
BobBack <drchap...@gmail.com>
SEE ALSO
perl(1), Math::Business::StockMonkey, Math::Business::StockMonkey::FAQ, Math::Business::StockMonkey::CookBook