LIB_ConfirmationLayerLibrary "LIB_ConfirmationLayer"
apply_confirmation(longRaw, shortRaw, signalDir, signalLine, posSize, o, h, l, c, _bar_index, _time, conf_useBreakout, conf_useSwing, conf_useMomentum, conf_momMode, conf_atrLen, conf_momAtrMult, conf_rocMinPct, conf_useSessionFilter, conf_session, conf_plotLevels, conf_requireCloseBeyond, conf_confirmTimeoutBars, conf_minWaitBars, conf_gateOnlyWhenFlat, conf_dynamicLevelWhileWaiting, conf_dynUpdateMode, conf_deferBreakOnLevelUpdate, conf_refreshOnNewRawSignal, conf_rawEventMode, conf_tieRule, conf_barCloseOnly, conf_requireRawStillTrue, conf_breakBufferTicks, conf_maxSwingDistPct, conf_maxPivotAgeBars, conf_pLeft, conf_pRight)
Parameters:
longRaw (bool)
shortRaw (bool)
signalDir (int)
signalLine (float)
posSize (float)
o (float)
h (float)
l (float)
c (float)
_bar_index (int)
_time (int)
conf_useBreakout (bool)
conf_useSwing (bool)
conf_useMomentum (bool)
conf_momMode (string)
conf_atrLen (simple int)
conf_momAtrMult (float)
conf_rocMinPct (float)
conf_useSessionFilter (bool)
conf_session (string)
conf_plotLevels (bool)
conf_requireCloseBeyond (bool)
conf_confirmTimeoutBars (int)
conf_minWaitBars (int)
conf_gateOnlyWhenFlat (bool)
conf_dynamicLevelWhileWaiting (bool)
conf_dynUpdateMode (string)
conf_deferBreakOnLevelUpdate (bool)
conf_refreshOnNewRawSignal (bool)
conf_rawEventMode (string)
conf_tieRule (string)
conf_barCloseOnly (bool)
conf_requireRawStillTrue (bool)
conf_breakBufferTicks (int)
conf_maxSwingDistPct (float)
conf_maxPivotAgeBars (int)
conf_pLeft (int)
conf_pRight (int)
المؤشرات والاستراتيجيات
EURUSD 5m SMA(5) x SMA(20) AlertsTracks every time the 5 sma crosses the 20 sma on the 5 minute chart
Non-Repainting Support/Resistance TrendlinesFeatures of This Version
Support lines: upward only, start at lowest low → next higher low
Resistance lines: downward only, start at highest high → next lower high
Lines do not cross price action (validated by every bar along the line)
Non-repainting, confirmed pivots only
Maximum number of trendlines is adjustable
Time-Segmented RVOLTime-Segmented RVOL
The Mathematical Flaw in Standard RVOL
Most Relative Volume (RVOL) indicators are built on a "Linear Scaling" hypothesis. They take the daily average and divide it by the number of bars in the day. This fails to account for the "Volume Smile"—the natural tendency for volume to be heavy at the open/close and dry up during mid-day. This leads to "False Highs" every morning and "False Lows" during lunch.
The Solution: Time-Slot Memory
This script uses a high-performance array to create a 20-Day Memory for every specific minute of the trading day.
Contextual Comparison: It compares the current 10:30 AM bar only to the previous twenty 10:30 AM bars.
Pre-Market Precision: Because it compares 4:00 AM volume to historical 4:00 AM volume, it can spot "early-bird" runners hours before the opening bell, identifying unusual interest when total volume is still low.
The Coherent Momentum Tiers
We have organized the color logic into four distinct, logical tiers to assist in rapid decision-making:
Cold (Blue): RVOL < 1.0 . Volume is below the historical average for this specific time slot.
Building (Green): RVOL 1.0 – 3.0. Active participation. The stock is "Awake" and moving with healthy, sustainable interest.
High Intensity (Yellow): RVOL 3.0 – 5.0. Extreme interest. The trade is becoming "crowded"; look for increased volatility.
Parabolic/Super High (Pink): RVOL > 5.0. Massive abnormality (5x+ normal volume). Common in small-cap "pumpers" and major institutional news events.
Trading Strategy: Spotting the "In-Play" Runner
The Awake Signal: Watch for a transition from Blue to Green. This confirms the ticker is "in-play" relative to its own 20-day history.
The Breakout: Look for Yellow or Pink bars accompanied by a price breakout from a consolidation zone. High RVOL confirms the move has real conviction.
Exhaustion (White X): The script includes built-in divergence tracking. If the price makes a new high but the RVOL bars are shrinking, a "White X" will appear. This suggests "Volume Exhaustion"—the fuel is running out.
Settings
Lookback (Days): Default is 20. This acts as a "Truth Filter" to ensure the baseline remains grounded in long-term reality rather than chasing short-term noise.
Custom Thresholds: Fully adjustable levels for the Green, Yellow, and Pink tiers to suit different asset classes (Small-caps vs. Mega-caps).
libhs_td6Library Overview Data for logger
This library contains test data used by library logger
import GETpacman/logger/x as logger
The Fantastic 4 - Momentum Rotation StrategyOverview
The Fantastic 4 is a tactical momentum rotation indicator. It rotates capital monthly across four carefully selected assets based on their 75-day Rate of Change (ROC), allocating only to assets with positive momentum and proportionally weighting them by their momentum strength.
This indicator tracks the strategy's historical performance, displays current allocation recommendations, and sends monthly rebalance alerts so you can easily manage your portfolio. Simply set your capital amount and the indicator shows exactly how much to invest in each asset.
Why These Four Assets?
The selection of 20-year Bonds, Gold, Russell 2000, and Emerging Markets is based on their specific volatility and decorrelation characteristics, which allow the strategy to react quickly to market shifts while providing protection during downturns.
Russell 2000 (Small Caps)
Chosen over the S&P 500 because it is more "lively" and active (Nowadays you could use also the Nasdaq). Its trends are steeper and more vertical, making it easier for a momentum indicator to catch clear trends. While the S&P 500 has more inertia, the Russell 2000 develops faster, allowing the strategy to capture gains in shorter periods.
Emerging Markets
Included because they can act like a "rocket," offering explosive growth potential while maintaining high decorrelation from developed equity markets. When emerging markets trend, they trend hard.
20-Year Bonds
Selected because they are the most decorrelated asset from equities. When a stock market crash occurs, capital typically flows into fixed income, and long-term bonds (20-year) notice this influx the most, making their price reaction more significant and easier to trade. This is the strategy's primary "safe haven."
Gold
Along with bonds, gold serves as a defensive asset providing a "shield" for the portfolio when general market conditions deteriorate. It offers additional decorrelation and crisis protection.
How the Strategy Works
The 75-Day Momentum Engine
The strategy uses a 75-day momentum lookback (roughly 3.5 months), which is considered very "agile" compared to other models like Global Equity Momentum (GEM) that use 200-day periods. This shorter window allows the strategy to:
React quickly to changes in trend
Catch upward movements in volatile assets early
Exit quickly when trends break
Monthly Rebalancing Process
At the end of each month:
Step 1: Calculate 75-day ROC for each asset
Step 2: Filter out assets with negative momentum (they receive 0% allocation)
Step 3: Distribute capital proportionally based on momentum strength
Step 4: Apply 5% minimum threshold (smaller allocations become zero)
Step 5: Apply 80% maximum cap (no single asset exceeds 80%, remainder stays in cash)
The 80% Ceiling Rule
There is an 80% investment ceiling for any single asset to prevent over-exposure. If only one asset (like bonds) has positive momentum, 80% goes to that asset and 20% remains in cash/liquidity.
Behavior in Bearish Markets
When markets turn bearish, the strategy protects capital through several mechanisms:
Automatic Risk-Off
Because the strategy only invests in assets with positive momentum, it automatically moves away from crashing equities. If an asset's trend becomes negative, the strategy stays "on the sidelines" for that asset.
The Bond Haven
During prolonged bearish periods or sudden crashes (like COVID-19), the strategy typically shifts into 20-year bonds. During the COVID-19 crash in March 2020, while global markets were collapsing, strategies like this reportedly yielded positive returns by being positioned in bonds.
Full Liquidity Option
If no assets show positive momentum, the strategy moves to 100% cash. This is rare given the decorrelation between the four assets—when equities crash, bonds and gold typically rise.
What This Indicator Does
This is a tracking and alerting tool that:
Calculates the optimal allocation based on current momentum
Shows historical monthly performance of the strategy
Simulates portfolio equity growth from your specified starting capital
Displays exact dollar amounts to invest in each asset
Sends monthly rebalance alerts with complete instructions
Detects missing data to prevent false signals
Features
Dynamic allocation table showing weights, dollar amounts, and ROC values
Monthly returns history with color-coded performance
Data availability detection with visual status indicators
Configurable alerts for rebalancing, go-to-cash, and missing data
Simulated equity curve from initial capital
Settings Guide
Assets
Configure your four ETFs. The default European ETFs are:
Asset 1 - XETR:IS04: iShares 20+ Year Treasury Bond (Bonds)
Asset 2 - XETR:GZUR: Gold ETC
Asset 3 - XETR:XRS2: Xtrackers Russell 2000 (Small Caps)
Asset 4 - XETR:XMME: Xtrackers Emerging Markets (EM)
For US markets, consider: TLT (20-year bonds), GLD (Gold), IWM (Russell 2000), EEM (Emerging Markets)
Strategy Settings
ROC Period - Momentum lookback in daily bars. Default: 75 days (~3.5 months)
Max Allocation % - Maximum weight for any single asset. Default: 80%
Min Allocation % - Threshold below which allocation becomes zero. Default: 5%
Capital
Initial Capital - Your portfolio value. The indicator calculates exact amounts for each asset based on this. Default: $20,000
Display
Table Positions - Position the allocation and history tables on screen
Months of History - How many past months to display (3-24)
Alerts
Monthly Rebalance Alert - Sends complete allocation details at month end
Go-to-Cash Alert - Alerts when all assets have negative momentum
Missing Data Alert - Warns when asset data is unavailable
How to Use
Initial Setup
Add indicator to any chart and switch to MONTHLY timeframe
Configure your four ETF tickers
Set your portfolio capital amount
Position the tables where you prefer
Setting Up Alerts
Click Alert button or press Alt+A
Set Condition to "Fanta4"
Select "Any alert() function call"
Choose notification method (Email, Push, Webhook, etc.)
Set expiration to "Open-ended"
Monthly Workflow
Receive rebalance alert at the start of each month
Alert shows exact percentages AND dollar amounts for each asset
Adjust your portfolio accordingly
No action needed during the month
Reading the Tables
Green = positive returns/momentum
Red = negative returns/momentum
Orange "N/A" = missing data
Alloc column shows weight distribution (e.g., "45/35/20/—")
Alert Message Example
Monthly alerts include:
Target month for the new allocation
Current portfolio value
Each asset's percentage AND dollar amount
Each asset's momentum (ROC) value
Cash allocation if applicable
Total return since inception
Historical Context
This strategy combines elements of:
Dual Momentum (Gary Antonacci) - Relative and absolute momentum
Global Equity Momentum (GEM) - But with shorter 75-day vs 200-day lookback
Risk parity concepts - Decorrelated asset selection
The key innovation is the specific asset selection optimized for momentum trading and the agile 75-day lookback period that allows faster reactions to trend changes.
Data Requirements
The strategy activates only when all four assets have valid price data (minimum 75 days of history). The data status row shows checkmarks for available data. Note: Some ETFs have limited history (e.g., XMME data starts June 2017).
Limitations
This is a tracking indicator, not an automated trading system
Past performance is hypothetical and does not guarantee future results
Requires all four assets to have valid data; partial allocation not supported
Monthly rebalancing may miss shorter-term momentum shifts
Transaction costs, slippage, and taxes are not included in simulation
ETF availability and liquidity vary by region
The 75-day momentum may whipsaw in choppy, trendless markets
Disclaimer
This indicator is for educational and informational purposes only. It does not constitute financial advice.
Version History
v1.0 - Initial release with momentum rotation, allocation tables, data validation, and monthly alerts
KJ Sessions (Today Only): Asia/London/US + OverlapKJ Sessions : Asia/London/US + Overlap.
best for people to clearly mark Asia, UK and US opening and closing timing.
logger.DEMO◼ Objective
This is an accompanying script to logger library. As the library has lot of logging features, this script demonstrates how all fields and methods interact to display logs on screen.
Please always use the latest version of the library and the key information functions
◼ How to access help and info about this library
Import the latest version of Library, call logger.overview(), and hover mouse over overview() to see help in Editor!
import GETpacman/logger/4 as logger
logger.overview() => Help and general information
logger.sampleCode() => Sample Code Usage
logger.fields() => For listing all fields
logger.methods() => For listing of all methods
TSLA Cycle Timing - 122-Day Reversal Map (Adaptive Framework)This indicator is a timing map built specifically for Tesla (TSLA) on the Daily chart. It plots a repeating set of vertical, color-coded timing markers inside a 122-bar cycle (commonly treated as ~122 trading days on the Daily timeframe). These markers highlight reversal “zones”—areas where TSLA has historically shown a tendency to pivot from high-to-low and low-to-high within the cycle.
The script includes:
23 TSLA-derived set points (Points 1–23): the core timing map used to mark the most repeatable reversal areas.
Two optional “Inversion Points” (INV A / INV B): manual markers you can enable when TSLA’s high/low sequence appears to flip due to a structural deviation.
One additional optional marker (OPT C) for user customization.
This is not an auto-buy/sell system. It is a cycle-structure framework designed to help you anticipate when a reversal is more likely to occur, so you can combine it with your own confirmation tools (price action, trend context, support/resistance, volume, etc.).
Definitions (How this script interprets highs/lows)
In the context of cycle mapping:
A High Point is the highest price reached between two neighboring high pivots.
A Low Point is the lowest price reached between two neighboring low pivots.
The vertical lines are timing markers, not “guaranteed pivot candles.” Price may top/bottom slightly before or after a line. That’s why the script includes an optional ± window (in bars) to visualize a small tolerance zone around each marker.
How it works (Conceptually)
The script defines a repeating cycle length (default 122 bars).
Inside each cycle, each point has an offset measured in bars from the cycle start.
For every cycle instance (past, current, and optional future cycles), the script draws:
a vertical dotted line at each enabled point offset
optional ± window bands around the line
optional labels (numbers for set points and “INV” labels for inversion points)
Because this is a Tesla-specific map, the default offsets for Points 1–23 are preconfigured based on TSLA’s observed structure, and the remaining optional points are user-controlled.
How to Use (Important)
1) Use the Daily chart first
This model is designed around TSLA’s Daily cycle behavior. Start with:
Symbol: TSLA
Timeframe: 1D
If you use other timeframes, the cycle “tempo” can change and may require different offsets.
2) Identify the cycle start (anchor)
Cycle mapping depends on where the current cycle is anchored.
Use “Bars Back to Current Cycle Start” to shift the cycle start so that the script’s point sequence aligns with your most recent known cycle beginning. Once aligned, the points should repeat near each 122-bar interval.
3) Read the vertical markers as reversal zones
The colored vertical lines represent areas where reversals have historically occurred, not a promise that price must reverse exactly on the line.
A practical approach:
Use the marker as a “heads-up” zone
Wait for confirmation (trend break, candle structure, momentum shift, key level reaction, etc.)
4) Understand “set points” vs “Inversion Points”
Set Points (1–23)
These are the primary TSLA reversal zones that tend to recur within the 122-bar structure. Specific numbered points often appear near the same relative position inside each cycle.
Inversion Points (INV A / INV B)
Occasionally, TSLA’s cycle behavior can flip—meaning the expected high-to-low (or low-to-high) progression temporarily swaps order. This is what I refer to as an inversion.
When you see a cycle behaving “backwards” relative to the usual sequence:
Enable INV A and/or INV B
Place their offsets at the bar locations where the flip becomes obvious
Use these markers as manual annotations so your cycle notes stay consistent even when TSLA deviates from its typical rhythm
These inversion markers do not force the script to predict a flip—they allow you to document it cleanly.
5) Use the ± Window Bands to manage real-world variance
Markets don’t pivot on perfect timestamps. If a reversal tends to happen “around” a point:
Enable ± Window Bands
Set Window ± Bars (commonly 1–3 bars on 1D)
This gives a realistic visual tolerance zone around each timing marker.
Settings Guide (Practical)
Cycle Length (bars): 122 (TSLA Daily baseline)
Lookback Bars: increase to study more history, decrease for performance
Future Cycles: use sparingly; future markers are guidance zones, not guarantees
Past Cycles: Lines Only: recommended ON for stable performance
Labels at Top: helps keep the chart clean and readable
Final Notes / Limitations
This is a historical timing framework designed to map TSLA’s repeating reversal structure. It helps estimate when reversal pressure tends to appear, but it does not replace risk management or confirmation. Cycle behavior can stretch, compress, or invert during unusual volatility regimes—hence the inclusion of optional inversion markers.
Daily ATR + DeltaThis indicator shows last value of ATR with this parameters: Length 14, Smoothing RMA, Timeframe 1 day i Wait for timeframe closes.
Also, it shows Delta in percentage.
Delta is calculated in this way: -((the last one-minute closing price of the previous day's stock exchange)-(last price at the moment))/(value of ATR) * 100
Notice:
If you are in postmarket or premarket, delta will be also calculated from the "the last one-minute closing prices of the previous day's stock exchange" not from the "the last one-minute closing price of the todays stock exchange".
You dont need to have indicator Average True Range for this indicator to be working.
StO Price Action - Impulse CandleShort Summary
- Highlights impulse candles based on relative momentum
- Compares current or previous closed candles against prior price movement
- Uses a configurable momentum factor to filter significant impulses
- Designed to make strong directional candles visually stand out
Full Description
Overview
- Identifies impulse candles with strong momentum
- Focuses on candle-to-candle expansion rather than trend or structure
- Intended to visually emphasize moments of acceleration in price
- Works as a complementary tool to price action and volatility analysis
Impulse Candle Logic
- Impulse candles are detected by comparing the current candle range to previous candles
- A candle is considered an impulse when its range exceeds prior movement by a defined factor
- The comparison basis can be (current forming Candle, previous fully closed Candle)
Momentum Factor
- The momentum factor defines how much stronger a candle must be compared to earlier candles
- Higher values filter out smaller moves and highlight only extreme impulses
- Lower values allow more frequent impulse detection
- Helps adapt the indicator to different instruments and volatility regimes
Range Calculation
- Two range calculation modes are available:
- Open / Close (Body range):
- Measures body-based momentum
- Focuses on directional conviction
- High / Low (Candle range):
- Measures full volatility expansion
- Includes wicks and intrabar extremes
Visualization
- Impulse candles are highlighted using a customizable bar color
- Designed to remain minimal and unobtrusive
Alerts
- Optional alert can be enabled after detected impulse candles
- Useful for monitoring momentum shifts without constant screen time
Usage
- Suitable for breakout detection and momentum confirmation
- Helps identify volatility expansion phases
- Can be used for entry timing or trade management
Notes
- This indicator does not predict direction on its own
- Impulse candles may occur in both trending and ranging markets
- Best used in combination with structure, levels or higher-timeframe context
- Momentum thresholds should be adjusted per market and timeframe
Polynomial Trend Exhaustion & DivergencePolynomial Trend Exhaustion & Divergence
Overview
This indicator combines advanced polynomial regression analysis with momentum-based exhaustion detection and forecast-based divergence signals. It identifies potential trend reversals by analyzing when price momentum is fading (exhaustion) and when price direction conflicts with the mathematical trajectory projected by cubic polynomial forecasting (divergence).
The system uses optional source smoothing (Linear Regression Blend or Kalman filtering) to reduce noise before analysis, then applies two independent detection methods to generate high-probability reversal warnings.
Exhaustion Detection
What it detects: Trend exhaustion occurs when price is still moving in one direction but the underlying momentum is weakening—a classic early warning of potential reversal.
How it works:
The indicator calculates either a cubic polynomial regression or Kalman filter trend, then monitors the slope of that trend line. Exhaustion is detected when:
Bullish Exhaustion: The slope is positive (uptrend) but the rate of change of the slope is negative (momentum decelerating)
Bearish Exhaustion: The slope is negative (downtrend) but the rate of change of the slope is positive (momentum decelerating)
Signal filtering:
Consecutive Bars Required: Exhaustion conditions must persist for a configurable number of bars before triggering
Max Repeat Signals: Limits how many consecutive exhaustion signals can fire to prevent clustering
Cooldown Period: After hitting the max signal limit, the indicator pauses before allowing new signals
This produces clean, actionable warnings rather than noise during extended exhaustion phases.
Divergence Detection
What it detects: Divergence signals identify when the polynomial-projected future price path conflicts with current price direction—suggesting price may be overextended and due for a correction toward the forecast.
How it works:
The indicator fits a cubic polynomial to recent price data and extrapolates it forward by a configurable number of bars. It then compares:
Current price direction (rising or falling over the lookback period)
Forecast position (above or below current price)
Divergence triggers when:
Bullish Divergence: Price is falling but the polynomial forecast is above current price (suggesting upward reversion)
Bearish Divergence: Price is rising but the polynomial forecast is below current price (suggesting downward reversion)
Signal filtering:
Minimum Divergence (ATR): The forecast must be at least X ATRs away from price
Minimum Price Movement (ATR): Price must have moved at least X ATRs over the lookback period (filters out sideways noise)
Consecutive Bars Required: Divergence conditions must persist for X bars before triggering
Cooldown Period: Minimum bars between divergence signals of the same type
Key Features
Dual trend methods: Choose between Polynomial Regression or Kalman filtering for the base trend calculation
Source smoothing options: None, LinReg Blend, or Kalman filter applied to OHLC data before analysis
ATR-normalized thresholds: All filter thresholds adapt to current volatility
Anti-clustering logic: Built-in repeat limits and cooldowns prevent signal spam during extended conditions
Full alert support: All four signal types (Bull/Bear Exhaustion, Bullish/Bearish Divergence) have dedicated alert conditions
Squeeze Indicator Squeeze Indicator is a volatility-focused indicator designed to identify periods of compression and the early transition into expansion.
It measures Bollinger Band Width (BBW) using a 20-period Bollinger Band to quantify how tightly price is coiling, then smooths BBW with a 16-period SMA and a faster 8-period EMA to distinguish structural compression from short-term changes in volatility.
The BBW itself is displayed as a subtle grey filled area to emphasize relative contraction and expansion, while a squeeze condition is highlighted whenever BBW falls below both its SMA and EMA, signaling an environment where volatility is suppressed and a directional move is more likely to follow.
Crossovers of the EMA above or below the SMA provide early warnings of volatility expansion or renewed compression, making the indicator especially useful for timing breakouts, anticipating regime shifts from range to trend, and managing options strategies that depend on changes in volatility rather than price direction.
Adaptive Support/Resistance EMA IndicatorThis indicator automatically identifies and displays the optimal Exponential Moving Average (EMA) period for the current market conditions by analyzing how well different EMAs act as support or resistance levels.
How It Works
Adaptive Period Selection:
The indicator tests 33 different EMA periods (ranging from 5 to 400, including Fibonacci numbers like 8, 13, 21, 34, 55, 89, 144, 233, 377) and scores each based on how effectively it functions as support or resistance.
Intelligent Scoring System:
Each EMA is evaluated using three key metrics:
Respect Rate - Percentage of time price stays on the correct side of the EMA (above for support, below for resistance)
Successful Bounces - Number of times price approached the EMA and reversed without breaking through
Break Severity - Penalties for failed breaks, weighted by both depth and duration of the violation
Trend-Aware Behavior:
Uptrend (price > 50 EMA): Finds the EMA that best acts as a support floor below price
Downtrend (price < 50 EMA): Finds the EMA that best acts as a resistance ceiling above price
Adaptive Features:
Dynamic Lookback: Automatically adjusts analysis period (50-200 bars) based on market volatility
Sticky Selection: Won't switch EMAs unless new choice shows significant improvement (8% threshold by default)
Update Frequency: Recalculates every 20 bars or immediately during high volatility periods
Visual Elements
EMA Display:
Green line = Support (in uptrends)
Red line = Resistance (in downtrends)
Optional glow effect for enhanced visibility
Optional fill between price and EMA
Labels:
Shows "SUP " or "RES " when the selected EMA changes
Markers appear only when there's a meaningful change
Info Table:
Displays real-time statistics:
Current EMA period
Role (Support or Resistance)
Adaptive lookback length
Number of successful bounces
Number of breaks
Break severity score (color-coded: green < 5, yellow 5-20, red > 20)
Key Advantages
No manual EMA period selection needed
Adapts to changing market conditions automatically
Considers both bounce quality and break severity
Reduces whipsaws through sticky selection logic
Provides transparency with detailed performance metrics
Settings
Performance Settings:
Min/Max Lookback: Range for adaptive analysis window
Update Frequency: How often to recalculate (higher = faster performance)
Sticky Threshold: Required improvement % to switch EMAs
Detection Settings:
Touch Threshold: How close price must get to count as a "touch"
Bounce Window: Bars to confirm a successful bounce vs break
Visual Settings:
Customizable support/resistance colors
Toggle glow and fill effects
Show/hide info table and change markers
ICT Power of 3 identify the high-probability Power of 3 pattern by analyzing price behavior rather than just specific times of day. It focuses on how the market builds, traps, and then expands.
1. Accumulation (The Setup)
Logic: The script monitors volatility using the Average True Range (ATR). When volatility drops below its recent average, the script recognizes that orders are being "accumulated."
Visual: A Blue Dotted Box appears. This marks the equilibrium zone where buy and sell side liquidity is being engineered above and below the high/low of the range.
2. Manipulation (The Trap)
Logic: The script looks for a "Sweep." This is defined as price moving outside the blue accumulation box but failing to sustain that move. In the video, this is the "Judas Swing" or false breakout.
Visual: A Red Diamond appears above or below the bar. This signals that the script has detected a liquidity grab—essentially, the market has "tricked" breakout traders into the wrong side of the market.
3. Distribution (The Expansion)
Logic: This is identified through Displacement. The script calculates the average candle body size. When a candle appears that is significantly larger (based on your Displacement Multiplier), it confirms that "Smart Money" has entered the market.
Visual: A Green Triangle appears. This marks the start of the distribution phase, which is the "meat" of the move where you want to be positioned.
Look-back Value V1新增 MA10 與 MA120 的計算、繪圖、表格顯示。
新增 table_pos 參數,可選擇表格顯示位置(top_left, top_right, bottom_left, bottom_right)。
所有 table.cell 改用 具名參數 text_color,避免誤判成 width。
這樣你就能靈活選擇表格位置,並同時觀察 MA5、MA10、MA20、MA60、MA120、MA240 的扣抵分析。
Fixed Price Levels with Zones (1000 / 750 / 500 / 250)idywbdiawunadnaw oidnawidnawodnaw wadaw dawd awdaw
Needle Below 20, Sub-chart## 指标名称
**单针下20副图(Needle Below 20, Sub-chart)**
## 一句话概述
在**中周期保持强势**的背景下,用短周期的“快速降温”来定位**强势回撤/错杀**,并额外标记**极端超卖(双线归零)**的情绪极值窗口。
---
## 指标逻辑与构成
本指标包含两条强弱线(随机指标风格的区间归一化):
* **短期线(默认 3)**
反映近短周期内价格在区间的位置,敏感度高,用于捕捉短线回撤与情绪快速降温。
* **长期线(默认 21)**
反映中周期强弱分布,用作“趋势/强势背景”的过滤。
并提供两类柱状提示(STICK):
1. **双线归零(默认:短期≤6 且 长期≤6)**
代表“情绪极端恐慌/极端超卖”的窗口,更多用于观察**反弹可能性**与“风险释放阶段”。
2. **单针下20(默认:短期≤20 且 长期≥80)**
代表“中周期强势未破 + 短线急跌/下探”的典型回撤信号,用于寻找趋势交易中的**回撤介入候选**。
图中绘制 **80/20** 参考线,帮助快速判断分位区域。
---
## 使用方法(推荐工作流)
### 1)先定“背景”:只在你认可的趋势环境使用
本指标本质是“**强势回撤定位器**”,并不负责替你判断大盘/板块/个股是否处于可交易趋势。建议搭配以下任一类过滤器:
* **趋势过滤(强烈推荐)**
* 价格位于中长期均线之上(例:MA50/MA200 上方)
* 或者你自己的趋势线/多空线系统显示多头趋势(如:快线>慢线、结构未破)
* **结构过滤(强烈推荐)**
* 回撤仍然在关键支撑之上(前高、趋势线、箱体上沿回踩等)
* 避免在明显“破位下跌”的结构中把信号当作抄底依据
### 2)信号触发后的处理:不要“看到就买”,而是“进入观察与触发”
* **单针下20(黄柱)**:
作为“候选提示”,下一步关注是否出现:
* 回踩关键位后的止跌K线(锤子线/吞没/放量止跌等)
* 次日/后续重新站回关键位或出现趋势延续确认
* 量价关系转好(缩量回撤、放量反转等)
* **双线归零(红柱)**:
更偏“情绪极值”提示,常见用途是:
* 提醒你风险已经释放到极端区域,观察是否出现反弹结构
* 不建议无过滤硬抄底;更适合与“结构止跌/大盘企稳”一起使用
---
## 风险控制与止损思路(示例,不构成建议)
以下仅提供“如何把信号落到可执行”的框架示例:
* **入场触发(示例)**
* 黄柱出现后:等待价格在关键位止跌,或出现确认K线再介入
* 分批:先小仓试错,确认后再加
* **止损锚点(示例)**
* 关键支撑位下破(趋势线/前低/箱体下沿)
* 或“信号触发后的反弹失败又破前低”
* **仓位建议(原则)**
* 把仓位大小与止损距离联动:止损距离越大,仓位越小
* 避免单次信号重仓;这类信号更适合“低风险试错 + 确认加仓”的趋势回撤逻辑
---
## 参数说明与调参建议
### 1)为什么是 3 / 21?
* **3**:强调“短期情绪/回撤”的敏感度,适合捕捉快速下探
* **21**:近似一个月交易日,刻画中周期强弱背景,适合作为“强势过滤”
如果你交易周期更短(更偏日内/隔日):
* 可考虑 **短期 2–5**、长期 **13–34** 区间做测试。
如果你交易周期更长(偏波段/中线):
* 可考虑 **短期 5–8**、长期 **34–55**。
### 2)为什么阈值是 6 / 20 / 80?
* **6**:更接近“极端”区域,用于标记情绪极值(双线归零)
* **20/80**:经典分位阈值,表示低位/高位区域,用于区分“短弱/长强”的错位状态
### 3)如何调参更贴合你的市场与标的?
建议按“信号密度—胜率—回撤”三者权衡:
* 信号太多:
* 降低“长期≥”阈值的触发频率(如 80→85)
* 或提高“短期≤”门槛的严苛度(20→15)
* 或把长期周期加长(21→34)
* 信号太少:
* 放宽阈值(长期 80→75、短期 20→25)
* 或缩短长期周期(21→13)
调参务必结合你常交易的品种波动特征,建议在同一市场同一类标的上做一致性回测/复盘。
---
## 免责声明
本脚本仅用于教育与研究目的,展示一种技术分析可视化方法,不构成任何形式的投资建议、交易建议或收益承诺。市场有风险,交易需谨慎。使用者应基于自身风险承受能力独立决策,并对交易结果自行负责。作者不对任何因使用本脚本导致的直接或间接损失承担责任。
---
## 致谢与来源
* **策略/思路来源**:B站 UP 主 **z哥** 的相关分享与讲解。
* **实现说明**:本脚本为 TradingView(Pine Script)版本的复现与可视化实现,便于在 TradingView 环境中使用与研究。
* 如原作者对公开引用有额外要求,请以原作者说明为准;若有侵权或需要修改归因方式,请联系我调整/下架相关描述。
下面给你补齐一份**英文版(可直接用于 TradingView 发布页)**,并与中文版结构对齐,符合社区常见写法(Overview / How it works / How to use / Inputs / Risk / Credits)。
---
## Title
**Needle Below 20 (Sub-chart) — TDX Style Recreation**
## Overview
This indicator is an auxiliary tool designed to spot **sharp short-term pullbacks (shakeouts) within a strong mid-term regime**, and to highlight **extreme oversold “panic” zones**. It is best used as a **candidate filter and timing aid** inside a broader trend-following framework, rather than as a standalone buy/sell signal.
## How it works
The script plots two normalized strength lines (stochastic-style normalization over a lookback window):
* **Short-term line (default: 3 bars)**
Captures fast sentiment cooling and short-term compression (high sensitivity).
* **Long-term line (default: 21 bars)**
Represents the mid-cycle regime strength, used as a context filter.
It also provides two stick/column signals:
1. **Double-Line Near-Zero (Red stick)**
Triggered when **Short-term ≤ 6 AND Long-term ≤ 6** (defaults).
This typically represents an **extreme oversold / capitulation-like** window, often used to monitor potential technical rebounds (confirmation recommended).
2. **Needle Below 20 (Yellow stick)**
Triggered when **Short-term ≤ 20 AND Long-term ≥ 80** (defaults).
This is commonly interpreted as a **strong regime intact + sudden short-term dump/pullback**, useful for spotting potential **trend pullback re-entry candidates**.
Reference levels **80/20** are drawn for quick zone reading.
### How to use (recommended workflow)
1. **Define the regime first (strongly recommended)**
This indicator does not decide whether a market is tradable. Use a trend/structure filter, for example:
* Price above a medium/long MA (e.g., MA50/MA200), or your own trend model
* Structure not broken (support holds, pullback into a valid support zone)
2. **Treat signals as “watchlist triggers,” not instant entries**
* **Yellow stick (Needle Below 20):**
After it prints, look for confirmation such as:
* A hold/reclaim of a key level (prior high, trendline, range top retest, etc.)
* A reversal candle or continuation confirmation
* Constructive volume/price behavior (e.g., pullback on lighter volume, rebound with demand)
* **Red stick (Double-Line Near-Zero):**
Best viewed as an **extreme sentiment/oversold marker**. Avoid blind bottom-fishing; combine with structure stabilization and broader market context.
## Risk management (examples, not financial advice)
* **Entry trigger (example):** scale in after confirmation rather than buying the first signal
* **Stop reference (example):** below the key support / prior swing low / structural invalidation level
* **Position sizing principle:** size positions based on stop distance; larger stop = smaller size
## Inputs / Parameters
* **Lookbacks (3 / 21):**
* 3 bars: short-term sensitivity for fast pullback detection
* 21 bars: mid-cycle regime context (roughly one trading month)
Suggested adjustments:
* Shorter-term trading: try **2–5** (short) and **13–34** (long)
* Longer swing trading: try **5–8** (short) and **34–55** (long)
* **Thresholds (6 / 20 / 80):**
* 6: “extreme” zone for near-zero panic marker
* 20/80: classic zone thresholds for low/high regime separation
If signals are too frequent:
* tighten thresholds (e.g., long ≥ 80 → 85, short ≤ 20 → 15), or lengthen long lookback (21 → 34)
If signals are too rare:
* loosen thresholds (e.g., long ≥ 80 → 75, short ≤ 20 → 25), or shorten long lookback (21 → 13)
## Disclaimer
This script is provided for **educational and research purposes only**. It does **not** constitute financial advice, investment recommendations, or any guarantee of performance. Trading involves risk. You are solely responsible for your decisions and outcomes.
## Credits / Attribution
* **Concept origin:** Inspired by the Bilibili creator **“z哥”**.
* **Implementation:** This is a TradingView (Pine Script) recreation for visualization and study.
If the original creator has specific attribution requirements, please follow the creator’s instructions. If any changes are needed, attribution text can be updated accordingly.
## Citation snippet
> Concept inspired by Bilibili creator “z哥”. Pine Script recreation for educational/research use.
Bradley Industries IndicatorThe Bradley Industries Indicator is a confluence-based trading system designed to identify early trend impulses while filtering out late or low-probability entries.
It combines four independent indicators, each measuring a different market dimension, and only generates a primary signal when all four align on the same bar.
The philosophy of the system is simple:
Enter only when structure, momentum, volatility, and directional flow agree at the start of a move.
Weinstein Stage AnalysisWeinstein Stage Analysis
This is an enhanced version of Stan Weinstein's classic Stage Analysis, optimized for visual clarity on dark themes. The indicator instantly colors your candlesticks based on the current Weinstein Stage using a bright, fully opaque color scheme that stands out strongly even on dark charts.
Key Features:
- Uses Weekly 30-period SMA (customizable length) as the primary reference line
- Supports "Within Range %" parameter – set to 0% for super-strong stocks that must stay clearly above/below the MA
- Four distinct stages with vivid colors:
• Stage 1 (Accumulation) – Bright Cyan (#00FFFF) – Stock is basing or consolidating near the MA
• Stage 2 (Uptrend) – Bright Green (#00CD00) – Strong uptrend, price clearly above the weekly MA
• Stage 3 (Topping) – Bright Orange (#FFAA00) – Price is still above MA but weakening (potential distribution)
• Stage 4 (Downtrend) – Bright Red (#FF0000) – Strong downtrend, price clearly below the weekly MA
- Automatic stage transition logic with perfect color persistence (no flickering)
- Super visible on both light and dark themes – colors are 100% opaque and highly saturated
- Plots the Weekly 30 SMA as a thick white line for easy reference
How to Use:
1. Add to any chart (works best on daily or weekly timeframes)
2. For very strong momentum stocks, set "Within Range %" to 0% – this forces the indicator to only show Stage 2 when price is clearly above the MA
3. Use default 30-period length or adjust based on your preference
4. Watch for clean stage transitions – especially the switch from Stage 3 (orange) to Stage 4 (red) as a strong sell signal, or Stage 1 (cyan) to Stage 2 (green) as a powerful buy signal
Key Zone$ - Support and Resistance0DTE Bounce Zones (6M) — Support & Resistance with VWAP, Volume, and Risk Management
This indicator is built for intraday and 0DTE options trading, focused on high-quality bounce and rejection setups at historically proven support and resistance zones.
It automatically identifies key zones from six months of historical price action and waits for real-time confirmation before signaling CALL or PUT opportunities. The goal is to reduce noise, avoid weak bounces, and provide clear, rules-based trade structure.
====================================================================
CORE FEATURES
====================================================================
Historical Support & Resistance Zones (6 Months)
Zones are built using 15-minute pivot highs and lows.
A zone must be tested at least 3 times to be considered valid.
Nearby zones are merged automatically to reduce clutter.
Zones extend forward in time and update dynamically.
Support zones are shown in green, resistance zones in red.
These are higher-quality structural levels, not same-day levels.
====================================================================
0DTE-Focused Entry Logic
Signals only trigger when price interacts with a confirmed zone and shows a strong rejection candle.
Signals are limited to high-probability trading windows only.
Market Open: 9:30–10:45 ET
Market Close: 3:00–4:00 ET
This avoids midday chop and focuses on periods with real momentum.
====================================================================
VWAP Confirmation (Strict)
CALL setups require a VWAP reclaim.
PUT setups require a VWAP loss.
This aligns trades with institutional order flow instead of counter-trend noise.
====================================================================
MACD Momentum Filter
MACD histogram behavior is used to confirm momentum direction and avoid taking bounces against the prevailing move.
====================================================================
ATR Candle Strength Filter
The signal candle must be large enough relative to ATR.
This filters out weak or indecisive candles that often fail with 0DTE.
====================================================================
Advanced Volume Confirmation (Relative Volume)
Relative Volume (RVOL) is used instead of raw volume.
Different RVOL thresholds are applied for CALLS versus PUTS.
Higher RVOL is required for PUTS due to downside urgency.
Lower RVOL is allowed for CALLS due to grind-up behavior.
Separate RVOL thresholds are used for the market open and market close.
This ensures signals only occur when real participation is present.
====================================================================
Built-In Risk Management (2:1 Reward/Risk)
Every signal automatically calculates an entry, stop loss, and target.
Stop loss is based on the zone edge with an ATR buffer.
Targets default to a 2:1 reward-to-risk ratio.
Entry, stop, and target levels are drawn directly on the chart and included in alerts.
====================================================================
Smart Alerts (CALLS & PUTS)
Alerts trigger only when all conditions are met.
Alerts include trade direction, entry price, stop price, target price, and RVOL information.
Alerts are designed for 5-minute confirmation trading.
To use alerts, select “Any alert() function call” when creating the alert.
====================================================================
INTENDED USE
====================================================================
0DTE options trading.
5-minute chart confirmation.
Index ETFs and liquid equities such as SPY, QQQ, IWM, and SPX.
Traders who want aggressive entries with confirmation.
Traders who value structure, volume, and risk control.
====================================================================
NOTES
====================================================================
This is not a prediction tool.
Signals require discipline and confirmation.
Best results come from trading only the highest-quality setups.






















