PulseHub
OPEN-SOURCE SCRIPT
Updated

Distance From Entry + Max Excursion

323
**What this script does**

This indicator displays a small, fully customizable table on the chart that shows two pieces of information relative to a manually defined entry price:

1. **Distance From Entry** — the absolute difference, in points, between the current price and the entry price, along with whether price is currently above, below, or at that level.
2. **Max Excursion** — the largest favorable move price has made since the most recent time it touched the entry level. If price is currently above entry, this tracks the highest high reached since that last touch; if price is currently below entry, it tracks the lowest low reached since that last touch. The figure shown is the point distance between entry and that extreme.

**How it works (concept)**

The script does not pull live position data from any broker. Pine Script has no access to a connected broker account's open trades, fill price, or quantity, so this tool instead uses a single user-defined input (the entry price you place by clicking on the chart) as its reference point.

From there, the script watches every bar to detect a "touch" of that entry price, defined as any bar whose high-low range brackets the entry level (low <= entry <= high). Each time a touch occurs, the running high/low tracker resets to that bar's range. Between touches, the tracker expands to capture the highest high (if price is above entry) or lowest low (if price is below entry) reached during that stretch. This produces a continuously updating "maximum excursion" figure without requiring the user to manually mark when a trade started or which direction it was — direction is inferred automatically from where price currently sits relative to the entry level.

**Why it's useful**

Traders who manually track trade management metrics — specifically, how far price has moved from an entry level, and the best the trade has looked since price last revisited that level — typically do this with mental math or by eyeballing the chart. This script automates that single calculation and displays it persistently in a screen-fixed table, so it doesn't require redrawing tools or recalculating by hand every time price moves.

**Customization**

Nearly every visual aspect of the table is exposed as an input, organized into grouped sections in the settings panel:

- Table position (any of the 9 standard chart anchor points)
- Cell width/height (manual sizing or auto-fit)
- Text horizontal/vertical alignment
- Text size (5 steps) and font family (default or monospace — the two families Pine Script supports)
- Decimal precision (0–4 digits)
- Optional prefix text and direction wording
- Background color, border color, and border width
- Optional color-coding of text based on whether price is above or below entry

**How to use it**

1. Add the indicator to your chart.
2. When prompted, click on the chart at your entry price (or place it roughly and drag the resulting line to the exact level).
3. The table will appear in your chosen screen corner, showing live point distance from entry and the running maximum excursion since the last touch of that level.
4. Open the indicator's settings at any time to adjust position, sizing, colors, font, and decimal precision to your preference.
5. To start tracking a new trade, simply update the entry price input to the new level.

**Limitations**

- This script does not read live broker/account data of any kind. The entry price is a manual input and will not update automatically when a position is closed or a new one is opened.
- If price gaps cleanly across the entry level on a single bar (the bar's open and close both clear entry, but its high/low range does not bracket the entry price), that bar will not register as a "touch," and the excursion tracker will not reset on that bar. This is uncommon in actively traded intraday futures but can occur around large gaps in thinner markets.
- This tool is for visual reference only. It does not generate buy/sell signals, does not constitute trading advice, and makes no claims about trading performance or outcomes.
Release Notes
Update — Added two new rows:
"Your Text Here" — shows the gap, in points, between the best price reached since entry (Max Excursion) and where price is right now. It's always zero or positive: zero when price is sitting at its peak, and growing as price pulls back from that peak. Toggle on/off and rename the label however you like via the settings.
% of Move — takes that same relationship and expresses it as a percentage instead of points: how much of the peak favorable move you're still holding onto right now. 100% means price is at its best point since the last touch of entry; it shrinks toward 0% as price gives that move back. Shows 0% rather than erroring if no excursion has built up yet.
Release Notes
Added rounding to minimum tick value.

Disclaimer

The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by PulseWire. Read more in the Terms of Use.