Appearance

Personalize your experience

Mode
Accent Color
Direction
All Docs/QuaScript//
QuaScript logo

QuaScript Documentation

Language guide, engine API, 601 builtins and the preset library · v3.0.0-phase1

Moving averages

Adaptive Average Suite

analysis · presets/analysis/ma/adaptive_suite.qs · uses stats/filters, viz/palette

Pick any average from the stats/filters library, compare it with a Kaufman / Jurik / Legoux reference, and tint the bars by where price sits inside an ATR envelope.

QuaScriptengine result
Loading the engine result…
quatick-charts · QuaScript engine on synthetic 1-minute bars · drag to pan · scroll to zoom · Run executes the script on the engine (⌘/Ctrl+Enter while editing)
adaptive_suite.qs
analysis "Adaptive Average Suite" {
    overlay = true
}
/// Pick any average from the stats/filters library, compare it with a Kaufman / Jurik / Legoux
/// reference, and tint the bars by where price sits inside an ATR envelope.
use "stats/filters" as flt
use "viz/palette" as pal

kind  = param.choice(flt.Average.hull, title = "Average")
len   = param.int(34, title = "Length", min = 2, max = 500)
env   = param.float(1.5, title = "Envelope (ATR)", min = 0.1, max = 10, step = 0.1)

base = flt.average(close, len, kind)
kama = ta.kaufman(close, len)
alma = ta.legoux(close, len, 0.85, 6)
a = ta.atr(len)
up = base + a * env
dn = base - a * env

p_base = render.line(base, "Selected average", color = pal.ACCENT, width = 2)
render.line(kama, "Kaufman", color = color.sky.400, width = 1, stroke = style.dashed)
render.line(alma, "Legoux", color = color.violet.400, width = 1, stroke = style.dotted)
p_up = render.line(up, "Envelope top", color = color.slate.500, width = 1)
p_dn = render.line(dn, "Envelope bottom", color = color.slate.500, width = 1)
render.band(p_up, p_base, color = pal.BEAR, opacity = 0.06)
render.band(p_base, p_dn, color = pal.BULL, opacity = 0.06)
pos = math.clamp((close - dn) / math.max(up - dn, 1e-12), 0, 1)
render.candle_color(color.gradient(pos, 0, 1, pal.BEAR, pal.BULL))
render.mark(ta.cross_up(close, up), shape = shape.arrow_up, at = anchor.below_bar, color = pal.BULL, text = "Breakout")
render.mark(ta.cross_down(close, dn), shape = shape.arrow_down, at = anchor.above_bar, color = pal.BEAR, text = "Breakdown")

Untitled

analysis · presets/analysis/ma/dema.qs

Double Exponential Moving Average (DEMA) with Triangle Markers

QuaScriptengine result
Loading the engine result…
quatick-charts · QuaScript engine on synthetic 1-minute bars · drag to pan · scroll to zoom · Run executes the script on the engine (⌘/Ctrl+Enter while editing)
dema.qs
analysis "Untitled" {
    render  = canvas
    overlay = true
}
// Double Exponential Moving Average (DEMA) with Triangle Markers
len = param.float(20, "length", min=1, max=500)

val = ta.dema(close, len)
render.line(val, "DEMA", color=color.purple.500, width=2)
render.candle_color(close > val ? color.emerald.500 : color.rose.500)

render.mark(ta.cross_up(close, val), shape=shape.triangle_up, text="DEMA BUY", color=color.emerald.500, at=anchor.below_bar)
render.mark(ta.cross_down(close, val), shape=shape.triangle_down, text="DEMA SELL", color=color.rose.500, at=anchor.above_bar)

alert.rule(ta.cross_up(close, val), "DEMA Bullish Cross", "Price crossed above DEMA")
alert.rule(ta.cross_down(close, val), "DEMA Bearish Cross", "Price crossed below DEMA")

Untitled

analysis · presets/analysis/ma/ema.qs

