π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.
Most strategies rely on one or two moving average patterns; the examples below illustrate common building blocks rather than prescriptive templates.
What is a Moving Average? A trend-following indicator. Displayed in a value or visual line calculated based on average price over time.
Range: It calculates the average of past prices to filter out short-term noise. If the price is consistently trading above the moving average, the trend is considered up. If the price is consistently trading below the moving average, the trend is considered down.
Supported technical indicators feature:
Formula: SMA = (A1 + A2 + β¦ + An) / n
SMA factores the sum of closing prices over a specific period and dividing the total by the number of periods. Closing prices have equal weights.
In other words, it calculates arithmetic mean of closing prices over a time window. Results are cached for performance (1-minute TTL).
Parameters:
window string or number Time window as duration string ("15m", "1h") or minutes (REQUIRED)
resolution string or number Bar resolution as duration string ("1m", "5m") or minutes (default "1m")
Returns:
number SMA value (returns 0 if no bars found)
Usage:
Common representation in LUA code as SMA(n), where n is the number of periods.
Formula: EMA = (Current Price Γ (2 / (N + 1))) + (Previous EMA Γ (1 β (2 / (N + 1)))
Is calculated using the Simple Moving Average (SMA) but assigning higher weights to recent prices.
In other words, to calculate the EMA one must be using a multiplier-based approach: multiplier = 2 / (periods + 1). Applies weighted multipliers to SMA values at each period.
Parameters:
periods number Number of periods (REQUIRED)
window string or number Time window as duration string ("15m", "1h") or minutes (default "1m")
Returns:
number EMA value
Usage:
Representation in LUA code as EMA(x), where x is the number of periods.
Formula: WMA = [(Priceβ Γ n) + (Priceβ Γ (n β 1)) +β¦ + Priceβ] / [n Γ (n + 1) / 2]
Similar to EMA, places greater emphasis on recent prices by assigning them higher importance,. the formula features a linear weighting method, making it less sensitive to recent price changes.
In other words, for calculating WMA one must use descending weights: denominator = (weights + 1) * weights / 2. More recent periods receive higher weights in descending order.
Parameters:
periods number Number of periods (REQUIRED)
window string or number Time window as duration string ("15m", "1h") or minutes (REQUIRED)
weights number Number of descending weights to apply (REQUIRED)
Returns:
number WMA value
Usage:
Representation in LUA code as EMA(x), where x is the number of periods.
Moving Average Convergence Divergence (MACD) Calculates MACD as the difference between fast and slow EMAs. Formula: fast_ema - slow_ema Note: Does NOT support asset name parameter (always uses primary asset).
Parameters:
small_periods number Fast EMA periods (default: 12) (default 12)
large_periods number Slow EMA periods (default: 26, must be > small_periods) (default 26)
window string or number Time window as duration string ("15m", "1h") or minutes (default "1m")
Returns:
number MACD value (fast EMA - slow EMA)
Usage:
Fields
periods
periods number Number of periods (REQUIRED)
window ? string|number Time window as duration string ("15m", "1h") or minutes (default: "1m")
window
window string|number Time window as duration string or minutes (REQUIRED)
resolution ? string|number Bar resolution as duration string or minutes (default: "1m")
periods
periods number Number of periods (REQUIRED)
window string|number Time window as duration string or minutes (REQUIRED)
weights number Number of descending weights to apply (REQUIRED)
small_periods
small_periods ? number Fast EMA periods (default: 12)
large_periods ? number Slow EMA periods (default: 26, must be > small_periods)
window ? string|number Time window as duration string ("15m", "1h") or minutes (default: "1m")
Last updated