Appearance
Personalize your experience
Risk Ladder Trail
Admin's Choice NewFreeTrailing stop with live 1R / 2R / 3R ladders, risk and reward zones
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
- 5
- Plots
- 8
- Lines of code
- 88
- Source
- presets/analysis/gpu/risk_ladder_trail.qs
About
A complete trade plan on the chart. An ATR supertrend decides the side and trails the stop; every flip opens a new leg whose risk (entry to the initial stop) defines R. From there the ladder draws the 1R, 2R and 3R targets, fills the risk zone (entry to stop) and the reward zone (entry to 3R), and tags each target the first time it is reached. The dashboard reports the live leg: side, entry, stop, the size of R and the open R multiple, so position size and expectancy are always one glance away.
What it draws
Price overlay · counted from the engine's plot table and the script's draw calls
Series
- Line5 visible · 3 helperTrailing stopEntryTarget 1Target 2Target 3
- Band fills (render.band calls)4
Signal marks
Drawings and chart effects
- Dashboard tables1 created
- Tags3 created
How it runs
From source to the live chart, for this script
- 1Compile
The QuaScript compiler checks the 88-line script (76 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. 8
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 WebGPU, drawings on the Canvas 2D QuaScript layer.
- 6Tune
5 settings in 2 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
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.
- • 8 plotted series
- • 4 band fill calls
- • 2 signal mark types
Chosen by render = webgpu in the header.
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.
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.
- • 1 dashboard tables (QuaScript layer)
- • 3 tags (QuaScript layer)
Alerts
1 alert rule declared with alert.rule
The trail flipped; a new leg_risk ladder starts at this close
Settings
5 settings, grouped as in the chart's settings dialog
| Setting | Type | Default | Range / options | Id |
|---|---|---|---|---|
| ATR multiple | Number | 3 | 0.5 – 10, step 0.1 | atr_multiple |
| ATR length | Integer | 10 | 2 – 200 | atr_length |
| Setting | Type | Default | Range / options | Id |
|---|---|---|---|---|
| Target 1 (R) | Number | 1 | 0.25 – 10, step 0.25 | target_1_r |
| Target 2 (R) | Number | 2 | 0.25 – 10, step 0.25 | target_2_r |
| Target 3 (R) | Number | 3 | 0.25 – 20, step 0.25 | target_3_r |
Script
packages/quascript/presets/analysis/gpu/risk_ladder_trail.qs
Header
analysis "Risk Ladder Trail" {
overlay = true
render = webgpu
max_objects = 300
}- Total lines
- 88
- Code lines
- 76
- Comment lines
- 7
- Helper functions
- 0
- Loops
- 0
- Persistent variables
- 8
- Higher-interval feeds
- 0
- Engine plots
- 8
Built with
ta.supertrendmath.absmath.is_namath.max
Discussion