指标

指标

RDZ PRO SMC**RDZ PRO SMC – Smart Money Concepts Trading Indicator**
RDZ PRO SMC is a Smart Money Concepts (SMC) market structure indicator designed to help traders identify key price action areas, liquidity events, and potential trade opportunities.
The indicator combines multiple SMC concepts into one clean chart tool:
• **Market Structure**
* Higher Highs (HH)
* Higher Lows (HL)
* Lower Highs (LH)
* Lower Lows (LL)
* Break of Structure (BOS)
* Change of Character (CHOCH)
• **Liquidity Analysis**
* Previous Day High/Low
* Previous Week High/Low
* Previous Month High/Low
* Liquidity sweep detection
• **Fair Value Gaps (FVG)**
* Bullish and bearish imbalance zones
* Automatic FVG box marking
* Optional mitigation removal
* Consequent Encroachment (CE) levels
• **Multi-Timeframe Analysis**
* Higher timeframe bias
* Lower timeframe confirmation
* Designed for traders using top-down analysis
• **Entry Assistance**
* BUY and SELL signals based on structure confirmation, trend bias, and imbalance conditions
* Alerts available for BOS, CHOCH, FVG, and entry signals
RDZ PRO SMC is designed for traders who use price action, liquidity concepts, and institutional-style market analysis. It is not a standalone trading system and should be combined with proper risk management and personal trading rules.
Best suited for futures, indices, forex, and crypto markets.
指标

RDZ PRO SMC**RDZ PRO SMC – Smart Money Concepts Trading Indicator**
RDZ PRO SMC is a Smart Money Concepts (SMC) market structure indicator designed to help traders identify key price action areas, liquidity events, and potential trade opportunities.
The indicator combines multiple SMC concepts into one clean chart tool:
• **Market Structure**
* Higher Highs (HH)
* Higher Lows (HL)
* Lower Highs (LH)
* Lower Lows (LL)
* Break of Structure (BOS)
* Change of Character (CHOCH)
• **Liquidity Analysis**
* Previous Day High/Low
* Previous Week High/Low
* Previous Month High/Low
* Liquidity sweep detection
• **Fair Value Gaps (FVG)**
* Bullish and bearish imbalance zones
* Automatic FVG box marking
* Optional mitigation removal
* Consequent Encroachment (CE) levels
• **Multi-Timeframe Analysis**
* Higher timeframe bias
* Lower timeframe confirmation
* Designed for traders using top-down analysis
• **Entry Assistance**
* BUY and SELL signals based on structure confirmation, trend bias, and imbalance conditions
* Alerts available for BOS, CHOCH, FVG, and entry signals
RDZ PRO SMC is designed for traders who use price action, liquidity concepts, and institutional-style market analysis. It is not a standalone trading system and should be combined with proper risk management and personal trading rules.
Best suited for futures, indices, forex, and crypto markets.
指标

Smart Money Concepts Liquidity Sweep, Order Block & FVGOVERVIEW
Every Smart Money indicator draws order blocks and tells you they work. This one scores them 0–100 and then forward-tests whether the score is actually true — on your instrument, on your timeframe.
It maps liquidity, detects stop-hunts, builds entry zones from the displacement that follows, confirms them with real order flow, and grades every zone that price returns to. Instead of "here is an order block, trust me", the panel tells you something like:
Tier-A zones returned +0.23R vs +0.08R for a matched control, n=61, t=2.1 — PROVEN
...or, just as usefully, NOT PROVEN. It is built to be able to tell you it doesn't work.
This is a research and framing tool. It is NOT a strategy, NOT a signal service, and NOT a validated edge.
WHY THESE PARTS ARE ONE TOOL (mashup rationale)
The Smart Money / ICT model is a SEQUENCE. Each step is meaningless on its own, and that is why they are combined here rather than sold as separate scripts:
1. LIQUIDITY POOLS — Stops cluster above equal highs (buy-side) and below equal lows (sell-side). Swing points within an ATR tolerance are clustered into a single pool; the more swings, the more stops resting there. A pool is not a signal. It is a magnet and a target.
2. THE SWEEP — Price wicks THROUGH the pool and closes back INSIDE it. That is a stop-hunt, and it is the only part of the sequence that reveals intent. A sweep alone is still not a trade.
3. DISPLACEMENT — An impulsive, ATR-normalised move away from the swept level. This is what separates a SWEEP (reversal) from a RUN (continuation).
4. THE ZONE — Displacement leaves footprints: a FAIR VALUE GAP (a three-bar imbalance) and an ORDER BLOCK (the last opposing candle before the impulse). Where an FVG sits INSIDE an order block, two independent structures agree — flagged as a confluence zone.
5. LOCATION — The zone is then judged on WHERE it sits. Against the VOLUME PROFILE (value area, point of control, and untested "naked" POCs), and against the DEALING-RANGE EQUILIBRIUM. A bullish zone in DISCOUNT is a zone you are being paid to buy; the same zone in premium is not.
6. ORDER FLOW — The question structure cannot answer: did anyone actually show up? Intrabar delta signs each lower-timeframe bar's volume by its own direction. A bullish zone born on NEGATIVE delta is a vacuum, not a footprint — and scores nothing for it.
7. THE ENTRY — Price is never chased. The engine arms only when price RETRACES into a fresh zone, then frames entry / stop / target — the target being THE NEXT OPPOSING POOL OF STOPS, because that is where the next batch of liquidity is resting.
8. THE CALIBRATION — Without it, everything above is folklore.
Remove any one of these and the tool marks noise, chases price, targets nothing, ignores where value actually is, or reports a confidence it has not earned.
THE SCORE (0–100, eight measurable components, no discretion)
Displacement strength ...... impulse body ÷ ATR — the energy behind the zone
Participation (RVOL) ....... volume at formation vs its own recent average
Born from a sweep .......... did a stop-hunt precede it? (the core ICT claim)
Imbalance size ............. FVG height ÷ ATR
HTF alignment .............. does the higher timeframe agree?
Premium / discount ......... bullish zone in DISCOUNT? bearish zone in PREMIUM?
Volume-profile location .... at value, at the POC, or at an untested POC?
Order flow (delta) ......... was the displacement backed by real aggressive flow?
Tiers: A (70+) · B (40–69) · C (below 40). Every weight is an input — if you think the sweep matters more than I do, turn it up, and let the calibration tell you whether you were right.
THE CALIBRATION — AND WHY IT IS HONEST
Every zone trade is paired with a MATCHED CONTROL: the same bar, the same direction, and the SAME R:R — but entered at market with an ATR stop instead of at the zone. This isolates exactly one variable: does entering AT THE ZONE beat entering anywhere else on identical geometry? Under a random walk, this control has zero expectancy, so anything the zones earn is real.
Each tier is tested against its OWN control, because an A-zone may carry a very different R:R from a C-zone, and a trade's hit rate depends on its R:R.
Results are reported as EXPECTANCY IN R, not hit rate. When R:R varies from trade to trade, a hit rate on its own is meaningless: a 6R winner at 20% is +0.4R (excellent), while a 1R winner at 55% is +0.1R (barely worth the commission).
A Welch t-test decides whether the difference is real or luck. The panel does not say "proven" unless t > 1.96.
The panel also answers the one question that matters most: DOES TIER A BEAT TIER C? If the scoring model has any value, A-grade zones must outperform C-grade zones. If they don't, the score is noise — and it will say so.
Conventions are deliberately chosen so the tool cannot flatter itself:
· Both barriers touched on the same bar → the STOP is assumed first.
· Expired trades are marked to market, not counted as wins or losses.
· Everything is logged and resolved on confirmed bars only.
HOW TO USE IT
1. Read the bias, the liquidity map, and the premium/discount shading. Pools above are buy-side, pools below are sell-side, and price usually travels from one to the other.
2. Wait for a SWEEP, then for a zone to be created by the displacement that follows.
3. Do NOT chase. The engine arms an entry only when price RETRACES into a fresh zone.
4. Watch for ABSORPTION at the zone — heavy volume, a small range, price holding. Someone is soaking up the aggression. That is a defended zone, and it is the best live confirmation available.
5. READ THE CALIBRATION BEFORE YOU WEIGHT ANY OF IT. If Tier A is not proven on your instrument and timeframe, a zone is a LOCATION, not a PROBABILITY — treat it as context only.
6. Entry / stop / target and the resulting R:R are drawn on the chart. They are arithmetic, not advice.
Do not tune the weights until the numbers turn green. That is curve-fitting, and the calibration exists to catch it — not to be defeated by it.
ORIGINALITY
The underlying SMC concepts are public and credited below. What is assembled here is the specific synthesis: an eight-component measurable score, the fusion of SMC structure with auction-theory location (volume profile and premium/discount), true intrabar order-flow confirmation, a per-tier matched control, expectancy-in-R reporting, and a significance test that can — and frequently does — return "not proven".
Clean-room implementation. No third-party Pine code is reused.
UNIVERSAL / DATA REQUIREMENTS
Works on any symbol and any timeframe — the engine is ATR-normalised throughout, so it adapts to the instrument rather than assuming point values.
Volume improves the score but is NOT required. On a symbol without real volume, the RVOL, volume-profile and order-flow components neutralise and the panel says so, rather than blanking or pretending.
Intrabar delta requires a timeframe strictly below the chart's. The script AUTO-MAPS this (1m→5s, 3m→15s, 5m→30s, 15m→1m, and so on) because if the intrabar timeframe equals the chart timeframe there is only ONE intrabar — the bar itself — and delta degenerates to ±100% on every bar. Where true intrabar data is unavailable, the script falls back to a close-location proxy AND LABELS IT AS A PROXY in the panel.
NON-REPAINTING
Pools, sweeps, displacement, zones, the volume profile, absorption and entries are ALL computed on confirmed bars only.
Swing points use ta.pivot* and are therefore known only AFTER their confirmation bars. This is why a liquidity pool appears a few bars after its swing. That delay is the honest cost of not repainting, and it is paid deliberately — a level that moves after the fact is worse than no level at all.
The higher-timeframe read uses lookahead_off with a live-bar offset. The calibration harness logs AND resolves on confirmed bars, so its statistics cannot inflate intrabar. Nothing here is drawn and then moved.
HONEST LIMITATIONS — PLEASE READ
Smart Money Concepts is a popular framework, not a proven one. That is precisely why this script measures it instead of asserting it.
The calibration figures are IN-SAMPLE, close-to-close, with NO costs or slippage, and they use overlapping windows. A proven in-sample edge is NOT a guarantee of out-of-sample results.
The rolling volume profile is an APPROXIMATION — each bar's volume is spread uniformly across the bins its range covers. It is not tick data.
Small samples are unreliable. A tier with a low "n" is provisional even if it looks good.
If the edge is near zero, negative, or unstable across timeframes, the honest conclusion is that this model carries no edge on that instrument. The tool is designed to be able to tell you that, and you should believe it when it does.
Nothing here predicts price.
CONCEPT CREDITS
Smart Money / ICT concepts — liquidity pools, stop-hunts, displacement, fair value gaps, order blocks, premium/discount and optimal trade entry — are public trading concepts popularised by Michael J. Huddleston (Inner Circle Trader) and the wider SMC community.
Market Profile, the point of control and the value area — J. Peter Steidlmayer and the CBOT.
Market structure theory — Charles Dow.
Average True Range — J. Welles Wilder.
Wilson score interval — Edwin B. Wilson.
Triple-barrier forward labelling — Marcos López de Prado.
Welch's t-test — B. L. Welch.
The zone-scoring model, the order-flow fusion, the per-tier matched control and the tier calibration are the author's own. Not affiliated with, nor endorsed by, any of the above.
DISCLAIMER
This is a research and educational tool only. It is NOT financial advice, NOT a recommendation, and offers NO guarantee of profitability or accuracy. Indicators describe past behaviour; they do not predict the future. Entry, stop and target output is arithmetic, not advice. Trading carries a risk of loss. Test out-of-sample and make your own decisions. The author accepts no liability for any use of this script. 指标

