@Peter_O, it depends. As a matter of fact, in addition to a derivative function I use a smoother, such as Kahlman smoother/filter. It may be any other function that straightens the curve. As you can see, the derivative function (or just the normalized negation of the price) features one important thing: it's getting closer to price as the price begins to revert, and crosses the price as the reversion has completed.
Peter_O
⋅
@capissimo, I didn't have smoothing in mind. What I had in mind was that when market trends DOWN, the sig line is ABOVE the market. But your shortCondition says to go short when sig crossesUNDER the price. ShortCondition should be when sig crossesOVER the price.