> ## Documentation Index
> Fetch the complete documentation index at: https://docs.hizz.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Trading modules

> The approved blocks, typed ports, and parameter contracts available to Hizz strategies.

Every Hizz strategy is a composition of small, deterministic modules. The graph
is generated from that strategy's actual engine and manifest; it is not a shared
set of decorative layers. Each module has typed input/output ports, a constrained
JSON parameter schema, and a runtime implementation. The same definition is
compiled for backtesting and agent execution.

<Card title="Open the visual workbench" icon="diagram-project" href="https://hizz.io/ai-trading/modules">
  Inspect a complete strategy as a Houdini/Grasshopper-style node graph. Select
  a node to see its actual parameters and highlight its immediate upstream and
  downstream connections. On desktop, drag any node to rearrange the canvas;
  typed cables update with it.
</Card>

## Directional pipeline

```text theme={null}
market series → trigger + filters → risk bracket → position sizing
              → entry throttle → maker/taker execution
```

Triggers emit `long`, `short`, or `none`. Filters independently allow or reject
each side. The risk block builds protective exits, sizing converts the approved
intent into margin/notional, and execution creates safe order intents.

## Approved module catalog

### Data

| Kind            | Output            | Key parameters                                   |
| --------------- | ----------------- | ------------------------------------------------ |
| `market_series` | aligned `candles` | `provider`, `interval`, `lookbackDays`, `ticker` |

### Signals

| Kind                        | Output             | Key parameters                                |
| --------------------------- | ------------------ | --------------------------------------------- |
| `ema_cross`                 | directional `bias` | `timeframe`, `fast`, `slow`, `clock`          |
| `trend_continuation`        | directional `bias` | `fast`, `slow`, `thresholdBps`                |
| `donchian_breakout`         | directional `bias` | `lookback`, `thresholdBps`                    |
| `rsi_reversion`             | directional `bias` | `period`, `oversold`, `overbought`            |
| `sma_deviation`             | directional `bias` | `window`, `thresholdBps`                      |
| `structure_breakout_retest` | directional `bias` | swing, retest, and volume confirmation fields |

### Filters

| Kind                     | Output              | Key parameters                            |
| ------------------------ | ------------------- | ----------------------------------------- |
| `ema_trend`              | allowed-side `gate` | `fast`, `slow`, `timeframe`               |
| `macd_rsi`               | allowed-side `gate` | RSI bounds and MACD periods               |
| `atr_expansion`          | allowed-side `gate` | `atrPeriod`, `barRangeMult`, `slowPeriod` |
| `volume_surge`           | allowed-side `gate` | `window`, `multiplier`                    |
| `bollinger_middle_break` | allowed-side `gate` | `period`, `armBars`                       |

### Risk, portfolio, and execution

| Kind                 | Output                       | Key parameters                                           |
| -------------------- | ---------------------------- | -------------------------------------------------------- |
| `atr_bracket`        | stop / take-profit `bracket` | `atrPeriod`, `atrStopMult`, `riskReward`, `maxHoldHours` |
| `trailing_stop`      | stop / trail `bracket`       | `stopBps`, `trailBps`, `maxHoldHours`                    |
| `atr_trailing`       | ATR stop / trail `bracket`   | `atrPeriod`, `atrStopMult`, `trailAtrMult`               |
| `position_sizing`    | position intent              | `riskFraction`, `leverage`                               |
| `entry_policy`       | throttled intent             | `maxEntriesPerUtcDay`                                    |
| `directional_orders` | order intents                | maker/taker modes, TTL, offset, retries, and fee model   |

The live registry is available at:

```bash theme={null}
curl https://hizz.io/api/v1/ai-trading/modules
curl https://hizz.io/api/v1/ai-trading/modules?category=signal
```

## Engine-specific graphs

Different engines use different node sets and contracts. Strategies only share
a module when they really share that runtime primitive.

| Engine       | Representative modules and connections                                                                                                                                     |
| ------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Directional  | frame feeds/aggregators → the selected trigger and filters → signal gate → the selected bracket → sizing → optional entry policy → maker/taker order lifecycle             |
| Basis        | Strike/DEX/mark/index/funding feeds → basis or premium z-score → liquidity/funding/forward-validation gates → convergence guard → sizing → execution                       |
| Pairs        | numerator + denominator feeds → pair z-score + hedge estimator → correlation/volatility/edge/cointegration gates → two-leg bracket → hedge-preserving sizing → pair ledger |
| Market maker | candles + order book + inventory → volatility regime + selected quote profile → inventory skew → safety guards → post-only cancel/replace lifecycle                        |
| Rotation     | universe → the selected scoring model → eligibility → selection → optional staggered sleeves → allocation → safety → rebalance orders                                      |

Every returned graph edge identifies `source`, `sourcePort`, `target`,
`targetPort`, and `dataType`. Compilation rejects a missing port or a mismatched
type instead of drawing an invalid cable. In the workbench, hover a node for its
responsibility; select it for parameters, typed ports, and immediate connections.

The API response is canonical and includes complete property descriptions,
bounds, enumerations, examples, and port data types. Prefer it over copying this
summary into an AI system prompt.

## Composition rules

* Exactly one trigger and one risk block are required
* Zero or more filters are combined as gates
* Every referenced `base`, `mid`, or `high` timeframe must exist in `data.frames`
* Fast periods must be lower than corresponding slow periods
* At least one of `allowLong` or `allowShort` must be true
* `riskFraction` is a margin allocation fraction, not a guaranteed loss cap
* `feeBps` is per fill; published maker strategies may instead preserve separate maker/taker costs
* Arbitrary code, imports, callbacks, webhooks, and shell commands are not valid modules
