The main idea is to consider that the change of a trend is not MA crossing, but the output prices of a flat zone. In other words, in flat (perhaps more appropriately be called "dead") zone, deals are not concluded, which can serve as a kind of filter to filter out false crossings of the Moving Average.
Translated from Russian by MetaQuotes Software Corp.
Original code: https://www.mql5.com/ru/code/1270
The Price Channel indicator. It draws the line of high and low price values for the last N bars from high timeframeOsHMA
The OsHMA oscillator is the indicator of the difference between two HMA (between two Hull Moving Averages).