Benner Cycle Map (A/B/C)Benner Cycle Map (A/B/C Years) + Macro Events • Educational Overlay
Description:
This script is an educational overlay that visualizes the classic Benner Cycle “A/B/C” year map (as presented on the historical Benner card) and optionally plots a curated set of major macro/market events (e.g., 1929 Crash, 9/11, Lehman, COVID) for historical context.
⚠️ Important: This indicator is NOT a trading strategy, does NOT generate buy/sell signals, and does NOT predict future market outcomes. It should not be used as financial advice.
What it shows:
A years (Panic)
B years (Good Times / Sell years)
C years (Hard Times / Buy/Accumulate years)
Optional Macro Events Overlay (context markers only)
Key features
Dynamic rebuild on zoom/pan (keeps labels aligned with the visible range)
Full customization: label position (Top/Center/Bottom), colors, opacity, sizes
Multiple label formats: horizontal, stacked, or vertical-styled (simulated via line breaks)
Background regime shading with selectable overlap priority
Two on-chart panels: Legend + Current Year Status
How to use (educational use-case)
Use this overlay to study historical clustering of the mapped years against price behavior and major events. It’s best viewed on higher timeframes (weekly/monthly) to reduce clutter.
Disclaimer
Markets are complex and influenced by countless variables. The Benner cycle map and the event markers shown here are provided for learning and visualization only. Past patterns do not guarantee future results. Always do your own research and risk management.
指標和策略
S21 SETUP (EMA9/21 + RSI 14)This script is only intended for a specific set up or strategy develop by our trading group. Lightning Strategy Group T3 Sniper has its specific strategy that requires this indicator script.
HA EMA10.30 Pullback, Trend Bias, No ConsolidationThis script is a trend-bias + entry signal indicator built around the Heikin-Ashi pullback strategy you shared.
It does three main jobs:
Decides the market bias (LONG only, SHORT only, or NO TRADE)
Filters out consolidation / chop
Signals entries only when momentum aligns
MACD Quality Confirmation Bipolar Index V2Indicator: MACD Quality Confirmation Bipolar Index (V2)
Overview
The MACD Quality Confirmation Bipolar Index V2 is a quantitative tool designed to solve the "False Signal" problem inherent in traditional MACD oscillators. Instead of merely showing momentum direction, this indicator filters MACD signals through a multi-dimensional Quality Engine that analyzes liquidity and price action efficiency.
Why Use This?
Standard MACD often produces "noisy" crossovers during low-volume consolidation or erratic price movements. This indicator assigns a "Quality Score" (0-100) to every move, visualized as a bipolar histogram.
Key Features
Liquidity Filtering (Volume Factor): Uses a percentile-based log-volume calculation over a 1-year lookback. It ensures that signals occurring on low institutional participation are suppressed.
Efficiency Scoring (Smoothness): Measures the ratio of candle body size to the total range. High-wick "erratic" price action reduces the score, while solid, trend-driven candles increase it.
Bipolar Visualization: * Positive Bars: Bullish momentum confirmed by high quality.
Negative Bars: Bearish momentum confirmed by high quality.
Bright Colors: Indicate "Strong Zones" (Score > 60), where price action and volume are in perfect sync.
Smart Crossover Labels: * Green/Red Triangles: High-quality crossovers (Score > 40).
Gray Triangles: Low-quality "noise" crossovers.
Yellow "!" Mark: A warning for extremely weak signals (Score < 20).
How to Trade
The Power Setup: Look for a Bullish Cross (Triangle) that coincides with a bar entering the Strong Zone (above 60). This indicates a high-conviction entry.
The Noise Filter: If you see a MACD crossover but the histogram remains in the "Active Zone" (below 40) or triggers a "!", exercise caution; the market may be ranging.
Trend Strength: Watch for increasing bar heights. If price moves higher but the Quality Score declines, it suggests a "hollow" trend prone to reversal.
3+ Consecutive Inside Candles Detectorlotshape(signal, title="Inside Candle Sequence", style=shape.labeldown,
text="Inside 3+", location=location.abovebar, color=color.new(color.blue, 0), size=size.tiny)
FVG Detector - With Close Direction & Breakoutdetects fvg. sharp rejection and sweep. developed to help traders achieve success with close direction and breakout
Swing Trader's DCR/WCRHere is the description formatted with simple tags, ready to copy and paste into your TradingView script description or personal notes.
Swing Trader's DCR/WCR Dashboard
This script creates a real-time dashboard on your chart to measure the Closing Range —a critical metric for verifying breakouts and momentum. It answers the question: "Who won the battle today, the bulls or the bears?"
The Logic
The script calculates the position of the Close relative to the High/Low range:
0%: Closed at the absolute low (Max Bearish)
50%: Closed in the middle (Neutral/Indecision)
100%: Closed at the absolute high (Max Bullish)
How to Read the Signals
The dashboard uses a high-contrast "Dark Mode" theme for instant readability:
STRONG (Dark Green): The stock is closing in the Top 25% of its range. This is your primary confirmation for breakouts. It signals that institutions are buying into the close.
WEAK (Dark Red): The stock is closing in the Bottom 25% of its range. This is a warning sign. If a stock breaks out but closes "WEAK," it is likely a failed breakout (or "Squat").
Trading Strategy Use Cases
Breakout Confirmation: Only trust breakouts that show a "STRONG" DCR signal.
Multi-Timeframe Check: Ensure both DCR (Day) and WCR (Week) are Green to confirm the trend is aligned on multiple timeframes.
End-of-Day Execution: Use this in the last 15 minutes of the session to filter out noise and enter trades with the highest conviction.
TSX Sector ETF Overlay// --- Plot Data with Standard Colors ---
plot(xiu, title="TSX 60", color=color.white, linewidth=2)
plot(xfn, title="Financials", color=color.blue, linewidth=2)
plot(xeg, title="Energy", color=color.orange, linewidth=2)
plot(xma, title="Materials", color=color.yellow, linewidth=2)
plot(xgd, title="Gold Miners", color=color.yellow, linewidth=1)
plot(xit, title="Tech", color=color.purple, linewidth=2)
plot(xre, title="REITs", color=color.red, linewidth=2)
plot(xut, title="Utilities", color=color.green, linewidth=2)
plot(xst, title="Staples", color=color.teal, linewidth=2)
Markets [SolQuant]The Markets indicator displays global trading session times with visual range boxes and highlights market maker activity zones. It maps the three major sessions — New York, London, and Asia — along with specialized zones that have been observed to correlate with specific market behaviors.
█ USAGE
Session Boxes
Colored boxes are drawn for each active trading session, spanning from the session open to the session close. The box height covers the price range traded during that session. Each session uses a distinct color for quick identification:
• New York: The primary session for US equities and crypto volume.
• London: Overlaps with New York for peak liquidity in forex and global markets.
• Asia: Tokyo/Hong Kong session, often setting the tone for the following London session.
Session boxes provide immediate visual context about which global market was active during any given price action.
Market Maker Zones
Two specialized time windows are highlighted:
• Reversal Session: A time window commonly associated with market reversals and directional shifts.
• Gap Session: A time window where gaps and displacement moves frequently occur.
These zones are derived from observed patterns in market maker behavior and are intended as awareness tools rather than predictive signals.
█ DETAILS
Sessions are defined by fixed time ranges in their respective timezones. The indicator uses daylight saving time-aware timezone strings to ensure accuracy year-round. Each session's price range (high/low) is tracked dynamically and the box height updates in real time as the session progresses.
Market maker zones use the same box-drawing mechanism but target narrower time windows. All boxes are automatically removed after a configurable maximum count to prevent chart clutter.
█ SETTINGS
• Show NY / London / Asia: Toggle each session's display.
• Show Reversal Session / Gap Session: Toggle market maker zones.
• Session Colors: Customizable colors for each session and zone.
• Max Boxes: Controls how many historical session boxes are kept on chart.
This indicator displays fixed time-based session zones and does not predict price direction. Market maker zones are based on observed patterns that may not persist. It does not constitute financial advice.
Two MA Crossover with Buy/Sell Labels//@version=5
indicator("Two MA Crossover with Buy/Sell Labels", overlay=true)
// === User Inputs ===
shortPeriod = input.int(10, title="Fast MA Period")
longPeriod = input.int(100, title="Slow MA Period")
maType = input.string("EMA", title="MA Type", options= )
// === Moving Average Function ===
ma(src, length) =>
maType == "EMA" ? ta.ema(src, length) : ta.sma(src, length)
// === Calculate MAs ===
fastMA = ma(close, shortPeriod)
slowMA = ma(close, longPeriod)
// === Plot MAs ===
plot(fastMA, title="Fast MA", linewidth=2, color=color.green)
plot(slowMA, title="Slow MA", linewidth=2, color=color.red)
// === Crossover Conditions ===
buySignal = ta.crossover(fastMA, slowMA)
sellSignal = ta.crossunder(fastMA, slowMA)
// === Buy Label ===
if buySignal
label.new(bar_index, low, "BUY 🚀",
style=label.style_label_up,
textcolor=color.white,
color=color.green)
// === Sell Label ===
if sellSignal
label.new(bar_index, high, "SELL 🔻",
style=label.style_label_down,
textcolor=color.white,
color=color.red)
MTF RSI Confluence (3 TFs) + Table + AlertsThis indicator displays RSI confluence across three user-selectable timeframes in a single oscillator pane. It's designed to help you quickly confirm whether momentum conditions (overbought/oversold/neutral) align across multiple time horizons before acting.
What it does
- Plots three RSI lines at once, each sourced from a different timeframe (defaults: 5m / 15m / 1H ).
- Applies independent overbought/oversold thresholds per timeframe , so each RSI can be evaluated with its own rules.
- Shows a color-coded table summarizing:
- timeframe
- RSI value
- status (OVERBOUGHT / NEUTRAL / OVERSOLD)
- that timeframe's OB/OS levels
- Highlights the pane background when there is full confluence:
- All 3 overbought (red tint)
- All 3 oversold (green tint)
- Provides alert conditions when all three timeframes agree on overbought or oversold.
How it works (key logic)
- RSI is calculated per timeframe using request.security() with lookahead=barmerge.lookahead_off to avoid forward-looking values.
- Each timeframe's RSI is classified:
- RSI >= Overbought → Overbought
- RSI <= Oversold → Oversold
- otherwise → Neutral
- Confluence triggers when all three statuses match (all overbought or all oversold).
- Signals/alerts are gated by barstate.isconfirmed so the confluence events only trigger on confirmed bars (reduces repaint-like behavior on the current forming bar).
How to use it
1. Add to chart (works on any symbol: crypto, forex, indices, stocks).
2. Configure:
- RSI Length (1–200)
- TF1 / TF2 / TF3 (any TradingView timeframe string)
- OB/OS per timeframe with input constraints:
- Overbought: 50–100
- Oversold: 0–50
- Optional: enable/disable the table and choose its position.
3. Interpret output:
- RSI line colors reflect status (red = overbought, green = oversold, gray = neutral).
- Table provides an at-a-glance confluence dashboard.
- Use alerts for "all oversold" or "all overbought" as a filter for entries/exits or as a regime warning.
Recommended usage
- Works well on lower chart timeframes (1m–15m) to confirm setups with a higher timeframe (e.g., 1H / 4H).
- Typical approach:
- Look for all-oversold confluence during uptrends (potential pullback exhaustion).
- Look for all-overbought confluence during downtrends (potential bounce exhaustion).
- Consider pairing with trend context (moving averages, market structure) to avoid counter-trend signals.
What makes it useful/original
- Combines three MTF RSI readings + independent thresholds into one pane and a compact table, reducing chart clutter.
- Uses non-forward-looking MTF data (lookahead_off) and confirmed-bar gating for more reliable confluence alerts.
- Clear "traffic light" style status labeling to support fast discretionary decisions and alert-driven workflows.
Disclaimer
This script is for educational and informational purposes only and does not constitute financial advice. Alerts and signals are based on historical/hypothetical calculations and do not guarantee future results. Always manage risk and validate signals within your own trading plan.
bezgincan_WPNR Momentum & Volatility Nexus 256 [v6]WPNR Nexus 256: Multi-Factor Macro Cycle Oscillator
Overview
The WPNR Nexus 256 is a high-performance hybrid oscillator designed for macro-trend analysis. It integrates a custom Weighted Percentile Nearest Rank (WPNR) algorithm with Momentum (RSI) and Volatility filters. By utilizing a 256-period lookback—often associated with a full trading year of data—it filters out market noise and identifies significant cyclical shifts in price action.
The Methodology
Unlike standard Percentile Rank indicators that treat all historical data points equally, the WPNR Nexus applies a logarithmic decay weight. This means recent price ranks have a higher impact on the current value than older ones, effectively reducing the inherent "lag" found in long-period oscillators.
Weighted Percentile (WPNR): Ranks the current close against the last 256 bars using a distance-weighted approach.
Momentum Fusion: Merges the WPNR value with RSI to ensure that price strength confirms the statistical ranking.
Volatility Awareness: Incorporates ATR-based normalization to distinguish between "trending volatility" and "range-bound noise."
Key Features
V6 Optimized: Written in the latest Pine Script™ v6 for maximum calculation efficiency and lower chart latency.
Macro Perspective: Designed specifically for 256-period analysis to capture institutional-grade market cycles.
Visual Intelligence: The indicator features a dynamic "Aura" effect. The color transitions between Vibrant Red (Overbought), Emerald Green (Oversold), and Neutral Gray based on momentum saturation.
Signal Precision: Includes built-in Triangle labels for Overbought/Oversold crossovers, helping to identify potential exhaustion points.
How to Read the Chart
The 50 Level: Acts as the "Equilibrium Line." Values sustaining above 50 indicate a dominant Bullish Macro Cycle, while values below 50 indicate a Bearish Macro Cycle.
Exhaustion Zones (80/20): When the line enters the dotted boundary areas and changes color, it signals that the current trend is reaching a statistical extreme.
Cross Signals: Look for the "Triangle" shapes. A green triangle rising from the 20 level suggests a high-probability cyclical bottom.
Settings
WPNR Period: Defaulted to 256 for macro analysis. Can be lowered for day-trading.
Weight Factor: Adjusts how aggressively the script favors recent data over older data.
Smoothing: A 5-period EMA filter to provide a clean, tradable signal line.
ADAPTIVE SCALP MASTERADAPTIVE SCALP MASTER (ASM)
Overview
ADAPTIVE SCALP MASTER (ASM) is a high-performance technical analysis tool specifically engineered for scalpers and day traders. It combines statistical volatility analysis with a unique time-frame adaptation engine, allowing the script to automatically recalibrate its sensitivity whether you are trading the 1-minute chart or the 4-hour trend.
The core logic is based on Z-Score Mean Reversion coupled with Zero-Lag Least Squares Moving Average (ZLSMA) for trend filtering, ensuring that you enter trades only when momentum and statistical overextension align.
Key Features
Timeframe Adaptation Engine: ASM automatically adjusts its Z-Score lengths, thresholds, and ATR multipliers based on your current chart. It tightens parameters for high-frequency scalping (M1-M5) and widens them for higher timeframes to filter out market noise.
Z-Score Mean Reversion: Utilizes statistical standard deviation to identify overbought and oversold conditions with precision.
Zero-Lag Trend Filtering: Features a customized ZLSMA to provide a smooth, reactive trend baseline without the lag of traditional MAs.
Smart Risk Management: Automatically calculates dynamic Stop Loss and Take Profit levels based on current ATR volatility.
Aggressive Scalping Mode: A specialized toggle for experienced traders that maximizes signal frequency by loosening standard confirmation filters.
How It Works
Normalization: The indicator calculates the price deviation (Z-Score).
Adaptive Thresholds: It checks if the price has reached a statistically significant extreme (Overbought/Oversold).
Multi-Stage Filtering:
Trend Filter: Signals must align with the ZLSMA direction (optional).
Volume Filter: Requires a surge in volume to confirm the move (optional).
Candle Confirmation: Requires price action to flip in the signal's direction before firing.
Execution: Once all conditions are met, the script plots entry shapes and dynamic risk levels.
Settings Guide
Aggressive Mode: Use this for fast-paced scalping on M1. It disables the trend and volume filters to capture every micro-reversal.
Base Sensitivity: Controls how far back the Z-Score looks. Default is 10. Lower values make the indicator more reactive.
Base Threshold: Standard is 1.5. Increase this value (e.g., to 2.0) if you want fewer, higher-probability signals.
Min Bars Between: Use this to prevent "signal clustering" during periods of high volatility.
User Interface
The Info Panel provides real-time data including:
Current Market Bias (Trend direction).
Live Z-Score value.
Current ATR-based volatility status.
Trade Signal confirmation status.
EMA + Ichimoku with LabelsSai and Deb - Levels marked with Exponential moving average of 9,20, 50 and 200 along with Ichimoku concept of kijunsen and SSB.
Forward Path (ATR Drift) + Confidence [v6]This indicator helps traders visualize where price is statistically likely to travel, how wide the uncertainty is, and how confident history has been in similar conditions — all without claiming to “predict” the market.
What this indicator does
This indicator projects a probable future price path for the next 15 / 20 / 30 candles on any chart and timeframe.
It combines:
Trend direction (EMA slope)
Volatility (ATR)
Historical behavior in similar market conditions
to show where price is likely to travel and how confident that expectation is.
What you see on the chart
Solid forward line
→ The most likely price path based on current trend momentum.
Dotted upper & lower lines
→ Expected price range using current volatility (ATR).
Think of this as the probable zone, not a target.
Confidence label
Prob Up (%) – how often price moved higher after N candles in similar conditions
Prob Down (%) – how often price moved lower
These are historical probabilities, not predictions.
How to use it (simple & practical)
1️⃣ Directional bias
If the projected path slopes up and Prob Up > 60%, the market favors longs.
If the path slopes down and Prob Down > 60%, the market favors shorts.
Near 50/50 → no edge, wait for structure or confirmation.
2️⃣ Expectation setting
Use the projection length (15 / 20 / 30 bars) to match your trade horizon.
Don’t expect price to exceed the dotted bands easily — they represent normal volatility.
3️⃣ Risk & trade management
Entries near the base path = better risk-reward.
Use the opposite band as a guide for:
Stop placement
Partial profit booking
Wide bands = reduce position size.
4️⃣ Trade filtering
Take trades only when your setup aligns with the projected direction.
Skip trades when:
Probability is low
Bands are extremely wide
Projection is flat (range-bound market)
Best use cases
Swing trading
Trade planning before entry
Position sizing & expectation control
Avoiding low-edge, random trades
What this indicator is NOT
❌ A price predictor
❌ A buy/sell signal generator
❌ A replacement for price action
It is a decision-support tool designed to visualize direction, uncertainty, and historical confidence.
Daily Pivot Points [Anatmart]Daily Pivot Points Indicator calculating the pivot points of previous day in a price chart. It shows support and resistance pivot points of today in Labels and Tables.
To calculate the standard, or floor, pivot point levels, we proceed this way:
H = maximum price of the previous day
L = minimum price of the previous day
C = close of the previous day
PP = (H + L + C) / 3
Level Formula
Resistance 3: R3 = R2 + (H - L)
Resistance 2: R2 = (PP - S1) + R1
Resistance 1: R1 = (2 * PP) - L
Support 1: S1 = (2 * PP) - H
Support 2: S2 = PP - (R1 - S1)
Support 3: S3 = S2 - (H - L)
Acrobatic Loto Predictor [Taolue Remix]
市場のカオスを、幸運の数字へ。
このインジケーターは、現在のチャートの「価格変動」「時間」「ボラティリティ」を複雑な計算式(カオス力学)に通すことで、 Loto 6 (6/43) および Loto 7 (7/37) の予想数字を算出する実験的なツールです。
単なるランダム生成(乱数)ではありません。RSIやボリンジャーバンドといったテクニカル指標の数値を「乱数の種(シード)」として使用しているため、 「相場の息遣い」がそのまま数字として出力されます。
【主な機能】
1. モード: 設定画面から「Loto 6」と「Loto 7」を切り替え可能です。
2. カオス&テクニカル・ロジック:
- カオス力学: ローレンツ・アトラクタに着想を得た非線形計算。
- テクニカル: RSI(相対力指数)とボリンジャーバンドの位置関係を係数化。
- 概念定数: 黄金比(φ)や特定の数学的定数を隠し味に配合。
3. ストップ(固定)機能: チャートが動くたびに数字は変動しますが、「ここだ!」と思った瞬間にチェックボックスで数字を 完全固定(ロック) できます。
4. リロール(再抽選)機能: 固定した数字が気に入らない場合、リロール値を変更することで、その瞬間のパラレルワールド(別の計算結果)を呼び出せます。
5. ディスコモード: 数字が変動している間は背景色がリズミカルに変化し、固定すると色が落ち着く視覚効果付き。
【使い方】
1. チャートに追加します(ビットコインや為替など、動きのある銘柄推奨)。
2. 設定画面で Loto 6 か Loto 7 を選びます。
3. チャートを眺め、相場の「波」を感じます。
4. 直感的に良いタイミングで設定画面の 「ストップ(数値を固定)」 にチェックを入れます。
5. 表示された数字をメモします。(気に入らなければ「結果のリロール」数値を変更してください)
※免責事項:
このツールはエンターテインメント目的で作成されています。当選を保証するものではありません。宝くじの購入は自己責任で楽しみましょう。
---
Transform Market Chaos into Lucky Numbers.
This indicator is an experimental tool that generates predictions for Loto 6 and Loto 7 by feeding current chart data—price action, time, and volatility—into complex chaotic algorithms.
This is not a simple random number generator. It uses technical indicators like RSI and Bollinger Bands as "seeds" for generation. Essentially, the heartbeat of the market decides your numbers.
1. Mode: Switch between "Loto 6" (pick 6 from 43) and "Loto 7" (pick 7 from 37) in the settings.
2. Chaos & Technical Logic:
- Chaos Dynamics: Non-linear calculations inspired by the Lorentz Attractor.
- Technical Analysis: Weighing factors based on RSI and Bollinger Band positioning.
- Conceptual Constants: Incorporates the Golden Ratio (φ) and other mathematical constants.
3. Freeze/Lock Function: Numbers fluctuate with every tick. Use the "Stop" checkbox to lock the numbers at the exact moment you feel the market energy align.
4. Reroll System: If you lock the numbers but don't like the result, change the "Reroll" value to access a parallel timeline (alternate calculation result) for the same candle.
5. Disco Visuals: Background colors dance rhythmically while spinning and settle down when locked.
1. Add to chart (highly volatile assets like BTC or FX recommended).
2. Select Loto 6 or Loto 7 in the settings.
3. Watch the chart and feel the "wave" of the market.
4. Check the "Stop (Lock Numbers)" box in settings when your intuition strikes.
5. Note down the numbers. (Use the "Reroll" input if you want to reshape your destiny).
This tool is for entertainment purposes only. It does not guarantee any lottery winnings. Please play responsibly.
Banknifty By PaisaPaniThis indicator displays a DEMO performance snapshot
to show how the PaisaPani approach behaves on BankNifty.
It is a trading system.
• Separate indicator designed specifically for BankNifty
• Intended for the mentioned timeframe only
• Focused on execution clarity, not predictions
🔒 Full access is limited.
⚠ Disclaimer:
For educational and demonstration purposes only.
Bob's Whale Hunter - V7 (Jorge's Algo)Trade like a whale, not the bait.
The Whale Hunter V7 is a high-performance toolkit specifically engineered for traders following Smart Money Concepts (SMC) and Institutional Price Action. This indicator automates the identification of high-probability zones based on the AMD (Accumulation, Manipulation, Distribution) cycle.
🚀 Key Features:
Institutional Liquidity Sweeps: Automatically detects liquidity grabs at key highs and lows. These are the exact spots where institutional "whales" enter the market by triggering retail stop losses.
Dynamic Fair Value Gaps (FVG): Highlights market imbalances that act as price magnets. This allows you to time your entries during the "rebalance" with surgical precision.
Multi-Timeframe Dashboard (HTF Matrix): A real-time panel showing the Macro bias (4H) versus the Entry trend (15m). Stay aligned with the higher-timeframe order flow at all times.
Elite Market Structure: An institutional-grade trend filter that shifts color based on market dominance, helping you distinguish between a deep retracement and a true trend reversal.
🛠 How to Trade it (The Institutional Checklist):
Macro Alignment: Check the Dashboard. If 4H is green, look for buy setups only. Never trade against the "Big Money" flow.
Identify the Sweep: Wait for the triangle signal (Sweep). This confirms that liquidity has been cleared and the "Manipulation Phase" is likely complete.
The Trigger (FVG): Once a Break of Structure (ChoCH) occurs after the sweep, look for entries within the highlighted FVG boxes that align with your OTE (Optimal Trade Entry) Fibonacci levels.
Targeting: Aim for the opposing liquidity pools or the next institutional level identified by the script.
"Trading is a game of probabilities. Follow the footprints left by the giants."
Weekly Tightness Near EMA//@version=6
indicator("Weekly Tightness Near EMA", overlay=true)
// ===========================
// INPUT PARAMETERS
// ===========================
tightness_pct = input.float(3.0, "Tightness % Range", minval=0.1, maxval=10.0)
ema_proximity_pct = input.float(5.0, "EMA Proximity %", minval=0.5, maxval=15.0)
small_candle_pct = input.float(5.0, "Small Candle % (body)", minval=0.5, maxval=10.0)
show_ema10 = input.bool(true, "Show 10 Week EMA")
show_ema20 = input.bool(true, "Show 20 Week EMA")
show_signals = input.bool(true, "Show Tightness Signals")
// ===========================
// GET WEEKLY DATA
// ===========================
weekly_close = request.security(syminfo.tickerid, "W", close, barmerge.gaps_off, barmerge.lookahead_off)
weekly_open = request.security(syminfo.tickerid, "W", open, barmerge.gaps_off, barmerge.lookahead_off)
weekly_high = request.security(syminfo.tickerid, "W", high, barmerge.gaps_off, barmerge.lookahead_off)
weekly_low = request.security(syminfo.tickerid, "W", low, barmerge.gaps_off, barmerge.lookahead_off)
weekly_close_1 = request.security(syminfo.tickerid, "W", close , barmerge.gaps_off, barmerge.lookahead_off)
weekly_open_1 = request.security(syminfo.tickerid, "W", open , barmerge.gaps_off, barmerge.lookahead_off)
weekly_high_1 = request.security(syminfo.tickerid, "W", high , barmerge.gaps_off, barmerge.lookahead_off)
weekly_low_1 = request.security(syminfo.tickerid, "W", low , barmerge.gaps_off, barmerge.lookahead_off)
weekly_close_2 = request.security(syminfo.tickerid, "W", close , barmerge.gaps_off, barmerge.lookahead_off)
weekly_open_2 = request.security(syminfo.tickerid, "W", open , barmerge.gaps_off, barmerge.lookahead_off)
weekly_high_2 = request.security(syminfo.tickerid, "W", high , barmerge.gaps_off, barmerge.lookahead_off)
weekly_low_2 = request.security(syminfo.tickerid, "W", low , barmerge.gaps_off, barmerge.lookahead_off)
// Weekly EMAs
weekly_ema10 = request.security(syminfo.tickerid, "W", ta.ema(close, 10), barmerge.gaps_off, barmerge.lookahead_off)
weekly_ema20 = request.security(syminfo.tickerid, "W", ta.ema(close, 20), barmerge.gaps_off, barmerge.lookahead_off)
// ===========================
// CALCULATE CANDLE SIZE
// ===========================
// Calculate body size (close - open) as percentage of price
candle_body_0 = math.abs(weekly_close - weekly_open)
candle_body_1 = math.abs(weekly_close_1 - weekly_open_1)
candle_body_2 = math.abs(weekly_close_2 - weekly_open_2)
candle_body_pct_0 = (candle_body_0 / weekly_close) * 100
candle_body_pct_1 = (candle_body_1 / weekly_close_1) * 100
candle_body_pct_2 = (candle_body_2 / weekly_close_2) * 100
// Calculate full range (high - low) as percentage
candle_range_0 = weekly_high - weekly_low
candle_range_1 = weekly_high_1 - weekly_low_1
candle_range_2 = weekly_high_2 - weekly_low_2
candle_range_pct_0 = (candle_range_0 / weekly_close) * 100
candle_range_pct_1 = (candle_range_1 / weekly_close_1) * 100
candle_range_pct_2 = (candle_range_2 / weekly_close_2) * 100
// Check if all 3 candles are small
small_candle_0 = candle_body_pct_0 <= small_candle_pct
small_candle_1 = candle_body_pct_1 <= small_candle_pct
small_candle_2 = candle_body_pct_2 <= small_candle_pct
all_candles_small = small_candle_0 and small_candle_1 and small_candle_2
// Average candle body size
avg_candle_body = (candle_body_pct_0 + candle_body_pct_1 + candle_body_pct_2) / 3
avg_candle_range = (candle_range_pct_0 + candle_range_pct_1 + candle_range_pct_2) / 3
// ===========================
// CALCULATE TIGHTNESS
// ===========================
// Find highest and lowest of last 3 weekly closes
highest_close = math.max(weekly_close, weekly_close_1, weekly_close_2)
lowest_close = math.min(weekly_close, weekly_close_1, weekly_close_2)
// Calculate range percentage
close_range_pct = ((highest_close - lowest_close) / lowest_close) * 100
// Check if within tightness range
is_tight = close_range_pct <= tightness_pct
// ===========================
// CHECK PROXIMITY TO EMAs
// ===========================
// Distance from EMAs
dist_from_ema10_pct = math.abs((weekly_close - weekly_ema10) / weekly_ema10) * 100
dist_from_ema20_pct = math.abs((weekly_close - weekly_ema20) / weekly_ema20) * 100
// Near EMA conditions
near_ema10 = dist_from_ema10_pct <= ema_proximity_pct
near_ema20 = dist_from_ema20_pct <= ema_proximity_pct
near_any_ema = near_ema10 or near_ema20
// ===========================
// COMBINED SIGNAL (with small candles filter)
// ===========================
tightness_signal = is_tight and near_any_ema and all_candles_small
// ===========================
// PLOT EMAs
// ===========================
plot(show_ema10 ? weekly_ema10 : na, "10 Week EMA", color=color.new(color.blue, 0), linewidth=2)
plot(show_ema20 ? weekly_ema20 : na, "20 Week EMA", color=color.new(color.orange, 0), linewidth=2)
// ===========================
// PLOT SIGNALS
// ===========================
// Background color when tight and near EMA
bgcolor(show_signals and tightness_signal ? color.new(color.green, 90) : na, title="Tightness Signal")
// Plot signal markers
plotshape(show_signals and tightness_signal and not tightness_signal ,
title="Tightness Start",
location=location.belowbar,
color=color.new(color.green, 0),
style=shape.triangleup,
size=size.small,
text="TIGHT")
// ===========================
// DISPLAY TABLE
// ===========================
var table info_table = table.new(position.top_right, 2, 9,
border_width=1,
border_color=color.gray,
frame_width=1,
frame_color=color.gray)
if barstate.islast
// Header
table.cell(info_table, 0, 0, "Weekly Analysis", bgcolor=color.new(color.gray, 70), text_color=color.white, text_size=size.normal)
table.cell(info_table, 1, 0, "Status", bgcolor=color.new(color.gray, 70), text_color=color.white, text_size=size.normal)
// Average candle body size
candle_color = all_candles_small ? color.new(color.green, 85) : color.new(color.red, 85)
table.cell(info_table, 0, 1, "Avg Candle Body", bgcolor=candle_color, text_color=color.white, text_halign=text.align_left)
table.cell(info_table, 1, 1, str.tostring(avg_candle_body, "#.##") + "%", bgcolor=candle_color, text_color=color.white)
// Small candle threshold
table.cell(info_table, 0, 2, "Small Candle <", bgcolor=color.new(color.gray, 90), text_color=color.white, text_halign=text.align_left)
table.cell(info_table, 1, 2, str.tostring(small_candle_pct, "#.#") + "%", bgcolor=color.new(color.gray, 90), text_color=color.white)
// 3 Week Close Tightness
tight_color = is_tight ? color.new(color.green, 85) : color.new(color.red, 85)
table.cell(info_table, 0, 3, "3W Close Range", bgcolor=tight_color, text_color=color.white, text_halign=text.align_left)
table.cell(info_table, 1, 3, str.tostring(close_range_pct, "#.##") + "%", bgcolor=tight_color, text_color=color.white)
// Tightness threshold
table.cell(info_table, 0, 4, "Threshold", bgcolor=color.new(color.gray, 90), text_color=color.white, text_halign=text.align_left)
table.cell(info_table, 1, 4, "<" + str.tostring(tightness_pct, "#.#") + "%", bgcolor=color.new(color.gray, 90), text_color=color.white)
// Distance from 10W EMA
ema10_color = near_ema10 ? color.new(color.blue, 85) : color.new(color.gray, 85)
table.cell(info_table, 0, 5, "From 10W EMA", bgcolor=ema10_color, text_color=color.white, text_halign=text.align_left)
table.cell(info_table, 1, 5, str.tostring(dist_from_ema10_pct, "#.##") + "%", bgcolor=ema10_color, text_color=color.white)
// Distance from 20W EMA
ema20_color = near_ema20 ? color.new(color.orange, 85) : color.new(color.gray, 85)
table.cell(info_table, 0, 6, "From 20W EMA", bgcolor=ema20_color, text_color=color.white, text_halign=text.align_left)
table.cell(info_table, 1, 6, str.tostring(dist_from_ema20_pct, "#.##") + "%", bgcolor=ema20_color, text_color=color.white)
// Near EMA status
near_ema_color = near_any_ema ? color.new(color.green, 85) : color.new(color.red, 85)
near_ema_text = near_any_ema ? "✓ NEAR" : "✗ Far"
table.cell(info_table, 0, 7, "Near EMA", bgcolor=near_ema_color, text_color=color.white, text_halign=text.align_left)
table.cell(info_table, 1, 7, near_ema_text, bgcolor=near_ema_color, text_color=color.white)
// Combined signal
signal_color = tightness_signal ? color.new(color.lime, 70) : color.new(color.gray, 85)
signal_text = tightness_signal ? "🎯 SETUP!" : "No Setup"
table.cell(info_table, 0, 8, "SIGNAL", bgcolor=signal_color, text_color=color.white, text_halign=text.align_left, text_size=size.large)
table.cell(info_table, 1, 8, signal_text, bgcolor=signal_color, text_color=color.white, text_size=size.large)
// ===========================
// ALERTS
// ===========================
alertcondition(tightness_signal and not tightness_signal ,
title="Tightness Setup Alert",
message="Weekly setup detected: Small candles, tight closes, near EMA!")






















