OPEN-SOURCE SCRIPT
Mis à jour Trade Tracker (with Trailing Stop)

A simple indicator to track an open trade position.
Notes de version
fix to buffersNotes de version
WHAT'S NEW- Status box showing status, price, move in $, trailing stop level, distance to TP / SL, Risk : Reward, Trail R : R and time in trade
- Two progress bars: SL to TP, and SL to trailing activation
- Entry marker on your start candle, plus markers when the trailing stop activates and when the trade closes (TP, SL or trailing stop)
- Alerts when the trailing stop activates and when the trade closes
- Status box text size setting (Tiny / Small / Normal) for a better fit on mobile
- Long and Short support
Notes de version
FULL INDICATOR DETAILSTRADE TRACKER
Follow a live trade right on your chart: entry, take profit, stop loss and a trailing stop that moves with price.
OVERVIEW
Trade Tracker is for traders who are already in a trade (or planning one) and want to see exactly where it stands. You type in your levels, and the script draws them, follows the trailing stop as price moves, shows a live status box, and alerts you when something important happens.
It does not place or close trades and it does not connect to any exchange. It is a tracking and visual tool, so you stay in full control.
WHAT YOU ENTER
- Direction: Long or Short
- Trade start time: the candle you entered on
- Entry price
- Take profit (TP) price
- Stop loss (SL) price
- Trailing stop activation price: the price that switches the trailing stop on
- Trailing callback (%): how far price can pull back from its best point before the trailing stop is hit
There are also display settings: show or hide the status box, status box text size (Tiny / Small / Normal), line labels on or off, shaded zones on or off, and how far to the right the labels sit.
HOW THE TRAILING STOP WORKS
1. Waiting. Until price touches your activation price, the trailing stop is off and your SL is your only stop.
2. Activation. The moment price reaches the activation price (the high for a long, the low for a short), the trailing stop switches on and stays on.
3. Following price. From then on, the script remembers the best price reached: the highest for a long, the lowest for a short.
4. The trailing stop line sits your callback % away from that best price, below it for a long and above it for a short. When price makes a new best, the line moves with it. When price pulls back, the line stays where it is. It only ever moves in your favour, never backwards.
5. Your SL stays as a safety floor. The trailing stop only takes over once it is closer to price than your SL.
Example (long): activation 100,500 and callback 0.5%. Price rises to 101,000, so the stop sits at 100,495. Price rises to 101,400, so the stop moves up to 100,893. Price falls back to 101,100 and the stop stays at 100,893. If price then drops to 100,893, the trade closes at the trailing stop.
WHEN THE TRADE ENDS
The trade is treated as closed when price touches any of these:
- Take profit
- Stop loss
- The trailing stop (once active)
Each candle is checked against the trailing stop as it stood at the start of that candle, so one candle can't raise the stop and hit it at the same time. If a candle could have hit both a stop and your TP, the script assumes the stop was hit first (the cautious choice).
Once closed, the script stops tracking. The lines end on the exit candle, an exit marker is drawn, and the status box freezes to show the result.
WHAT YOU SEE ON THE CHART
Lines (drawn from your start time while the trade is live)
- Entry (grey), TP (green), SL (red), trailing activation (thin orange)
- Best price since activation (faint aqua): a helper line so you can check the trailing stop is doing the right thing
- Trailing stop (yellow), which appears once the trailing stop is active
Extended lines and labels
Lines run off to the right of the latest candle, with a name label at the end of each: Entry, TP, SL, Trailing activation and Trailing stop. The trailing stop label only shows once it is active.
Shaded zones
A soft green zone between entry and TP, and a soft red zone between entry and SL, so you can see at a glance how much room you have each way.
Markers
- Entry: green up-triangle (long) or red down-triangle (short) on your start candle
- Orange circle where the trailing stop activates
- Green diamond for a TP exit
- Red X for an SL exit
- Yellow X for a trailing stop exit
THE STATUS BOX (top right)
- Title bar: green for Long, red for Short
- Status: Waiting, Trailing on, or Closed with the reason (TP, SL or Trailing stop)
- Price: the latest price
- Move ($): the price move against your entry, green when in profit and red when losing. This is the move per one unit of the asset, not your account profit
- Trail stop: the current trailing stop level, or how far price still has to go to activate it
- TP / SL away: distance from the current price to your TP and SL, in whole numbers
- Risk : Reward: your SL distance compared with your TP distance, e.g. 1 : 2.4. It is fixed for the trade
- Trail R : R: your SL distance compared with the distance from entry to the activation price. It shows how much you would be up, compared with your risk, when the trailing stop switches on
- In trade: how long the trade has been running (days, hours, minutes). It freezes at the exit once the trade closes
- SL to TP bar: fills as price moves from your SL towards your TP
- SL to activation bar: fills as price moves from your SL towards the trailing activation price. It turns full and aqua with a tick once the trailing stop is on
The numbers in the box use fixed formats, so the box doesn't change width as prices move. Set the text size to Tiny if you want it smaller on a phone.
ALERTS
You get an alert when:
- The trailing stop activates
- The trade closes, with the reason (TP, SL or Trailing stop) and the exit price
To set it up: click Create Alert, choose Trade Tracker as the condition, then select "Any alert() function call". Alerts run on the chart's timeframe, so a smaller timeframe (like 1 minute) gets closer to real time.
GOOD TO KNOW
- - Everything is worked out from each candle's high and low, so the script can't see the order of moves inside a candle. This is why it assumes the stop comes first when both could have been hit.
- Exits are assumed to fill exactly at your levels. Real fills in fast markets can be worse.
- Fees, funding, leverage and position size are not included.
- It tracks one trade at a time.
- The trailing stop follows the common "callback rate" idea used on many crypto exchanges, but each exchange has its own rules (for example, which price triggers it), so your real stop may behave slightly differently.
- Prices are shown in the chart's own price units, and "$" is used for readability.
DISCLAIMER
This script is a tracking and visualisation tool for educational and informational purposes only. It is not financial advice and does not guarantee any results. Trading carries risk, so always manage your own risk.
Script open-source
Dans l'esprit TradingView, le créateur de ce script l'a rendu open source afin que les traders puissent examiner et vérifier ses fonctionnalités. Bravo à l'auteur! Bien que vous puissiez l'utiliser gratuitement, n'oubliez pas que la republication du code est soumise à nos Règles.
Clause de non-responsabilité
Les informations et publications ne sont pas destinées à être, et ne constituent pas, des conseils ou recommandations financiers, d'investissement, de trading ou autres fournis ou approuvés par TradingView. Pour en savoir plus, consultez les Conditions d'utilisation.
Script open-source
Dans l'esprit TradingView, le créateur de ce script l'a rendu open source afin que les traders puissent examiner et vérifier ses fonctionnalités. Bravo à l'auteur! Bien que vous puissiez l'utiliser gratuitement, n'oubliez pas que la republication du code est soumise à nos Règles.
Clause de non-responsabilité
Les informations et publications ne sont pas destinées à être, et ne constituent pas, des conseils ou recommandations financiers, d'investissement, de trading ou autres fournis ou approuvés par TradingView. Pour en savoir plus, consultez les Conditions d'utilisation.