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

Language showcases

Oscillator Selector

analysis · presets/analysis/advanced/enum_oscillator_switch.qs

An enum-driven choice of oscillator. The subject of the match is a param, so only the selected oscillator is computed and no conditional-state warning is raised.

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)
enum_oscillator_switch.qs
analysis "Oscillator Selector" {
    overlay = false
}
// An enum-driven choice of oscillator. The subject of the match is a param, so only the
// selected oscillator is computed and no conditional-state warning is raised.
enum OscType {
    rsi(title = "Relative Strength")
    macd(title = "MACD Momentum")
    cci(title = "Commodity Channel")
}
choice = param.choice(OscType.rsi, title = "Oscillator")
len = param.int(14, title = "Period", min = 2, max = 100)

osc = match choice {
    case OscType.rsi { ta.rsi(close, len) }
    case OscType.macd {
        (line, _, _) = ta.macd(close, 12, 26, 9)
        line
    }
    case OscType.cci { ta.cci(bar.typical, len) }
}
hi = choice == OscType.cci ? 100 : choice == OscType.macd ? 0 : 70
lo = choice == OscType.cci ? -100 : choice == OscType.macd ? 0 : 30

render.line(osc, "Oscillator", color = color.purple.500, width = 2)
render.line(hi, "Upper", color = color.rose.500, stroke = style.dashed, width = 1)
render.line(lo, "Lower", color = color.emerald.500, stroke = style.dashed, width = 1)
render.mark(ta.cross_up(osc, hi), shape = shape.triangle_down, at = anchor.above_bar, color = color.rose.500, text = "OB")
render.mark(ta.cross_down(osc, lo), shape = shape.triangle_up, at = anchor.below_bar, color = color.emerald.500, text = "OS")
alert.rule(ta.cross_up(osc, hi), "Overbought", "The selected oscillator entered the upper zone")
alert.rule(ta.cross_down(osc, lo), "Oversold", "The selected oscillator entered the lower zone")

Pivot Points (struct)

analysis · presets/analysis/advanced/pivot_points_udt.qs

A struct tracks the last confirmed pivot; drawing tags label each pivot on the bar it formed.

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)
pivot_points_udt.qs
analysis "Pivot Points (struct)" {
    overlay = true
}
// A struct tracks the last confirmed pivot; drawing tags label each pivot on the bar it formed.
legs = param.int(10, title = "Pivot legs", min = 2, max = 50)

struct PivotPoint {
    price: float = na
    bar: int = 0
    is_high: bool = true
    fn label(self) -> text { return self.is_high ? "PH" : "PL" }
}

ph = ta.pivot_high(legs, legs)
pl = ta.pivot_low(legs, legs)
persist last = PivotPoint()
if not math.is_na(ph) {
    last := PivotPoint(price = ph, bar = bar.index - legs, is_high = true)
    draw.tag.create(last.bar, last.price, last.label(), color = color.rose.500, shape = shape.tag_down)
}
if not math.is_na(pl) {
    last := PivotPoint(price = pl, bar = bar.index - legs, is_high = false)
    draw.tag.create(last.bar, last.price, last.label(), color = color.emerald.500, shape = shape.tag_up)
}
render.dots(ph, "Pivot highs", color = color.rose.500, shape = shape.cross, size = 4)
render.dots(pl, "Pivot lows", color = color.emerald.500, shape = shape.cross, size = 4)
render.step(last.price, "Last pivot", color = last.is_high ? color.rose.300 : color.emerald.300, width = 1)

© 2026 Quatick Technologies. All rights reserved.