Exponential Moving Average (EMA) with Spline Smoothing & Candle Coloring

QuaScriptengine result
Loading the engine result…
quatick-charts · QuaScript engine on synthetic 1-minute bars · drag to pan · scroll to zoom · Run executes the script on the engine (⌘/Ctrl+Enter while editing)
ema.qs
analysis "Untitled" {
    render  = canvas
    overlay = true
}
// Exponential Moving Average (EMA) with Spline Smoothing & Candle Coloring
len = param.float(20, "length", min=1, max=500)

val = ta.ema(close, len)
render.spline(val, "EMA", color=color.amber.500, width=2)
render.candle_color(close > val ? color.emerald.500 : color.rose.500)

render.mark(ta.cross_up(close, val), shape=shape.arrow_up, text="CROSS ABOVE", color=color.emerald.500, at=anchor.below_bar)
render.mark(ta.cross_down(close, val), shape=shape.arrow_down, text="CROSS BELOW", color=color.rose.500, at=anchor.above_bar)

alert.rule(ta.cross_up(close, val), "EMA Bullish Cross", "Price crossed above EMA")
alert.rule(ta.cross_down(close, val), "EMA Bearish Cross", "Price crossed below EMA")

Untitled

analysis · presets/analysis/ma/ma_ribbon.qs

Multi-Horizon Moving Average Ribbon with Spline Curves & Golden Cross Shapes

QuaScriptengine result
Loading the engine result…
quatick-charts · QuaScript engine on synthetic 1-minute bars · drag to pan · scroll to zoom · Run executes the script on the engine (⌘/Ctrl+Enter while editing)
ma_ribbon.qs
analysis "Untitled" {
    render  = canvas
    overlay = true
}
// Multi-Horizon Moving Average Ribbon with Spline Curves & Golden Cross Shapes
ma20  = ta.sma(close, 20)
ma50  = ta.sma(close, 50)
ma100 = ta.sma(close, 100)
ma200 = ta.sma(close, 200)

p1 = render.spline(ma20,  "SMA 20",  color=color.blue.500, width=1)
p2 = render.spline(ma50,  "SMA 50",  color=color.cyan.500, width=1)
p3 = render.spline(ma100, "SMA 100", color=color.amber.500, width=2)
p4 = render.spline(ma200, "SMA 200", color=color.pink.500, width=2)

render.band(p1, p2, color=color.blue.500, opacity=0.08, title="Short Ribbon")
render.band(p3, p4, color=color.amber.500, opacity=0.08, title="Long Ribbon")

render.mark(ta.cross_up(ma20, ma50), shape=shape.arrow_up, text="FAST BULL CROSS", color=color.emerald.500, at=anchor.below_bar)
render.mark(ta.cross_down(ma20, ma50), shape=shape.arrow_down, text="FAST BEAR CROSS", color=color.rose.500, at=anchor.above_bar)
render.mark(ta.cross_up(ma50, ma200), shape=shape.star, text="GOLDEN CROSS", color=color.yellow.500, at=anchor.below_bar)
render.mark(ta.cross_down(ma50, ma200), shape=shape.cross, text="DEATH CROSS", color=color.rose.500, at=anchor.above_bar)

alert.rule(ta.cross_up(ma50, ma200), "Golden Cross", "50 SMA crossed above 200 SMA")
alert.rule(ta.cross_down(ma50, ma200), "Death Cross", "50 SMA crossed below 200 SMA")

EMA Ribbon Gradient Cloud

analysis · presets/analysis/ma/ribbon_gradient_cloud.qs · uses viz/palette

Six Fibonacci EMAs (8 .. 89) unrolled at compile time. Each line is colored by its slope, the ribbon between the fastest and slowest line is a gradient band whose colors follow the ribbon order, and a mark fires when the ribbon becomes fully stacked.

