Bentrix Docs
HomePricingDashboard

Assay reference: Declarations, output and the bar's own values

runs as written · runs with Bentrix's own convention, said in its note · refused by name, the note says what Bentrix lacks · not yet built.

Functions

alert#

runs — Bentrix's own convention
alert(message: any, freq: string?)

Recorded at the candle's close, the study's alert condition 'alert call' its own

messageanyrequired
freqstringoptional

alertcondition#

runs
alertcondition(condition: bool, title: string?, message: string?)

A declared condition an alert may follow

conditionboolrequired
titlestringoptional
messagestringoptional

barcolor#

runs
barcolor(color: color, offset: int?, editable: bool?, show_last: int?, title: string?, display: any?)

The candles' colour, bar by bar

colorcolorrequired
offsetintoptional
editablebooloptional
show_lastintoptional
titlestringoptional
displayanyoptional

bgcolor#

runs
bgcolor(color: color, offset: int?, editable: bool?, show_last: int?, title: string?, display: any?, force_overlay: bool?)

The pane's background colour, bar by bar

colorcolorrequired
offsetintoptional
editablebooloptional
show_lastintoptional
titlestringoptional
displayanyoptional
force_overlaybooloptional

bool#

runs
bool(x: any) → bool

A non-zero number or true is true; na is false in version 6 and stays na in version 5

xanyrequired

color#

runs
color(x: color) → color

Na or a colour, as a colour

xcolorrequired

dayofmonth#

runs
dayofmonth(time: int, timezone: string?) → int

The day of the month of a time

timeintrequired
timezonestringoptional

dayofweek#

runs
dayofweek(time: int, timezone: string?) → int

The weekday of a time

timeintrequired
timezonestringoptional

fill#

runs
fill(hline1: any, hline2: any, color: color?, title: string?, editable: bool?, fillgaps: bool?, display: any?, top_value: float?, bottom_value: float?, top_color: color?, bottom_color: color?)

A band between two lines or two levels

hline1anyrequired
hline2anyrequired
colorcoloroptional
titlestringoptional
editablebooloptional
fillgapsbooloptional
displayanyoptional
top_valuefloatoptional
bottom_valuefloatoptional
top_colorcoloroptional
bottom_colorcoloroptional

fixnan#

runs
fixnan(source: T) → T

The value, or the last value that was present

sourceTrequired

float#

runs
float(x: num) → float

The value as a float; na stays na

xnumrequired

hline#

runs
hline(price: float, title: string?, color: color?, linestyle: any?, linewidth: int?, editable: bool?, display: any?) → hline

A level of the study, fixed for the script's life

pricefloatrequired
titlestringoptional
colorcoloroptional
linestyleanyoptional
linewidthintoptional
editablebooloptional
displayanyoptional

hour#

runs
hour(time: int, timezone: string?) → int

The hour of a time

timeintrequired
timezonestringoptional

indicator#

runs
indicator(title: string, shorttitle: string?, overlay: bool?, format: any?, precision: int?, scale: any?, max_bars_back: int?, timeframe: string?, timeframe_gaps: bool?, explicit_plot_zorder: bool?, max_lines_count: int?, max_labels_count: int?, max_boxes_count: int?, calc_bars_count: int?, max_polylines_count: int?, dynamic_requests: bool?, behind_chart: bool?)

The script's declaration: its title, whether it draws over the price, its history depth

titlestringrequired
shorttitlestringoptional
overlaybooloptional
formatanyoptional
precisionintoptional
scaleanyoptional
max_bars_backintoptional
timeframestringoptional
timeframe_gapsbooloptional
explicit_plot_zorderbooloptional
max_lines_countintoptional
max_labels_countintoptional
max_boxes_countintoptional
calc_bars_countintoptional
max_polylines_countintoptional
dynamic_requestsbooloptional
behind_chartbooloptional

input#

runs
input(defval: T, title: string?, tooltip: string?, inline: string?, group: string?, display: any?) → T

An input of the default's type

defvalTrequired
titlestringoptional
tooltipstringoptional
inlinestringoptional
groupstringoptional
displayanyoptional

int#

runs
int(x: num) → int

The value truncated toward zero; na stays na

xnumrequired

library#

runs
library(title: string, overlay: bool?, dynamic_requests: bool?)

