Presented here is code for the "Directional Movement w/Hann" indicator originally conceived by John Ehlers. The code is also published in the December 2021 issue of Trader's Tips by Technical Analysis of Stocks & Commodities (TASC) magazine.
John Ehlers is continuing to revamp old indictors with Hann windowing. The original script uses zero line cross to signal buy/sell in this modified version buy/sell is signaled based on slope change, where signal is generated on with previous value is greater/less than current value
If current > previous = buy and if current < previous = sell