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

Bins raw data automatically and shows the counts with sample size, mean, median and share of positive values.

Examples

Shows the distribution of the changes of the last 200 hourly K-lines.

javascript
function main() { var r = exchange.GetRecords(PERIOD_H1) if (!r || r.length < 3) return r = r.slice(-201) var rets = r.slice(1).map(function (b, i) { return b.Close / r[i].Close - 1 }) LogStatus({type: "histogram", title: "Hourly change distribution", data: rets, format: {percent: true, precision: 2}}) }
python
def main(): r = exchange.GetRecords(PERIOD_H1) if not r or len(r) < 3: return r = r[-201:] rets = [r[i]["Close"] / r[i - 1]["Close"] - 1 for i in range(1, len(r))] LogStatus({"type": "histogram", "title": "Hourly change distribution", "data": rets, "format": {"percent": True, "precision": 2}})
rust
fn main() { let Ok(r) = exchange.GetRecords(None, PERIOD_H1, None) else { return }; if r.len() < 3 { return; } let r = &r[r.len().saturating_sub(201)..]; let rets: Vec<String> = r.windows(2) .map(|w| (w[1].Close / w[0].Close - 1.0).to_string()) .collect(); LogStatus!(format!( r#"{{"type": "histogram", "title": "Hourly change distribution", "data": [{}], "format": {{"percent": true, "precision": 2}}}}"#, rets.join(",") )); }

Attributes

NameTypeDescription

type

string

Required. Always histogram.

data

numeric array

Required. Raw data, at least 2 numbers.

bins

number

Number of bins, 1–100. Defaults to the square root of the sample size, limited to 5–40.

format

object

Format of bin bounds and statistics; see Status Bar Components.

color

string

Bar color. By default positive bins use the up color and negative ones the down color. Values: see Status Bar Components.

height

number

Height in pixels, 120–600. Default 220.

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

When the data has both signs, 0 falls on a bin boundary, so gains and losses never share a bin.