Calculate EMA using SV's/History lists

Share your automation file with other users.
Post Reply
User avatar
mcgoo
Posts: 898
Joined: Thu Jul 18, 2013 12:30 pm

Hi. Was advised by support to post this request here. As an exercise (maybe in futility but should be fun to try anyway :P ) I would like to be able to calculate the EMA (like the one you can add to charts) using SV's and/or history lists (variable periods) for use in horse racing (back,lay or LTP-not fussed.) I have had a go myself but can't seem to get it right. Any help to create a baf appreciated. Cheers :D
mono88
Posts: 5
Joined: Tue Jan 10, 2023 8:15 pm

I would like an answer to this too, does anyone reply in this forum anymore…?
User avatar
ShaunWhite
Posts: 9731
Joined: Sat Sep 03, 2016 3:42 am

EMA = Closing price x multiplier + EMA (previous day) x (1-multiplier)

So, the multiplier can be a constant or a simple calc, it's just
[2 ÷ (number of observations + 1)]

Then at the required frequency .....
EMA = price x multiplier + EMAprev x (1-multiplier)
EMAprev = EMA
..and repeat

The calc only needs to remember the prev EMA not a whole history. The shorter the number of observations, the larger the multiplier, and that gives more weight to the current price (the price x multiplier part) than the previous EMA (the EMAprev x (1-multiplier) part). Long observations, smaller muliplier, opposite effect.

You'll need to translate that into Guardianese. That part is beyond my pay grade :) Hope it helps.
Last edited by ShaunWhite on Fri Jan 27, 2023 1:57 am, edited 1 time in total.
Post Reply

Return to “Bet Angel Automation - Shared files”