Version: 1.0 Last Updated: January 25, 2026 For: Fusion Builder V1.0
A State Machine Block allows you to build multi-step sequential entry logic visually – without writing any code.
Think of it like a checklist that must be completed in order:
SCANNING → ARMED → CONFIRMED → ENTRY
↑ ↓ ↓ ↓
└───────────┴───────────┴──────────┘
(Timeout or Abort resets)
Without a State Machine, building “RSI drops below 30, THEN within 10 bars price touches support, THEN RSI crosses back above 30” would require 8+ blocks (SR Latches, Signal Extenders, AND gates, etc.).
With a State Machine: 1 block.
| Scenario | Example |
|---|---|
| Sequential conditions | “First X happens, then Y, then Z” |
| Timed windows | “Y must happen within 10 bars of X” |
| Complex entries | Breakout → Pullback → Continuation |
| Pattern completion | Divergence detection with confirmation |
| Multi-step filters | Volume spike → Reversal → Confirmation |
| Scenario | Better Alternative |
|---|---|
| Simple threshold crossing | Condition Block |
| Two conditions at same time | AND Gate |
| Either/or logic | OR Gate |
| Toggle between states | SR Latch or Toggle Gate |
INPUT PORTS (Left Side):
| Port | Purpose |
|---|---|
| S1 | Stage 1 trigger (ARM condition) |
| S2 | Stage 2 trigger (CONFIRM condition) |
| S3 | Stage 3 trigger (ENTRY condition) |
| S4-S6 | Additional stages (when StageCount > 3) |
| Abort | Global reset trigger (optional) |
OUTPUT PORTS (Right Side):
| Port | Purpose |
|---|---|
| Signal | Fires when terminal stage reached (1.0 or -1.0) |
| State | Current state number (0-6) for debugging |
Click the State Machine block to open the Properties Panel.
| Property | What It Does | Options |
|---|---|---|
| Signal Name | Identifier for your state machine | Any text (e.g., “RSI_Bounce”) |
| Direction | Signal direction when entry fires | Long (+1), Short (-1), Both (±1) |
| Long Output | Value output for Long signals | Default: 1.0 |
| Short Output | Value output for Short signals | Default: -1.0 |
| Property | What It Does | Notes |
|---|---|---|
| Stage Count | How many stages (2-6) | Default: 3 |
| Stage N Name | Label for the stage | Shows in block body |
| Timeout (bars) | Max bars to wait | 0 = infinite (no timeout) |
| Reset on timeout | Return to Scanning if timeout | Usually ON |
| Property | What It Does | |
|---|---|---|
| Enable Abort | Allow abort condition to reset | Shows/hides Abort port |
| Abort Resets To | Where to reset on abort | 0=Scanning, 1-6=specific stage |
| Property | What It Does |
|---|---|
| Auto-reset after signal | Return to Scanning after signal fires |
| Reset Delay (bars) | Cooldown before re-arming |
| Property | What It Does |
|---|---|
| Show state on block | Display current state on block body |
| Plot state output | Enable State output port |
Stage inputs expect a truthy value (non-zero, non-NaN):
| Source Block | How to Wire |
|---|---|
| Condition Block | Wire output directly → S1/S2/S3 |
| Gate Block | Wire output directly → S1/S2/S3 |
| Indicator Block | Use with Condition to create true/false |
| Math Block | Use if result should trigger stage |
┌─────────────────┐
│ Condition Block │───► S1 (Arms when condition true)
│ "RSI < 30" │
└─────────────────┘
┌─────────────────┐
│ Condition Block │───► S2 (Confirms when condition true)
│ "Price < LowerBB"│
└─────────────────┘
┌─────────────────┐
│ Condition Block │───► S3 (Entry triggers when condition true)
│ "RSI CrossAbove" │
└─────────────────┘
┌─────────────────┐
│ Condition Block │───► Abort (Resets entire state machine)
│ "RSI < 20" │
└─────────────────┘
Purpose: Verify basic state transitions work
Setup:
| Component | Configuration |
|---|---|
| Indicator 1 | RSI(14) |
| Condition 1 | RSI CrossBelow 30 → wire to S1 |
| Condition 2 | RSI CrossAbove 25 → wire to S2 |
| Condition 3 | RSI CrossAbove 30 → wire to S3 |
| State Machine | StageCount=3, Stage1Timeout=0, Stage2Timeout=20, Stage3Timeout=10 |
Expected Behavior:
Verification:
Purpose: Verify timeout resets to Scanning
Setup:
| Component | Configuration |
|---|---|
| Indicator 1 | RSI(14) |
| Condition 1 | RSI CrossBelow 30 → wire to S1 |
| Condition 2 | RSI CrossAbove 50 → wire to S2 (unlikely to trigger quickly) |
| State Machine | Stage1Timeout=0, Stage2Timeout=5 |
Expected Behavior:
Purpose: Verify abort resets state machine
Setup:
| Component | Configuration |
|---|---|
| Indicator 1 | RSI(14) |
| Condition 1 | RSI CrossBelow 30 → wire to S1 |
| Condition 2 | RSI CrossAbove 30 → wire to S2 |
| Condition 3 | RSI > 25 → wire to S3 |
| Condition 4 | RSI < 20 → wire to Abort |
| State Machine | AbortEnabled=true, AbortResetsTo=0 |
Expected Behavior:
Purpose: Verify cooldown prevents immediate re-arming
Setup:
| Component | Configuration |
|---|---|
| Indicator 1 | RSI(14) |
| Condition 1 | RSI < 30 → wire to S1 |
| Condition 2 | RSI < 28 → wire to S2 |
| Condition 3 | RSI < 25 → wire to S3 |
| State Machine | AutoResetAfterSignal=true, ResetDelayBars=3 |
Expected Behavior:
Purpose: Verify Both direction uses input sign
Setup:
| Component | Configuration |
|---|---|
| Indicator 1 | RSI(14) |
| Math Block | Subtract RSI from 50 (result positive if RSI<50, negative if RSI>50) |
| Condition 1 | Abs(Result) > 20 → wire to S1 (signed value) |
| Condition 2 | Abs(Result) > 15 → wire to S2 |
| Condition 3 | Abs(Result) > 10 → wire to S3 (pass the signed value) |
| State Machine | Direction=Both |
Expected Behavior:
Purpose: Verify extended stage count works
Setup:
| Component | Configuration |
|---|---|
| State Machine | StageCount=5 |
| Condition 1 | RSI < 40 → S1 |
| Condition 2 | RSI < 35 → S2 |
| Condition 3 | RSI < 30 → S3 |
| Condition 4 | RSI < 25 → S4 |
| Condition 5 | RSI CrossAbove 30 → S5 |
Expected Behavior:
The Pattern:
Block Configuration:
┌────────────────────────────────────────────────────┐
│ INDICATOR: RSI(14) │
│ INDICATOR: Bollinger(20,2) │
│ │
│ CONDITION: RSI < 30 ────► S1 (Armed) │
│ CONDITION: Close < LowerBB ────► S2 (Confirm) │
│ CONDITION: RSI CrossAbove 30 ────► S3 (Entry) │
│ CONDITION: RSI < 20 ────► Abort │
│ │
│ STATE MACHINE SETTINGS: │
│ Stage1Timeout = 0 (wait forever) │
│ Stage2Timeout = 10 bars │
│ Stage3Timeout = 5 bars │
│ Direction = Long │
└────────────────────────────────────────────────────┘
The Pattern:
Block Configuration:
┌────────────────────────────────────────────────────┐
│ INDICATOR: Highest(High, 20) │
│ INDICATOR: Lowest(Low, 20) │
│ │
│ CONDITION: Close > Highest[1] ────► S1 (Breakout)│
│ CONDITION: Low < Midpoint ────► S2 (Pullback)│
│ CONDITION: High > Recent High ────► S3 (Continue)│
│ │
│ STATE MACHINE SETTINGS: │
│ Stage1Timeout = 0 │
│ Stage2Timeout = 15 bars │
│ Stage3Timeout = 10 bars │
│ Direction = Long │
└────────────────────────────────────────────────────┘
The Pattern:
Block Configuration:
┌────────────────────────────────────────────────────┐
│ INDICATOR: SMA(Volume, 20) │
│ MATH: Divide Volume by SMA(Volume) │
│ │
│ CONDITION: VolRatio > 2.0 ────► S1 (Climax) │
│ CONDITION: Close > Open ────► S2 (Reversal)│
│ CONDITION: VolRatio < 1.5 ────► S3 (Normal) │
│ CONDITION: VolRatio > 2.0 ────► Abort │
│ │
│ STATE MACHINE SETTINGS: │
│ Stage1Timeout = 0 │
│ Stage2Timeout = 3 bars │
│ Stage3Timeout = 5 bars │
│ ResetDelayBars = 5 (prevent rapid re-triggers) │
└────────────────────────────────────────────────────┘
| Symptom | Cause | Solution |
|---|---|---|
| Stuck on “Scanning” | S1 condition never fires | Check S1 wiring, verify condition logic |
| Stuck on “Armed” | S2 condition not firing | Check Stage2Timeout, verify S2 wiring |
| Timeout keeps resetting | Timeout too short | Increase timeout value |
| Symptom | Cause | Solution |
|---|---|---|
| Reaches terminal stage but no signal | Direction mismatch | Check SignalDirection setting |
| Final condition fires but stays at 0 | AutoReset issue | Verify AutoResetAfterSignal |
| Symptom | Cause | Solution |
|---|---|---|
| State resets unexpectedly | Abort condition too sensitive | Adjust Abort condition thresholds |
| Abort firing during normal progression | Disable AbortEnabled temporarily |
| Symptom | Cause | Solution |
|---|---|---|
| Display doesn’t update | ShowStateOnBlockBody=false | Enable in properties |
| State number seems wrong | Counting from 0 | 0=Scanning, 1=Stage1, etc. |
| Market Condition | Recommended Timeout |
|---|---|
| Scalping (1-5 min) | 3-10 bars |
| Day Trading (15-60 min) | 5-20 bars |
| Swing Trading (Daily) | 3-10 bars |
| Position Trading (Weekly) | 2-5 bars |
| Number | State | Meaning |
|---|---|---|
| 0 | Scanning | Waiting for first condition |
| 1 | Armed | S1 fired, waiting for S2 |
| 2 | Confirmed | S2 fired, waiting for S3 |
| 3-6 | Stage 3-6 | Additional stages if configured |
| Direction | Output |
|---|---|
| Long | +1.0 (default, configurable) |
| Short | -1.0 (default, configurable) |
| Both | Sign determined by final stage input |
| Port | Type | Purpose |
|---|---|---|
| S1-S6 | Input | Stage trigger conditions |
| Abort | Input | Global reset condition |
| Signal | Output | Entry signal (1.0/-1.0) |
| State | Output | Current state number (0-6) |
RSI < 30 → SR Latch (Set)
→ SignalExtender (10 bars)
→ AND Gate ← LowerBB Touch
→ SignalExtender (5 bars)
→ AND Gate ← RSI CrossAbove 30
→ Signal Output
Plus abort logic: RSI < 20 → SR Latch (Reset) wired to all components
RSI < 30 → S1
LowerBB Touch → S2
RSI CrossAbove 30 → S3
RSI < 20 → Abort
→ Signal Output
Timeouts and resets handled internally!
Happy Trading with Fusion Builder!