FX Risk Cockpit is a position size calculator TradingView traders can keep pinned to the chart. Also, you type an account size, a risk percentage and a stop in pips. The script returns lots, units and per-pip value, then draws the entry, the stop and up to three targets as live lines. Indeed, a dashboard adds reward ratios, session range, session drawdown and a risk heat readout. It fires no buy or sell signals.
It is free and open source. Still, you can add it to any chart from the FX Risk Cockpit script page on TradingView, and the full Pine source is published there for you to read.
What FX Risk Cockpit plots on the price chart
On the last bar the script draws a solid entry line and a dashed stop line, both extended to the right. Thus, TP1 draws in the same style, with TP2 and TP3 optional. Semi-transparent fills shade the band between entry and each level. Hence, a LONG or SHORT label sits on the entry price. Each target label shows the pip distance, the cash figure and the reward ratio. Next, a 20-row dashboard groups the rest under Trade Setup, Position Size, Session and Risk Heat. Seven values also stream to the Data Window.

How FX Risk Cockpit is built
The sizing arithmetic
Everything starts with pip size. Then, the script reads the symbol’s minimum tick. If that tick sits below 0.01 it treats a pip as 0.0001, otherwise as 0.01. Yet, stop and target prices then follow simple arithmetic. At default settings a long stop sits 25 pips under entry, TP1 sits 50 pips above, TP2 75 and TP3 100. Truly, entry defaults to the current close, or you type a fixed price instead.
Risk amount is account size times risk percent, so 10,000 at 1 percent gives 100. Plainly, per-pip value for one unit comes from the symbol’s point value, scaled by pip size over min tick. Position units then equal the risk amount divided by stop pips times that per-pip value. Also, dividing units by the lot size gives the lot figure: 100,000 for standard, 10,000 for mini, 1,000 for micro. Reward ratios are simply target pips over stop pips.
Session tracking and the heat gauge
A second block tracks the trading day. On the first bar of each session the script stores the open, then rolls a running high and low. From those it reports session range in pips, session gain or loss in pips from the session open, and drawdown from the session high in both pips and percent.
The drawdown cell shifts color at two levels. Indeed, above 1 percent it turns red. Between 0.5 and 1 percent it turns yellow. Below that it stays green. A separate alert fires when session drawdown passes 2 percent.
Risk heat closes the panel. Still, the script divides the cash stop loss by account size and shows the result as a percent. The label reads LOW under 2, MEDIUM from 2 to 5, and HIGH above 5. Thus, note what that number really is. The cash stop is rebuilt from the same risk amount you typed, so the heat reading mirrors your Risk Per Trade input. Hence, it confirms your setting rather than measuring anything new.
How to read the signals
Set the top three inputs first: account size, risk percent and stop distance in pips. Everything else follows from those. The Lot Size row is the number you carry across to your broker platform.
Check the Pip Value row before you trust that lot figure. Next, the script tries to detect pip value from the symbol. If the number looks wrong, type the correct per-lot value into Pip Value Override. Then, ten is the usual figure for a standard lot on USD-quoted pairs.
Use the reward ratios to sanity-check the plan. Yet, TP1 at 50 pips against a 25-pip stop reads 1:2. If a target needs a ratio you would not normally accept, change the plan before the trade rather than after it.

Every FX Risk Cockpit setting explained
The script exposes 24 inputs, grouped in the settings panel exactly as shown below. Defaults are the published values.
Account
| Setting | What it does | Default | Range |
|---|---|---|---|
| Account Size | Your total account balance in account currency | 10000.0 | |
| Risk Per Trade % | Percentage of account to risk on this trade | 1.0 | 0.1 to 25 |
| Account Currency | Your account denomination currency | USD | USD, EUR, GBP, JPY, AUD, CAD |
Trade Setup
| Setting | What it does | Default | Range |
|---|---|---|---|
| Direction | Trade direction: Long (buy) or Short (sell) | Long | Long, Short |
| Entry Price (0 = current) | Set to 0 to use current close as entry, or type a specific price | 0.0 | |
| Stop Loss (pips) | Stop loss distance in pips from entry | 25.0 | 0.1 to 1000 |
| Take Profit 1 (pips) | TP1 distance in pips from entry | 50.0 | 0.1 to 2000 |
| Show TP2 | Toggles show tp2 on the chart. | on | on / off |
| TP2 (pips) | TP2 distance in pips from entry | 75.0 | 0.1 to 2000 |
| Show TP3 | Toggles show tp3 on the chart. | off | on / off |
| TP3 (pips) | TP3 distance in pips from entry | 100.0 | 0.1 to 2000 |
Position Sizing
| Setting | What it does | Default | Range |
|---|---|---|---|
| Lot Type | Standard=100K, Mini=10K, Micro=1K units per lot | Standard | Standard, Mini, Micro |
| Pip Value Override (0=auto) | Per-pip value for 1 standard lot in account currency. 0 = auto-detect. Use 10 for most USD-quoted pairs | 0.0 |
Display
| Setting | What it does | Default | Range |
|---|---|---|---|
| Show Lines & Labels | Draw entry, SL, and TP lines with labels on the chart | on | on / off |
| Show Risk/Reward Zones | Semi-transparent fill between entry and SL/TP levels | on | on / off |
| Show Dashboard | Show the risk cockpit dashboard table | on | on / off |
| Table Position | Choose the table position from the listed options. | top_right | top_left, top_center, top_right, middle_left, middle_right, bottom_left |
| Text Size | Choose the text size from the listed options. | small | tiny, small, normal |
| Show Risk Heat Gauge | Color-coded risk level indicator in dashboard | on | on / off |
Colors
| Setting | What it does | Default | Range |
|---|---|---|---|
| Entry | Colour used for entry. | #2196F3 | |
| Stop Loss | Colour used for stop loss. | #EF5350 | |
| TP1 | Colour used for tp1. | #26A69A | |
| TP2 | Colour used for tp2. | #66BB6A | |
| TP3 | Colour used for tp3. | #00C853 |