Margin Debt YoY % 以下提供中英文版本,你可以依 TradingView 發布規範直接貼上使用:
中文說明
FINRA 保證金負債年增率 (FRED 替代數據)
本指標追蹤美國股市槓桿程度的年增率變化,作為觀察市場情緒與系統性風險的參考工具。
數據來源與計算方式
由於 TradingView 平台並未直接提供 FINRA 官方月度保證金負債數據,本指標改用 FRED(聖路易斯聯邦準備銀行)公布的季度數據 BOGZ1FL663067003Q(證券經紀商與交易商保證金貸款餘額)作為替代指標。此數據與 FINRA 每月公布的保證金負債高度相關,但統計口徑與頻率略有不同(季度 vs 月度),因此數值會與 FINRA 官方數據存在些微差異,僅供趨勢參考。
年增率計算方式為:當期數值與去年同期(4個季度前)相比的百分比變化。
視覺標示區間
🔴 過熱警戒帶(+20% ~ +45%):保證金負債年增率達此區間時,顯示市場槓桿擴張速度偏快,歷史上常出現在牛市末期或泡沫階段。
🟢 恐慌洗盤帶(-20% ~ -45%):年增率大幅萎縮時,顯示投資人正在去槓桿,常見於市場修正或恐慌性拋售期間。
⬜ 經濟衰退期(灰色背景):根據 NBER(美國國家經濟研究局)官方認定的衰退期間,資料取自 FRED 的 USREC 系列。
注意事項
保證金負債數據本身具有落後性,且季度/月度發布頻率遠低於股價數據,因此本指標不適合作為短線交易訊號,較適合用於中長期市場情緒與槓桿週期的觀察。
過熱與恐慌區間的數值門檻(±20%、±45%)是根據歷史經驗設定的參考範圍,並非精確的買賣訊號,使用者應搭配其他技術指標與基本面分析綜合判斷。
本指標僅供教育與研究用途,不構成任何投資建議。
English Description
FINRA Margin Debt YoY % (FRED Proxy)
This indicator tracks the year-over-year percentage change in U.S. stock market leverage, offered as a reference tool for gauging market sentiment and systemic risk.
Data Source and Methodology
Since TradingView does not provide a direct feed of FINRA's official monthly margin debt statistics, this indicator uses BOGZ1FL663067003Q from FRED (Federal Reserve Bank of St. Louis) — "Security Brokers and Dealers; Margin Accounts at Brokers and Dealers" — as a proxy. This FRED series is closely correlated with FINRA's monthly margin debt figures but differs in reporting frequency (quarterly vs. monthly) and methodology, so values will diverge slightly from official FINRA data. Use this indicator for trend observation rather than exact figures.
The year-over-year change is calculated by comparing the current value to the value four quarters (one year) prior.
Visual Zones
🔴 Overheat zone (+20% to +45%): Rapid expansion of margin debt, historically associated with late-cycle bull markets or bubble conditions.
🟢 Panic/washout zone (-20% to -45%): Sharp contraction in margin debt, typically seen during market corrections or forced deleveraging events.
⬜ Recession periods (gray background): Official U.S. recession dates as determined by the NBER (National Bureau of Economic Research), sourced from FRED's USREC series.
Notes
Margin debt data is inherently lagging, and its quarterly/monthly release frequency is much slower than price data. This indicator is better suited for observing medium- to long-term leverage cycles and sentiment shifts rather than short-term trading signals.
The overheat and panic thresholds (±20%, ±45%) are historically informed reference ranges, not precise buy/sell signals. Combine with other technical and fundamental analysis before making decisions.
This indicator is for educational and research purposes only and does not constitute financial advice. 指标

指标

