Bitcoin Forum
May 09, 2021, 08:54:20 AM *
News: Latest Bitcoin Core release: 0.21.0 [Torrent]
 
   Home   Help Search Login Register More  
Warning: One or more bitcointalk.org users have reported that they strongly believe that the creator of this topic is a scammer. (Login to see the detailed trust ratings.) While the bitcointalk.org administration does not verify such claims, you should proceed with extreme caution.
Pages: [1]
  Print  
Author Topic: Arnaud Legoux Moving Average  (Read 2650 times)
Najska
Full Member
***
Offline Offline

Activity: 152
Merit: 100


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!

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

Posts: 1620550460

View Profile Personal Message (Offline)

Ignore
1620550460
Reply with quote  #2

1620550460
Report to moderator
1620550460
Hero Member
*
Offline Offline

Posts: 1620550460

View Profile Personal Message (Offline)

Ignore
1620550460
Reply with quote  #2

1620550460
Report to moderator
knbitcoin
Newbie
*
Offline Offline

Activity: 4
Merit: 0


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
Merit: 100


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.

JackTheBlack
Newbie
*
Offline Offline

Activity: 1
Merit: 0


View Profile
April 28, 2020, 07:49:20 AM
 #4

I can confirm that the 2 should be in the code. In codes without 2 other parts are different, too. So, it is result of other calculation if there is 2 or not.
Tradestation code (open source) for ALMA and many other filters (like very good Ehlers SuperSmoother or advanced Kalman) you can find on www.advantagetrading.net/adv-filters.html
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!