Strategy Validation

Real-time validation ensures your strategy is correctly configured before backtesting or deployment. Understanding validation rules, common errors, and how to fix them is essential for building robust trading strategies.

Why Validation Matters

Validation catches configuration errors, type mismatches, and logical issues before you run a backtest. This saves time by preventing failed backtests and helps you build more reliable strategies. The validation system runs continuously as you build, providing immediate feedback.

Understanding the Validation Panel

The validation panel is docked in the left slot of the canvas and updates in real-time as you modify your strategy.

Strategy Valid

When the panel shows the green ok marker, the strategy passes validation and is ready to save and backtest:

  • At least one Data Source node is present
  • At least one Action node (BUY, SELL, or CLOSE) is connected to valid logic
  • No configuration errors in any nodes
  • All connections are valid (correct data types)
  • No circular dependencies detected

Warnings

Yellow warnings indicate potential issues that don't prevent saving:

  • Disconnected nodes that don't contribute to any Action node (isolated_nodes)
  • A Set Variable node uses a name another Set Variable already uses (duplicate var name)
  • A heuristic check on suspicious literals (e.g. a value compared against zero)
  • Cross-timeframe action without a bar-open gate

You can save and backtest with warnings, but consider addressing them for better strategy quality.

Errors (Must Fix)

Red errors prevent saving and backtesting. Common errors:

  • A Condition node with a NUMERIC input but no column chosen (type mismatch)
  • A Math node whose output is never connected anywhere (orphan Math output)
  • A node placed too close to another node
  • A Super-Node referencing a template that no longer exists
  • A variable referenced in a Data Source column with no Set Variable node declaring it (orphan var reader)
  • A Set Variable node with its value port connected but no column selected (missing value column)
  • A circular dependency in the node graph — detected at save time

The Save button is disabled until all errors are resolved.

What a Valid Strategy Requires

A MangoLabs strategy does not use Output nodes on the main canvas. Instead, trade execution is driven by Action nodes. Two things are required:

At least one Data Source node

REQUIRED

Every strategy needs a Data Source node to supply market data (OHLCV, technical indicators, portfolio state) to the rest of the graph.

At least one Action node

REQUIRED

An Action node is the execution endpoint. It has a trigger port (BOOLEAN) that fires an order when it transitions to true, and an optional size port (NUMERIC).

Action types available

  • BUY — opens a long position when the trigger fires
  • SELL — opens a short position, or closes an existing long
  • CLOSE — closes the current open position regardless of direction

A well-formed strategy typically has a BUY action for entry and a SELL or CLOSE action for exit, each connected to its own logic chain.

Common Validation Errors

Learn to recognize and fix the most frequent validation errors:

Error: "Node missing required configuration"

Condition node without a feature or operator selected

Cause:

You added a node but didn't configure its required properties.

How to Fix:

  1. Click the node with the red border to select it
  2. The side panel opens showing configuration options
  3. Fill in all required fields (marked with red asterisks)
  4. For Data Source nodes: select the feature columns you need
  5. For Condition nodes: Choose an operator (<, >, ==, etc.)

✓ Fixed: Node border turns from red to normal color, error disappears from validation panel

Error: "Type mismatch in connection"

Connecting NUMERIC output to BOOLEAN input (or vice versa)

Cause:

You tried to connect incompatible data types. For example, connecting a Data Source column (NUMERIC) directly to an Action node trigger (requires BOOLEAN).

How to Fix:

  1. Identify the problematic connection (shown in validation panel)
  2. Delete the invalid connection
  3. Add an intermediate node to convert data types
  4. For NUMERIC → BOOLEAN: Use a Condition node (e.g., "RSI < 30")
  5. Recreate connections with proper type flow

Tip: Watch connection colors: Cyan = NUMERIC, White = BOOLEAN, Teal = DATA

Error: "Action node trigger not connected"

An Action node exists on the canvas but its trigger port has no connection

Cause:

You added an Action node but haven't wired any logic to its trigger port.

How to Fix:

  1. Build your entry/exit logic using Condition and Logic nodes
  2. Ensure the final node in your logic chain outputs a BOOLEAN value
  3. Connect that BOOLEAN output to the trigger port of your Action node
  4. Verify the connection is valid (BOOLEAN connection type)

Error: "Orphan Math node"

A Math node's output is not connected to any downstream node

