Detect a changing value

I have a tag whose value continuously increases/ decreases in real time. How can I detect if the value is increasing or decreasing and then display it?

Depending on a lot of things, a quick way would be something like this.
Create two memory tags, one named Increasing and one Decreasing, both of boolean type, then in the real time tags value changed event script add the following code.

if initialChange:
	return

increasing = currentValue.value > previousValue.value

writes = {"Increasing" : increasing,
	      "Decreasing" : not increasing}

system.tag.writeAll(writes.keys(), writes.values())

If the realtime tag ‘flickers’ a lot, this might need some adjustment though. Also, if the tag is steady, the last increasing or decreasing state is held