//@version=6 indicator(title="Average True Range", shorttitle="ATR", overlay=false, timeframe="", timeframe_gaps=true) length = input.int(title="Length", defval=14, minval=1) smoothing = input.string(title="Smoothing", defval="RMA", options=["RMA", "SMA", "EMA", "WMA"]) ma_function(source, length) => switch smoothing "RMA" => ta.rma(source, length) "SMA" => ta.sma(source, length) "EMA" => ta.ema(source, length) => ta.wma(source, length) plot(ma_function(ta.tr(true), length), title = "ATR", color=color.new(#B71C1C, 0))