Forward P/E: Price-Reactive and Reported [Pro]How to Interpret the Forward P/E: Price-Reactive and Reported Indicator and Table:
What this indicator does
This indicator compares two versions of forward P/E:
Term
Meaning
Reactive
Daily price-adjusted forward P/E using the latest anchored forward EPS
Reported
TradingView’s reported forward P/E from its financial data source
The chart itself plots the Reactive Forward P/E, while the table shows both Reactive / Reported valuation context.
The main question it answers is:
Has the stock’s valuation moved too far compared with its own history?
Best default settings
Setting
Suggested
Financial Period Mode
Auto FY then FQ
Historical Lookback
3 Years or 5 Years
Require Full Lookback History
Off
Minimum Valid Bars
63 or 126
Smoothing Type
EMA
Smoothing Length
10
Signal Length
20
Percentile / Z-Score Source
Raw Price-Reactive P/E
Show Reported Line
Off
Show Reactive Adaptive Bands
On
Fill Extreme Zones
On
For newer stocks, use 6 Months, 1 Year, or 2 Years.
Main table readings
Reactive / Reported P/E
Example:
42.5x / 38.9x
This means:
Side
Meaning
Reactive P/E
Price-adjusted forward P/E based on current price
Reported P/E
TradingView’s reported forward P/E
If Reactive P/E is much higher than Reported P/E, the stock price may have run up since the last reported valuation update.
Smoothed Reactive P/E
This is the smoother plotted value.
Use it to read the trend, not the exact current valuation.
Reading
Best use
Reactive P/E
Current valuation estimate
Smoothed Reactive P/E
Cleaner visual trend
Anchored Forward EPS
This is the estimated forward EPS base used to calculate the Reactive P/E.
Reactive P/E = Current Price / Anchored Forward EPS
If the anchored EPS is stale, the Reactive P/E may still move daily with price, but the earnings base may be outdated.
Reactive / Reported Rank
This is one of the most important rows.
Example:
91% / 78%
Side
Meaning
Reactive Rank
Where the price-adjusted P/E ranks versus its own history
Reported Rank
Where the reported P/E ranks versus its own history
Interpretation:
Percentile Rank
Meaning
95%+
Extremely expensive
90–95%
Expensive / stretched
75–90%
Above-normal valuation
25–75%
Normal valuation range
10–25%
Below-normal valuation
5–10%
Historically cheap
Below 5%
Deep valuation discount
A major warning setup is:
Reactive Rank above 90%
Reported Rank much lower
That can mean price has moved ahead of the last reported valuation update.
Reactive / Reported Median
Example:
31.0x / 29.5x
This shows the stock’s historical “normal” P/E level for each method.
Use this to see whether the current valuation is above or below its own normal range.
Reactive / Reported Premium
Example:
+37% / +28%
This means valuation is above its historical median.
Reading
Meaning
+50%
Very rich versus normal
+20%
Above normal
0%
Near median valuation
-20%
Below normal
-40%
Potentially cheap
This is one of the easiest rows to use.
Reactive / Reported P95
This shows each method’s historical expensive zone.
Example:
52x / 48x
If the Reactive P/E is near or above its P95, the stock is historically expensive based on current price movement.
Reactive / Reported P05
This shows each method’s historical cheap zone.
Example:
18x / 16x
If the Reactive P/E is near or below P05, the stock is historically cheap versus its own valuation history.
Reactive / Reported Yield
This converts forward P/E into earnings yield.
Forward Earnings Yield = 100 / Forward P/E
Examples:
P/E
Earnings Yield
10x
10.0%
20x
5.0%
40x
2.5%
80x
1.25%
Lower yield means richer valuation.
Reactive Room to P95
This shows how much room remains before the Reactive P/E reaches its historical expensive zone.
Reading
Meaning
Positive
Still below historical expensive extreme
Near zero
Near historical expensive extreme
Negative
Already above historical expensive extreme
Example:
Reactive Room to P95: -3.5x
The stock is already above its historical 95th percentile valuation level.
Reactive Room above P05
This shows how far the Reactive P/E is above its historical cheap zone.
Reading
Meaning
Large positive
Not cheap
Near zero
Near historical cheap zone
Negative
Below historical cheap extreme
EPS / Multiple Trend
This shows whether the anchored EPS base and valuation multiple are rising, falling, or stable.
Reading
Meaning
Rising / Expansion
EPS anchor rising and multiple rising
Rising / Compression
EPS anchor rising while valuation gets cheaper
Falling / Expansion
EPS anchor falling while valuation rises — riskier
Falling / Compression
EPS anchor falling and multiple falling
Stable / Stable
Little change
Most concerning:
Falling / Expansion
That means investors are paying a higher multiple while the earnings base is worsening.
Driver
This explains what is mostly driving the valuation move.
Driver
Meaning
Price-Led Multiple Expansion
Price is pushing valuation higher
Price-Led Multiple Compression
Price decline is compressing valuation
EPS Anchor Improved
Earnings base improved
EPS Anchor Deteriorated
Earnings base worsened
Stable
No major change
For overextension, watch for:
Price-Led Multiple Expansion
especially when Reactive Rank is above 90%.
PEG / Fwd P/S
These are supplemental checks.
Metric
Use
PEG
P/E adjusted for growth
Forward P/S
Useful when earnings are unstable or distorted
A high P/E is less concerning if growth is strong and PEG is reasonable. A high P/E with a high PEG is more concerning.
Data Quality
This row tells you whether the indicator has enough usable history.
Message
Meaning
Full reactive history
Most reliable
Limited reactive history
Usable, but be cautious
Too little reactive history
Percentiles are weak
No valid reported P/E
TradingView does not have usable forward P/E
Bars since anchor
How long since the reported P/E last updated
If “bars since anchor” is very high, the Reactive P/E is still useful for price movement, but the earnings base may be stale.
Status readings
Reactive Status
This is the main status because the chart is price-reactive.
Status
Meaning
Extreme Expensive
Reactive Rank 95%+
Expensive / Stretched
Reactive Rank 90–95%
Above Normal Valuation
Reactive Rank 75–90%
Normal Valuation Range
Reactive Rank 25–75%
Below Normal Valuation
Reactive Rank 10–25%
Historically Cheap
Reactive Rank 5–10%
Deep Valuation Discount
Reactive Rank below 5%
Limited / Building History
Not enough data yet
Reported Status
This is the slower TradingView-reported valuation status.
Use it as confirmation.
Best warning setup:
Reactive Status = Expensive / Stretched
Reported Status = Normal Valuation Range
That can mean the stock price has moved ahead of the last reported valuation update.
How to use it practically
Avoid chasing
Be cautious when you see:
Reactive Rank above 90%
Reactive Premium strongly positive
Reactive Room to P95 near zero or negative
Driver = Price-Led Multiple Expansion
That means valuation is stretched mainly because price has moved up.
Look for possible value
Look closer when you see:
Reactive Rank below 10%
Reactive Premium negative
Reactive Room above P05 near zero or negative
Reported Status also cheap
That means the stock may be cheap versus its own history.
Best long setup
The healthier setup is often:
Reactive Rank 25–75%
EPS trend Rising
Multiple Stable or Compressing
Price trend improving
That means the stock may not be overextended, and the earnings base may be improving.
Main takeaway
Use this indicator as a stock-specific valuation stretch tool.
The most important rows are:
Reactive / Reported P/E
Reactive / Reported Rank
Reactive / Reported Premium
Reactive Room to P95
Reactive Status
Reported Status
Data Quality
The key idea:
Reactive = what valuation looks like today after price movement.
Reported = what TradingView’s financial data currently reports.
Here is the source code:
//@version=6
indicator("Price-Reactive Forward P/E Extremes ", shorttitle="PRFPE+", overlay=false, max_bars_back=3000)
//====================================================
// INPUTS
//====================================================
grp1 = "Forward Valuation Settings"
financialMode = input.string("Auto FY then FQ", "Financial Period Mode", options= , group=grp1)
minValidPE = input.float(0.1, "Minimum Valid Forward P/E", minval=0.0, step=0.1, group=grp1)
maxValidPE = input.float(500.0, "Maximum Valid Forward P/E", minval=1.0, step=5.0, group=grp1)
grp2 = "Historical Lookback Settings"
lookbackChoice = input.string("5 Years", "Historical Lookback", options= , group=grp2)
requireFullHistory = input.bool(false, "Require Full Lookback History?", group=grp2)
minValidBars = input.int(63, "Minimum Valid Bars in Limited-History Mode", minval=20, maxval=1260, group=grp2)
usePriorHistoryOnly = input.bool(true, "Rank Current Reading vs Prior History Only?", group=grp2)
grp3 = "Smoothing Settings"
smoothType = input.string("EMA", "Price-Reactive P/E Smoothing Type", options= , group=grp3)
smoothLen = input.int(10, "Smoothing Length", minval=1, group=grp3)
signalLength = input.int(20, "Signal Line Length", minval=1, group=grp3)
rankSource = input.string("Raw Price-Reactive P/E", "Percentile / Z-Score Source", options= , group=grp3)
grp4 = "EPS / Multiple Trend Settings"
epsTrendLen = input.int(63, "EPS / Multiple Trend Lookback", minval=1, group=grp4)
trendThreshold = input.float(2.5, "Trend Threshold %", minval=0.0, step=0.5, group=grp4)
grp5 = "Visuals & UI"
showHistogram = input.bool(false, "Show Price-Reactive P/E Histogram?", group=grp5)
showReportedLine = input.bool(false, "Show Reported Forward P/E Step Line?", group=grp5)
showAdaptiveBands = input.bool(true, "Show Reactive Adaptive Percentile Bands?", group=grp5)
showZoneFills = input.bool(true, "Fill Extreme Zones?", group=grp5)
showFixedBands = input.bool(false, "Show Fixed Forward P/E Bands?", group=grp5)
showTable = input.bool(true, "Show Current Reading Table?", group=grp5)
showBgHighlight = input.bool(false, "Highlight Extreme Background?", group=grp5)
fixedUpper1 = input.float(30.0, "Fixed Upper Band 1", step=0.5, group=grp5)
fixedUpper2 = input.float(45.0, "Fixed Upper Band 2", step=0.5, group=grp5)
fixedLower1 = input.float(15.0, "Fixed Lower Band 1", step=0.5, group=grp5)
fixedLower2 = input.float(10.0, "Fixed Lower Band 2", step=0.5, group=grp5)
//====================================================
// LOOKBACK CONVERSION
//====================================================
historyBars = lookbackChoice == "6 Months" ? 126 : lookbackChoice == "1 Year" ? 252 : lookbackChoice == "2 Years" ? 504 : lookbackChoice == "3 Years" ? 756 : lookbackChoice == "4 Years" ? 1008 : 1260
requiredBars = requireFullHistory ? historyBars : minValidBars
//====================================================
// REPORTED FINANCIAL DATA
//====================================================
peFY = request.financial(syminfo.tickerid, "PRICE_EARNINGS_FORWARD", "FY", barmerge.gaps_off, true)
peFQ = request.financial(syminfo.tickerid, "PRICE_EARNINGS_FORWARD", "FQ", barmerge.gaps_off, true)
pegFY = request.financial(syminfo.tickerid, "PEG_RATIO", "FY", barmerge.gaps_off, true)
pegFQ = request.financial(syminfo.tickerid, "PEG_RATIO", "FQ", barmerge.gaps_off, true)
psFY = request.financial(syminfo.tickerid, "PRICE_SALES_FORWARD", "FY", barmerge.gaps_off, true)
psFQ = request.financial(syminfo.tickerid, "PRICE_SALES_FORWARD", "FQ", barmerge.gaps_off, true)
f_valid_pe(_v) =>
not na(_v) and _v >= minValidPE and _v <= maxValidPE ? _v : na
validPEFY = f_valid_pe(peFY)
validPEFQ = f_valid_pe(peFQ)
float reportedPE = na
string effectivePeriod = "n/a"
if financialMode == "FY"
reportedPE := validPEFY
effectivePeriod := "FY"
else if financialMode == "FQ"
reportedPE := validPEFQ
effectivePeriod := "FQ"
else if financialMode == "Auto FY then FQ"
if not na(validPEFY)
reportedPE := validPEFY
effectivePeriod := "FY"
else
reportedPE := validPEFQ
effectivePeriod := "FQ"
else
if not na(validPEFQ)
reportedPE := validPEFQ
effectivePeriod := "FQ"
else
reportedPE := validPEFY
effectivePeriod := "FY"
pegRatioData = effectivePeriod == "FY" ? pegFY : effectivePeriod == "FQ" ? pegFQ : na
forwardPSData = effectivePeriod == "FY" ? psFY : effectivePeriod == "FQ" ? psFQ : na
//====================================================
// PRICE-REACTIVE FORWARD P/E
//====================================================
reportedUpdated = not na(reportedPE) and (na(reportedPE ) or reportedPE != reportedPE )
var float anchoredForwardEPS = na
if reportedUpdated and reportedPE > 0.0
anchoredForwardEPS := close / reportedPE
else
anchoredForwardEPS := anchoredForwardEPS
priceReactivePE = not na(anchoredForwardEPS) and anchoredForwardEPS > 0.0 ? close / anchoredForwardEPS : na
barsSinceReportedUpdate = ta.barssince(reportedUpdated)
//====================================================
// SMOOTHING
//====================================================
f_smooth(_src, _len) =>
if smoothType == "None" or _len <= 1
_src
else if smoothType == "SMA"
ta.sma(_src, _len)
else if smoothType == "EMA"
ta.ema(_src, _len)
else
ta.rma(_src, _len)
smoothedReactivePE = f_smooth(priceReactivePE, smoothLen)
rankReactivePE = rankSource == "Raw Price-Reactive P/E" ? priceReactivePE : smoothedReactivePE
signalLine = f_smooth(smoothedReactivePE, signalLength)
//====================================================
// HISTORICAL STATS FUNCTIONS
//====================================================
f_array_percentile(_arr, _pct) =>
int _n = array.size(_arr)
float _result = na
if _n > 0
float _pos = (_pct / 100.0) * (_n - 1)
int _lo = int(math.floor(_pos))
int _hi = int(math.ceil(_pos))
float _weight = _pos - _lo
float _loVal = array.get(_arr, _lo)
float _hiVal = array.get(_arr, _hi)
_result := _loVal + ((_hiVal - _loVal) * _weight)
_result
f_hist_stats(_series, _x, _len, _priorOnly) =>
array _values = array.new_float(0)
float _sum = 0.0
float _sumSq = 0.0
int _start = _priorOnly ? 1 : 0
int _finish = _priorOnly ? _len : _len - 1
for i = _start to _finish
_v = _series
if not na(_v)
array.push(_values, _v)
_sum += _v
_sumSq += _v * _v
int _n = array.size(_values)
float _p95 = na
float _p90 = na
float _p75 = na
float _p50 = na
float _p25 = na
float _p10 = na
float _p05 = na
float _rank = na
float _mean = na
float _stdev = na
if _n > 0
array.sort(_values, order.ascending)
_p95 := f_array_percentile(_values, 95)
_p90 := f_array_percentile(_values, 90)
_p75 := f_array_percentile(_values, 75)
_p50 := f_array_percentile(_values, 50)
_p25 := f_array_percentile(_values, 25)
_p10 := f_array_percentile(_values, 10)
_p05 := f_array_percentile(_values, 5)
if not na(_x)
float _countBelowOrEqual = 0.0
for j = 0 to _n - 1
if array.get(_values, j) <= _x
_countBelowOrEqual += 1.0
_rank := (_countBelowOrEqual / _n) * 100.0
_mean := _sum / _n
if _n > 1
float _variance = (_sumSq - ((_sum * _sum) / _n)) / (_n - 1)
_stdev := _variance >= 0.0 ? math.sqrt(_variance) : na
//====================================================
// REACTIVE HISTORICAL STATS
//====================================================
= f_hist_stats(rankReactivePE, rankReactivePE, historyBars, usePriorHistoryOnly)
hasEnoughReactiveHistory = not na(priceReactivePE) and reactiveHistoryCount >= requiredBars
rP95 = hasEnoughReactiveHistory ? rP95Raw : na
rP90 = hasEnoughReactiveHistory ? rP90Raw : na
rP75 = hasEnoughReactiveHistory ? rP75Raw : na
rP50 = hasEnoughReactiveHistory ? rP50Raw : na
rP25 = hasEnoughReactiveHistory ? rP25Raw : na
rP10 = hasEnoughReactiveHistory ? rP10Raw : na
rP05 = hasEnoughReactiveHistory ? rP05Raw : na
reactivePercentRank = hasEnoughReactiveHistory ? rRankRaw : na
reactiveZScore = hasEnoughReactiveHistory and not na(rStdevRaw) and rStdevRaw != 0.0 ? (rankReactivePE - rAvgRaw) / rStdevRaw : na
//====================================================
// REPORTED HISTORICAL STATS
//====================================================
= f_hist_stats(reportedPE, reportedPE, historyBars, usePriorHistoryOnly)
hasEnoughReportedHistory = not na(reportedPE) and reportedHistoryCount >= requiredBars
reportedP95 = hasEnoughReportedHistory ? fP95Raw : na
reportedP90 = hasEnoughReportedHistory ? fP90Raw : na
reportedP75 = hasEnoughReportedHistory ? fP75Raw : na
reportedP50 = hasEnoughReportedHistory ? fP50Raw : na
reportedP25 = hasEnoughReportedHistory ? fP25Raw : na
reportedP10 = hasEnoughReportedHistory ? fP10Raw : na
reportedP05 = hasEnoughReportedHistory ? fP05Raw : na
reportedPercentRank = hasEnoughReportedHistory ? fRankRaw : na
reportedZScore = hasEnoughReportedHistory and not na(fStdevRaw) and fStdevRaw != 0.0 ? (reportedPE - fAvgRaw) / fStdevRaw : na
//====================================================
// VALUATION CONTEXT
//====================================================
reactivePremiumToMedian = not na(rP50) and rP50 != 0.0 and not na(rankReactivePE) ? ((rankReactivePE - rP50) / rP50) * 100.0 : na
reportedPremiumToMedian = not na(reportedP50) and reportedP50 != 0.0 and not na(reportedPE) ? ((reportedPE - reportedP50) / reportedP50) * 100.0 : na
reactiveRoomToP95 = not na(rP95) and not na(rankReactivePE) ? rP95 - rankReactivePE : na
reportedRoomToP95 = not na(reportedP95) and not na(reportedPE) ? reportedP95 - reportedPE : na
reactiveRoomAboveP05 = not na(rP05) and not na(rankReactivePE) ? rankReactivePE - rP05 : na
reportedRoomAboveP05 = not na(reportedP05) and not na(reportedPE) ? reportedPE - reportedP05 : na
reactiveEarningsYield = not na(priceReactivePE) and priceReactivePE > 0.0 ? 100.0 / priceReactivePE : na
reportedEarningsYield = not na(reportedPE) and reportedPE > 0.0 ? 100.0 / reportedPE : na
anchoredEPSChangePct = not na(anchoredForwardEPS ) and anchoredForwardEPS != 0.0 ? ((anchoredForwardEPS - anchoredForwardEPS ) / math.abs(anchoredForwardEPS )) * 100.0 : na
reactivePEChangePct = not na(rankReactivePE ) and rankReactivePE != 0.0 ? ((rankReactivePE - rankReactivePE ) / math.abs(rankReactivePE )) * 100.0 : na
priceChangePct = not na(close ) and close != 0.0 ? ((close - close ) / close ) * 100.0 : na
//====================================================
// DATA QUALITY
//====================================================
string reactiveDataQualityText = "n/a"
if na(reportedPE)
reactiveDataQualityText := "No valid reported P/E"
else if na(anchoredForwardEPS)
reactiveDataQualityText := "No anchored EPS yet"
else if reactiveHistoryCount < minValidBars
reactiveDataQualityText := "Too little reactive history: " + str.tostring(reactiveHistoryCount, "#") + " bars"
else if requireFullHistory and reactiveHistoryCount < historyBars
reactiveDataQualityText := "Need full reactive lookback: " + str.tostring(reactiveHistoryCount, "#") + "/" + str.tostring(historyBars)
else if reactiveHistoryCount < historyBars
reactiveDataQualityText := "Limited reactive history: " + str.tostring(reactiveHistoryCount, "#") + "/" + str.tostring(historyBars)
else
reactiveDataQualityText := "Full reactive history: " + str.tostring(reactiveHistoryCount, "#") + "/" + str.tostring(historyBars)
string reportedDataQualityText = "n/a"
if na(reportedPE)
reportedDataQualityText := "No valid reported P/E"
else if reportedHistoryCount < minValidBars
reportedDataQualityText := "Too little reported history: " + str.tostring(reportedHistoryCount, "#") + " bars"
else if requireFullHistory and reportedHistoryCount < historyBars
reportedDataQualityText := "Need full reported lookback: " + str.tostring(reportedHistoryCount, "#") + "/" + str.tostring(historyBars)
else if reportedHistoryCount < historyBars
reportedDataQualityText := "Limited reported history: " + str.tostring(reportedHistoryCount, "#") + "/" + str.tostring(historyBars)
else
reportedDataQualityText := "Full reported history: " + str.tostring(reportedHistoryCount, "#") + "/" + str.tostring(historyBars)
//====================================================
// STATUS LOGIC
//====================================================
f_status(_hasEnough, _rank, _valueIsValid) =>
string _status = "Neutral"
if not _valueIsValid
_status := "No Forward P/E Data"
else if not _hasEnough
_status := "Limited / Building History"
else if _rank >= 95
_status := "Extreme Expensive"
else if _rank >= 90
_status := "Expensive / Stretched"
else if _rank >= 75
_status := "Above Normal Valuation"
else if _rank <= 5
_status := "Deep Valuation Discount"
else if _rank <= 10
_status := "Historically Cheap"
else if _rank <= 25
_status := "Below Normal Valuation"
else
_status := "Normal Valuation Range"
_status
reactiveStatusText = f_status(hasEnoughReactiveHistory, reactivePercentRank, not na(priceReactivePE))
reportedStatusText = f_status(hasEnoughReportedHistory, reportedPercentRank, not na(reportedPE))
isReady = hasEnoughReactiveHistory and not na(reactivePercentRank)
isExtremeExpensive = isReady and reactivePercentRank >= 95
isExpensive = isReady and reactivePercentRank >= 90 and reactivePercentRank < 95
isAboveNormal = isReady and reactivePercentRank >= 75 and reactivePercentRank < 90
isDeepDiscount = isReady and reactivePercentRank <= 5
isCheap = isReady and reactivePercentRank > 5 and reactivePercentRank <= 10
isBelowNormal = isReady and reactivePercentRank > 10 and reactivePercentRank <= 25
string epsTrendText = "n/a"
if not na(anchoredEPSChangePct)
if anchoredEPSChangePct > trendThreshold
epsTrendText := "Rising"
else if anchoredEPSChangePct < -trendThreshold
epsTrendText := "Falling"
else
epsTrendText := "Flat"
string multipleTrendText = "n/a"
if not na(reactivePEChangePct)
if reactivePEChangePct > trendThreshold
multipleTrendText := "Expansion"
else if reactivePEChangePct < -trendThreshold
multipleTrendText := "Compression"
else
multipleTrendText := "Stable"
string driverText = "n/a"
if not na(priceChangePct) and not na(reactivePEChangePct)
if priceChangePct > trendThreshold and reactivePEChangePct > trendThreshold
driverText := "Price-Led Multiple Expansion"
else if priceChangePct < -trendThreshold and reactivePEChangePct < -trendThreshold
driverText := "Price-Led Multiple Compression"
else if priceChangePct > trendThreshold and reactivePEChangePct < -trendThreshold
driverText := "EPS Anchor Improved"
else if priceChangePct < -trendThreshold and reactivePEChangePct > trendThreshold
driverText := "EPS Anchor Deteriorated"
else
driverText := "Stable"
color dynamicColor = color.gray
if isReady
if reactivePercentRank > 50
dynamicColor := color.from_gradient(reactivePercentRank, 50, 100, color.new(color.gray, 45), color.new(color.red, 0))
else
dynamicColor := color.from_gradient(reactivePercentRank, 0, 50, color.new(color.blue, 0), color.new(color.gray, 45))
color statusColor = color.gray
if isReady
if isExtremeExpensive
statusColor := color.red
else if isExpensive
statusColor := color.orange
else if isAboveNormal
statusColor := color.yellow
else if isDeepDiscount
statusColor := color.blue
else if isCheap
statusColor := color.aqua
else if isBelowNormal
statusColor := color.teal
else
statusColor := color.gray
//====================================================
// PLOTS — PRICE-REACTIVE ONLY
//====================================================
plot(showHistogram ? smoothedReactivePE : na, title="Smoothed Price-Reactive Forward P/E Histogram", style=plot.style_columns, color=color.new(dynamicColor, 45))
plot(showReportedLine ? reportedPE : na, title="Reported Forward P/E Step Line", color=color.new(color.white, 65), linewidth=1, style=plot.style_stepline)
plot(smoothedReactivePE, title="Price-Reactive Forward P/E", color=dynamicColor, linewidth=3)
plot(signalLine, title="Price-Reactive Forward P/E Signal Line", color=color.new(color.yellow, 0), linewidth=2)
p95Plot = plot(showAdaptiveBands ? rP95 : na, title="Reactive 95th Percentile", color=color.new(color.red, 20), linewidth=2)
p90Plot = plot(showAdaptiveBands ? rP90 : na, title="Reactive 90th Percentile", color=color.new(color.red, 65), linewidth=1)
p75Plot = plot(showAdaptiveBands ? rP75 : na, title="Reactive 75th Percentile", color=color.new(color.gray, 75), linewidth=1)
p50Plot = plot(showAdaptiveBands ? rP50 : na, title="Reactive 50th Percentile / Median", color=color.new(color.gray, 20), linewidth=2)
p25Plot = plot(showAdaptiveBands ? rP25 : na, title="Reactive 25th Percentile", color=color.new(color.gray, 75), linewidth=1)
p10Plot = plot(showAdaptiveBands ? rP10 : na, title="Reactive 10th Percentile", color=color.new(color.blue, 65), linewidth=1)
p05Plot = plot(showAdaptiveBands ? rP05 : na, title="Reactive 5th Percentile", color=color.new(color.blue, 20), linewidth=2)
fill(p95Plot, p90Plot, color=showAdaptiveBands and showZoneFills ? color.new(color.red, 88) : na, title="Reactive Expensive Zone Fill")
fill(p10Plot, p05Plot, color=showAdaptiveBands and showZoneFills ? color.new(color.blue, 88) : na, title="Reactive Cheap Zone Fill")
fill(p75Plot, p25Plot, color=showAdaptiveBands and showZoneFills ? color.new(color.gray, 94) : na, title="Reactive Normal Zone Fill")
plot(showFixedBands ? fixedUpper1 : na, title="Fixed Upper Band 1", color=color.new(color.orange, 45), linewidth=1)
plot(showFixedBands ? fixedUpper2 : na, title="Fixed Upper Band 2", color=color.new(color.red, 45), linewidth=1)
plot(showFixedBands ? fixedLower1 : na, title="Fixed Lower Band 1", color=color.new(color.aqua, 45), linewidth=1)
plot(showFixedBands ? fixedLower2 : na, title="Fixed Lower Band 2", color=color.new(color.blue, 45), linewidth=1)
bgcolor(showBgHighlight and isExtremeExpensive ? color.new(color.red, 90) : showBgHighlight and isDeepDiscount ? color.new(color.blue, 90) : na)
//====================================================
// TABLE
//====================================================
f_x(_value) =>
na(_value) ? "n/a" : str.tostring(_value, "#.##") + "x"
f_pct(_value) =>
na(_value) ? "n/a" : str.tostring(_value, "#.##") + "%"
f_num(_value) =>
na(_value) ? "n/a" : str.tostring(_value, "#.##")
f_price(_value) =>
na(_value) ? "n/a" : str.tostring(_value, format.mintick)
f_bars(_value) =>
na(_value) ? "n/a" : str.tostring(_value, "#")
var table infoTable = table.new(position.top_right, 2, 18, border_width=1, border_color=color.new(color.gray, 75))
if showTable and barstate.islast
table.cell(infoTable, 0, 0, "Metric", text_color=color.white, bgcolor=color.new(color.black, 0))
table.cell(infoTable, 1, 0, "Current", text_color=color.white, bgcolor=color.new(color.black, 0))
table.cell(infoTable, 0, 1, "Reactive / Reported P/E", text_color=color.white, bgcolor=color.new(color.black, 50))
table.cell(infoTable, 1, 1, f_x(priceReactivePE) + " / " + f_x(reportedPE), text_color=color.white, bgcolor=color.new(dynamicColor, 25))
table.cell(infoTable, 0, 2, "Smoothed Reactive P/E", text_color=color.white, bgcolor=color.new(color.black, 50))
table.cell(infoTable, 1, 2, f_x(smoothedReactivePE), text_color=color.white, bgcolor=color.new(dynamicColor, 25))
table.cell(infoTable, 0, 3, "Anchored Forward EPS", text_color=color.white, bgcolor=color.new(color.black, 50))
table.cell(infoTable, 1, 3, f_price(anchoredForwardEPS), text_color=color.white, bgcolor=color.new(color.black, 50))
table.cell(infoTable, 0, 4, "Reactive / Reported Rank", text_color=color.white, bgcolor=color.new(color.black, 50))
table.cell(infoTable, 1, 4, f_pct(reactivePercentRank) + " / " + f_pct(reportedPercentRank), text_color=color.white, bgcolor=color.new(dynamicColor, 25))
table.cell(infoTable, 0, 5, "Reactive / Reported Median", text_color=color.white, bgcolor=color.new(color.black, 50))
table.cell(infoTable, 1, 5, f_x(rP50) + " / " + f_x(reportedP50), text_color=color.white, bgcolor=color.new(color.black, 50))
table.cell(infoTable, 0, 6, "Reactive / Reported Premium", text_color=color.white, bgcolor=color.new(color.black, 50))
table.cell(infoTable, 1, 6, f_pct(reactivePremiumToMedian) + " / " + f_pct(reportedPremiumToMedian), text_color=color.white, bgcolor=color.new(color.black, 50))
table.cell(infoTable, 0, 7, "Reactive / Reported P95", text_color=color.white, bgcolor=color.new(color.black, 50))
table.cell(infoTable, 1, 7, f_x(rP95) + " / " + f_x(reportedP95), text_color=color.white, bgcolor=color.new(color.black, 50))
table.cell(infoTable, 0, 8, "Reactive / Reported P05", text_color=color.white, bgcolor=color.new(color.black, 50))
table.cell(infoTable, 1, 8, f_x(rP05) + " / " + f_x(reportedP05), text_color=color.white, bgcolor=color.new(color.black, 50))
table.cell(infoTable, 0, 9, "Reactive / Reported Yield", text_color=color.white, bgcolor=color.new(color.black, 50))
table.cell(infoTable, 1, 9, f_pct(reactiveEarningsYield) + " / " + f_pct(reportedEarningsYield), text_color=color.white, bgcolor=color.new(color.black, 50))
table.cell(infoTable, 0, 10, "Reactive Room to P95", text_color=color.white, bgcolor=color.new(color.black, 50))
table.cell(infoTable, 1, 10, f_x(reactiveRoomToP95), text_color=color.white, bgcolor=color.new(color.black, 50))
table.cell(infoTable, 0, 11, "Reactive Room above P05", text_color=color.white, bgcolor=color.new(color.black, 50))
table.cell(infoTable, 1, 11, f_x(reactiveRoomAboveP05), text_color=color.white, bgcolor=color.new(color.black, 50))
table.cell(infoTable, 0, 12, "EPS / Multiple Trend", text_color=color.white, bgcolor=color.new(color.black, 50))
table.cell(infoTable, 1, 12, epsTrendText + " / " + multipleTrendText, text_color=color.white, bgcolor=color.new(color.black, 50))
table.cell(infoTable, 0, 13, "Driver", text_color=color.white, bgcolor=color.new(color.black, 50))
table.cell(infoTable, 1, 13, driverText, text_color=color.white, bgcolor=color.new(color.black, 50))
table.cell(infoTable, 0, 14, "PEG / Fwd P/S", text_color=color.white, bgcolor=color.new(color.black, 50))
table.cell(infoTable, 1, 14, f_x(pegRatioData) + " / " + f_x(forwardPSData), text_color=color.white, bgcolor=color.new(color.black, 50))
table.cell(infoTable, 0, 15, "Data Quality", text_color=color.white, bgcolor=color.new(color.black, 50))
table.cell(infoTable, 1, 15, reactiveDataQualityText + " / " + effectivePeriod + " / " + f_bars(barsSinceReportedUpdate) + " bars since anchor", text_color=color.white, bgcolor=color.new(color.black, 50))
table.cell(infoTable, 0, 16, "Reactive Status", text_color=color.white, bgcolor=color.new(color.black, 50))
table.cell(infoTable, 1, 16, reactiveStatusText, text_color=color.white, bgcolor=color.new(statusColor, 20))
table.cell(infoTable, 0, 17, "Reported Status", text_color=color.white, bgcolor=color.new(color.black, 50))
table.cell(infoTable, 1, 17, reportedStatusText, text_color=color.white, bgcolor=color.new(color.black, 50))
if not showTable and barstate.islast
table.clear(infoTable, 0, 0, 1, 17)
//====================================================
// ALERTS — PRICE-REACTIVE ONLY
//====================================================
crossOver95 = ta.crossover(reactivePercentRank, 95)
crossUnder95 = ta.crossunder(reactivePercentRank, 95)
crossOver90 = ta.crossover(reactivePercentRank, 90)
crossUnder90 = ta.crossunder(reactivePercentRank, 90)
crossUnder5 = ta.crossunder(reactivePercentRank, 5)
crossOver5 = ta.crossover(reactivePercentRank, 5)
crossUnder10 = ta.crossunder(reactivePercentRank, 10)
crossOver10 = ta.crossover(reactivePercentRank, 10)
crossOverMedian = ta.crossover(rankReactivePE, rP50)
crossUnderMedian = ta.crossunder(rankReactivePE, rP50)
peCrossAboveSignal = ta.crossover(smoothedReactivePE, signalLine)
peCrossBelowSignal = ta.crossunder(smoothedReactivePE, signalLine)
enteredExtremeExpensive = isReady and crossOver95
exitedExtremeExpensive = isReady and crossUnder95
enteredExpensive = isReady and crossOver90
exitedExpensive = isReady and crossUnder90
enteredDeepDiscount = isReady and crossUnder5
exitedDeepDiscount = isReady and crossOver5
enteredCheap = isReady and crossUnder10
exitedCheap = isReady and crossOver10
expensiveMultipleCompression = isReady and reactivePercentRank >= 90 and peCrossBelowSignal
cheapReRating = isReady and reactivePercentRank <= 10 and peCrossAboveSignal
alertcondition(enteredExtremeExpensive, title="Entered Extreme Expensive Zone", message="Price-reactive forward P/E entered its 95th percentile extreme expensive zone.")
alertcondition(exitedExtremeExpensive, title="Exited Extreme Expensive Zone", message="Price-reactive forward P/E exited its 95th percentile extreme expensive zone.")
alertcondition(enteredExpensive, title="Entered Expensive Zone", message="Price-reactive forward P/E entered its 90th percentile expensive zone.")
alertcondition(exitedExpensive, title="Exited Expensive Zone", message="Price-reactive forward P/E exited its 90th percentile expensive zone.")
alertcondition(enteredDeepDiscount, title="Entered Deep Discount Zone", message="Price-reactive forward P/E entered its 5th percentile deep discount zone.")
alertcondition(exitedDeepDiscount, title="Exited Deep Discount Zone", message="Price-reactive forward P/E exited its 5th percentile deep discount zone.")
alertcondition(enteredCheap, title="Entered Historically Cheap Zone", message="Price-reactive forward P/E entered its 10th percentile historically cheap zone.")
alertcondition(exitedCheap, title="Exited Historically Cheap Zone", message="Price-reactive forward P/E exited its 10th percentile historically cheap zone.")
alertcondition(crossOverMedian, title="Reactive P/E Crossed Above Median", message="Price-reactive forward P/E crossed above its historical median.")
alertcondition(crossUnderMedian, title="Reactive P/E Crossed Below Median", message="Price-reactive forward P/E crossed below its historical median.")
alertcondition(expensiveMultipleCompression, title="Expensive Multiple Compression Warning", message="Price-reactive forward P/E is historically expensive and crossed below its signal line.")
alertcondition(cheapReRating, title="Cheap Re-Rating Warning", message="Price-reactive forward P/E is historically cheap and crossed above its signal line.") 指标

