1

I have a monitoring application in python 2.6 that calculates the number of entries in a queue (queue_len). I want to create a simple function that can use these queue_len rate of change values over time and extract a trend from them.

The goal is to start up or shut down queue processing nodes depending of the +ive or -ive trend over time and not flip flop.

MACD from the financial arena looks sort of what I need or does it? Looking for any help here.

David Kierans
  • 1,599
  • 1
  • 16
  • 24

1 Answers1

1

Isn't that just a simple derivative?

def derivs(l):
  return [l[i + 1] - l[i] for i in range(len(l) - 1)]
Blender
  • 289,723
  • 53
  • 439
  • 496
  • Yes for sure this derivative is part of what I'm after. I would see the solution as somehow using this first derivative of the moving averages and then applying another function/formula to that which would magically tell me when a certain high or low threshold value has been triggered i.e., the trend has reversed or some such. Does that make sense? – David Kierans May 22 '11 at 03:22
  • Then do just that ;) `numpy` will be a good module to use for this, as it contains many number-crunching functions. – Blender May 22 '11 at 03:28
  • Because nobody chimed in here with a piece of code that I could just slot in to solve my problem I took your advice and had to do it myself! – David Kierans May 29 '11 at 05:21
  • Mind posting how you did it? I bet it would save others with the same problem a few hours of coding. – Blender May 29 '11 at 05:23
  • 2nd @Blender's suggestion of posting your code - I am interested in exactly this ability to estimate trend and trend change of an underlying value set – venzen Jul 18 '13 at 14:22