Condition applied to traces by slider values

Hello there, I am trying to create an interactive plot to see graphically what it’s going on with derivatives. Until now, I can show the function and the slope with a little message that shows you if the function has a positive, negative, or null slope.
But if you go from right to left, the slope should be different from the left to right. Is there any way to take into account the direction of the values in the slider?