BTC Correlation - short clubBTC Correlation % — Indicator Description
Author: Short Club / @DemianNagoga
Version: Pine Script v6
Type: Indicator (non-overlay, separate pane)
Overview
The BTC Correlation % indicator measures how closely an altcoin's price movements follow Bitcoin in real time. It uses Pearson correlation on 1-bar rate-of-change (RoC) values over a configurable lookback window, giving you a clear signal of whether the altcoin is riding BTC's coattails or moving independently.
How It Works
RoC Calculation — Computes the 1-bar % change for both the current chart symbol and BTC.
Pearson Correlation — Runs ta.correlation() over the user-defined lookback (default 50 bars).
Percentage Scale — Multiplies the correlation coefficient by 100, yielding a range from −100% to +100%.
Color-Coded Columns — The histogram is split into four segments, each plotted as a separate column-style plot for clean color separation.
Color Zones & Interpretation
Zone Range Meaning
🟢 Green > 70% High correlation — altcoin closely follows BTC
🟡 Yellow 30–70% Moderate correlation — partial BTC influence
⚪ Gray 0–30% Weak correlation / decoupling — altcoin lives its own life
🔴 Red < 0% Inverse correlation — altcoin moves opposite to BTC
A dashed zero line sits at 0% for visual reference.
On-Chart Table
A small overlay table (position configurable: top-right, top-left, bottom-right, bottom-left) displays:
Ticker — current chart symbol
BTC Corr. — current correlation value in % (color-coded by zone)
Rating — qualitative label: Strong (>70%), Moderate (30–70%), Weak (0–30%), Inverse (<0%)
Input Parameters
Parameter Default Description
BTC Symbol BINANCE:BTCUSDT.P BTC pair used as benchmark
Correlation Lookback 50 Number of bars for Pearson correlation
Show Table true Toggle the on-chart info table
Show Correlation Line true Toggle the histogram columns
Table Position top_right Placement of the info table
Use Cases
Altcoin scalping — Know instantly whether your alt is following BTC or running on its own catalyst.
Decoupling detection — Gray zone = potential breakout candidate independent of BTC direction.
Hedging signals — Red zone (inverse) = altcoin moving opposite to BTC; useful for pairs or hedging.
Swing context — Avoid fading BTC trend on a highly-correlated alt; size down when correlation drops.
Credits
Built for the Short Club community. If you reuse or build upon this script, please credit @DemianNagoga. 指标