A library's declaration: a script whose exported functions, types and enums other scripts import from the person's own indicators folder; Bentrix hosts and fetches none

titlestringrequired
overlaybooloptional
dynamic_requestsbooloptional

minute#

runs
minute(time: int, timezone: string?) → int

The minute of a time

timeintrequired
timezonestringoptional

month#

runs
month(time: int, timezone: string?) → int

The month of a time

timeintrequired
timezonestringoptional

na#

runs
na(x: any) → bool

Whether a value is absent

xanyrequired

nz#

runs
nz(source: T, replacement: T?) → T

The value, or a replacement (zero by default) where it is absent

sourceTrequired
replacementToptional

plot#

runs
plot(series: float, title: string?, color: color?, linewidth: int?, style: any?, trackprice: bool?, histbase: float?, offset: int?, join: bool?, editable: bool?, show_last: int?, display: any?, format: any?, precision: int?, force_overlay: bool?) → plot

A line of the study; its colour may change from bar to bar

seriesfloatrequired
titlestringoptional
colorcoloroptional
linewidthintoptional
styleanyoptional
trackpricebooloptional
histbasefloatoptional
offsetintoptional
joinbooloptional
editablebooloptional
show_lastintoptional
displayanyoptional
formatanyoptional
precisionintoptional
force_overlaybooloptional

plotarrow#

runs
plotarrow(series: float, title: string?, colorup: color?, colordown: color?, offset: int?, minheight: int?, maxheight: int?, editable: bool?, show_last: int?, display: any?, format: any?, precision: int?, force_overlay: bool?) → plot

An arrow up for a positive value, down for a negative one

seriesfloatrequired
titlestringoptional
colorupcoloroptional
colordowncoloroptional
offsetintoptional
minheightintoptional
maxheightintoptional
editablebooloptional
show_lastintoptional
displayanyoptional
formatanyoptional
precisionintoptional
force_overlaybooloptional

plotbar#

runs
plotbar(open: float, high: float, low: float, close: float, title: string?, color: color?, editable: bool?, show_last: int?, display: any?, format: any?, precision: int?, force_overlay: bool?)

Open-high-low-close bars of four series in the study's pane; their colour may change from bar to bar

openfloatrequired
highfloatrequired
lowfloatrequired
closefloatrequired
titlestringoptional
colorcoloroptional
editablebooloptional
show_lastintoptional
displayanyoptional
formatanyoptional
precisionintoptional
force_overlaybooloptional

plotcandle#

runs
plotcandle(open: float, high: float, low: float, close: float, title: string?, color: color?, wickcolor: color?, editable: bool?, show_last: int?, bordercolor: color?, display: any?, format: any?, precision: int?, force_overlay: bool?)

Candles of four series in the study's pane; their colours may change from bar to bar

openfloatrequired
highfloatrequired
lowfloatrequired
closefloatrequired
titlestringoptional
colorcoloroptional
wickcolorcoloroptional
editablebooloptional
show_lastintoptional
bordercolorcoloroptional
displayanyoptional
formatanyoptional
precisionintoptional
force_overlaybooloptional

plotchar#

runs
plotchar(series: any, title: string?, char: string?, location: any?, color: color?, offset: int?, text: string?, textcolor: color?, editable: bool?, size: any?, show_last: int?, display: any?, format: any?, precision: int?, force_overlay: bool?) → plot

A character on each bar where the series is true or a number

seriesanyrequired
titlestringoptional
charstringoptional
locationanyoptional
colorcoloroptional
offsetintoptional
textstringoptional
textcolorcoloroptional
editablebooloptional
sizeanyoptional
show_lastintoptional
displayanyoptional
formatanyoptional
precisionintoptional
force_overlaybooloptional

plotshape#

runs
plotshape(series: any, title: string?, style: any?, location: any?, color: color?, offset: int?, text: string?, textcolor: color?, editable: bool?, size: any?, show_last: int?, display: any?, format: any?, precision: int?, force_overlay: bool?) → plot

A mark on each bar where the series is true or a number

seriesanyrequired
titlestringoptional
styleanyoptional
locationanyoptional
colorcoloroptional
offsetintoptional
textstringoptional
textcolorcoloroptional
editablebooloptional
sizeanyoptional
show_lastintoptional
displayanyoptional
formatanyoptional
precisionintoptional
force_overlaybooloptional

second#

