Value Filtering Rule

First - I did not find any ready to go live (there are few staled) topics for shearing rules.
So, I created a new one.

I was experimenting with different approaches how to get solid reliable output from sensors
when output value from a sensor is jumping up and down. Another words, how to create
simple but reliable Low Pass Filter. The example below is related to the Light Sensors but
basically applicable to any sensor with decimal value output. My final algorithm is based on
3 points up/sown slope detection and hysteresis (gap between min and max values).
Almost the same algorithm I am using for filtering noisy signals in my electrical designs.

Here is a rule:

First 3 lines is a Shift Register.
First IF is a Down/Up Slop Detector.
Down Slop is detected when Var3>Var2>Var1
Up Slop is detected when Var1>Var2>Var3
In both cases Var1 holds Min value for the Down Slop or Max value for the Up slop.
Three nested IFs are hysteresis control for the correspondent Virtual Switches.
Switch turns ON when Up Slop is detected and turns OFF when Down Slop is detected.

Filter is tolerant even for the condition when sensor value is increased when
the correspondent light turns on. Fast passing clouds are filtered out. The response
(delay time) for the slow passing clouds is acceptable.

In some cases more stages for the Shift Register may required.
It depend on how fast is a response from sensor.
For the slow sensors the filter response time could be longer than desired.
And of course, for very slow sensors filter is not required at all
(slow sensor itself does the filtering job).

I can see a case for the Custom Filter Application.
For the experienced SW developer putting together this app should take
about 30 min. So, if anybody wants to write this app. please feel free to
use this algorithm and of course, feel free to modify the algorithm.