指标

指标

指标

RS/Correlation Panel**RS/Correlation Panel**
A single-table dashboard that benchmarks the current chart's symbol against any reference ticker you choose (SPY, QQQ, BTC, or any other symbol) across multiple timeframes — correlation, today's relative performance, short-term relative strength, and a longer IBD-style relative strength rating — plus historical daily move statistics for the symbol itself.
**Inputs**
- **Benchmark Ticker** — the symbol to compare against. Defaults to SPY, but accepts any ticker (QQQ, individual stocks, or crypto via its exchange prefix, e.g. COINBASE:BTCUSD).
- **Correlation Lookback (bars)** — number of bars used for the rolling correlation calculation. Default 20.
- **Daily Stats Lookback (days)** — number of trading days used to calculate average rise/fall and green/red day percentages. Default 60.
- **Short-Term RS/RW Lookback (bars)** — the window used for the medium-term relative strength/weakness reading, sitting between the 1-day and quarterly reads. Default 10.
- **Table Position** — corner of the chart where the table is displayed.
**Table Rows**
- **Correlation** — rolling correlation coefficient between the symbol and the benchmark over the chosen lookback, tagged Strong / Moderate / Weak based on absolute value.
- **Symbol's Today's Move / Benchmark's Today's Move** — each instrument's current-session percent change, calculated from that day's open to the live/last close.
- **RS/RW Today** — the difference between the symbol's and benchmark's daily percent change. Positive means the symbol is outperforming the benchmark today; negative means it's underperforming.
- **N-Bar RS/RW** — the same outperformance/underperformance concept, but measured as the difference in rate-of-change over the user-defined short-term lookback (default 10 bars). This fills the gap between a single day's move and a full quarterly trend.
- **IBD-Style RS** — a quarterly-weighted relative strength calculation modeled on the classic IBD Relative Strength methodology: the symbol's and benchmark's trailing performance are each computed across four rolling quarters (weighted 40/20/20/20, most recent quarter weighted heaviest), then compared as a percentage difference. This is a slower-moving, trend-level strength read — it won't react much to a single day's move, by design.
- **Avg % Rise / Fall** — average percentage gain on up days and average percentage loss on down days, calculated over the Daily Stats Lookback period.
- **Green Days % / Red Days %** — percentage of days in the lookback period that closed up versus down.
**Notes**
- All relative-strength and correlation metrics reference the same user-selected benchmark, so switching the input updates every row consistently.
- The IBD-Style RS calculation is a reproduction of the standard quarterly-weighted RS methodology and is intended to complement — not replace — short-term price action analysis.
- This is a decision-support tool, not a standalone trading signal. Always confirm readings against price structure, volume, and catalysts before acting. 指标