runs
second(time: int, timezone: string?) → int

The second of a time

timeintrequired
timezonestringoptional

strategy#

runs — Bentrix's own convention
strategy(title: string, shorttitle: string?, overlay: bool?, format: any?, precision: int?, scale: any?, pyramiding: int?, calc_on_order_fills: bool?, calc_on_every_tick: bool?, max_bars_back: int?, backtest_fill_limits_assumption: int?, default_qty_type: string?, default_qty_value: float?, initial_capital: float?, currency: any?, slippage: int?, commission_type: string?, commission_value: float?, process_orders_on_close: bool?, close_entries_rule: string?, margin_long: float?, margin_short: float?, explicit_plot_zorder: bool?, max_lines_count: int?, max_labels_count: int?, max_boxes_count: int?, calc_bars_count: int?, risk_free_rate: float?, use_bar_magnifier: bool?, fill_orders_on_standard_ohlc: bool?, max_polylines_count: int?, dynamic_requests: bool?, behind_chart: bool?)

A strategy script is a second body under Bentrix's strategy runner; its account, costs and fills are the workbench's

titlestringrequired
shorttitlestringoptional
overlaybooloptional
formatanyoptional
precisionintoptional
scaleanyoptional
pyramidingintoptional
calc_on_order_fillsbooloptional
calc_on_every_tickbooloptional
max_bars_backintoptional
backtest_fill_limits_assumptionintoptional
default_qty_typestringoptional
default_qty_valuefloatoptional
initial_capitalfloatoptional
currencyanyoptional
slippageintoptional
commission_typestringoptional
commission_valuefloatoptional
process_orders_on_closebooloptional
close_entries_rulestringoptional
margin_longfloatoptional
margin_shortfloatoptional
explicit_plot_zorderbooloptional
max_lines_countintoptional
max_labels_countintoptional
max_boxes_countintoptional
calc_bars_countintoptional
risk_free_ratefloatoptional
use_bar_magnifierbooloptional
fill_orders_on_standard_ohlcbooloptional
max_polylines_countintoptional
dynamic_requestsbooloptional
behind_chartbooloptional

string#

runs
string(x: string) → string

Na or a string, as a string (a number is read with str.tostring)

xstringrequired

timestamp#

runs — Bentrix's own convention
timestamp(a: any, b: any?, c: any?, d: any?, e: any?, f: any?, g: any?) → int

A time from its parts; a timezone is UTC or a fixed offset (named zones are, through Bentrix's zone table); a date string is later

aanyrequired
banyoptional
canyoptional
danyoptional
eanyoptional
fanyoptional
ganyoptional

weekofyear#

runs — Bentrix's own convention
weekofyear(time: int, timezone: string?) → int

The ISO week of a time

timeintrequired
timezonestringoptional

year#

runs
year(time: int, timezone: string?) → int

The year of a time

timeintrequired
timezonestringoptional

Variables

bar_index#

runs

The bar's index from 0

close#

runs

The bar's close

dayofmonth#

runs

The bar's day of the month

dayofweek#

runs

The bar's weekday, 1 Sunday to 7 Saturday

high#

runs

The bar's high

hl2#

runs

(high + low) / 2

hlc3#

runs

(high + low + close) / 3

hlcc4#

runs

(high + low + close + close) / 4

hour#

runs

The bar's hour

last_bar_index#

runs

The index of the bar at the cursor

low#

runs

The bar's low

minute#

runs

The bar's minute

month#

runs

The bar's month, 1-12

na#

runs

The absent value of every type

ohlc4#

runs

(open + high + low + close) / 4

open#

runs

The bar's open

second#

runs

The bar's second

time#

runs

The bar's opening time, epoch milliseconds

time_close#

runs — Bentrix's own convention

The next bar's opening time; the forming bar's is its open plus the chart's interval

time_tradingday#

runs — Bentrix's own convention

The start of the bar's day on the bench's clock

timenow#

runs — Bentrix's own convention

The bench's clock at the cursor — never this machine's clock

volume#

runs — Bentrix's own convention

The bar's volume: the tick volume an MT5 bar carries, zero where the feed carries none

weekofyear#

runs — Bentrix's own convention

The ISO week of the bar's date

year#

runs

The bar's year on the bench's clock

Bentrix 0.1.382Every number, name and default on these pages is read from the application itself.What is comingWhat changed