I'm wondering if it would actually be possible to calculate exponential 
moving average using a tick script.

for instance where exponential moving average for number of pings in a time 
period would be calculated as follows:

Multiplier: (2 / (Time periods + 1) ) = (2 / (10 + 1) ) = 0.1818 (18.18%)

EMA: ((# of pings for some period - last plotted EMA point) x multiplier) + 
last plotted EMA point


To do this I need to do something like



var currentPings = batch
        |query('select sum(count) from telegraf.seven_days.pos_heartbeat')
                .every(1m)
                .period(1m)
                .groupBy(time(1m), 'fingerprint')
                .align()
                .offset(1m)

var pingsWithMultiplier = currentPings
        |eval(lambda: 2.0 / (10.0 + 1.0), lambda: "sum" + 0.0)
                .as('multiplier', 'total')

var lastEma = batch
       |query('select last(avg) from telegraf.seven_days.pos_heartbeat_ema')
              .groupBy('fingerprint')

---- at this point I need a way to combine lastEma and pingsWIthMultiplier 
nodes on tags where 'fingerprint' == 'fingerprint' ---

Based on the documentation I've read, there's not currently a good way to 
do this. Am I missing something? Thanks in advance for any guidance! 


-- 
Remember to include the version number!
--- 
You received this message because you are subscribed to the Google Groups 
"InfluxData" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/influxdb.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/influxdb/fd4681fa-f991-4807-b46b-f639bfffe890%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to