Bitcoin Halving Cycle PhasesBitcoin Halving Cycle Phases is a calendar-based visual indicator that highlights approximate Bitcoin halving cycle phase zones directly on the chart.
The indicator uses historical Bitcoin halving dates and predefined calendar phase boundaries to display different cycle regions, including Halving, Bullish, Bearish, Recovery, and Pre-halving phases. Future zones are projected using an approximate cycle length and are intended only as visual calendar references.
This script does not calculate price targets, buy or sell signals, trading entries, exits, stop losses, take profits, backtest results, or financial advice. The displayed future zones are approximate calendar projections only and should not be interpreted as forecasts or guaranteed market outcomes.
The indicator is designed for educational cycle visualization and long-term market context.
指标

指标

指标

Automated Institutional Levels + Weekly (v6 Published)Overview:
Tired of spending your pre-market hours manually plotting higher timeframe levels and session boundaries every single morning?This lightweight, comprehensive script automates the tedious technical analysis process for futures, forex, and equities traders. It dynamically projects institutional key levels, daily and weekly ranges, macro market structure, and session extremes directly onto your execution charts—all with zero lag and zero diagonal chart slopes.Unlike 95% of the multi-timeframe indicators available on TradingView, this script is fully Bar Replay Optimized. By utilizing custom lookahead configurations and historical indexing, the levels render flawlessly during backtesting sessions, allowing you to practice historical trading setups without data leak distortions or misalignments.
Key Features:
Previous Week High / Low (PWH / PWL):Automatically locks and projects the completed extremes of the prior week. It holds perfectly flat, ignoring the current developing week's price data to give you macro expansion targets.
Previous Day High / Low (PDH / PDL):Tracks the definitive 24-hour highs and lows, shifting dynamically at the daily session crossover with precise stair-step tracking.
London Session Extremes (LH / LL):Isolates the exact high and low wicks formed during the standalone London hours (03:00 AM to 08:00 AM EST). The script automatically projects these liquidity pools forward into the New York AM and PM sessions—perfect for identifying Judas Swing traps and session liquidity sweeps.
Automated 4H Structural BOS Ceiling:Mechanically scans the 4-hour timeframe for true 3-candle swing high peaks. It projects the macro structural lower high forward onto your lower timeframes (1m, 5m, 15m), maintaining a clear look at macro bearish resistance until a true 4H candle body close invalidates it.
Dynamic Confluence Label Stacking:Keeps your charts clean. When multiple high-timeframe zones collapse onto the exact same price tick, the individual labels disappear and convert into an eye-catching CONFLUENCE or TRIPLE WALL box on your price scale, alerting you to a high-probability institutional reversal wall.
Recommended Setup for Day Traders:
Load the script onto an intraday execution chart (such as the 1-minute or 5-minute charts).
Use a clean continuous futures contract ticker (like ES1! or NQ1!).
Pair this framework with a Fair Value Gap (FVG) or Order Block indicator. Look for fast 09:30 AM EST New York opening volume to sweep the white London High/Low or blue PDH/PDL lines right beneath the orange 4H BOS wall before hunting A+ displacement triggers.
指标

