Indicators · Regime and trust · explained simply
Grail 0.50
Copy the full Pine script and paste it into TradingView’s Pine Editor. Or copy this explanation, open Grok, and paste it with your question.
Grail is a decision panel for a chart. It first says what kind of market this is—uptrend, downtrend, range, or panic. Then it only marks a buy or sell when several checks agree, and only trusts that mark if the same kind of setup has a decent record on this chart. A green BUY or red SELL is trusted. A small grey buy? or sell? is shown but not trusted yet.

Six questions this page answers
Use the guide below the same way you would judge any tool on a chart:
- What state is the market in?
- What should I do, and at exactly what price?
- How sure is it?
- What proves it wrong?
- Has it worked before on this chart?
- What can’t it tell me?
What it tells you
What state is the market in? Grail names the market first. You can read it in the table’s Market row and in the thin ribbon along the bottom of the chart:
- Green ribbon — uptrend: trend strength is high (ADX at or above 25, or the efficiency ratio at or above 0.35), and price and the directional indicators agree that the side is up, relative to a 50-bar EMA.
- Red ribbon — downtrend: the same strength test, but the side is down.
- Blue ribbon — range (chop): trend strength is not high, or the side is unclear. In the default “Both” setting, a strong reading still counts as range if the EMA side and the directional indicators disagree.
- Orange ribbon — panic: volatility is in the top 10% of its own last 252 bars (about one year on a daily chart). Panic is checked first, so it wins over trend or range.
While Grail is still learning (it needs those 252 bars plus the stretch and momentum lines), the ribbon is blank and the table says LEARNING.
Grail is built from the same stretch line as MR Zones 1.1 and the same momentum turn (PMO) as PrimoX 1.1, then adds extra checks. A mark is only drawn when the layers agree:
- Location: how far the close has stretched from its 45-bar average, scored against zones learned from the last 252 bars. Panic uses even farther “extreme” edges.
- Trigger: the move is actually turning. In a range or panic that means the stretch line turns back from the zone. In a trend it means the PMO crosses its signal line after a dip or bounce. A volume check exists but is off by default.
- Higher timeframe: by default, no new longs against a falling weekly trend, and no new shorts against a rising one, unless the market is in panic at an extreme. This filter is ignored when the chosen timeframe is not actually higher than the chart.
- Odds (the record): every past setup of the same type on this chart is scored the way the trade book would trade it (in at the next open; out at the trailing stop, at the next open after an exit signal, or at a time limit if you set one), after costs. Too little history, or a record that fails the trust test, makes the mark grey.
There are six setups. At most one can fire on a bar, and only on a confirmed close, so the marks do not repaint:
- Range bounce (buy): range market, the stretch line turns up after a bar below the green zone, and momentum is rising or recently confirmed.
- Trend dip (buy): uptrend, the PMO crosses up through its signal line after a pullback toward the middle of the stretch range.
- Panic low (buy): panic, the stretch line turns up after a bar below the extreme low line. The weekly filter is waived here.
- Range top, trend rally, and panic spike: the sell-side mirrors of those three. A panic spike also needs price to have closed lower than it did 20 bars ago (on by default), so a blow-off rally is not shorted just because volatility is high.
By default Grail is long only: a sell is an exit, not a short. Also by default, any sell-side turn can close a long, even if that turn is not a trusted SELL. No orders are sent to a broker. It works on any chart and timeframe.
The marks and colors
What should I do? Read the words on the chart first:
- BUY / SELL: a trusted setup at that bar’s close. The idea is to act at the next bar’s open.
- buy? / sell?: a setup that does not yet have a trusted record. It is shown so you can see it, but by default it does not enter the trade book or fire the main alert.
- out: the trade book closed a position on an exit signal (at the next open).
- stop: the trade book was stopped out.
- E: an earnings report is due within five trading days (or a report just landed). Crypto, futures, forex and most ETFs have no earnings dates, so this stays quiet there.
The chart is shaded while the trade book holds a position. Hover a mark to see the setup name, the record, the suggested stop, and any warnings. An optional Agreement number can be printed on the marks; it is off by default, and a higher number has not been shown to win more often.
Prices to watch
At exactly what price? The right edge of the chart shows the levels that matter right now, once Grail is ready:
- Buy zone below [price]: the stretch counts as far enough down. A buy mark comes if the stretch line then turns back up from there. In panic this is the farther “panic buy zone.”
- Exit zone above [price]: the stretch counts as far enough up. An exit or sell mark comes if the line then turns back down.
- Momentum turns up above / down below [price]: the close that would make the PMO cross its signal line on the next bar. In a trend, that cross is the trigger. This price is exact; the zone prices are close estimates.
- Trade stop / Stop [price]: the gold line. While the trade book is in a trade, this is the book’s trailing stop. Otherwise it is the suggested stop of the latest trusted signal.
A label that says not active is still drawn so you can see the level, but it is not the trigger in the current market type (for example, the momentum price is only live in a trend). Levels more than 15% away are hidden. A close past the stop is Grail’s plain test that the idea was wrong.
The table, row by row
The default layout is Phone: two narrow columns that fit a phone screen. Compact and Full layouts show the same facts with more room. The header cell has a chart key in its tooltip.
- Status (top right): LEARNING, WAIT (not in a trade), BUY or SELL (a trusted signal at the last close), or HOLDING LONG / HOLDING SHORT with the entry and the open gain or loss.
- Market: uptrend, downtrend, range, or panic, plus the weekly (or other higher-timeframe) trend if that filter is on.
- Stretch: normal, stretched down or up (in a zone), or very stretched (the panic extremes).
- Buy if: what would make the next buy, in words, often with a price.
- Exit if (or Sell if when shorts are on): what would make the next exit. In an uptrend this often says the stop is the only exit.
- Last: the most recent setup, how many bars ago, and whether it was trusted.
- Record: for setups like the last one, the win rate, the average result after costs, how that compares with the market’s normal drift, a sample count, and whether it is trusted. If similar setups were borrowed to help the count, that is said here too.
- Book: the pretend trade book: an open trade and its stop, or flat with the book’s total versus simply holding.
- Risk: only when there is something to act on. After a fresh buy signal: the stop and a position size for a 1% account risk. During an open trade: the trade stop and how far it is from here. Otherwise: “no trade now.”
- Warn: earnings soon, conditions Grail has not seen in its learning window, recent results weaker than the long-run record, or too few setups on this timeframe (it may suggest a shorter one). You can also type a wipe-out price from a leveraged account; if you do, Grail will warn when price gets close. Leave that setting at 0 if you do not want it.
Has it worked before? The Record and Book rows are Grail’s own test on this chart, after the costs in the settings (default 0.10% for a round trip). They are not anyone’s real results. The numbers in the example screenshot are from that one TSLA 2-hour chart only.
How sure it is, and what proves it wrong
How sure is it? Trust is a yes-or-no gate, not a promise. By default a setup is trusted only when:
- it has enough finished samples of its own (20, or at least 5 of its own plus 20 in a pool of similar setups on this same symbol), and
- the average result, after costs, beats the market’s normal drift over the same number of bars (the average bar-to-bar return in the learning window). A setup that only rode a rising market does not pass on that drift alone.
You can loosen that test to “average above zero,” or tighten it so the edge also has to be clearly above zero. A setup with no history of its own can never be trusted from the pool alone. If the last 20 finished results trail the long-run record by 5 points or more, new marks are dimmed; the table warns “recent results weak.”
The Agreement number (0–100) mixes how strongly the layers agree with the historical win rate. It is not calibrated: a higher number has not been shown to win more often. Treat it as a label, not a probability.
What proves it wrong? The gold stop. For a long, it starts at the 10-bar low minus half an ATR, then trails up at each close and never moves back (on by default). If a bar’s low touches the stop, the trade book exits at the stop; if the bar opens past the stop (a gap), it exits at the open, which is worse. In an uptrend there is often no exit signal at all, so the stop is the only way out until the market type changes. A close past that line is the chart’s way of saying the idea failed.
Alerts
Set one alert per chart. In TradingView open the alert dialog, set Condition to Grail 0.50, choose Any alert() function call, and pick Once per bar close if offered. With the trade book on (the default), that alert follows the book:
- BUY or SELL opens a position at the next open.
- EXIT or COVER closes one. In long-only mode nothing is sent as SELL; a close is EXIT.
- A reason field says why (including stop when the book is stopped out on that bar).
With the trade book off, trusted setups send BUY, and SELL (EXIT in long-only mode). Grey marks do not fire this alert unless you turn on “Alert on untrusted marks.”
The condition list also has plain-text alerts for a trusted long, a trusted short or exit, any trusted signal, a grey setup, a market-type change, an exit on a sell turn, earnings soon, and unfamiliar conditions.
What it can’t tell you
- It does not predict prices. A trusted BUY means this kind of setup has a passing record on this chart and the checks agreed at the close, not that the bottom is in.
- The record is this symbol and timeframe only. A thin history, a new listing, or a market doing something outside the last 252 bars can make the record a poor guide. When conditions are unfamiliar, Agreement is cut and the table warns.
- Agreement is not a win probability. Trust can also be borrowed from similar setups on the same chart; that is helpful when samples are scarce, and it is also a way one setup can lean on another’s luck.
- In a strong uptrend there may be no exit signal. A trailing stop can still give back a large gain, and a gap can open past the stop.
- Earnings reports can jump price past any stop. The E mark is a warning, not a time to trade.
- The rules look at price (and optional volume). They ignore news, the wider market and your own risk. Position size in the Risk row is a helper for a 1% stop risk, not a recommendation.
- The Record and Book are a pretend account on past prices. They do not include taxes, and real fills can be worse than the next open. The numbers change with the chart, timeframe and settings. Do not read them as anyone’s real results, and do not treat the example screenshot as a typical outcome.
- Grail is a TradingView indicator. It is not part of the nightly site refresh, so MystTrades does not show live Grail readings.
Version
Grail 0.50 by TheurgyLabs (build of Nov 14, 2026). Version 0.50 scores past setups the way the trade book trades them, asks the record to beat the market’s normal drift before a mark is trusted, keeps the stop line from showing a short stop or a stale stop in long-only mode, and makes the JSON alert follow the trade book. Earlier 0.4x builds added long-only exits, word marks, the market-type ribbon, the Phone table, a trailing stop, and the rule that trust needs a positive record.
For learning and research, not personal investment advice. This page explains the indicator; it does not show live readings or change your TradingView script. The table numbers are a hypothetical test on past prices, not real trades. Past results do not promise future results.