OPEN-SOURCE SCRIPT

Futures Risk-Based Position Calculator

82
Futures Risk‑Based Position Calculator — Description
This TradingView indicator automatically calculates and displays Entry, Stop Loss (SL), and Take Profit (TP) levels for futures trades based on a fixed dollar‑risk amount.

What it does
Uses your account balance, dollar risk, number of contracts, point value, and tick size to compute how far the stop should be from the entry.
Determines the take‑profit level using a chosen risk‑to‑reward ratio.
Draws three lines on the chart:
Entry line
Stop loss line
Take profit line
Places labels next to the SL and TP lines showing prices and point distances.
Key features
Supports long or short calculation mode.
Configurable line styling:
Width, style (solid/dashed/dotted), color, opacity.
Separate styling for entry, SL, and TP.
Configurable label behavior:
Optional background.
Text color choices.
Adjustable vertical offset to avoid overlapping the lines.
Lines extend left/right by user‑defined bar amounts.
Values are always rounded to the market's tick size.
How levels are calculated
Entry = current close rounded to tick size.
Stop distance (points) = dollarRisk / (contracts × pointValue).
SL = entry − distance (long) or entry + distance (short).
TP = entry + distance × RR (long) or entry − distance × RR (short).
Visual behavior
Lines and labels update only on the last bar to avoid clutter.
Labels show:
SL: price, point distance, and contract count.
TP: price and point distance.

Aviso legal

As informações e publicações não se destinam a ser, e não constituem, conselhos ou recomendações financeiras, de investimento, comerciais ou de outro tipo fornecidos ou endossados pela TradingView. Leia mais nos Termos de Uso.