Connect a Risk Config node to the config input of your Long and Short Signal nodes. Its values become inputs in the strategy's TradingView Settings, so you can tune them on the chart.
atr input and switch "Stop units". Take-profit 3 then means 3 × the current ATR. Stops adapt to volatility instead of using the same % in quiet and wild markets.| Take-profit | Trailing stop | What happens |
|---|---|---|
| set | 0 | A normal take-profit order. |
| 0 | set | The trailing stop switches on once price has moved the trailing distance into profit, then follows the best price at that distance. |
| set | set | No fixed take-profit: when price reaches the take-profit level, the trailing stop switches on and follows the best price at the trailing distance. Lets a winner run instead of capping it. |
| 0 | 0 | The position closes only by stop-loss or an exit signal. |
Example in ATR mode: take-profit 3, trailing 0.5 → once the trade is 3 ATR in profit, a stop follows 0.5 ATR behind the best price. Because both values are TradingView inputs, setting trailing to 0 on the chart turns take-profit back into a normal limit order without regenerating.
Leverage in Strategy Settings scales the position size (same capital, bigger position). The editor also estimates the liquidation price (isolated margin, ignoring fees and funding) and never lets the stop sit beyond it, so a wide stop at high leverage reports the liquidation that would really happen first.
bars_in_trade → Compare >= 20 → Exit Signal closes any trade still open after 20 bars.open_profit_pct is the open trade's profit in % at the bar's close.By default an opposite signal is ignored while a position is open, so one noisy signal can't flip you from long to short. Turn on Allow signal reversal in Risk Config if you want the opposite signal to close the position and open the other side.
TradingView's backtester doesn't know the exact price path inside a bar. When take-profit and stop-loss could both be hit in the same bar, it has to assume an order, and a very tight trailing stop usually looks better in a backtest than it does live. See Can I trust this backtest?
More guides: all guides · step-by-step tutorial · what's new