QuaScriptengine result
Loading the engine result…
quatick-charts · QuaScript engine on synthetic 1-minute bars · drag to pan · scroll to zoom · Run executes the script on the engine (⌘/Ctrl+Enter while editing)
ribbon_gradient_cloud.qs
analysis "EMA Ribbon Gradient Cloud" {
    overlay = true
}
/// Six Fibonacci EMAs (8 .. 89) unrolled at compile time. Each line is colored by its slope,
/// the ribbon between the fastest and slowest line is a gradient band whose colors follow the
/// ribbon order, and a mark fires when the ribbon becomes fully stacked.
use "viz/palette" as pal

src = param.source(close, title = "Source")

persist stacked_up = false
persist stacked_dn = false
up_count = 0
for len in [8, 13, 21, 34, 55, 89] {
    e = ta.ema(src, len)
    rising = e > e[1]
    if rising { up_count := up_count + 1 }
    render.line(e, str.format("EMA {}", len), color = rising ? color.emerald.400 : color.rose.400, width = len >= 55 ? 2 : 1)
}
fast = ta.ema(src, 8)
slow = ta.ema(src, 89)
p_fast = render.line(fast, "Ribbon top", color = color.transparent, width = 0)
p_slow = render.line(slow, "Ribbon base", color = color.transparent, width = 0)
render.band(p_fast, p_slow, texture = "gradient", upper_color = pal.BULL, lower_color = pal.BEAR, opacity = 0.22, title = "Ribbon")

all_up = up_count == 6 and ta.ema(src, 8) > ta.ema(src, 21) and ta.ema(src, 21) > ta.ema(src, 55)
all_dn = up_count == 0 and ta.ema(src, 8) < ta.ema(src, 21) and ta.ema(src, 21) < ta.ema(src, 55)
render.mark(all_up and not stacked_up, shape = shape.triangle_up, at = anchor.below_bar, color = pal.BULL, text = "Stacked")
render.mark(all_dn and not stacked_dn, shape = shape.triangle_down, at = anchor.above_bar, color = pal.BEAR, text = "Stacked")
stacked_up := all_up
stacked_dn := all_dn
alert.rule(all_up, "Ribbon stacked up", "All six averages rising and in order")
alert.rule(all_dn, "Ribbon stacked down", "All six averages falling and in order")

Untitled

analysis · presets/analysis/ma/sma.qs

Simple Moving Average (SMA) Dual Cross with Cloud Fill

QuaScriptengine result
Loading the engine result…
quatick-charts · QuaScript engine on synthetic 1-minute bars · drag to pan · scroll to zoom · Run executes the script on the engine (⌘/Ctrl+Enter while editing)
sma.qs
analysis "Untitled" {
    render  = canvas
    overlay = true
}
// Simple Moving Average (SMA) Dual Cross with Cloud Fill
fast_len = param.float(20, "fast_length", min=1, max=200)
slow_len = param.float(50, "slow_length", min=1, max=500)

fast_ma = ta.sma(close, fast_len)
slow_ma = ta.sma(close, slow_len)

p_fast = render.line(fast_ma, "Fast SMA", color=color.blue.500, width=2)
p_slow = render.line(slow_ma, "Slow SMA", color=color.amber.500, width=2)

render.band(p_fast, p_slow, color=color.blue.500, opacity=0.10, title="SMA Trend Cloud")

render.mark(ta.cross_up(fast_ma, slow_ma), shape=shape.triangle_up, text="BULL CROSS", color=color.emerald.500, at=anchor.below_bar)
render.mark(ta.cross_down(fast_ma, slow_ma), shape=shape.triangle_down, text="BEAR CROSS", color=color.rose.500, at=anchor.above_bar)

alert.rule(ta.cross_up(fast_ma, slow_ma), "SMA Bullish Cross", "Fast SMA crossed above Slow SMA")
alert.rule(ta.cross_down(fast_ma, slow_ma), "SMA Bearish Cross", "Fast SMA crossed below Slow SMA")

Untitled

analysis · presets/analysis/ma/tema.qs

Triple Exponential Moving Average (TEMA) with Arrow Marks

