Appearance
Personalize your experience
Williams Fractals
Admin's Choice NewWilliams Fractals 5-bar structural swing turning points with trailing breakout and breakdown trigger lines
Favourites and Admin's Choice analyses appear in the terminal's indicators window under Analyses.
- Language
- QuaScript
- Engine
- Native C++, incremental on live ticks
- Rendering
- WebGL
- Placement
- Price overlay
- Settings
- 0
- Plotted series
- 4
- Lines of code
- 36
- Source
- presets/analysis/levels/williams_fractals.qs
About
Bill Williams Fractals identify turning points on a price chart through a 5-bar swing geometric formation: Bearish Fractal (Resistance Peak): Bar with the highest high preceded by 2 lower highs and followed by 2 lower highs. Bullish Fractal (Support Trough): Bar with the lowest low preceded by 2 higher lows and followed by 2 higher lows. Confirmed fractals plot structural swing pivots and establish trailing breakout trigger lines.
What it draws
Price overlay · counted from the engine's plot table and the script's draw calls
Series
- Line2Trailing Top FractalTrailing Bottom Fractal
- Dots2Fractal HighsFractal Lows
- Band fills (render.band calls)1
Signal marks
No bar marks.
Drawings and chart effects
No drawings; everything is plotted series.
How it runs
From source to the live chart, for this script
- 1Compile
The QuaScript compiler checks the 36-line script (25 lines of code) and lowers it for the native C++ engine. Compile errors point at the exact line and column.
- 2Place
The header sets
overlay = true, so everything is drawn on the price chart, on the same scale as the candles. - 3Compute
The script runs once per bar, oldest to newest. 2
persistvariables keep state (objects, counters) across bars. - 4Stay 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.
- 5Render
The results are handed to the chart: series on WebGL.
- 6Tune
The script has no settings.
Rendering
This script draws on WebGL
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.
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.
- • 4 plotted series
- • 1 band fill call
Chosen by render = webgl in the header.
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.
Signals
4 signal rules declared with signal.rule
Williams Bearish Fractal peak confirmed at swing high
Williams Bullish Fractal trough confirmed at swing low
Price broke out above trailing fractal swing high
Price broke down below trailing fractal swing low
Settings
This script has no settings.
Script
packages/quascript/presets/analysis/levels/williams_fractals.qs
Header
analysis "Williams Fractals" {
overlay = true
render = webgl
precision = 2
short_title = Fractals
}- Total lines
- 36
- Code lines
- 25
- Comment lines
- 4
- Helper functions
- 0
- Loops
- 0
- Persistent variables
- 2
- Higher-interval feeds
- 0
- Engine plots
- 4
Built with
ta.cross_downta.cross_upta.pivot_highta.pivot_lowmath.is_na
Discussion