๐Ÿบ
/Documentation

Building

Blocks Reference

Last updated March 1, 2026

Complete reference for all blocks available in the visual strategy editor. Each block is documented with its parameters, internal behavior, and example usage.

Trading

Trading blocks perform actions. They go inside the do slot of an if block and cannot be used as conditions.

Trading

BUY

Places a paper buy order for the current symbol using a specified USD amount.

USD amount: A number block representing how many USD to spend. Converted to quantity using the current mark price (latest close).

Internal behavior

If no position is open, a new position is created at the current mark price. If a position already exists, the new buy is averaged in using a volume-weighted average entry price.

โš ๏ธ
Common mistake: Forgetting the "NOT In Position" guard. Without it, your strategy buys on every tick where the condition is true, even if you're already holding.
Trading

SELL

Sells a percentage of the current open position for the current symbol.

Percent: A number 1โ€“100. 100 closes the entire position. Values below 100 result in a partial close.
๐Ÿ’ก
Best practice: Always use SELL inside an if In Position check, or pair it with Take Profit / Stop Loss blocks.
Trading

Take Profit

Returns true when the current mark price is at or above entry price plus the specified percentage gain. Use as a condition wired to a SELL block.

PCT: Percentage gain target (e.g. 5 = exit when up 5%). Default: 5. Range: 0.01โ€“100.
Example: Exit at 5% profit
if Take Profit 5%:
  SELL 100%
Trading

Stop Loss

Returns true when the current mark price is at or below entry price minus the specified percentage loss.

PCT: Maximum loss tolerance (e.g. 3 = exit when down 3%). Default: 3.
โš ๏ธ
Important: Take Profit and Stop Loss only evaluate the condition, they don't automatically sell. You must wire them to a SELL block.

Market Data

Market Data blocks return numeric or boolean values derived from the current candle's OHLCV data. All price data comes from the in-memory kline cache, sourced from Binance.

Market Data

Price (Close / Open / High / Low)

Returns the latest value of a specific price field from the most recent completed candle on the 1-minute timeframe.

Price Close: Optional source override: Close, Open, High, Low, HL2, OHLC4, Typical Price.
Price Open / High / Low: Fixed to their respective field.
Market Data

Candle Pattern

Returns true if the most recent completed candle matches a specified classical candle pattern.

Pattern: One of: Doji, Bullish Engulfing, Bearish Engulfing, Hammer, Shooting Star.
Doji Threshold: Ratio of body to full range. Default: 0.1 (10%). Only relevant when Pattern = Doji.
Market Data

Volume Spike

Returns true when the current bar's volume is at least N times its rolling average over the last M bars.

Multiplier: How many times the average the current volume must exceed. Default: 2.
Avg Period (bars): Window for the average. Default: 20. The current bar is excluded from the average.
Market Data

Price Change %

Returns the percentage price change over the last N bars as a number (positive = up, negative = down).

Bars: How many bars back to compare. Default: 4. Calculation: ((current_close โˆ’ close[N]) / close[N]) ร— 100.

Lookback / History

Lookback blocks allow you to access historical values of any series or reference key levels across recent bars.

Lookback

Previous Value (PREV)

Returns the value of any connected series N bars ago. Maintains a per-project, per-symbol rolling buffer (up to 50 values) that persists across ticks.

SERIES_INPUT: Connect any numeric block (e.g. RSI, EMA, Price Close).
Lookback Bars (N): How many bars back. Default: 1.
โš ๏ธ
Important: PREV needs at least N ticks of history to return a valid value. On startup it returns NaN for the first N ticks.
Lookback

Highest / Lowest (Close)

Returns the highest or lowest Close price over the last N bars from the 1m kline cache.

Lookback Length: Number of bars to scan. Default: 20.
Lookback

Highest High / Lowest Low

Returns the highest High wick (or lowest Low wick) over the last N bars, a true price range that includes wicks, not just closes.

Lookback Length: Number of bars. Default: 20.

Indicators

Indicator blocks return numeric values computed from the kline series. All indicators use the 1-minute timeframe kline cache by default. Results are cached within each strategy run to avoid redundant computation.

Trend

SMA: Simple Moving Average

Returns the arithmetic mean of the last N values of the chosen price source.

Source: Price series: Close, Open, High, Low, HL2, OHLC4, Typical Price. Default: Close.
Length: Number of bars to average. Default: 20.
Trend

EMA: Exponential Moving Average

Returns the latest value of an exponential moving average, which gives more weight to recent prices. Reacts faster to recent price changes than SMA.

Source: Same options as SMA. Default: Close.
Length: Period. Default: 20.
Momentum

RSI: Relative Strength Index

Returns a value between 0 and 100 measuring the speed and magnitude of recent price changes. Values above 70 are considered overbought; below 30 are considered oversold.

