OPEN-SOURCE SCRIPT
已更新

Cardwell Range Analyze [MarkitTick]

32 545
💡 A comprehensive, all-in-one technical analysis suite designed to decode market regimes, identify high-probability momentum shifts, and automate risk management visualization. Built upon the foundation of Andrew Cardwell's advanced Relative Strength Index (RSI) theories, this tool transcends traditional oscillator analysis. Rather than relying on static overbought and oversold thresholds, it dynamically tracks regime shifts by observing where momentum consolidates. When combined with trend confirmation, volatility-based targets, and directional movement filters, it provides a holistic view of the market state directly on your chart.

✨ Originality and Utility
Most traders utilize momentum oscillators in a vacuum, searching for mean-reversion signals at arbitrary boundaries. The utility of this script lies in its departure from that static approach. It introduces a multifaceted evaluation system that cross-references momentum bands with structural trend data. By integrating a Higher Timeframe (HTF) directional filter and an Average Directional Index (ADX) volatility threshold, it systematically filters out market noise and chop.
Its originality shines through the automated Trade Tools suite. Upon detecting a valid regime shift, the indicator instantly projects Average True Range (ATR) based Stop Loss and Take Profit levels, complete with risk-to-reward zoning. This allows traders to visually assess the mathematical viability of a setup before execution. The inclusion of a real-time diagnostic dashboard further elevates its utility, offering a heads-up display of all underlying metrics without cluttering the primary price action.

🔬 Methodology and Concepts
快照
● Cardwell RSI Framework
Traditional RSI theory dictates that an asset is overbought at 70 and oversold at 30. However, the foundational concept here relies on range shifts. In a robust uptrend, RSI rarely reaches 30; instead, it finds support around 40 and can push up to 80. Conversely, in a downtrend, RSI encounters resistance around 60 and can fall to 20. This script mathematically codifies these ranges.
● Regime Confirmation
A raw regime is identified when the price resides on the correct side of the Trend Moving Average (SMA) while the RSI operates within the corresponding Cardwell range. To eliminate premature signals, a confirmation threshold requires the market to sustain this raw state for a consecutive number of bars.
● Structural and Volatility Filtering
To ensure signals align with macro momentum, the script queries a higher timeframe's trend state using non-repainting historical referencing. Additionally, the ADX is calculated to measure the absolute strength of the current trend. If the ADX falls below the minimum threshold, the market is deemed sideways, and signals are suppressed.
● Dynamic Risk Mapping
Once a validated signal fires, the script calculates dynamic price levels based on current market volatility (ATR). The Stop Loss is mapped at a fractional multiplier against the entry, while Take Profit levels are projected at linear multiples, mapping out a structured trade lifecycle.

🎨 Visual Guide
快照
● Heatmap Candles
The standard price candles are dynamically recolored to reflect the prevailing market regime.
  • Teal Candles: Indicate a confirmed Bullish Regime.
  • Red Candles: Indicate a confirmed Bearish Regime.
  • Gray Candles: Indicate a Neutral state where conditions are mixed.
  • Black Wicks/Borders: Maintain visual clarity regardless of the body color.

● Trade Levels and Zones
When a signal triggers, specific horizontal projections appear on the chart:
  • Entry Line: A dashed blue line representing the closing price of the signal bar.
  • Stop Loss (SL) Line: A solid red line marking the invalidation point.
  • Take Profit (TP1, TP2, TP3) Lines: Dashed teal lines marking incremental profit targets.
  • Risk Fill: A translucent red background shading the area between the Entry and the Stop Loss.
  • Reward Fill: A translucent teal background shading the area between the Entry and the highest Take Profit.

● Dashboard
A specialized table anchored to the chart corner providing real-time data:
  • Regime: Displays current state (BULLISH, BEARISH, or NEUTRAL) in respective colors.
  • RSI Value: A visual progress bar measuring current RSI against a 100-scale, color-coded by intensity.
  • Trend & Ranges: Explicit text readouts of the current MA trend direction and defined RSI boundaries.
  • ADX Strength: A progress bar indicating the conviction of the trend.

📌 Note : the best way to resolve visual overlap is to navigate to the Object Tree and drag the indicator above the main chart layer, or simply hide the native candles in your chart settings.

