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#
alert(message: any, freq: string?)Recorded at the candle's close, the study's alert condition 'alert call' its own
message | any | required |
freq | string | optional |
alertcondition#
alertcondition(condition: bool, title: string?, message: string?)A declared condition an alert may follow
condition | bool | required |
title | string | optional |
message | string | optional |
barcolor#
barcolor(color: color, offset: int?, editable: bool?, show_last: int?, title: string?, display: any?)The candles' colour, bar by bar
color | color | required |
offset | int | optional |
editable | bool | optional |
show_last | int | optional |
title | string | optional |
display | any | optional |
bgcolor#
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
color | color | required |
offset | int | optional |
editable | bool | optional |
show_last | int | optional |
title | string | optional |
display | any | optional |
force_overlay | bool | optional |
bool#
bool(x: any) → boolA non-zero number or true is true; na is false in version 6 and stays na in version 5
x | any | required |
color#
color(x: color) → colorNa or a colour, as a colour
x | color | required |
dayofmonth#
dayofmonth(time: int, timezone: string?) → intThe day of the month of a time
time | int | required |
timezone | string | optional |
dayofweek#
dayofweek(time: int, timezone: string?) → intThe weekday of a time
time | int | required |
timezone | string | optional |
fill#
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
hline1 | any | required |
hline2 | any | required |
color | color | optional |
title | string | optional |
editable | bool | optional |
fillgaps | bool | optional |
display | any | optional |
top_value | float | optional |
bottom_value | float | optional |
top_color | color | optional |
bottom_color | color | optional |
fixnan#
fixnan(source: T) → TThe value, or the last value that was present
source | T | required |
float#
float(x: num) → floatThe value as a float; na stays na
x | num | required |
hline#
hline(price: float, title: string?, color: color?, linestyle: any?, linewidth: int?, editable: bool?, display: any?) → hlineA level of the study, fixed for the script's life
price | float | required |
title | string | optional |
color | color | optional |
linestyle | any | optional |
linewidth | int | optional |
editable | bool | optional |
display | any | optional |
hour#
hour(time: int, timezone: string?) → intThe hour of a time
time | int | required |
timezone | string | optional |
indicator#
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
title | string | required |
shorttitle | string | optional |
overlay | bool | optional |
format | any | optional |
precision | int | optional |
scale | any | optional |
max_bars_back | int | optional |
timeframe | string | optional |
timeframe_gaps | bool | optional |
explicit_plot_zorder | bool | optional |
max_lines_count | int | optional |
max_labels_count | int | optional |
max_boxes_count | int | optional |
calc_bars_count | int | optional |
max_polylines_count | int | optional |
dynamic_requests | bool | optional |
behind_chart | bool | optional |
input#
input(defval: T, title: string?, tooltip: string?, inline: string?, group: string?, display: any?) → TAn input of the default's type
defval | T | required |
title | string | optional |
tooltip | string | optional |
inline | string | optional |
group | string | optional |
display | any | optional |
int#
int(x: num) → intThe value truncated toward zero; na stays na
x | num | required |
library#
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
title | string | required |
overlay | bool | optional |
dynamic_requests | bool | optional |
minute#
minute(time: int, timezone: string?) → intThe minute of a time
time | int | required |
timezone | string | optional |
month#
month(time: int, timezone: string?) → intThe month of a time
time | int | required |
timezone | string | optional |
na#
na(x: any) → boolWhether a value is absent
x | any | required |
nz#
nz(source: T, replacement: T?) → TThe value, or a replacement (zero by default) where it is absent
source | T | required |
replacement | T | optional |
plot#
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?) → plotA line of the study; its colour may change from bar to bar
series | float | required |
title | string | optional |
color | color | optional |
linewidth | int | optional |
style | any | optional |
trackprice | bool | optional |
histbase | float | optional |
offset | int | optional |
join | bool | optional |
editable | bool | optional |
show_last | int | optional |
display | any | optional |
format | any | optional |
precision | int | optional |
force_overlay | bool | optional |
plotarrow#
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?) → plotAn arrow up for a positive value, down for a negative one
series | float | required |
title | string | optional |
colorup | color | optional |
colordown | color | optional |
offset | int | optional |
minheight | int | optional |
maxheight | int | optional |
editable | bool | optional |
show_last | int | optional |
display | any | optional |
format | any | optional |
precision | int | optional |
force_overlay | bool | optional |
plotbar#
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
open | float | required |
high | float | required |
low | float | required |
close | float | required |
title | string | optional |
color | color | optional |
editable | bool | optional |
show_last | int | optional |
display | any | optional |
format | any | optional |
precision | int | optional |
force_overlay | bool | optional |
plotcandle#
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
open | float | required |
high | float | required |
low | float | required |
close | float | required |
title | string | optional |
color | color | optional |
wickcolor | color | optional |
editable | bool | optional |
show_last | int | optional |
bordercolor | color | optional |
display | any | optional |
format | any | optional |
precision | int | optional |
force_overlay | bool | optional |
plotchar#
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?) → plotA character on each bar where the series is true or a number
series | any | required |
title | string | optional |
char | string | optional |
location | any | optional |
color | color | optional |
offset | int | optional |
text | string | optional |
textcolor | color | optional |
editable | bool | optional |
size | any | optional |
show_last | int | optional |
display | any | optional |
format | any | optional |
precision | int | optional |
force_overlay | bool | optional |
plotshape#
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?) → plotA mark on each bar where the series is true or a number
series | any | required |
title | string | optional |
style | any | optional |
location | any | optional |
color | color | optional |
offset | int | optional |
text | string | optional |
textcolor | color | optional |
editable | bool | optional |
size | any | optional |
show_last | int | optional |
display | any | optional |
format | any | optional |
precision | int | optional |
force_overlay | bool | optional |
second#
second(time: int, timezone: string?) → intThe second of a time
time | int | required |
timezone | string | optional |
strategy#
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
title | string | required |
shorttitle | string | optional |
overlay | bool | optional |
format | any | optional |
precision | int | optional |
scale | any | optional |
pyramiding | int | optional |
calc_on_order_fills | bool | optional |
calc_on_every_tick | bool | optional |
max_bars_back | int | optional |
backtest_fill_limits_assumption | int | optional |
default_qty_type | string | optional |
default_qty_value | float | optional |
initial_capital | float | optional |
currency | any | optional |
slippage | int | optional |
commission_type | string | optional |
commission_value | float | optional |
process_orders_on_close | bool | optional |
close_entries_rule | string | optional |
margin_long | float | optional |
margin_short | float | optional |
explicit_plot_zorder | bool | optional |
max_lines_count | int | optional |
max_labels_count | int | optional |
max_boxes_count | int | optional |
calc_bars_count | int | optional |
risk_free_rate | float | optional |
use_bar_magnifier | bool | optional |
fill_orders_on_standard_ohlc | bool | optional |
max_polylines_count | int | optional |
dynamic_requests | bool | optional |
behind_chart | bool | optional |
string#
string(x: string) → stringNa or a string, as a string (a number is read with str.tostring)
x | string | required |
timestamp#
timestamp(a: any, b: any?, c: any?, d: any?, e: any?, f: any?, g: any?) → intA 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
a | any | required |
b | any | optional |
c | any | optional |
d | any | optional |
e | any | optional |
f | any | optional |
g | any | optional |
weekofyear#
weekofyear(time: int, timezone: string?) → intThe ISO week of a time
time | int | required |
timezone | string | optional |
year#
year(time: int, timezone: string?) → intThe year of a time
time | int | required |
timezone | string | optional |
Variables
bar_index#
The bar's index from 0
close#
The bar's close
dayofmonth#
The bar's day of the month
dayofweek#
The bar's weekday, 1 Sunday to 7 Saturday
high#
The bar's high
hl2#
(high + low) / 2
hlc3#
(high + low + close) / 3
hlcc4#
(high + low + close + close) / 4
hour#
The bar's hour
last_bar_index#
The index of the bar at the cursor
low#
The bar's low
minute#
The bar's minute
month#
The bar's month, 1-12
na#
The absent value of every type
ohlc4#
(open + high + low + close) / 4
open#
The bar's open
second#
The bar's second
time#
The bar's opening time, epoch milliseconds
time_close#
The next bar's opening time; the forming bar's is its open plus the chart's interval
time_tradingday#
The start of the bar's day on the bench's clock
timenow#
The bench's clock at the cursor — never this machine's clock
volume#
The bar's volume: the tick volume an MT5 bar carries, zero where the feed carries none
weekofyear#
The ISO week of the bar's date
year#
The bar's year on the bench's clock