Cause:

A Math node was placed and configured but its output port was never wired to anything — its result is unused.

How to Fix:

  1. Connect the Math node's output to a Condition, another Math node, or an Action node's size port
  2. Or delete the Math node if it is no longer needed

Error: "Circular dependency detected" (at save time)

Node graph contains a loop — caught when you attempt to save

Cause:

A node's output eventually connects back to its own input through a chain of other nodes. You can draw the cycle freely on the canvas; the validator catches it when you try to save.

How to Fix:

  1. The validation panel lists nodes involved in the cycle
  2. Trace the connection path to identify the loop
  3. Delete one connection in the loop to break the cycle
  4. Restructure your nodes to create a directed acyclic graph (DAG)

Example: Node A → Node B → Node C → Node A (INVALID)

Understanding Warnings

Warnings don't prevent saving but indicate areas for improvement:

Warning: "Disconnected nodes detected"

What it means: You have nodes that aren't connected to the main strategy graph. They won't affect your strategy's behavior.

Should you fix it? Usually yes - disconnected nodes are either mistakes or leftover from testing. Delete them to keep your strategy clean.

Exception: Comment nodes are allowed to be disconnected (they're for documentation).

Warning: "Duplicate variable name"

What it means: Two Set Variable nodes declare the same variable name. The last write wins on each tick, which is rarely intentional.

Should you fix it? Yes — give each Set Variable node a unique name to make the logic explicit.

Warning: "Cross-timeframe action without a gate"

What it means: An action is driven only by a higher-timeframe condition, with no faster trigger to time it, so it may fire repeatedly within a single higher-timeframe bar.

How to fix it: Add a condition on the base (fastest) timeframe, or turn on the Bar-open gate on the higher-timeframe Data Source node. The Bar-open gate makes the action fire only once — on the first candle of each new higher-timeframe bar — instead of repeating on every faster candle.

Validation Workflow Best Practices

Build-Validate-Fix Cycle

  1. Build incrementally: Add 2-3 nodes at a time, then check validation panel
  2. Fix errors immediately: Don't accumulate errors - address each one as it appears
  3. Watch for red borders: Nodes with errors show red borders - click them to see details
  4. Verify connections: Ensure connection colors match expected data types
  5. Test logic: Mentally trace data flow from sources to outputs
  6. Address warnings: Clean up disconnected nodes and unused features
  7. Final check: Green "Strategy Valid" in panel before saving

Testing Strategy Logic

Validation ensures technical correctness, but you should also verify logical correctness:

Trace Data Flow

Manually follow the path from data sources through logic nodes to your Action nodes. Ensure the logic makes sense: "If RSI is below 30 AND price is above SMA, then the BUY action should trigger."

Consider Edge Cases

Think about extreme scenarios: What happens if RSI is exactly 30? What if all indicators are neutral? Ensure your logic handles these cases appropriately.

Run Small Backtest First

Before running a full backtest, test with a small date range (1 week). This quickly reveals logic errors without waiting for a long backtest to complete.

Check for Conflicting Signals

Ensure your BUY and SELL Action nodes can't both trigger on the same candle unless that is intentional. Use Logic nodes to create mutually exclusive conditions.

Pre-Backtest Validation Checklist

Before Running Your Backtest

Validation Panel Shows Green

"Strategy Valid" message with checkmark visible

Action Nodes Present and Connected

At least one Action node (BUY, SELL, or CLOSE) with its trigger port wired to valid boolean logic

All Features Configured

Every Condition node has a feature and operator selected

No Type Mismatches

All connection colors match expected types (cyan to cyan, white to white)

Logic Makes Sense

Traced data flow from sources to outputs, logic is sound

Disconnected Nodes Removed

All nodes contribute to final outputs (except Comment nodes)

Strategy Saved

Clicked Save button and received success notification

Documentation Added

Comment nodes explain key logic sections (optional but recommended)

Pro Tip: Save your strategy before running a backtest, even if it's still a work in progress. This way, if the backtest reveals issues, you can return to the saved version and iterate.

After Validation Passes

Once your strategy shows "Strategy Valid" in green:

1. Save

Click the Save button to persist your strategy to the database

2. Backtest

Run a backtest to evaluate historical performance and validate logic

3. Deploy

If backtest results are good, deploy to paper trading for live testing

What's Next?