Skip to content

Blocks

Trading blocks are executed by the platform: they call the exchange, compute indicators and send notifications. A block’s inputs are set in the properties panel — as a value or a variable; its result goes to a variable for the following blocks.

getKlines — loads candles (klines) for a symbol.

Input Description
Exchange the exchange to take candles from
Symbol the instrument, e.g. BTC/USD_LEVERAGE
Interval candle timeframe
Number of candles how many latest candles to load
Wait for close wait for the current candle to close before loading

Result — a list of Candles: each has open time, open, high, low, close and volume. The latest candle is klines[-1].

computeIndicator — computes a technical indicator over candles.

Input Description
Indicator rsi, macd, bollinger_bands, ks
Candles the candle list from Fetch candles

Result — a list of values per candle. Fields depend on the indicator:

Indicator Fields Defaults
RSI value period 14
MACD value, MACD line 12 / 26 / 9
Bollinger Bands upper band, middle line, lower band period 20
KS trend direction (up / down / no signal) —

evaluateExpression — evaluates any FEEL expression and stores the result in a variable. Useful when a condition is computed once and used in several places. See Conditions for the syntax.

createOrder — opens an order on the exchange.

Input Required Description
Exchange, Symbol yes where and what to trade
Quantity yes order size
Leverage yes leverage
Side yes buy or sell
Price no limit price; without it — a market order
Stop loss / Stop loss distance no stop as a level or a distance from the price
Take profit / Take profit distance no take as a level or a distance from the price
Notification type no telegram — report the accepted order

Result — the Order ID (orderUid): use it to close or update the order and to check its status.

Before sending, the order is checked against the risk limits. An order that breaks a limit is not sent to the exchange and the process goes on — Order status returns Rejected for it.

getOrderStatus — returns the order status by orderUid: Not opened, Open, Closed, Canceled, Rejected, Expired. Usually followed by a gateway that decides what to do next.

updateOrder — changes the stop loss and take profit of an open trade by orderUid. The new stop is checked against risk limits too: you cannot remove the stop when a stop loss is required, or move it beyond the allowed risk.

closeOrder — closes the position opened by orderUid, or cancels an order that has not been filled yet. Positions can be closed even while new orders are halted by a risk limit.

sendNotification — sends your text to the chosen channel. See Notifications.