📖 How to Use
快照
● Interpreting Regimes
Monitor the color of the candles. A transition from Gray to Teal suggests a bullish momentum shift aligning with the underlying trend. This is your primary directional bias. You should generally look for buying opportunities when candles are Teal and selling opportunities when they are Red.
● Acting on Signals
When all conditions (Cardwell Range, Trend MA, HTF Trend, and ADX Chop Filter) align, a BUY or SELL label will populate below or above the price. These represent active momentum shifts.
● Managing Risk
Do not trade blindly on signals. Upon a signal firing, visually inspect the red Risk Zone versus the teal Reward Zone. Ensure the projected Stop Loss aligns with logical market structure (like a recent swing low or high). Use the progressive TP1, TP2, and TP3 lines to scale out of positions as the market moves in your favor.
● Monitoring the Dashboard
Keep an eye on the ADX Strength bar in the dashboard. If the bar is predominantly empty and red, the market is consolidating. Wait for the ADX bar to fill and turn orange or green before expecting strong follow-through on any signals.

⚙️ Inputs and Settings
快照
• Core Settings
RSI Length: The lookback period for momentum calculation (default 14).
Trend MA Length: The lookback period for the primary structural trend baseline (default 50).
• Filters
Bull/Bear Ranges: The upper and lower bounds for the Cardwell RSI shifts.
Regime Confirm Bars: The consecutive number of bars required to validate a new regime.
Use HTF Confirmation: Toggles the higher timeframe trend filter.
HTF Timeframe: Select the specific higher timeframe to query (e.g., 240 for 4-hour).
Use Chop Filter: Toggles the ADX volatility requirement.
ADX Min Strength: The threshold value ADX must exceed to allow signals.
• Trade Tools
ATR Length: The lookback period for volatility modeling.
SL/TP Multipliers: Fractional inputs to dictate how wide the Stop Loss and Profit Targets are projected relative to the ATR.
• Alerts
Action Strings: Customizable JSON payload strings for integrating with third-party automated execution platforms via webhooks.

🔍 Deconstruction of the Underlying Scientific and Academic Framework
This indicator synthesizes three foundational pillars of quantitative market analysis: momentum distribution, structural mean, and volatility modeling.
First, it deconstructs the Relative Strength Index, initially formulated by J. Welles Wilder Jr. in 1978. Wilder mathematically defined momentum as the ratio of average gains to average losses. However, the Cardwell extension incorporated into this script addresses a fundamental flaw in Wilder's fixed bounding by applying regime-dependent probability distributions. In a positively skewed asset (uptrend), the probability mass of the RSI shifts upward, meaning a reading of 40 represents a statistically significant mean-reversion point (oversold) rather than 30.
Second, the script applies directional movement theory via the Average Directional Index (ADX). The ADX smooths the differences between the positive and negative directional indicators (+DI and -DI) to isolate the scalar strength of the trend vector, devoid of direction. By requiring a minimum ADX threshold, the algorithm mathematically enforces a non-stationary environment, filtering out random walk (white noise) conditions where momentum signals carry no statistical edge.
Finally, the projection of trade levels utilizes the Average True Range (ATR). ATR is a rigorous measure of the variance in asset prices, accounting for opening gaps and limit moves. By mapping target boundaries as functional multiples of ATR, the script ensures that standard deviation and local market dispersion strictly govern risk parameters, adapting dynamically to expanding or contracting market distributions.

⚠️ Disclaimer
All provided scripts and indicators are strictly for educational exploration and must not be interpreted as financial advice or a recommendation to execute trades. We expressly disclaim all liability for any financial losses or damages that may result, directly or indirectly, from the reliance on or application of these tools. Market participation carries inherent risk where past performance never guarantees future returns, leaving all investment decisions and due diligence solely at your own discretion.
發行說明
Fixed: SL/TP profile now invalidates on price/regime breach, and RSI gauge colors are now unified with the Bull/Bear Range regime logic.
發行說明
We have reverted the "SL/TP profile invalidation on price/regime breach" update to ensure settings remain visible as requested by many users.
發行說明
The core logic was enhanced by introducing a modular function for regime detection, which improves the accuracy of higher timeframe confirmation.

A new feature was added to allow users to customize the extension length of trade level lines on the chart.

The dashboard was expanded to include additional data, such as chop filter status, progress of confirmation bars, and the risk-to-reward ratio.

Filter settings were updated to be optional, and the visual interface was refined to respond more accurately to market state changes.
發行說明
Visual corrections
發行說明
Fixed the error caused by the recent update.

免責聲明

這些資訊和出版物並非旨在提供,也不構成TradingView提供或認可的任何形式的財務、投資、交易或其他類型的建議或推薦。請閱讀使用條款以了解更多資訊。