Source: Price series. Default: Close.
Length (Period): Lookback period. Default: 14. Common: 7 (fast), 14 (standard), 21 (slow).
Smoothing Method: Currently only Wilder (Wilder's smoothing / RMA) is supported.
Volatility

ATR: Average True Range

Returns the average volatility of recent candles as an absolute price value. Higher ATR = higher volatility.

Length: Period for the average. Default: 14.
Volatility

Bollinger Bands

Returns one of the three Bollinger Band values: upper band, middle band (SMA), or lower band.

Source: Price series. Default: Close.
Length: SMA period for the middle band. Default: 20.
Standard Deviation: Multiplier for band width. Default: 2.
Band: Which band to return: upper, middle, or lower.
MACD

MACD

Returns one component of the MACD indicator: the MACD line, signal line, or histogram.

Fast Length: Fast EMA period. Default: 12.
Slow Length: Slow EMA period. Default: 26.
Signal Length: EMA period of the signal line. Default: 9.
Output: macd, signal, or histogram.

Formula: MACD = EMA(fast) โˆ’ EMA(slow). Signal = EMA of MACD line. Histogram = MACD โˆ’ Signal.

Volume

VWAP: Volume Weighted Average Price

Returns the volume-weighted average price, reset at the start of each trading session (UTC day).

Source: Price source to weight by volume. Default: Close.
Reset Mode: When to reset the cumulative calculation. Session resets at UTC midnight.

Events

Event blocks detect specific transitions between two values. They return true on the bar the event occurs, and false on all other bars.

Events

Cross Up

Returns true on the bar where Series A crosses above Series B (was below or equal, now above).

Series A: The series that crosses upward (e.g. fast EMA).
Series B: The series being crossed (e.g. slow EMA).
Strict: If true, the prior bar must have A strictly below B. Default: false.
Example: Buy on EMA 12 crossing above EMA 26
if Cross Up (EMA 12, EMA 26):
  BUY $100
Events

Cross Down

Returns true on the bar where Series A crosses below Series B. Same parameters as Cross Up, with direction inverted.

Events

Breakout Up / Down

Returns true when the chosen price source breaks above (or below) a specified level, confirmed over N bars.

Price Source: Which price to compare: Close, High, etc.
Level: Connect a numeric block (e.g. Highest High 20 bars) as the resistance level.
Confirmation Bars: Consecutive bars required above the level. Default: 1. Use 2โ€“3 to reduce false breakouts.

Filters

Filter blocks are boolean conditions designed to gate trade signals. Use them with AND logic to ensure your strategy only trades in appropriate market conditions.

Filters

Price Above MA / Price Below MA

Returns true when the chosen price source is above (or below) a moving average of a specified type and length.

Price Source: Close, Open, High, Low, HL2, OHLC4, Typical Price.
Moving Average Type: EMA, SMA, or WMA.
MA Length: Period of the moving average.
Filters

Trend Direction

Returns true when the fast MA is above (Bullish) or below (Bearish) the slow MA.

Direction: Bullish (fast > slow) or Bearish (fast < slow).
Fast MA: Type and period of the faster MA. Default: EMA 20.
Slow MA: Type and period of the slower MA. Default: EMA 50.
Filters

Volatility Regime

Returns true when the current ATR is above or below a multiple of its own average, classifying the market as high or low volatility.

ATR Length: Period for ATR calculation. Default: 14.
Threshold Multiplier: Default: 1.5.
Mode: High Volatility or Low Volatility.

Strategy

Strategy blocks provide runtime state about your current position and control execution flow.

Strategy

In Position

Returns true if the project currently has an open position for the current symbol, false otherwise.

๐Ÿ’ก
Best practice: Use two separate if blocks: one for entry (guarded by NOT In Position), and one for exits (guarded by In Position).
Strategy

Bars Since Entry

Returns the number of bars elapsed since the current position was opened. Returns a very large number if no position is open.

Use for time-based exits: Bars Since Entry > 100 to exit positions that have been held too long.

Strategy

Cooldown Bars

Returns true only when the minimum required number of bars have passed since the last trade. Acts as a re-entry cooldown.

Cooldown Bars: Minimum bars that must have elapsed. Default: 10.
Scope: Entry Only: counts bars since the last buy. Last Trade: counts bars since any trade.

Logic & Math

Standard Blockly core blocks for building conditions and calculations.

BlockCategoryUse
if / doLogicExecute blocks conditionally. Add else-if or else clauses via the settings gear.
AND / ORLogicCombine two boolean conditions.
NOTLogicInvert a boolean condition.
comparison (< > = โ‰ )LogicCompare two numeric values. Returns true/false.
NumberMathA literal number value. Connect to any numeric input.
arithmetic (+, โˆ’, ร—, รท)MathMath operations on two number inputs.
constrain / clampMathLimit a value between a min and max.