Gold Buy/Sell Signals with Engulfing & S&D ZonesTrade base on the Fast & Slow Moving Average. When the Fast MA line is below the candle, it is an uptrend to BUY. if Fast MA line is above the candle, it's time to SELL.
Wskaźniki i strategie
NIFTY Intraday Strategy - 50 Points📊 NIFTY Intraday Strategy – Description
This Pine Script defines an intraday trading strategy targeting +50 points per trade on NIFTY, using a blend of trend-following and momentum indicators. Here's a breakdown:
🔍 Core Components
1. Indicators Used
VWAP: Volume-Weighted Average Price – institutional anchor for fair value.
Supertrend: Trend direction indicator (parameters: 10, 3.0).
RSI (14): Measures strength/momentum.
ATR (14): Determines volatility for stop-loss calculation.
📈 Entry Conditions
✅ Buy Entry
Price is above VWAP
Supertrend direction is bullish
RSI is above 50
Time is between 9:15 AM and 3:15 PM (India time)
❌ Sell Entry
Price is below VWAP
Supertrend direction is bearish
RSI is below 50
Time is within same market hours
🎯 Exit Logic
Target: 50 points from entry
Stop Loss: 1 × ATR from entry
If neither is hit by 3:15 PM, the position is held (though you may add exit logic at that time).
📌 Visualization
VWAP: orange line
Supertrend: green (uptrend), red (downtrend)
Buy Signal: green triangle below bar
Sell Signal: red triangle above bar
This strategy is ideal for intraday scalping or directional momentum trading in NIFTY Futures or Options.
a. Add end-of-day exit at 3:15 PM to fully close all trades
b. Add a risk-reward ratio input to dynamically adjust target vs stop-loss
🔥 Volatility Squeeze Breakout Strategy (TP/SL in Points)This strategy is designed to catch explosive breakout moves from low-volatility consolidations using a "volatility squeeze" + breakout + momentum" approach. It identifies high-probability buy opportunities when the market is in a tight range and preparing for expansion.
✅ Entry Condition:
- Previous candle is in a squeeze
- Current candle breaks above channel high
- Momentum is positive (ROC)
🎯 Exit Conditions:
- Take Profit in fixed points above entry price
- Stop Loss in fixed points below entry price
🧰 Inputs:
- ATR Length for volatility
- Channel Length for breakout levels
- ROC Length for momentum
- Squeeze threshold (ATR/close)
- TP/SL in absolute price points
📊 Plots:
- Buy signals shown as green triangles
- Channel high/low plotted
- TP/SL levels shown as live lines when in position
Suitable for intraday breakout scalping or directional trades
when price expands from compression zones.
SMEMA Trend CoreSMEMA Trend Core is a multi-timeframe trend analysis tool designed to provide a clean, adaptive and structured view of the market’s directional bias. It can be used in short term, swing or long term contexts. The internal calculation adjusts automatically based on the selected trading style, while always combining data from six timeframes.
At its core, the indicator uses a SMEMA, which is a Simple Moving Average applied to an EMA. This combination improves smoothness without losing reactivity. The SMEMA is calculated separately on 1H, 4H, 1D, 3D, 1W and 1M timeframes. These six values are then combined using dynamic weights that depend on the trading mode:
Short Term mode gives more influence to 1H and 4H
Swing Trading mode gives more influence to 1D, 3D and 1W
Long Term mode gives more influence to 1W and 1M
However, all six timeframes are always included in the final result. This avoids the tunnel vision of relying on a single resolution and ensures that the indicator captures both local and structural movements.
The result is a synthetic trend line, called Global SMEMA, that adapts to market conditions and offers a realistic view of the ongoing trend. To enhance the reading, the indicator calculates a Trend Score. This score reflects the position of price relative to the Global SMEMA, scaled by a long-term ATR, and adjusted by the slope of the trend line. A hyperbolic tangent function is used to normalize values and reduce distortion from outliers.
The final score is capped between -10 and +10, and used to define the trend state:
Green when the trend is bullish (score > +1.5)
Red when the trend is bearish (score < -1.5)
Brown when the trend is neutral (score between -1.5 and +1.5)
Optional Deviation Bands can be displayed at ±1, ±2 and ±3 ATR distances around the central line. These dynamic zones help identify extended price movements or potential support and resistance areas, depending on the current trend bias.
Main features:
A single, stable trend line based on six timeframes
Automatic rebalancing depending on trading mode
Quantified score integrating distance and slope
No overreaction to short-term noise
Deviation zones for advanced market context
No repainting, no lookahead, 100% real-time
SMEMA Trend Core is not a signal tool. It is a directional framework that helps you stay aligned with the real structure of the market. Use it to confirm setups, filter trades or simply understand where the market stands in its trend cycle.
David_FairPriceCandlestick_calculatedDescription:
This indicator displays the "Typical Price" for each candle as a visual marker (cross) directly on the chart. The Typical Price is calculated as the average of the High, Low, and Close values of each bar:
(High + Low + Close) / 3
The marker provides a quick visual reference to the fair or average price level within every single candle.
Unlike a Point of Control (POC) or volume-based indicators, this script works purely with price data and is independent of volume or order flow.
Use cases:
Identify where most trading activity may have been concentrated within the candle (for price-based strategies)
Support as a reference line for mean-reversion or fair value concepts
Works on all timeframes and instruments
Customization:
You can easily change the marker style (cross, dot, triangle, etc.) and color within the script.
JonnyBtc Daily Pullback Strategy (Volume + ADX)📈 JonnyBtc Daily Optimized Pullback Strategy (With Volume + ADX)
This strategy is designed for Bitcoin swing trading on the daily timeframe and uses a combination of price action, moving averages, volume, RSI, and ADX strength filtering to time high-probability entries during strong trending conditions.
🔍 Strategy Logic:
Trend Filter: Requires price to be aligned with both 50 EMA and 200 EMA.
Pullback Entry: Looks for a pullback to a fast EMA (default 21) and a crossover signal back above it.
RSI Confirmation: RSI must be above a minimum threshold for long entries (default 55), or below for short entries.
Volume Filter: Entry is confirmed only when volume is above a 20-day average.
ADX Filter: Only enters trades when ADX is above a strength threshold (default 20), filtering out sideways markets.
Trailing Stop (optional): Uses ATR-based trailing stop-loss and take-profit system, fully configurable.
⚙️ Default Settings:
Timeframe: Daily
Trade Direction: Long-only by default (can be toggled)
Trailing Stop: Enabled (can disable)
Session Filter: Off by default for daily timeframe
📊 Best Use:
Optimized for Bitcoin (BTCUSD) on the 1D chart
Can be adapted to other trending assets with proper tuning
Works best in strong trending markets — not ideal for choppy/ranging conditions
🛠️ Customizable Parameters:
EMA lengths (Fast, Mid, Long)
RSI and ADX thresholds
ATR-based TP/SL multipliers
Trailing stop toggle
Volume confirmation toggle
Time/session filter
⚠️ Disclaimer:
This script is for educational and research purposes only. Past performance does not guarantee future results. Always backtest and verify before trading with real funds.
📈 Pro EMA/SMA Buy Sell (Clean & Glowing) 📈 Pro EMA/SMA Buy Sell
This indicator plots a crossover-based buy/sell signal system using:
- A fast Exponential Moving Average (EMA)
- A slower Simple Moving Average (SMA)
🔹 BUY Signal: When EMA crosses above SMA
🔹 SELL Signal: When EMA crosses below SMA
Features:
✅ Clean glowing lines for EMA and SMA
✅ Transparent glowing BUY (green) and SELL (red) labels
✅ Real-time alert conditions for automated strategy triggers
Ideal for:
- Intraday and Swing Traders
- Beginners looking for trend-based signals
- Chart setups requiring minimal noise but powerful visuals
quanstocThe quanstoc indicator is designed to detect rare and potentially high-probability reversal or trend initiation signals using Stochastic RSI. It identifies a double cross event: two consecutive crosses between %K and %D lines (on back-to-back candles), following a quiet period of at least three candles without any crossover. The signal is marked clearly on the chart and can trigger custom alerts. Supports all timeframes.
EMA-MACD-Stoch by PashaThis indicator combines three popular technical analysis tools — EMA, MACD, and Stochastic — to generate strong and filtered buy/sell signals. It incorporates its own strategic logic and provides trade suggestions only when multiple confirmations align.
Developed by Mehmet (alias: Pasha), this indicator is designed for users seeking short-term entries in markets like BIST. It performs most effectively on the 30-minute timeframe, but can also be used across different timeframes.
Lucy – 3-Bar Reversal with EMA50 Trend Filter📛 Lucy – 3-Bar Reversal with EMA50 Trend Filter
Purpose:
To detect and highlight bullish and bearish 3-bar reversal patterns on the chart, but only when they align with the dominant trend, defined by the EMA 50.
✅ How It Works
🟢 Bullish 3-Bar Reversal (Buy Setup):
Bar 1 is bearish (close < open)
Bar 2 makes a lower low than Bar 1
Bar 3 is bullish (close > open) and closes above Bar 2’s high
Price must be above EMA 50 (trend filter)
✅ Result: Shows a green triangle below the bar
🔴 Bearish 3-Bar Reversal (Sell Setup):
Bar 1 is bullish (close > open)
Bar 2 makes a higher high than Bar 1
Bar 3 is bearish (close < open) and closes below Bar 2’s low
Price must be below EMA 50
✅ Result: Shows a red triangle above the bar
📊 What It Plots:
🔼 Green triangle below bullish signal bar
🔽 Red triangle above bearish signal bar
🟠 Orange line = EMA50 (trend filter)
🔔 Built-in Alerts:
You’ll get an alert if:
A bullish reversal pattern forms above EMA50
A bearish reversal pattern forms below EMA50
🧠 Use Cases:
Great for trend-following traders who want clean, price-action entries
Works well on intraday (15m/1h) or swing (4h/daily) timeframes
Can be used for manual entries, or converted to strategy for automation
quanstocThe quanstoc indicator is designed to detect rare and potentially high-probability reversal or trend initiation signals using Stochastic RSI. It identifies a double cross event: two consecutive crosses between %K and %D lines (on back-to-back candles), following a quiet period of at least three candles without any crossover. The signal is marked clearly on the chart and can trigger custom alerts. Supports all timeframes.
quanstocThe quanstoc2 indicator is designed to detect rare and potentially high-probability reversal or trend initiation signals using Stochastic RSI. It identifies a double cross event: two consecutive crosses between %K and %D lines (on back-to-back candles), following a quiet period of at least three candles without any crossover. The signal is marked clearly on the chart and can trigger custom alerts. Supports all timeframes.
quanstocThe quanstoc indicator is designed to detect rare and potentially high-probability reversal or trend initiation signals using Stochastic RSI. It identifies a double cross event: two consecutive crosses between %K and %D lines (on back-to-back candles), following a quiet period of at least three candles without any crossover. The signal is marked clearly on the chart and can trigger custom alerts. Supports all timeframes.
RSI + WaveTrend Sinyal Alarmı//@version=5
indicator("RSI + WaveTrend Sinyal Alarmı", overlay=true)
// === RSI Divergence ===
len = input.int(9, "RSI Period")
src = input.source(close, "RSI Source")
lbR = input.int(3, "Pivot Lookback Right")
lbL = input.int(1, "Pivot Lookback Left")
osc = ta.rsi(src, len)
plFound = not na(ta.pivotlow(osc, lbL, lbR))
phFound = not na(ta.pivothigh(osc, lbL, lbR))
oscHL = osc > ta.valuewhen(plFound, osc , 1)
priceLL = low < ta.valuewhen(plFound, low , 1)
bullCond = priceLL and oscHL and plFound
oscLL = osc < ta.valuewhen(plFound, osc , 1)
priceHL = low > ta.valuewhen(plFound, low , 1)
hiddenBullCond = priceHL and oscLL and plFound
oscLH = osc < ta.valuewhen(phFound, osc , 1)
priceHH = high > ta.valuewhen(phFound, high , 1)
bearCond = priceHH and oscLH and phFound
oscHH = osc > ta.valuewhen(phFound, osc , 1)
priceLH = high < ta.valuewhen(phFound, high , 1)
hiddenBearCond = priceLH and oscHH and phFound
rsiBuySignal = bullCond or hiddenBullCond
rsiSellSignal = bearCond or hiddenBearCond
// === WaveTrend ===
n1 = input.int(10, "WT Channel Length")
n2 = input.int(21, "WT Average Length")
ap = hlc3
esa = ta.ema(ap, n1)
d = ta.ema(math.abs(ap - esa), n1)
ci = (ap - esa) / (0.015 * d)
tci = ta.ema(ci, n2)
wt1 = tci
wt2 = ta.sma(wt1, 4)
wtCrossUp = ta.crossover(wt1, wt2)
wtCrossDown = ta.crossunder(wt1, wt2)
// === Ortak Sinyal Şartı ===
buySignal = wtCrossUp and rsiBuySignal
sellSignal = wtCrossDown and rsiSellSignal
plotshape(buySignal, style=shape.labelup, color=color.lime, text="AL", title="AL Sinyali")
plotshape(sellSignal, style=shape.labeldown, color=color.red, text="SAT", title="SAT Sinyali")
alertcondition(buySignal, title="AL Sinyali", message="RSI Divergence + WaveTrend AL sinyali oluştu!")
alertcondition(sellSignal, title="SAT Sinyali", message="RSI Divergence + WaveTrend SAT sinyali oluştu!")
Simplified STH-MVRVSTH-MVRV for MSTR
STH-MVRV compares the Market Value (current price × circulating supply) to the Realized Value (the total cost basis of coins held by short-term holders,
BigCandleLibrary "BigCandle"
init()
method bigGreenCandleTail(state, i)
Namespace types: BigCandleState
Parameters:
state (BigCandleState)
i (int)
method bigRedCandleTail(state, i)
Namespace types: BigCandleState
Parameters:
state (BigCandleState)
i (int)
method removeCrossedGreenCandleIndexes(state)
Namespace types: BigCandleState
Parameters:
state (BigCandleState)
method removeCrossedRedCandleIndexes(state)
Namespace types: BigCandleState
Parameters:
state (BigCandleState)
method run(state, opts)
Namespace types: BigCandleState
Parameters:
state (BigCandleState)
opts (BigCandleOpts)
method lastGreenCandleIndex(state)
Namespace types: BigCandleState
Parameters:
state (BigCandleState)
method lastRedCandleIndex(state)
Namespace types: BigCandleState
Parameters:
state (BigCandleState)
method lastGreenCandleTail(state)
Namespace types: BigCandleState
Parameters:
state (BigCandleState)
method lastRedCandleTail(state)
Namespace types: BigCandleState
Parameters:
state (BigCandleState)
method lastGreenCandleStrength(state)
Namespace types: BigCandleState
Parameters:
state (BigCandleState)
method lastRedCandleStrength(state)
Namespace types: BigCandleState
Parameters:
state (BigCandleState)
method reset(state, direction)
Namespace types: BigCandleState
Parameters:
state (BigCandleState)
direction (int)
BigCandleState
Fields:
greenCandleIndexes (array)
redCandleIndexes (array)
greenCandleStrength (array)
redCandleStrength (array)
averageHeight (series float)
averageBodyHeight (series float)
heightPercentage (series float)
bodyHeightPercentage (series float)
BigCandleOpts
Fields:
averageHeightPeriod (series int)
minCandleHeight (series float)
minCandleBodyHeight (series float)
minCandleHeight2 (series float)
minCandleBodyHeight2 (series float)
Babil34 Comparative Average PanelBabil34 Comparative Average Panel is an advanced moving averages dashboard that allows you to add and compare up to 5 EMAs, 5 DEMAs, and 5 SMAs simultaneously.
You can independently set the period, source, and timeframe for each average. With its colorful table and optional labels, you can easily observe the differences, trend changes, and crossovers between all averages at a glance.
It is suitable for both short-term and long-term strategies and lets you monitor multiple averages side by side.
Key Features:
Support for up to 5 independent EMAs, 5 DEMAs, and 5 SMAs
Multi-timeframe and multi-source selection
Clean, colorful table visualization
Toggleable labels and table for flexibility
Compatible with all markets and timeframes
Enhanced visual and technical analysis
This panel is specifically designed for traders who want to compare different types and periods of moving averages at a glance.
Yearly Performance Table with CAGROverview
This Pine Script indicator provides a clear table displaying the annual performance of an asset, along with two different average metrics: the arithmetic mean and the geometric mean (CAGR).
Core Features
Annual Performance Calculation:
Automatically detects the first trading day of each calendar year.
Calculates the percentage return for each full calendar year.
Based on closing prices from the first to the last trading day of the respective year.
Flexible Display:
Adjustable Period: Displays data for 1-50 years (default: 10 years).
Daily Timeframe Only: Functions exclusively on daily charts.
Automatic Update: Always shows the latest available years.
Two Average Metrics:
AVG (Arithmetic Mean)
A simple average of all annual returns. (Formula: (R₁ + R₂ + ... + Rₙ) ÷ n)
Important: Can be misleading in the presence of volatile returns.
GEO (Geometric Mean / CAGR)
Compound Annual Growth Rate. (Formula: ^(1/n) - 1)
Represents the true average annual growth rate.
Fully accounts for the compounding effect.
Limitations
Daily Charts Only: Does not work on intraday or weekly/monthly timeframes.
Calendar Year Basis: Calculations are based on calendar years, not rolling 12-month periods.
Historical Data: Dependent on the availability of historical data from the broker/data provider.
Interpretation of Results
CAGR as Benchmark: The geometric mean is more suitable for performance comparisons.
Annual Patterns: Individual year figures can reveal seasonal or cyclical trends.
15-Metric Strong Buy System (Final Version)This Pine Script analyzes 15 key technical signals to identify strong buy opportunities.
It assigns a score out of 13 for core conditions and checks 2 optional filters (Delivery Spike and RS > Nifty).
It only shows signals on the latest bar to keep the chart clean.
🧠 Core Structure Breakdown
✅ SECTION 1: Core Technical Signals (13 total)
Each of the following conditions adds 1 point to the score:
# Signal What It Checks Why It's Used
1 RSI (Daily & 1H) Both timeframes >55 and rising Confirms strength across multiple timeframes
2 Price > EMA20 & EMA50 Above short/medium-term trend lines Confirms uptrend support
3 Price near 20-day High Within 2% of recent high Breakout proximity
4 Volume > 20 SMA Unusual trading activity Confirms strength behind move
5 MACD Bullish Line > Signal and Histogram > 0 Momentum is building
6 ADX > 20 and +DI > -DI Trend strength and direction Validates strong directional trend
7 Bullish Candle Green candle with higher close Confirms bullish price action
8 BB Breakout Close > Upper Bollinger Band Volatility breakout confirmation
9 Supertrend Proxy Close above custom supertrend Simple trend direction filter
10 Close > Prev. High Break of short-term resistance Momentum continuation
11 VWAP Filter Close above VWAP Price leadership relative to volume
12 Weekly RSI > 50 Long-term trend momentum Confirms broader trend strength
13 BB Squeeze Bollinger Band width is low Signals potential upcoming move
🎯 Total Score = 0 to 13
🎯 SECTION 2: Optional Strength Filters (Displayed as labels)
Label What It Means Why It Matters
RS > Nifty Relative strength RSI > 55 vs Nifty Indicates outperformance
Delivery Spike Volume > 1.5× avg & bullish candle Suggests institutional activity
These are not included in the score, but if triggered, the chart displays:
🏷️ "RS > NIFTY" and/or
🏷️ "DELIVERY SPIKE"
in black background + white text boxes above the latest bar.
✅ SECTION 3: Output Logic
If score ≥ 12 → Show "STRONG BUY" on latest candle
If score = 11 → Show "BUY"
Also shows score label like Score: 12/13
Optional filters are displayed as labels if true
No clutter on historical candles — only current signal is shown.
🔔 SECTION 4: Alerts
Alert Trigger What It Does
score >= 12 Fires "Strong Buy Alert"
score == 11 Fires "Buy Alert"
⚖️ Pros & Cons (Analyst View)
✅ Pros:
Covers breadth of momentum, trend, breakout, and strength
Uses multi-timeframe confirmation for reliability
Avoids repainting by using latest bar only
Optional filters help detect smart money participation
Clean, uncluttered interface
❌ Cons:
Doesn’t include fundamentals
False positives possible during sideways or news-driven moves
No exit logic or Sell trigger
Uses proxy for Delivery spike, not actual delivery % (due to TradingView data limits)
💡 When to Trust the Signal?
Score Label Confidence
13/13 ✅ STRONG BUY + optional filters 🔥 Extremely strong
12/13 ✅ STRONG BUY ✅ Very high
11/13 BUY ⚠️ Medium — confirm with chart pattern
<11 — ❌ Avoid
Nifty Futures ATM Option Signal//@version=6
indicator('Nifty Futures ATM Option Signal', overlay = true)
// === Input symbols ===
// You must update these to match the live ATM options of current expiry.
niftyFutSymbol = input.symbol('NSE:NIFTY1!', 'Nifty Index Futures')
atmCallSymbol = input.symbol('NSE:NIFTY250605C24750', 'ATM Call Option (Same Expiry)')
atmPutSymbol = input.symbol('NSE:NIFTY250605P24750', 'ATM Put Option (Same Expiry)')
// === Get OHLC values from 5-minute charts ===
niftyOpen = request.security(niftyFutSymbol, '5', open)
niftyClose = request.security(niftyFutSymbol, '5', close)
callOpen = request.security(atmCallSymbol, '5', open)
callClose = request.security(atmCallSymbol, '5', close)
putOpen = request.security(atmPutSymbol, '5', open)
putClose = request.security(atmPutSymbol, '5', close)
// === Candle directions ===
niftyRed = niftyClose < niftyOpen
niftyGreen = niftyClose > niftyOpen
callGreen = callClose > callOpen
putGreen = putClose > putOpen
// === Trading signals ===
buySignal = niftyRed and callGreen
sellSignal = niftyGreen and putGreen
// === Plot signals on chart ===
plotshape(buySignal, title = 'Buy Signal', location = location.belowbar, color = color.green, style = shape.triangleup, size = size.small)
plotshape(sellSignal, title = 'Sell Signal', location = location.abovebar, color = color.red, style = shape.triangledown, size = size.small)
bgcolor(buySignal ? color.new(color.green, 85) : na, title = 'Buy Background')
bgcolor(sellSignal ? color.new(color.red, 85) : na, title = 'Sell Background')
OBV + Momentum + DI+ Dashboard 📊 Script Description: OBV + Momentum + DI+ Dashboard
This custom TradingView indicator combines three powerful technical analysis tools—On-Balance Volume (OBV), Momentum (ROC), and Directional Movement Index (+DI)—into a single, easy-to-read dashboard.
🔍 Key Features:
✅ Buy & Sell Signals
Plots signals on the chart when multiple conditions align:
Buy Signal: Bullish candle + Rising OBV + Positive Momentum + Strong +DI
Sell Signal: Bearish candle + Falling OBV + Negative Momentum + Weak +DI
✅ Dashboard Panel (Top Center)
A real-time dashboard displays key market conditions:
Price Action (Bullish, Bearish, or Neutral)
OBV Trend (Rising, Falling, or Flat)
Momentum (Rising, Falling, or Flat)
+DI Strength (Strong, Weak, or Neutral)
✅ Visual Enhancements
Color-coded trends for quick interpretation.
Compact table view in the center top of the chart.
📈 Technical Indicators Used:
OBV (On-Balance Volume): Measures buying/selling pressure via volume.
Momentum (Rate of Change): Detects acceleration/deceleration in price movement.
+DI from DMI/ADX: Indicates the strength of the uptrend.
This tool is ideal for momentum traders, volume analysts, and those who prefer a confluence-based trading approach. Use it on any time frame or asset to help confirm entries and exits with greater confidence.
aiQ - 10min Crypto Pro - v2aiQ - 10min Crypto Pro - v2
Professional-grade indicator specifically designed for 10-minute binary options trading on cryptocurrency pairs. Uses a 6-point confluence scoring system combining RSI divergences, VWMA trend ribbon, dynamic support/resistance, volume analysis, and momentum filters to identify high-probability CALL/PUT entries.
Key Features:
Two-tier signal system: ★ for premium setups (70% win rate), standard for regular trades (60% win rate)
Built-in money management calculator showing exact position sizing
Session filter highlights optimal trading hours (default: 08:00-22:00 UTC)
Real-time dashboard displays signal strength, trend, RSI, volume conditions
Automatic filtering of low-volume periods to avoid manipulation zones
Optimized for Speed: All parameters fine-tuned for 10-minute expiry times - faster RSI (9), responsive VWMA ribbon (3/8/13), and quick divergence detection. Includes alerts for both signal tiers.
Best Use: Wait for ★ signals with 4+ confluence score during active session hours. Never trade during "DRY" volume conditions. Position size based on 2% risk per trade (adjustable).
Note: This indicator provides signals only - actual binary options execution must be done through your broker platform.
AD BackGrand//@version=5
indicator("AD BackGrand", overlay=true)
// فقط برای XAUUSD اجرا بشه
isGold = syminfo.ticker == "XAUUSD"
// ⚙️ ورودیها
threshold = input.float(4.0, title="🟡 Volatility Threshold ($)", minval=0.1, step=0.1)
candleCount = input.int(3, title="🕒 Number of Candles to Check", minval=1, maxval=50)
// محاسبه مجموع نوسان کندلها (داینامیک)
totalVol = 0.0
for i = 0 to candleCount - 1
totalVol += high - low
// شرطها
isVolatile = isGold and (totalVol > threshold)
isCalm = isGold and (totalVol <= threshold)
// رنگ بکگراند
bgcolor(isVolatile ? color.new(color.green, 80) : na, title="High Volatility")
bgcolor(isCalm ? color.new(color.red, 85) : na, title="Low Volatility")
// نمایش مجموع نوسان (اختیاری)
plot(isGold ? totalVol : na, title="🔢 Total Volatility", color=color.orange)