Natenberg's Volatility
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © crypteisfuture

//@version=5
indicator("Natenberg's Volatility")

smooth = input.int(14, title = 'SMA Smooth Length')

natenberg_daily             = ta.stdev( math.log( close / close[1] ), 10 ) * math.sqrt( 365 )
natenberg_weekly            = ta.stdev( math.log( close / close[1] ), 10 ) * math.sqrt( 365 / 7 )

volatility_smoothed         = ta.sma(natenberg_daily, smooth)

plot(natenberg_daily, color             = color.new(color.aqua, 0))
plot(volatility_smoothed, color         = color.new(color.maroon, 0))

//plot(natenberg_weekly, color         = color.new(color.maroon, 0))