πMoving Average Indicators
Moving averages are used to identify trend direction, filter noise, and define entry or exit conditions. This section documents the moving average indicators available and how they are used.
Last updated
-- Using primary asset (window REQUIRED)
local sma_val = sma("15m") -- 15-minute window, default 1-minute resolution
local sma_val = sma("1h", "5m") -- 1-hour window, 5-minute resolution
local sma_val = sma(60, 5) -- 60-minute window, 5-minute resolution
-- Using specific asset (asset + window REQUIRED)
local sma_val = sma("ETH", "15m") -- ETH, 15m window, default 1m resolution
local sma_val = sma("ETH", "15m", "1m") -- ETH, 15m window, 1m resolution-- Using primary asset
local ema_val = ema(14) -- 14 periods, default 1-minute window
local ema_val = ema(14, "15m") -- 14 periods, 15-minute window
local ema_val = ema(20, 60) -- 20 periods, 60-minute window
-- Using specific asset
local ema_val = ema("BTC", 14) -- BTC, 14 periods, default 1m window
local ema_val = ema("BTC", 14, "15m") -- BTC, 14 periods, 15m window-- Using primary asset (all 3 parameters REQUIRED)
local wma_val = wma(14, "15m", 14) -- 14 periods, 15-min window, 14 weights
local wma_val = wma(10, 30, 10) -- 10 periods, 30-min window, 10 weights
-- Using specific asset (all 4 parameters REQUIRED)
local wma_val = wma("BTC", 14, "15m", 14) -- BTC, 14 periods, 15m window, 14 weights-- Using defaults
local macd_val = macd() -- 12, 26, "1m"
-- Custom parameters
local macd_val = macd(12, 26, "15m") -- 15-minute window
local macd_val = macd(9, 21, 60) -- 9, 21 periods, 60-minute window