<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">=encoding utf8

=head1 NAME

Math::SMA - SMA in object form

=head1 SYNOPSIS

    use Math::SMA;
	my $sma = Math::SMA-&gt;new(size =&gt; $n);
	$sma-&gt;sma($value);

=head1 DESCRIPTION

Implements a simple moving average of N periods with an amortized runtime complexity of &lt; O(nÂ˛).

L&lt;http://en.wikipedia.org/wiki/Moving_average&gt;

=head2 new

Create a new SMA object of C&lt;$n&gt; periods.

	my $sma = Math::SMA-&gt;new(size =&gt; $n);

=head2 sma

Add a value to series and return the current simple moving average

    $sma-&gt;sma($current);

C&lt;$current&gt; is the current live value

Returns C&lt;last_avg&gt; if called with no arguments.

=head2 precision

The precision level for decimal places. Defaults to 2.

=head2 last_avg

The current value of the SMA series. 

=head2 values

The current values of the SMA period. If you want to continue a series from a previous time,
then pass an arrayref in during object construction:

	$sma = Math::SMA-&gt;new(size =&gt; 5, values =&gt; [3,2,7,4,9] );

=head1 AUTHORS

Samuel Smith E&lt;lt&gt;esaym@cpan.orgE&lt;gt&gt;

=head1 BUGS

See L&lt;http://rt.cpan.org&gt; to report and view bugs.

=head1 SOURCE

The source code repository for Math::EWMA can be found at
L&lt;https://github.com/smith153/Math-SMA&gt;.

=head1 COPYRIGHT

Copyright 2015 by Samuel Smith E&lt;lt&gt;esaym@cpan.orgE&lt;gt&gt;.

This program is free software; you can redistribute it and/or
modify it under the same terms as Perl itself.

See L&lt;http://www.perl.com/perl/misc/Artistic.html&gt;

</pre></body></html>