Moving Average % channel (Vlad965)
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
//SMA indicator. Creates two additional SMA around the normal SMA , offset by the specified percentage. This creates the look of a channel.
// © Vlad965
//@version=4
study(title="Moving Average % channel (Vlad965)", shorttitle="MA % channel (Vlad965)", overlay=true, resolution="")

//Settings
per = input(600, minval = 1, maxval = 1000, title = "Length")
src = input(close, title = "Source")
buylevel = input(-26.0, minval = -1000, maxval = 1000, title = "Buy line (lime)")
selllevel = input(431.0, minval = -1000, maxval = 1000, title = "Sell line (red)")

//SMAs
sma = sma(src, per) 
buy = sma * ((100 + buylevel) / 100)
sell = sma * ((100 + selllevel) / 100)
plot(buy, linewidth = 2, color=color.lime, title = "Buy line")
plot(sell, linewidth = 2, color=color.red, title = "Sell line")
plot(sma, linewidth = 2, color=color.black, title = "MA line")