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.
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.
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.if In Position check, or pair it with Take Profit / Stop Loss blocks.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.if Take Profit 5%: SELL 100%
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.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.
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.
Close, Open, High, Low, HL2, OHLC4, Typical Price.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.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.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.
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.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.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.
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.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.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.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.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
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.
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.
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.if Cross Up (EMA 12, EMA 26): BUY $100
Cross Down
Returns true on the bar where Series A crosses below Series B. Same parameters as Cross Up, with direction inverted.
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.
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.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.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.
In Position
Returns true if the project currently has an open position for the current symbol, false otherwise.
if blocks: one for entry (guarded by NOT In Position), and one for exits (guarded by In Position).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.
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.
| Block | Category | Use |
|---|---|---|
if / do | Logic | Execute blocks conditionally. Add else-if or else clauses via the settings gear. |
AND / OR | Logic | Combine two boolean conditions. |
NOT | Logic | Invert a boolean condition. |
comparison (< > = โ ) | Logic | Compare two numeric values. Returns true/false. |
Number | Math | A literal number value. Connect to any numeric input. |
arithmetic (+, โ, ร, รท) | Math | Math operations on two number inputs. |
constrain / clamp | Math | Limit a value between a min and max. |