OPEN-SOURCE SCRIPT

Weinstein Human-Like Stage Layout [v6]

371
This indicator automates the classic Stan Weinstein 4-Stage Market Cycle Analysis (from his legendary book “Secrets for Profiting in Bull and Bear Markets”) using a custom context-aware layout engine.

Most automated stage analysis scripts create immense visual clutter, resetting indicators and stacking labels on every minor bar cross. This script uses a human-like design philosophy, relying on multi-week absolute price structures to print exactly one clean, dynamic tracking label per macro phase.

Human-Centric Visual Design
The indicator adapts its graphics engine based on the style of phase the market is currently experiencing:
  • Stage 1 (Accumulation): Draws a clean, horizontal Dashed Blue Box around the absolute support/resistance boundary floor, with a floating blue label centered over the base.
  • Stage 2 (Markup): Strips away consolidation frames and softly tints the entire chart vertical background Green to signify a clean, institutional buying regime.
  • Stage 3 (Distribution): Places a precise, horizontal Dashed Orange Box around the macro topping range to track turning points.
  • Stage 4 (Markdown): Softly tints the chart vertical background Red to warn traders away from catching a falling knife.


How the Boundary Engine Works
Instead of calculating mathematical slope percentages (which shift falsely on volatile weeks), the engine operates via a shifted Donchian Price Channel Model:
  1. Breakout Tracking: It evaluates the asset's closing price against the Highest High / Lowest Low of the prior 20 weeks (using a [1] lookback offset to remove current bar skew).
  2. Expansion Filtering: A true Stage 2 or Stage 4 regime shift will only trigger when price completely bursts out of the historical multi-month ceiling or floor line while confirming its position relative to the 30-Week Simple Moving Average.
  3. Automatic Clean-Up: The script natively tracks historical nodes. The moment a new cycle phase is mathematically confirmed, it deletes overlapping data to keep your screen spotless.


Best Practices for Setup
  • Timeframe: To stay true to Weinstein's original methodology, always run this indicator on a Weekly (1W) chart.
  • Customization: Open the settings gear panel to adjust the Consolidation Range Lookback (Weeks) up or down depending on whether you want to focus on intermediate market movements or structural multi-year cycles.


⚠️ Disclaimer & Risk Disclosure
  • Educational Purpose Only: This script is an automated open-source visual aid designed solely for educational, historical analysis, and charting convenience. It does not constitute investment advice, financial advice, or a recommendation to buy, sell, or hold any financial asset or security.
  • No Guarantees of Accuracy: Market conditions are subject to rapid change. Past performance, channel breakouts, or historical bounding boxes generated by this script are not indicative of future market results.
  • Backtesting & Verification: Systems using algorithmic filters can generate false breakouts or delayed lag-signals during highly volatile or macroeconomic events. Users should always cross-reference these automated stages with their own fundamental analysis, independent price action charting, and volume verification.
  • Risk of Loss: Trading financial markets involves a high degree of financial risk. The author of this script assumes absolutely no liability or responsibility for any direct or indirect financial losses, trading errors, or damages resulting from the use or interpretation of this indicator.

Wyłączenie odpowiedzialności

Informacje i publikacje nie stanowią i nie powinny być traktowane jako porady finansowe, inwestycyjne, tradingowe ani jakiekolwiek inne rekomendacje dostarczane lub zatwierdzone przez TradingView. Więcej informacji znajduje się w Warunkach użytkowania.