Risk / Reward
The Risk/Reward node derives a stop-loss price and a take-profit price from the current entry price so that the trade has a defined R:R ratio. Given a stop-loss distance, the take-profit is placed at a proportionally larger distance on the profitable side. Default is 1:3.
Formula
With defaults (SL = 2%, risk = 1, reward = 3): TP% = 2 × (3/1) = 6%. On a $100 entry: SL = $98, TP = $106, risk = $2, reward = $6.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
| stopLossPercent | number | 2.0 | Percentage below entry where the stop loss is placed. Controls the risk side of the ratio. |
| riskRatio | number | 1 | Risk side of the ratio (numerator). Typically 1. |
| rewardRatio | number | 3 | Reward side of the ratio (denominator). Higher values push the TP further from entry. |
Inputs & Outputs
| Port | Type | Description |
|---|---|---|
| Input | ||
| input | (number | null)[] | Close price series used as entry reference. |
| Outputs | ||
| entryPrice | number | null | Last valid close price. |
| stopLossPrice | number | null | Stop level at the most recent bar. |
| takeProfitPrice | number | null | Take profit level at the most recent bar. |
| riskRewardRatio | string | Formatted ratio string, e.g. "1:3". |
| riskAmount | number | null | entryPrice − stopLossPrice (per-unit risk in price terms). |
| rewardAmount | number | null | takeProfitPrice − entryPrice (per-unit reward in price terms). |
| values | (number | null)[] | Per-bar stop loss price array (same index as input). |
| timestamps | number[] | UNIX ms timestamps. |
Use Cases
Enforce minimum R:R before entry
Compare rewardAmount / riskAmount against a minimum threshold (e.g. 2.5). Only allow trades where the calculated ratio meets the floor, filtering setups that don't justify the risk.
Combined with Position Sizing
Use Risk/Reward to get the stop-loss price, then feed riskAmount into a Position Sizing calculation together with account equity to determine how many units to trade at the defined R:R.