Tradingview sma
Average True Range script for TradingView Pine · Kodify Else another if statement checks if atrSmooth matches ‘SMA’. When that evaluates to true we use the sma() function for the ATR. When that's neither the case we default to using a Weighted Moving Average (WMA). For that we call TradingView's wma() function, and have it run on tr values for a length of atrLen bars.