Checking Lua runtime availability...
What this builds:
a Lua-backed expression that returns
true
or
false.
After it is saved, use it like any other expression in a strategy slot:
Open Bid, Open Ask, Close Bid, or Close Ask.
Procedure:
select the expressions and bar frames this Lua expression may use, then write one Lua function named
evaluate().
No class, inheritance, or special reference is needed. The runtime gives the function a ready-to-use
gts
object.
Code contract:
read inputs with
gts.bar("5Min")
and
gts.expr("DX_14_1m"),
calculate your condition, then return only
true
or
false.
Drag expressions from the left library or click to toggle them here.
Lua Review Workspace
Write the script, validate in the browser, then submit it for private-server review.
Review can take up to 24 hours.
Certification runs in an isolated Docker environment before private-runtime deployment.
Lua submission
Current step
Status
Message
Action
Waiting
Load status
-
Loading Lua review status...
-
API Reference — gts_base.lua Getters
How to write the Lua code:
define one function:
function evaluate().
The runtime provides gts automatically; do not call
require().
Inside it, read only the inputs you selected above, such as
gts.bar("5Min")
for candle data or
gts.expr("DX_14_1m")
for a saved expression value. Calculate your condition and return
true when the signal should fire, otherwise return
false.
You do not create a class, inherit anything, or connect to the server yourself.
After submit, GTS validates the script, runs it in an isolated Lua container, and deploys the approved script to the private runtime.
| Getter |
Returns |
Description |
gts.bar() |
table |
Last received bar (any frame): {symbol, period, open, close, high, low, volume, date} |
gts.bar("5Min") |
table |
Latest bar for a specific frame (not overwritten by other frames). |
gts.bars() |
table |
All bars keyed by frame: {"1Min"=bar, "5Min"=bar, ...} |
gts.symbol() |
string |
Current symbol name this script is handling. |
gts.expr("name") |
number |
Expression value by name. |
gts.has_bar() / has_bar("5Min") |
boolean |
True if any bar / specific frame bar has been received. |
gts.has_expr("name") |
boolean |
True if expression has been received at least once. |
gts.has_tick() |
boolean |
True if any tick has been received. |
gts.has_open() / has_open(id) |
boolean |
True if any / specific open position exists. |
gts.has_closed() / has_closed(id) |
boolean |
True if any / specific closed position exists. |
gts.tick() |
table |
Last tick: {symbol, bid, ask, volume, date} |
gts.current_open() |
table/nil |
First/only open position, or nil if none. |
gts.last_closed() |
table/nil |
Most recently closed position (by closeDate), or nil. |
gts.open_positions() |
table |
All open positions keyed by id. |
gts.closed_positions() |
table |
All closed positions keyed by id. |
gts.bar_count() / gts.tick_count() |
number |
Running counters of received bars and ticks. |