Sakalau02 (10 Sessions)Market Sessions – 10 Customizable Sessions
This indicator plots up to 10 fully customizable market sessions directly on the chart.
Each session can be individually configured with its own time range, color, and label, and is displayed as a dynamic box that automatically tracks the session high and low.
Features
Up to 10 fully customizable trading sessions
Individual session time, color, and name customization
Automatic session high / low tracking
UTC-based session logic with optional weekend filtering
Clean and lightweight visual design for intraday analysis
Well suited for ICT / Smart Money Concepts (SMC) trading
Designed for flexibility and clarity, this indicator allows traders to adapt session analysis to their own trading style while keeping the chart clean and easy to read.
อินดิเคเตอร์และกลยุทธ์
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.
Adjustable Average Dollar Volume ( Mashrab)Institutional Shadow Hunter. It’s not just a volume bars; it’s a X-ray for the "Big Money" flow.
The Logic: Trading the Vacuum
Standard volume tells you how many shares moved. This indicator tells you how much cash was committed. When the market goes quiet, the Shadow appears. When the "Smart Money" strikes, the Shadow vanishes.
1. The Stealth Phase (The Shadow)
When you see shading below the Average Line, the stock is in a liquidity vacuum.
The Signature: Small, shaded bars indicate "Quiet Accumulation."
The Elite Move: Look for the shadow to get as thin as possible—this is the Volatility Contraction (VCP) right before a massive expansion.
2. The Strike (The Breakout)
The moment the shading disappears, the stealth phase is over.
The Signature: A solid, bright bar towering above the Average Line.
The Elite Move: If this "unshaded" bar happens as the price breaks a pivot point, you have a 99% conviction "Home Run" entry.
3. The Bull Test (Institutional Defense)
Use the shadow to distinguish between a "crash" and a "rest."
The Logic: If the price pulls back but the bars stay shaded and low, no big funds are selling. It’s just a "shakeout" of weak hands before the next leg up.
Fixed Range Line + EMA Cross Signals with Targetsfixed range lines generate buy sell signal and also we can set targets
Big Tech AI vs AI Semi Market Cap
Recently, Big Tech stocks have faced downward pressure due to growing concerns over whether they can sustain massive AI CapEx and ultimately achieve monetization. In contrast, AI-related semiconductor stocks—the direct recipients of these investment funds—are rebounding and gaining momentum.
Some market participants compare this flow to the Dot-com bubble era. I created this script to track in real-time whether a true "Market Cap Flipping" (reversal) is occurring between the AI Service providers (Big Tech) and the AI Infrastructure providers (Semiconductors).
This indicator aggregates and compares the total Market Capitalization (Price × Shares Outstanding) of two distinct groups:
🟦 Big Tech (AI Solutions & Services): The companies spending heavily on AI infrastructure.
🟧 AI Semiconductors (Hardware & Infra): The companies benefiting from Big Tech's CapEx.
Real-time Comparison: Visualizes the aggregate value of both sectors on a single chart to spot divergence or convergence.
Cap Flipping Watch: Easily identify if the "Hardware" sector's valuation overtakes the "Solution" sector.
Percentage Ratio: Displays a label showing the Semiconductor sector's size relative to Big Tech (e.g., "Semi is 60% of Tech").
Customizable Tickers: You can toggle individual companies On/Off in the settings to adjust your basket.
Big Tech: MSFT, GOOGL, AMZN, META, AAPL, TSLA, PLTR, ORCL, ADBE
AI Semi: NVDA, TSM, AVGO, AMD, MU, ARM, ASML, ANET, MRVL
If the Orange Line (Semi) rises while the Blue Line (Tech) falls/stagnates, it indicates the market is favoring "Infrastructure Builders" over "Service Providers."
Use this to gauge the maturity of the AI investment cycle.
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
ATR% Z-Score Z-Score of ATR% measures price volatility intensity relative to its historical average to identify extreme panic.
stelaraX - ALMAstelaraX – ALMA
stelaraX – ALMA is a trend-following moving average designed to reduce lag while maintaining smooth price representation. It uses a Gaussian-weighted distribution to emphasize recent price data without the excessive noise often seen in faster averages.
This indicator is part of the stelaraX ecosystem, focused on clean technical analysis and AI-supported chart evaluation
stelarax.com
Core logic
The Arnaud Legoux Moving Average (ALMA) applies a Gaussian weighting scheme across a user-defined lookback period. Unlike traditional moving averages, it shifts the weighting curve using an offset parameter, allowing fine control over responsiveness and smoothness.
Key principles:
* the lookback period defines the smoothing horizon
* the offset controls the center of the Gaussian curve and thus the balance between lag and responsiveness
* the sigma parameter adjusts the width of the Gaussian distribution
* rising ALMA values indicate bullish trend momentum
* falling ALMA values indicate bearish trend momentum
The ALMA reacts faster to price changes than classic moving averages while remaining visually smooth and stable.
Visualization
The script plots:
* the ALMA line directly on the price chart
* dynamic color changes based on ALMA slope direction
* green coloring for rising ALMA values
* red coloring for falling ALMA values
This color-coded display provides immediate visual feedback on short-term trend direction and momentum shifts.
Use case
This indicator is intended for:
* identifying trend direction and trend changes
* acting as a dynamic support and resistance guide
* filtering entries in trend-following strategies
* confirming momentum in breakout or pullback setups
* replacing traditional moving averages with reduced lag
It integrates well with price action, structure-based systems, and AI-assisted chart analysis.
Disclaimer
This indicator is provided for educational and technical analysis purposes only and does not constitute financial advice or trading recommendations. All trading decisions and risk management remain the responsibility of the user.
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)
stelaraX - Fair Value GapstelaraX – Fair Value Gap
stelaraX – Fair Value Gap is a technical analysis indicator designed to detect, visualize, and manage Fair Value Gaps (FVGs) using a strict three-candle imbalance model. The script identifies bullish and bearish gaps, draws them as zones on the chart, and tracks their mitigation status over time.
For advanced AI-based chart analysis and automated structure interpretation, visit stelarax.com
Core logic
The indicator detects Fair Value Gaps using a three-bar condition:
* bullish FVG when the current low is above the high from two bars ago
* bearish FVG when the current high is below the low from two bars ago
Detected gaps are filtered using minimum size requirements:
* minimum size in ticks
* minimum size as a percentage of price
Each FVG stores its top and bottom boundaries, its midpoint level (Consequent Encroachment), the creation bar, and its current state.
Consequent Encroachment and mitigation
The script can optionally plot the Consequent Encroachment (CE) level, defined as the midpoint of the gap.
Mitigation tracking is supported and can be defined as:
* Touch
* 50 percent retracement to the CE level
* Full fill of the gap
When mitigation occurs, the FVG can:
* remain visible in a mitigated state
* be deleted automatically
* stop extending and close at the mitigation bar
Mitigation styling uses a dedicated color scheme to clearly separate active and mitigated gaps.
Visualization
FVGs are drawn directly on the chart as colored zones:
* bullish FVGs are displayed in green tones
* bearish FVGs are displayed in red tones
Optional features include:
* CE level line with configurable line style
* FVG labels
* automatic extension of active gaps
* configurable maximum age and maximum number of displayed gaps
All colors and display settings are fully customizable.
Dashboard
An optional on-chart dashboard provides a real-time overview of:
* total bullish and bearish FVGs
* mitigated bullish and bearish FVGs
* active (unmitigated) FVGs
* mitigation percentages
Dashboard position and text size are configurable.
Alerts
Alert conditions are available for:
* newly detected bullish FVGs
* newly detected bearish FVGs
Additional real-time alerts can be triggered when an FVG is mitigated.
Use case
This indicator is intended for:
* imbalance and fair value gap mapping
* identifying potential reaction zones and retracement areas
* tracking gap mitigation behavior over time
* multi-timeframe confluence analysis
For a fully automated AI-driven chart analysis solution, additional tools and insights are available at stelarax.com
Disclaimer
This indicator is provided for educational and technical analysis purposes only and does not constitute financial advice or trading recommendations. All trading decisions and risk management remain the responsibility of the user.
Weekly Cycles [SolQuant]The Weekly Cycles indicator maps recurring weekly behavioral phases onto the chart using colored daily boxes and labels. It divides each week into distinct phases based on observed market patterns, providing structural context for intraweek trading decisions.
█ USAGE
Weekly Phases
Each day of the week is assigned a behavioral phase:
• Sunday — Dead Gap Zone: Low-liquidity period where gaps from the weekend close can create traps. Price action during this phase is often unreliable for directional bias.
• Monday — False Move: The early-week move that frequently reverses. Monday often establishes a range extreme that gets swept later in the week.
• Tuesday — Consolidation: A transition day where the market digests Monday's move and begins building the structure for the week's main directional move.
• Wednesday/Thursday — Midweek Reversal: The highest-probability window for the week's primary directional move. This phase often sees the week's true trend establish itself.
• Friday — Model Completion: The closing phase where weekly targets are either achieved or the move stalls. Profit-taking and position squaring are common.
• Saturday — Weekend Trap: Low-liquidity continuation of Friday's action that can create misleading signals for the following week.
Visual Display
Each phase is represented by a colored box spanning the day's price range. Labels at the top of each box display the phase name for quick reference. The boxes update in real time as each day's high and low develop.
█ DETAILS
The indicator uses the day of the week (dayofweek) to assign phases. Box boundaries are defined by each day's opening time through the next day's opening time, with the price range tracking the high and low of bars within that window.
Historical boxes are maintained up to a configurable maximum count. Boxes are created at the start of each new day and their height is updated with each new bar as the day's range expands.
█ SETTINGS
• Show Phase Labels: Toggle the text labels above each daily box.
• Phase Colors: Customizable colors for each day/phase.
• Max Boxes: Controls how many historical weekly cycle boxes are displayed.
Weekly cycle phases are based on observed market patterns and do not guarantee that price will follow the described behavior in any given week. Market conditions vary and phases should be used as context, not as standalone signals. This indicator does not constitute financial advice.
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.
Trend Pro + No Wick Alert[tommy]no wick ema confirmation for notifications just something simple if you want to trade imbalence
AI Heavy Buyer Scanner V6 - 100min to Close100 minutes before the end of daily trading, scan US-traded stocks and ETFs with a market cap > $50B and ETFs (including 3x leveraged). Locate Japanese candlesticks on an intraday chart where the following conditions are met: 1. The price has increased by at least 1% from the daily opening price. 2. The candlestick has a lower shadow that is at least 1% longer than the price. 3. The daily trading volume up to this time is 10% higher than the daily average of the last 100 days. Send an instant alert
PDH(RTH)+PMH / PDL(RTH)+PML First Break + 3m EMA Retest + TPshows pre market levels, previous day levels, includes the 3min 9ema for the retest and a take profit indicator.
Vertical Event Lines - BTC Halving & Custom DatesThis indicator plots vertical lines and labels for Bitcoin halving dates and any custom events you define directly on the price chart.
It is designed as a clean, lightweight event-timeline overlay so you can instantly see where key dates occur relative to price action.
Main features
Built-in Bitcoin halving dates (2012, 2016, 2020, 2024), plus 8 additional custom event slots with freely configurable date/time, name and color.
Vertical lines are positioned using xloc.bar_time , ensuring each event is anchored to the exact timestamp in the chart’s timeframe and timezone.
Past and current events:
A label is created once, on the first bar that crosses the event time, and placed near the bar’s high for consistent readability across symbols and timeframes.
Future events:
A separate label is shown at the bottom of the chart, making future dates clearly visible even to the right of the last bar. These labels update only on the most recent bar to keep the script efficient.
Flexible styling:
Global controls for line width, line style and label size, with per-event color selection and optional per-event overrides of global width and style.
How to use
Add the script to any chart (BTC or other symbols). It works on all timeframes.
Use the Global settings to configure default line style, line width and label appearance (size, orientation, text color).
In each Event X section, enable the event and set:
Date/time in YYYY-MM-DD HH:MM format
Event name
Color
Optional custom width/style
When scrolling through time:
Events left of the last bar show a vertical line and a one-time label at the crossing bar.
Events right of the last bar show a vertical line and a bottom label that remains visible in the future.
This script is intended as a visual reference tool only .
It does not generate trading signals, alerts or backtests.
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.
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!")






















