Bitcoin Forum
December 12, 2017, 04:00:11 PM *
News: Latest stable version of Bitcoin Core: 0.15.1  [Torrent].
 
   Home   Help Search Donate Login Register  
Pages: [1]
  Print  
Author Topic: Arnaud Legoux Moving Average  (Read 2557 times)
Najska
Full Member
***
Offline Offline

Activity: 152


View Profile
March 01, 2014, 01:35:51 AM
 #1

Hi fellows,

Let me introduce you ALMA, the best moving average I've ever utilised. This is the website of Arnaud Legoux, where you can find related explanations: http://www.arnaudlegoux.com.

And this is the simple PHP implementation of it:

Code:
function ALMA ($data) {
$sigma = 6;
$offset = 0.85;
$size = count ($data);
$m = $offset * ($size - 1);
$s = $size / $sigma;
$sum = 0;
$norm = 0;
for ($i = 0; $i < $size; $i++) {
$coeff = exp (- ($i - $m) * ($i - $m) / 2 * $s * $s);
$sum += $data[$size - $i - 1] * $coeff;
$norm += $coeff;
}
return $sum / $norm;
}

The array $data will compromise the last closing values, data[0] being the most recent one. It is argued that an odd value for the size of the array would yield better results.

Any opinion is welcome!

1513094411
Hero Member
*
Offline Offline

Posts: 1513094411

View Profile Personal Message (Offline)

Ignore
1513094411
Reply with quote  #2

1513094411
Report to moderator
1513094411
Hero Member
*
Offline Offline

Posts: 1513094411

View Profile Personal Message (Offline)

Ignore
1513094411
Reply with quote  #2

1513094411
Report to moderator
1513094411
Hero Member
*
Offline Offline

Posts: 1513094411

View Profile Personal Message (Offline)

Ignore
1513094411
Reply with quote  #2

1513094411
Report to moderator
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction. Advertise here.
1513094411
Hero Member
*
Offline Offline

Posts: 1513094411

View Profile Personal Message (Offline)

Ignore
1513094411
Reply with quote  #2

1513094411
Report to moderator
knbitcoin
Newbie
*
Offline Offline

Activity: 4


View Profile
March 02, 2014, 02:31:01 AM
 #2

Can I ask why you use 2 * s * s?
Najska
Full Member
***
Offline Offline

Activity: 152


View Profile
March 02, 2014, 06:33:16 AM
 #3

Hi knbitcoin,

Thanks for your interest. If you check their website, there is an article describing ALMA, and there are sample codes calculating it. In the article, there is no 2, and there are some other differences as well. But in the code they write, which I only translate to PHP, there is this 2, which in fact improves the result. But I don't know why it is there.

Pages: [1]
  Print  
 
Jump to:  

Sponsored by , a Bitcoin-accepting VPN.
Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!