Alerts built into FX Risk Cockpit
The script ships 5 alert conditions. Truly, open the alert dialog on the chart, pick the indicator as the condition source, then choose the event you want. Alerts fire on the close of the bar, so they follow the same confirmed-bar rule the on-chart signals use.
- Price at Entry Level
- Price at Stop Loss
- Price at TP1
- Risk Heat Above 5%
- Session Drawdown Above 2%
Other markets and timeframes
This one is not market-agnostic. Plainly, the script hard-codes pip size into two cases: 0.0001 when the symbol’s min tick sits under 0.01, otherwise 0.01. That rule suits forex pairs well. On indices, crypto and stocks it calls 0.01 a pip, which rarely matches how you think about those markets. Auto pip value can miss too. Also, so outside spot forex, set Pip Value Override and read every pip figure as raw arithmetic.

Limitations worth knowing
The account currency selector is a label only. Indeed, it prefixes the cash figures with USD, EUR or whatever you pick. No conversion happens anywhere in the code. Still, if your account currency differs from the pair’s quote currency, you convert those cash numbers by hand.
Nothing here connects to a broker or to an open position. Thus, the script does not know your real balance, your fills or your current exposure. It sizes one hypothetical trade from numbers you type. Hence, spread, commission, swap and slippage sit outside the maths, and a gap through your stop can cost more than the figure shown.
The session rows track price, not equity. Next, session drawdown measures how far price has slipped from the session high. It says nothing about your account. Then, the tool also produces no entry signals, so timing stays entirely with you.
Get FX Risk Cockpit on TradingView
Open FX Risk Cockpit on TradingView
If you also trade MetaTrader, the MT4 and MT5 indicator library is available below.
Get the complete indicator library
One email unlocks the full MT4 and MT5 indicator library. Yet, this TradingView script stays free on TradingView – the button above adds it to your chart.
Using it alongside MetaTrader
Adding a script on TradingView takes one click, so there is no install step here. Truly, if you want the same idea on MetaTrader, the MT4 and MT5 indicator installation guide walks through copying files into the data folder and attaching them to a chart. You can also browse the full MetaTrader indicator library, the MT4 indicators section, or the other free TradingView scripts published on this profile. For related chart tools see the MT5 indicators section and the forex trading strategies guides.
External references
Frequently asked questions
How does FX Risk Cockpit calculate lot size?
It divides your risk amount by the stop distance in pips times the per-pip value of one unit. That gives units. Dividing units by 100,000, 10,000 or 1,000 converts them to standard, mini or micro lots. Plainly, with a 10,000 account, 1 percent risk and a 25-pip stop, the risk amount is 100.
Does it place trades or send orders?
No. Also, it is a display-only indicator. It draws lines, labels and a table, and it can fire alerts when price comes within one pip of your entry, stop or TP1. Indeed, order entry stays in your broker platform.
Why is the lot size wrong on gold or an index?
Pip detection. Still, the script calls any symbol with a min tick of 0.01 or larger a 0.01-pip instrument, and that rule targets forex. Set Pip Value Override to the correct per-lot value for the symbol. Thus, units and lots then recalculate around it.
What does the Risk Heat gauge tell me?
It shows the cash stop as a percent of account size, green under 2, yellow to 5, red above. Hence, the cash stop derives from the risk percent you typed, so the gauge restates your own input. Treat it as a visual check, not an independent measure.
How much should I rely on this indicator?
Treat it as one input, not a decision. Next, it is a chart analysis tool, not trading advice. Test it on your own markets and timeframes before relying on it. Results are not guaranteed; past performance is not indicative of future results.
