Analysis Blocks
Create indicators, signals, and calculations with analysis blocks.
Analysis blocks process data and produce outputs that can be used by other blocks or entry rules.
Block Types
Value Block
A simple constant value.
Use for: Reference values, thresholds, parameters
oversold_level: 30
overbought_level: 70Function Block
A single indicator or function call.
Use for: Simple indicators, single calculations
rsi_14: RSI(btc.close, 14)
sma_20: SMA(btc.close, 20)Compare Block
Compare two values.
Use for: Simple conditions
rsi_oversold: rsi_14 < 30
price_above_ma: btc.close > sma_20Operators: < > <= >= == !=
Cross Block
Detect when one value crosses another.
Use for: Crossover signals
ma_cross_up: CROSS_ABOVE(fast_ma, slow_ma)
rsi_cross_down: CROSS_BELOW(rsi, 70)Functions: CROSS_ABOVE(a, b) CROSS_BELOW(a, b)
Logic Block
Combine multiple signals with boolean logic.
Use for: Complex conditions
entry_signal: ma_cross_up AND rsi_oversoldOperators: AND OR NOT
Advanced Block
Multiple named outputs in a single block.
Use for: Related calculations grouped together
outputs:
fast_ema: EMA(btc.close, 9)
slow_ema: EMA(btc.close, 21)
trend_up: fast_ema > slow_emaCode Block
Custom JavaScript or Python code.
Use for: Complex logic, external data, custom calculations
// Returns: { signal: boolean[], strength: number[] }
const rsi = utils.indicators.RSI(data.get('btc').close, 14);
const signal = rsi.map(v => v < 30);
const strength = rsi.map(v => (30 - v) / 30);
return { signal, strength };Learn more about Code Blocks →
Output Types
Analysis blocks produce two types of outputs:
Numeric Outputs
Numbers used for calculations or conditions:
- Indicator values (RSI, MA, etc.)
- Prices and levels
- Ratios and percentages
Shown with blue color in the editor.
Boolean Outputs (Signals)
True/false values that trigger actions:
- Entry conditions
- Filter conditions
- Alert triggers
Shown with yellow color in the editor.
Referencing Outputs
Reference outputs from other blocks using dot notation:
block_name.output_nameExamples:
signals.cross_up # Boolean output from 'signals' block
indicators.rsi # Numeric output from 'indicators' block
btc.close # Data source columnLookback
Access previous values using bracket notation:
btc.close[1] # Previous bar's close
rsi[5] # RSI value 5 bars ago
signals.up[1] # Previous bar's signalPosition-Dependent Blocks
Position-dependent blocks only evaluate correctly when there's an open position. They show an orange indicator in the editor.
Some blocks use position-aware functions:
entry_price()— Price at entrybars_since_entry()— Bars since position openedposition_profit_pct()— Current profit percentage
Best Practices
Name blocks descriptively — trend_signals is much better than block1. Your future self will thank you!
- Name blocks descriptively (
trend_signals, notblock1) - Group related calculations in Advanced blocks
- Use Code blocks sparingly — expressions are faster
- Keep signal logic separate from value calculations
- Document complex logic with block descriptions