QuaScriptengine result
Loading the engine result…
quatick-charts · QuaScript engine on synthetic 1-minute bars · drag to pan · scroll to zoom · Run executes the script on the engine (⌘/Ctrl+Enter while editing)
tema.qs
analysis "Untitled" {
    render  = canvas
    overlay = true
}
// Triple Exponential Moving Average (TEMA) with Arrow Marks
len = param.float(20, "length", min=1, max=500)

val = ta.tema(close, len)
render.line(val, "TEMA", color=color.pink.500, width=2)
render.candle_color(close > val ? color.emerald.500 : color.rose.500)

render.mark(ta.cross_up(close, val), shape=shape.arrow_up, text="TEMA BUY", color=color.emerald.500, at=anchor.below_bar)
render.mark(ta.cross_down(close, val), shape=shape.arrow_down, text="TEMA SELL", color=color.rose.500, at=anchor.above_bar)

alert.rule(ta.cross_up(close, val), "TEMA Bullish Cross", "Price crossed above TEMA")
alert.rule(ta.cross_down(close, val), "TEMA Bearish Cross", "Price crossed below TEMA")

Untitled

analysis · presets/analysis/ma/vwma.qs

Volume Weighted Moving Average (VWMA) with Volume Confluence

QuaScriptengine result
Loading the engine result…
quatick-charts · QuaScript engine on synthetic 1-minute bars · drag to pan · scroll to zoom · Run executes the script on the engine (⌘/Ctrl+Enter while editing)
vwma.qs
analysis "Untitled" {
    render  = canvas
    overlay = true
}
// Volume Weighted Moving Average (VWMA) with Volume Confluence
len = param.int(20, title = "Length", min = 1, max = 500)

val = ta.vwma(close, len)
benchmark = ta.sma(close, len)

p_vwma = render.line(val, "VWMA", color=color.emerald.500, width=2)
p_sma  = render.line(benchmark, "SMA Ref", color=color.slate.500, width=1)

render.band(p_vwma, p_sma, color=color.emerald.500, opacity=0.10, title="Volume Premium")

render.mark(ta.cross_up(val, benchmark), shape=shape.star, text="VOL EXPANSION", color=color.yellow.500, at=anchor.below_bar)
render.mark(ta.cross_down(val, benchmark), shape=shape.x, text="VOL CONTRACTION", color=color.rose.500, at=anchor.above_bar)

alert.rule(ta.cross_up(val, benchmark), "VWMA Above SMA", "Volume-weighted price crossed above SMA")
alert.rule(ta.cross_down(val, benchmark), "VWMA Below SMA", "Volume-weighted price crossed below SMA")

Untitled

analysis · presets/analysis/ma/wma.qs

Weighted Moving Average (WMA) with Candle Tint & Diamond Markers

QuaScriptengine result
Loading the engine result…
quatick-charts · QuaScript engine on synthetic 1-minute bars · drag to pan · scroll to zoom · Run executes the script on the engine (⌘/Ctrl+Enter while editing)
wma.qs
analysis "Untitled" {
    render  = canvas
    overlay = true
}
// Weighted Moving Average (WMA) with Candle Tint & Diamond Markers
len = param.float(20, "length", min=1, max=500)

val = ta.wma(close, len)
render.line(val, "WMA", color=color.cyan.500, width=2)
render.candle_color(close > val ? color.emerald.500 : color.rose.500)

render.mark(ta.cross_up(close, val), shape=shape.diamond, text="WMA BUY", color=color.emerald.500, at=anchor.below_bar)
render.mark(ta.cross_down(close, val), shape=shape.diamond, text="WMA SELL", color=color.rose.500, at=anchor.above_bar)

alert.rule(ta.cross_up(close, val), "WMA Bullish Cross", "Price crossed above WMA")
alert.rule(ta.cross_down(close, val), "WMA Bearish Cross", "Price crossed below WMA")

© 2026 Quatick Technologies. All rights reserved.