指标

指标

Pro Scalper AI v2 subbarao# Pro Scalper AI v3 – Koteswararao Saga
**Pro Scalper AI v3 – Koteswararao Saga** is a professional intraday trading indicator engineered for high-probability scalping and momentum trading. It combines trend analysis, price action, volume, volatility, and institutional-style filters to identify high-quality Buy and Sell opportunities while reducing false signals.
Designed primarily for **1-minute and 3-minute charts**, the indicator helps traders follow the prevailing trend, identify momentum shifts, and manage entries with greater confidence.
## Key Features
* ✅ AI-Based Bull & Bear Trend Detection
* ✅ High-Confidence Buy & Sell Signals
* ✅ Early Buy & Early Sell Alerts
* ✅ Momentum Buy & Momentum Sell Signals
* ✅ EMA Trend Confirmation
* ✅ ATR Volatility Filter
* ✅ Volume Confirmation
* ✅ Dynamic Support & Resistance Levels
* ✅ Liquidity Sweep Detection
* ✅ Break of Structure (BOS)
* ✅ Change of Character (CHoCH)
* ✅ Smart Dashboard with Market Bias
* ✅ Trend Background Coloring
* ✅ Customizable Inputs
* ✅ TradingView Pine Script v6 Compatible
* ✅ Non-Repainting Signal Logic
## Best Suited For
* NIFTY Options
* BANKNIFTY Options
* NIFTY Futures
* Equity Intraday Trading
* Index Scalping
* Momentum Trading
## Recommended Timeframes
* 1 Minute (Primary)
* 3 Minute
* 5 Minute
## Trading Style
Pro Scalper AI v3 is built to assist traders in identifying trend continuation, pullback entries, momentum breakouts, and potential reversals. It is intended to improve decision-making by combining multiple technical factors into a single, easy-to-read trading system.
**Disclaimer:** This indicator is an educational and decision-support tool. It does not guarantee profits and should be used alongside sound risk management, position sizing, and personal market analysis.
指标

