Price delta
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © Crypto-Hamster

//@version=5
indicator(title="Price delta")
Length = input.int(14, minval=1)
Source = input.source(close)
TestMA = ta.sma(close, Length)
Delta = (Source[0] - Source[1])/Source[1] * 100
DeltaRatio = (close - TestMA) * 100 / close
plot(Delta, color=color.white, title="Delta")
plot(DeltaRatio, color=color.lime, title="Delta")