Type/to search
Built-in Functions
Structures
Ticker
Depth
OrderBook
Trade
Record
Market
Order
Condition
Account
Asset
Position
Funding
Other Structures
HttpQuery-options
HttpQuery-return
LogStatus-table
LogStatus-btnTypeOne
LogStatus-btnTypeTwo
Status Bar Components
grid
tabs
kpi
stat
progress
gauge
sparkline
chart
heatmap
calendar
histogram
pie
timeline
markdown
alert
badge
Chart-options
Chart-return
KLineChart-options
KLineChart-return
SetData-data
EventLoop-return
exchange.Go-return
DBExec-return
Dial-return
Thread.join-return
Built-in Variables and Constants
Conventions
Exchanges

Shows where a value sits in a range on a half-circle dial, with optional threshold colors; for RSI, exposure or risk.

Examples

Shows where the last price sits in the 24-hour high-low range, changing color near the ends.

javascript
function main() { var r = exchange.GetRecords(PERIOD_H1) if (!r || r.length < 24) return var bars = r.slice(-24) var hi = Math.max.apply(null, bars.map(function (b) { return b.High })) var lo = Math.min.apply(null, bars.map(function (b) { return b.Low })) var pos = hi > lo ? (bars[23].Close - lo) / (hi - lo) : 0.5 var levels = [{value: 0, color: "down"}, {value: 0.2, color: "primary"}, {value: 0.8, color: "up"}] LogStatus({type: "gauge", title: "Position in 24h range", value: pos, format: {percent: true}, thresholds: levels}) }
python
def main(): r = exchange.GetRecords(PERIOD_H1) if not r or len(r) < 24: return bars = r[-24:] hi = max(b["High"] for b in bars) lo = min(b["Low"] for b in bars) pos = (bars[-1]["Close"] - lo) / (hi - lo) if hi > lo else 0.5 levels = [{"value": 0, "color": "down"}, {"value": 0.2, "color": "primary"}, {"value": 0.8, "color": "up"}] LogStatus({"type": "gauge", "title": "Position in 24h range", "value": pos, "format": {"percent": True}, "thresholds": levels})
rust
fn main() { let Ok(r) = exchange.GetRecords(None, PERIOD_H1, None) else { return }; if r.len() < 24 { return; } let bars = &r[r.len() - 24..]; let hi = bars.iter().map(|b| b.High).fold(f64::MIN, f64::max); let lo = bars.iter().map(|b| b.Low).fold(f64::MAX, f64::min); let pos = if hi > lo { (bars[23].Close - lo) / (hi - lo) } else { 0.5 }; LogStatus!(format!( r#"{{"type": "gauge", "title": "Position in 24h range", "value": {}, "format": {{"percent": true}}, "thresholds": [{{"value": 0, "color": "down"}}, {{"value": 0.2, "color": "primary"}}, {{"value": 0.8, "color": "up"}}]}}"#, pos )); }

Attributes

NameTypeDescription

type

string

Required. Always gauge.

value

number

Required. Current value.

min

number

Lower bound. Default 0.

max

number

Upper bound, must be greater than min. Default 1.

unit

string

Unit.

format

object

Number format {precision, compact, percent}; see Status Bar Components.

color

string

Color when no threshold is reached, default primary. Values: see Status Bar Components.

thresholds

object array

Thresholds: the color of the highest threshold reached by value is used.

thresholds[].value

number

From this value on color is used.

thresholds[].color

string

Color: up, down, primary, warning or muted; see Status Bar Components.

title

string

Title shown at the top left of the component.

id

string

Stable identifier. Set it when the number or order of components changes, so refreshes do not rebuild the component.

span

number

Number of columns it spans in the enclosing grid. Default 1.

See Also

Remarks

A max not greater than min shows an error card.