Trend Reversal Detection
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © peacefulLizard50262

//@version=5
indicator("Trend Reversal Detection", overlay = true)
import peacefulLizard50262/peacefulIndicators/1 as p 

src       = input.source(close, "Source")
rocLength = input.int(10)
maLength  = input.int(10)
maType    = input.string("ema", "MA Style", ["sma", "ema", "wma"])

[reversalDirection, reversalPoint] = p.trendReversalDetection(src, rocLength, maLength, maType) 

colour = reversalDirection == -1 ? color.orange : color.blue

plot(reversalPoint, "Reversal Point", colour)

