Appearance

Personalize your experience

Mode
Accent Color
Direction
Analysis Marketplace
QuaScript

Support & Resistance Clusters

Admin's Choice NewFree

Volume-weighted swing clusters as ranked S/R zones

Trendlines & LevelsPrice overlay WebGPU CanvasHybridZonesDashboardSignalsAlerts
quascriptlevelssupportresistancezonesclusters

Favourites and Admin's Choice analyses are listed in the terminal's indicators window under Analysis Marketplace.

Language
QuaScript
Engine
Native C++, incremental on live ticks
Rendering
WebGPU + Canvas
Placement
Price overlay
Settings
7
Plots
2
Lines of code
138
Source
presets/analysis/levels/support_resistance_clusters.qs
Support & Resistance Clustersengine 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)

About

Support and resistance found by clustering swing points. Every confirmed swing high and low is kept with the volume traded on its bar; nearby swings (within the tolerance, in ATR) are merged into one level whose price is their volume-weighted mean. Each level gets a strength score from its number of touches and its volume, and the strongest levels are drawn as zones from their first touch to the right edge, coloured from cool (weak) to hot (strong) on a perceptual ramp. Reading: a zone with many touches and high volume is where size has defended price before; expect reactions there, and treat a close through it as a structural break. The dotted lines are the nearest levels above and below. Signals: breakouts above the nearest resistance cluster and breakdowns below the nearest support cluster.

2
Plotted series
2
Signal marks
2
Drawings
2
Alert rules
7
Settings
120
Lines of code

What it draws

Price overlay · counted from the engine's plot table and the script's draw calls

Series

  • Line2
    Nearest resistanceNearest support
Legend
Nearest resistance Nearest support

Signal marks

Cluster breakoutCluster breakdown

Drawings and chart effects

  • Dashboard tables1 created
  • Zones1 created

How it runs

From source to the live chart, for this script

  1. 1
    Compile

    The QuaScript compiler checks the 138-line script (120 lines of code) and lowers it for the native C++ engine. Compile errors point at the exact line and column.

  2. 2
    Place

    The header sets overlay = true, so everything is drawn on the price chart, on the same scale as the candles.

  3. 3
    Compute

    The script runs once per bar, oldest to newest. Each bar also runs 7 loops (4 for, 3 while). 6 persist variables keep state (objects, counters) across bars. Helper function: cluster().

  4. 4
    Stay live

    On the terminal the script keeps one live engine session: a tick rolls the forming bar back to its checkpoint and re-executes only that bar, and new bars are appended, so history is never rerun while the market moves. The live result is identical to a full run.

  5. 5
    Render

    The results are handed to the chart: series on WebGPU, drawings on the Canvas 2D QuaScript layer.

  6. 6
    Tune

    7 settings in 3 groups appear in the chart's settings dialog. Changing one reruns the engine with the new value.

Rendering

Hybrid: this script draws on 2 surfaces at once

WebGPUSeries renderer

The browser's modern GPU API. The chart uploads every line, band and mark of the script as GPU buffers and draws them in one pass, so dense heatmaps and dozens of series stay smooth while you pan and zoom. Without WebGPU support the chart's GPU layer falls back to WebGL 2, then Canvas 2D.

In this script
  • • 2 plotted series
  • • 2 signal mark types

Chosen by render = webgpu in the header.

WebGLNot used

GPU drawing through WebGL 2, available in every current browser. Used for chart-native profiles and for series that ask for it with backend = "webgl". Fast for large numbers of bars and wide fills.

CanvasUsed

The browser's 2D drawing API. Text-heavy and object-style output (dashboard tables, zones, tags, segments), candle colors and backgrounds are painted by the QuaScript layer, a Canvas 2D surface over the chart. Series use Canvas when the script's header does not ask for a GPU.

In this script
  • • 1 dashboard tables (QuaScript layer)
  • • 1 zones (QuaScript layer)

Alerts

2 alert rules declared with alert.rule

Cluster breakout

Price closed above the nearest resistance cluster

Cluster breakdown

Price closed below the nearest support cluster

Settings

7 settings, grouped as in the chart's settings dialog

Swings
SettingTypeDefaultRange / optionsId
Swing bars leftInteger62 – 50swing_bars_left
Swing bars rightInteger31 – 30swing_bars_right
Swings rememberedInteger8010 – 400swings_remembered
Clusters
SettingTypeDefaultRange / optionsId
Merge tolerance (ATR)Number0.60.1 – 3, step 0.05merge_tolerance_atr
Levels drawnInteger61 – 20levels_drawn
Minimum touchesInteger31 – 10minimum_touches
Signals
SettingTypeDefaultRange / optionsId
Break margin (ATR)Number0.60 – 3, step 0.05break_margin_atr

Script

packages/quascript/presets/analysis/levels/support_resistance_clusters.qs

Header

analysis "Support & Resistance Clusters" {
    overlay = true
    render = webgpu
    short_title = SRC
    max_objects = 60
}
Total lines
138
Code lines
120
Comment lines
13
Helper functions
1
Loops
7
Persistent variables
6
Higher-interval feeds
0
Engine plots
2

Built with

Technical analysis (ta.*)
ta.atrta.pivot_highta.pivot_low
Lists (list.*)
list.clearlist.copylist.createlist.getlist.pushlist.shiftlist.sizelist.sort_by
Math (math.*)
math.is_namath.maxmath.min
Imported modules
viz/premium

Discussion

Sign in to join the discussion. Your posts and replies show up on your profile.