Risk Per Trade
The Risk Per Trade node converts a time-series of account equity values into a dollar risk budget at each bar. It applies a fixed percentage to the account value, giving you the maximum amount of money you should be willing to lose on any single trade at that point in time.
Formula
riskPercentage is a decimal (default 0.01 = 1%). Null or NaN inputs produce null outputs. The calculation is applied element-wise across the entire windowed input series.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
| riskPercentage | number | 0.01 | Fraction of account value to risk. Stored as a decimal: 0.01 = 1%, 0.02 = 2%. Typical range: 0.005–0.03. |
Inputs & Outputs
| Port | Type | Description |
|---|---|---|
| Input | ||
| input | (number | null)[] | Account equity series. Each value represents total account value at that bar. |
| Outputs | ||
| values | (number | null)[] | Per-bar dollar risk budget (accountValue[i] × riskPercentage). Null where input is null/NaN. |
| timestamps | number[] | UNIX ms timestamps aligned 1-to-1 with values. |
| riskPercentage | number | The configured fraction (mirrored for downstream reference). |
Live Update Behaviour
When the chart streamer is active (live mode), the node uses an incremental update path: it updates or appends only the last bar rather than recomputing the full series. This keeps CPU usage minimal during live sessions while keeping the risk budget current in real time.
Use Cases
Adaptive sizing as equity grows
Feed a live equity curve to Risk Per Trade. As the account grows, the risk budget increases proportionally — a natural compounding effect. During drawdown periods, the budget automatically shrinks, reducing exposure when the strategy is underperforming.
Input to Position Sizing
Pipe values from Risk Per Trade into the riskAmount slot of a custom Position Sizing calculation. This keeps the two nodes loosely coupled and makes it easy to adjust the risk percentage without touching the sizing logic.