Pro Scalper AI v3 koteswararao saga# Pro Scalper AI v3 – Koteswararao Saga
**Pro Scalper AI v3 – Koteswararao Saga** is a professional intraday trading indicator engineered for high-probability scalping and momentum trading. It combines trend analysis, price action, volume, volatility, and institutional-style filters to identify high-quality Buy and Sell opportunities while reducing false signals.
Designed primarily for **1-minute and 3-minute charts**, the indicator helps traders follow the prevailing trend, identify momentum shifts, and manage entries with greater confidence.
## Key Features
* ✅ AI-Based Bull & Bear Trend Detection
* ✅ High-Confidence Buy & Sell Signals
* ✅ Early Buy & Early Sell Alerts
* ✅ Momentum Buy & Momentum Sell Signals
* ✅ EMA Trend Confirmation
* ✅ ATR Volatility Filter
* ✅ Volume Confirmation
* ✅ Dynamic Support & Resistance Levels
* ✅ Liquidity Sweep Detection
* ✅ Break of Structure (BOS)
* ✅ Change of Character (CHoCH)
* ✅ Smart Dashboard with Market Bias
* ✅ Trend Background Coloring
* ✅ Customizable Inputs
* ✅ TradingView Pine Script v6 Compatible
* ✅ Non-Repainting Signal Logic
## Best Suited For
* NIFTY Options
* BANKNIFTY Options
* NIFTY Futures
* Equity Intraday Trading
* Index Scalping
* Momentum Trading
## Recommended Timeframes
* 1 Minute (Primary)
* 3 Minute
* 5 Minute
## Trading Style
Pro Scalper AI v3 is built to assist traders in identifying trend continuation, pullback entries, momentum breakouts, and potential reversals. It is intended to improve decision-making by combining multiple technical factors into a single, easy-to-read trading system.
**Disclaimer:** This indicator is an educational and decision-support tool. It does not guarantee profits and should be used alongside sound risk management, position sizing, and personal market analysis.
指标

NICS Yesterday Box PRONICS Yesterday Box PRO
NICS Yesterday Box PRO automatically plots the previous trading day's High, Low, and Midpoint, providing clean institutional reference levels for intraday trading.
Designed for Smart Money Concepts (SMC), ICT, price action, futures, forex, crypto, indices, and commodities.
Features
• Automatic Yesterday High (YH)
• Automatic Yesterday Low (YL)
• Automatic Yesterday Mid (50%)
• Auto-refresh at the beginning of every trading day
• Optional line extension
• Customizable colors and line width
• Lightweight and optimized Pine Script v6 implementation
Best Used For
• Intraday support & resistance
• Liquidity targets
• Market structure analysis
• Breakout confirmation
• Mean reversion setups
• ICT / SMC trading models
• Session-based trading
Markets
Works on all TradingView-supported markets:
• Forex
• Cryptocurrency
• Stocks
• Futures
• Commodities
• Indices
Recommended Timeframes
Optimized for:
• 1 Minute
• 3 Minute
• 5 Minute
• 15 Minute
• 30 Minute
• 1 Hour
About NICS
NICS (Neural Intelligent Cognitive System) develops professional AI-powered trading tools and institutional market analysis solutions for discretionary and systematic traders.
© AI Byte Consult Ltd.
NICS AI Ecosystem
指标

指标
