Buy/Sell Zones – TV Style//@version=5
indicator("Buy/Sell Zones – TV Style", overlay=true, timeframe="", timeframe_gaps=true)
//=====================
// الإعدادات
//=====================
len     = input.int(100,  "Length", minval=10)
useATR  = input.bool(true, "Use ATR (بدل الانحراف المعياري)")
mult    = input.float(2.0, "Band Multiplier", step=0.1)
useRSI  = input.bool(true, "تفعيل فلتر RSI")
rsiOB   = input.int(70, "RSI Overbought", minval=50, maxval=90)
rsiOS   = input.int(30, "RSI Oversold",  minval=10, maxval=50)
//=====================
// القناة: أساس + انحراف
//=====================
basis = ta.linreg(close, len, 0)
off   = useATR ? ta.atr(len) * mult : ta.stdev(close, len) * mult
upper = basis + off
lower = basis - off
// نطاق علوي/سفلي بعيد لعمل تعبئة المناطق
lookback      = math.min(bar_index, 500)
topBand       = ta.highest(high, lookback)  + 50 * syminfo.mintick
bottomBand    = ta.lowest(low, lookback)    - 50 * syminfo.mintick
//=====================
// الرسم
//=====================
pUpper   = plot(upper, "Upper", color=color.new(color.blue, 0), linewidth=1)
pLower   = plot(lower, "Lower", color=color.new(color.red,  0), linewidth=1)
pBasis   = plot(basis, "Basis", color=color.new(color.gray, 60), linewidth=2)
// تعبئة المناطق: فوق القناة (أزرق)، تحت القناة (أحمر)
pTop     = plot(topBand,    display=display.none)
pBottom  = plot(bottomBand, display=display.none)
fill(pUpper, pTop,    color=color.new(color.blue, 80))   // منطقة مقاومة/بيع
fill(pBottom, pLower, color=color.new(color.red,  80))   // منطقة دعم/شراء
//=====================
// خط أفقي من قمّة قريبة (يمثل مقاومة) – قريب من الخط المنقّط في الصورة
//=====================
resLen   = math.round(len * 0.6)
dynRes   = ta.highest(high, resLen)
plot(dynRes, "Recent Resistance", color=color.new(color.white, 0), linewidth=1)
//=====================
// إشارات BUY / SELL + فلتر RSI (اختياري)
//=====================
rsi = ta.rsi(close, 14)
touchLower = ta.crossover(close, lower) or close <= lower
touchUpper = ta.crossunder(close, upper) or close >= upper
buyOK  = useRSI ? (touchLower and rsi <= rsiOS) : touchLower
sellOK = useRSI ? (touchUpper and rsi >= rsiOB) : touchUpper
plotshape(buyOK,  title="BUY",  location=location.belowbar, style=shape.labelup,
     text="BUY",  color=color.new(color.green, 0), textcolor=color.white, size=size.tiny, offset=0)
plotshape(sellOK, title="SELL", location=location.abovebar, style=shape.labeldown,
     text="SELL", color=color.new(color.red,   0), textcolor=color.white, size=size.tiny, offset=0)
// تنبيهات
alertcondition(buyOK,  title="BUY",  message="BUY signal: price touched/closed below lower band (RSI filter may apply).")
alertcondition(sellOK, title="SELL", message="SELL signal: price touched/closed above upper band (RSI filter may apply).")
Penunjuk dan strategi
10 EMA + 20 EMA + Previous Day High/Low (Day-Bounded)it gives the reand and also plot the day's lowest volume.it is very helpful in reversals
Mirpapa_Lib_DivergenceLibrary   "Mirpapa_Lib_Divergence" 
다이버전스 감지 및 시각화 라이브러리 (범용 설계)
 newPivot(bar, priceVal, indVal) 
  피벗 포인트 생성
  Parameters:
     bar (int) : 바 인덱스
     priceVal (float) : 가격
     indVal (float) : 지표값
  Returns: PivotPoint
 newDivSettings(pivotLen, maxStore, maxShow) 
  다이버전스 설정 생성
  Parameters:
     pivotLen (int) : 피벗 좌우 캔들
     maxStore (int) : 저장 개수
     maxShow (int) : 표시 라인 개수
  Returns: DivergenceSettings
 emptyDivResult() 
  빈 다이버전스 결과
  Returns: 감지 안 된 DivergenceResult
 checkPivotHigh(length, source) 
  고점 피벗 감지
  Parameters:
     length (int) : 좌우 비교 캔들 수
     source (float) : 비교할 데이터 (지표값)
  Returns: 피벗 값 또는 na
 checkPivotLow(length, source) 
  저점 피벗 감지
  Parameters:
     length (int) : 좌우 비교 캔들 수
     source (float) : 비교할 데이터 (지표값)
  Returns: 피벗 값 또는 na
 addPivotToArray(pivotArray, pivot, maxSize) 
  피벗을 배열에 추가 (FIFO 방식)
  Parameters:
     pivotArray (array) : 피벗 배열
     pivot (PivotPoint) : 추가할 피벗
     maxSize (int) : 최대 크기
 checkBullishDivergence(pivotArray) 
  상승 다이버전스 체크 (Bullish)
  Parameters:
     pivotArray (array) : 저점 피벗 배열
  Returns: DivergenceResult
 checkBearishDivergence(pivotArray) 
  하락 다이버전스 체크 (Bearish)
  Parameters:
     pivotArray (array) : 고점 피벗 배열
  Returns: DivergenceResult
 createDivLine(result, lineColor, isOverlay) 
  다이버전스 라인 생성
  Parameters:
     result (DivergenceResult) : DivergenceResult
     lineColor (color) : 라인 색상
     isOverlay (bool) : true면 가격 기준, false면 지표 기준
  Returns:  
 cleanupLines(lineArray, labelArray, maxLines) 
  오래된 라인/라벨 정리
  Parameters:
     lineArray (array) : 라인 배열
     labelArray (array) : 라벨 배열
     maxLines (int) : 최대 유지 개수
 addLineAndCleanup(lineArray, labelArray, newLine, newLabel, maxLines) 
  라인/라벨 추가 및 자동 정리
  Parameters:
     lineArray (array) : 라인 배열
     labelArray (array) : 라벨 배열
     newLine (line) : 새 라인
     newLabel (label) : 새 라벨
     maxLines (int) : 최대 개수
 PivotPoint 
  피벗 데이터 저장
  Fields:
     barIndex (series int) : 바 인덱스
     price (series float) : 종가
     indicatorValue (series float) : 지표값
 DivergenceSettings 
  다이버전스 설정
  Fields:
     pivotLength (series int) : 피벗 좌우 캔들 수
     maxPivotsStore (series int) : 저장할 최대 피벗 개수
     maxLinesShow (series int) : 표시할 최대 라인 개수
 DivergenceResult 
  다이버전스 감지 결과
  Fields:
     detected (series bool) : 다이버전스 감지 여부
     isBullish (series bool) : true면 상승, false면 하락
     bar1 (series int) : 첫 번째 피벗 바 인덱스
     value1_price (series float) : 첫 번째 가격
     value1_ind (series float) : 첫 번째 지표값
     bar2 (series int) : 두 번째 피벗 바 인덱스
     value2_price (series float) : 두 번째 가격
     value2_ind (series float) : 두 번째 지표값
No-Trade Zones UTC+7This indicator helps you visualize and backtest your preferred trading hours. For example, if you have a 9-to-5 job, you obviously can’t trade during that time — and when backtesting, you should avoid those hours too. It also marks weekends if you prefer not to trade on those days.
By highlighting no-trade periods directly on the chart, you can easily see when you shouldn’t be taking trades, without constantly checking the time or date by hovering over the chart. It makes backtesting smoother and more realistic for your personal schedule.
Mirpapa_Lib_MACDLibrary   "Mirpapa_Lib_MACD" 
MACD 계산 및 크로스 체크를 위한 라이브러리
 calc_smma(src, len) 
  SMMA (Smoothed Moving Average) 계산
  Parameters:
     src (float) : 소스 데이터
     len (simple int) : 길이
  Returns: SMMA 값
 calc_zlema(src, length) 
  ZLEMA (Zero Lag EMA) 계산
  Parameters:
     src (float) : 소스 데이터
     length (simple int) : 길이
  Returns: ZLEMA 값
 checkMacdCross(lengthMA, lengthSignal, src, enabled) 
  MACD 크로스오버 체크
  Parameters:
     lengthMA (simple int) : MACD 길이
     lengthSignal (int) : 시그널 길이
     src (float) : 소스 (기본값: hlc3)
     enabled (bool) : 계산 활성화 여부 (기본값: true)
  Returns: 
Cumulative Volume Library (plyst)Library   "CumulativeVolumeLib" 
 GetVolumeMetrics(lookback, calcType, useUSD, includeBybit, includeOKX, includeCoinbase, includeBitget, includeKucoin, includeKraken, includeMexc, includeGateio, includeHTX) 
  Parameters:
     lookback (simple int) 
     calcType (simple string) 
     useUSD (simple bool) 
     includeBybit (bool) 
     includeOKX (bool) 
     includeCoinbase (bool) 
     includeBitget (bool) 
     includeKucoin (bool) 
     includeKraken (bool) 
     includeMexc (bool) 
     includeGateio (bool) 
     includeHTX (bool)
Change% by Amit Multi-Period Returns Table 
This indicator displays percentage returns across multiple timeframes — 
1 Week, 
1 Month, 
3 Months, 
6 Months, 
12 Months.
This helps traders quickly assess short-term and long-term performance trends.
Positive returns are highlighted in blue, while negative returns are shown in red, allowing instant visual recognition of strength or weakness.
Ideal for spotting momentum shifts, relative performance, and trend consistency across different horizons.
Mirpapa_Lib_RenkoLibrary   "Mirpapa_Lib_Renko" 
Mirpapa Renko Library - HL2 기반 ATR 렌코 차트 생성 라이브러리
 get_renko(atr_period, atr_multiplier) 
  ATR 기반 렌코 차트 생성
  Parameters:
     atr_period (simple int) : ATR 계산 기간
     atr_multiplier (float) : ATR 승수 (박스 크기 조절)
  Returns:   렌코 캔들 OHLC 값
Smart Money Concepts URUGUAYSmart money concept, Bos , choch , liquidiciones con niveles marcados con lineas perfecto
SuperTrend Cyan — Split ST & Triple Bands (A/B/C)SuperTrend Cyan — Split ST & Triple Bands (A/B/C)
✨ Concept:
The SuperTrend Cyan indicator expands the classical SuperTrend logic into a split-line + triple-band visualization for clearer structure and volatility mapping.
Instead of a single ATR-based line, this tool separates SuperTrend direction from volatility envelopes (A/B/C), providing a layered view of both regime and range compression.
✨ The design goal:
 
  Preserve the simplicity of SuperTrend
  Add volatility context via multi-band envelopes
  Provide a compact MTF (Multi-Timeframe) summary for broader trend alignment
 
✨ How It Works
1. SuperTrend Core (Active & Opposite Lines)
 
 Uses ATR-based bands (Factor × ATR-Length).
 Active SuperTrend is plotted according to current regime.
 Opposite SuperTrend (optional) shows potential reversal threshold.
 
2. Triple Band System (A/B/C)
 
 Each band (A, B, C) scales from the median price (hl2) by different ATR multipliers.
 A: Outer band (wider, long-range context)
 B: Inner band (mid-range activity)
 C: Core band (closest to price, short-term compression)
 Smoothness can be controlled with EMA.
 Uptrend fills are lime-toned, downtrend fills are red-toned, with adjustable opacity (gap intensity).
 
3. Automatic Directional Switch
 
 When the regime flips from up → down (or vice versa), the overlay automatically switches between lower and upper bands for a clean transition.
 
4. Multi-Timeframe SuperTrend Table
 
 Displays SuperTrend direction across 5m, 15m, 1h, 4h, and 1D frames.
 Green ▲ = Uptrend, Red ▼ = Downtrend.
 Useful for checking cross-timeframe trend alignment.
 
✨ How to Read It
Green SuperTrend + Lime Bands 
- Uptrend regime; volatility expanding upward 
Red SuperTrend + Red Bands
- Downtrend regime; volatility expanding downward
Narrow gaps (A–C)
- Low volatility / compression (potential squeeze)
Wide gaps
- High volatility / active trend phase
Opposite ST line close to price
- Early warning for regime transition
✨ Practical Use
 
 Identify trend direction (SuperTrend color & line position).
 Assess volatility conditions (band width and gap transparency).
 Watch for MTF alignment: consistent up/down signals across 1h–4h–1D = strong structural trend.
 Combine with momentum indicators (e.g., RSI, DFI, PCI) for confirmation of trend maturity or exhaustion.
 
✨ Customization Tips
ST Factor / ATR Length 
- Adjust sensitivity of SuperTrend direction changes
Band ATR Length
- Controls overall smoothness of volatility envelopes
Band Multipliers (A/B/C)
- Define how wide each volatility band extends
Gap Opacity
- Affects visual contrast between layers
MTF Table
- Enable/disable multi-timeframe display
✨ Educational Value
This script visualizes the interaction between trend direction (SuperTrend) and volatility envelopes, helping traders understand how price reacts within layered ATR zones.
It also introduces a clean MTF (multi-timeframe) perspective — ideal for discretionary and system traders alike.
✨ Disclaimer
This indicator is provided for educational and research purposes only.
It does not constitute financial advice or a trading signal.
Use at your own discretion and always confirm with additional tools.
───────────────────────────────
📘 한국어 설명 (Korean translation below)
───────────────────────────────
✨개념
SuperTrend Cyan 지표는 기존의 SuperTrend를 확장하여,
추세선 분리(Split Line) + 3중 밴드 시스템(Triple Bands) 으로
시장의 구조적 흐름과 변동성 범위를 동시에 시각화합니다.
단순한 SuperTrend의 강점을 유지하면서도,
ATR 기반의 A/B/C 밴드를 통해 변동성 압축·확장 구간을 직관적으로 파악할 수 있습니다.
✨ 작동 방식
1. SuperTrend 코어 (활성/반대 라인)
 
 ATR×Factor를 기반으로 추세선을 계산합니다.
 현재 추세 방향에 따라 활성 라인이 표시되고, “Show Opposite” 옵션을 켜면 반대편 경계선도 함께 보입니다.
 
2. 트리플 밴드 시스템 (A/B/C)
 
 hl2(중간값)를 기준으로 ATR 배수에 따라 세 개의 밴드를 계산합니다.
 A: 외곽 밴드 (가장 넓고 장기 구조 반영)
 B: 중간 밴드 (중기적 움직임)
 C: 코어 밴드 (가격에 가장 근접, 단기 변동성 반영)
 EMA 스무딩으로 부드럽게 조정 가능.
 업트렌드 구간은 라임색, 다운트렌드는 빨간색 음영으로 표시됩니다.
 
3. 자동 전환 시스템
 
 추세가 전환될 때(Up ↔ Down), 밴드 오버레이도 자동으로 교체되어 깔끔한 시각적 구조를 유지합니다.
 
4. MTF SuperTrend 테이블
 
 5m / 15m / 1h / 4h / 1D 프레임별 SuperTrend 방향을 표시합니다.
 초록 ▲ = 상승, 빨강 ▼ = 하락.
 복수 타임프레임 정렬 확인용으로 유용합니다.
 
✨ 해석 방법
초록 SuperTrend + 라임 밴드
- 상승 추세 및 확장 구간
빨강 SuperTrend + 레드 밴드
- 하락 추세 및 확장 구간
밴드 폭이 좁음
- 변동성 축소 (스퀴즈)
밴드 폭이 넓음
- 변동성 확장, 추세 강화
반대선이 근접
- 추세 전환 가능성 높음
✨ 활용 방법
 
 SuperTrend 색상으로 추세 방향을 확인
 A/B/C 밴드 폭으로 변동성 수준을 판단
 MTF 테이블을 통해 복수 타임프레임 정렬 여부 확인
 RSI, DFI, PCI 등 다른 지표와 함께 활용 시, 추세 피로·모멘텀 변화를 조기에 파악 가능
 
✨ 교육적 가치
이 스크립트는 추세 구조(SuperTrend) 와 변동성 레이어(ATR Bands) 의 상호작용을
시각적으로 학습하기 위한 교육용 지표입니다.
또한, MTF 구조를 통해 시장의 “위계적 정렬(hierarchical alignment)”을 쉽게 인식할 수 있습니다.
✨ 면책
이 지표는 교육 및 연구 목적으로만 제공됩니다.
투자 판단의 책임은 사용자 본인에게 있으며, 본 지표는 매매 신호를 보장하지 않습니다.
Rolling Correlation vs Another Symbol (SPY Default)This indicator visualizes the rolling correlation between the current chart symbol and another selected asset, helping traders understand how closely the two move together over time.
It calculates the Pearson correlation coefficient over a user-defined period (default 22 bars) and plots it as a color-coded line:
	•	Green line → positive correlation (move in the same direction)
	•	Red line → negative correlation (move in opposite directions)
	•	A gray dashed line marks the zero level (no correlation).
The background highlights periods of strong relationship:
	•	Light green when correlation > +0.7 (strong positive)
	•	Light red when correlation < –0.7 (strong negative)
Use this tool to quickly spot diversification opportunities, confirm hedges, or understand how assets interact during different market regimes.
Aggression IndexAggression index is a simple yet very helpful indicator. 
It measures:
-  the number of bull vs bear candles;
- bull vs bear volume;
- length bull vs bear candlesticks over a predetermined lookback period. 
It will use that information to come up with a delta for each measurement and an Aggression Index in the end.
FXbyFaris – Liquidity & Trend Frameworkfxbyfaris is a ultimate pro strategy which gives you accurate entry and exits
Cumulative Delta Volume MTFCumulative Delta Volume MTF (CDV_MTF) 
Within volume analytics, “delta (buy − sell)” often acts as a leading indicator for price.
This indicator is a cumulative delta tailored for day trading.
It differs from conventional cumulative delta in two key ways:
Daily Reset
If heavy buying hits into the prior day’s close, a standard cumulative delta “carries” that momentum into the next day’s open. You can then misread direction—selling may actually be dominant, but yesterday’s residue still pushes the delta positive. With Daily Reset, accumulation uses only the current day’s delta, giving you a more reliable, open-to-close read for intraday decision-making.
Timeframe Selection (MTF)
You might chart 30s/15s candles to capture micro structure, while wanting the cumulative delta on 5-minute to judge the broader flow. With Timeframe (MTF), you can view a lower-timeframe chart and a higher-timeframe delta in one pane.
Overview
MTF aggregation: choose the delta’s computation timeframe via Timeframe (empty = chart) (empty = chart timeframe).
Daily Reset: toggle on/off to accumulate strictly within the current session/day.
Display: Candle or Line (Candle supports Heikin Ashi), with Bull/Bear background shading.
Overlays: up to two SMA and two EMA lines.
Panel: plotted in a sub-window (overlay=false).
Example Use Cases
At the open: turn Daily Reset = ON to see the pure, same-day buy/sell build-up.
Entry on lower TF, bias from higher TF: chart at 30s, set Timeframe = 5 to reduce noise and false signals.
Quick read of momentum: Candle + HA + background shading for intuitive direction; confirm with SMA/EMA slope or crosses.
Key Parameters
Timeframe (empty = chart): timeframe used to compute cumulative delta.
Enable Daily Reset: resets accumulation when the trading day changes.
Style: Candle / Line; Heikin Ashi toggle for Candle mode.
SMA/EMA 1 & 2: individual length and color settings.
Background: customize Bull and Bear background colors.
How to Read
Distance from zero: positive build = buy-side dominance; negative = sell-side dominance.
Slope × MAs: use CDV slope and MA direction/crossovers for momentum and potential turns.
Reset vs. non-reset:
ON → isolates intraday net flow.
OFF → tracks multi-day accumulation/dispersion.
Notes & Caveats
The delta here is a heuristic derived from candle body/wick proportions—it is not true bid/ask tape.
MTF updates are based on the selected timeframe’s bar closes; values can fluctuate intrabar.
Date logic follows the symbol’s exchange timezone.
Renders in a separate pane.
Suggested Defaults
Timeframe = 5 (or 15) / Daily Reset = ON
Style = Candle + Heikin Ashi = ON
EMA(50/200) to frame trend context
For the first decisions after the open—and for scalps/day trades throughout the session—MTF × Daily Reset helps you lock onto the flow that actually matters, right now.
==========================
Cumulative Delta Volume MTF(CDV_MTF)
出来高の中でも“デルタ(買い−売り)”は株価の先行指標になりやすい。
本インジケーターはデイトレードに特化した累積デルタです。
通常の累積デルタと異なるポイントは2つ。
デイリーリセット機能
前日の大引けで大きな買いが入ると、通常の累積デルタはその勢いを翌日の寄りにも“持ち越し”ます。実際は売り圧が強いのに、前日の残渣に引っ張られて方向を誤ることがある。デイリーリセットを使えば当日分だけで累積するため、寄り直後からの判断基準として信頼度が上がります。
タイムフレーム指定(MTF)機能
たとえばチャートは30秒足/15秒足で細部の動きを追い、累積デルタは5分足で“大きな流れ”を確認したい──そんなニーズに対応。**一画面で“下位足の値動き × 上位足のフロー”**を同時に把握できます。
概要
MTF対応:Timeframe で集計足を指定(空欄=チャート足)
デイリーリセット:当日分のみで累積(オン/オフ切替)
表示:Candle/Line(CandleはHA切替可)、背景をBull/Bearで自動塗り分け
補助線:SMA/EMA(各2本)を重ね描き
表示先:サブウィンドウ(overlay=false)
使い方の例
寄りのフロー判定:デイリーリセット=オンで、寄り直後の純粋な買い/売りの積み上がりを確認
下位足のエントリー × 上位足のバイアス:チャート=30秒、Timeframe=5分で騙しを減らす
勢いの視認:Candle+HA+背景色で直感的に上げ下げを把握、SMA/EMAの傾きで補強
主なパラメータ
Timeframe (empty = chart):累積に使う時間足
デイリーリセットを有効にする:日付切替で累積をリセット
Style:Candle / Line、Heikin Ashi切替
SMA/EMA 1・2:期間・色を個別設定
背景色:Bull背景 / Bear背景 を任意のトーンに
読み取りのコツ
ゼロからの乖離:+側へ積み上がるほど買い優位、−側は売り優位
傾き×MA:CDVの傾きと移動平均の方向/クロスで転換やモメンタムを推測
日内/日跨ぎの切替:デイリーリセット=オンで日内の純流入出、オフで期間全体の偏り
仕様・注意
本デルタはローソクのボディ/ヒゲ比率から近似したヒューリスティックで、実際のBid/Ask集計とは異なります。
MTFは指定足の確定ベースで更新されます。
日付判定はシンボルの取引所タイムゾーン準拠。
推奨初期セット
Timeframe=5(または15)/デイリーリセット=有効
Style=Candle+HA=有効
EMA(50/200)で流れの比較
寄りの一手、そしてスキャル/デイの判断材料に。MTF×デイリーリセットで、“効いているフロー”を最短距離で捉えます。
SuperBulls - Heiken Ashi StrategyA streamlined, trade-ready strategy from the SuperBulls universe that turns noisy charts into clear decisions. It combines a smoothed price view, adaptive momentum gating, and a dynamic support/resistance overlay so you can spot high-probability turns without overthinking every candle. Entries and exits are signalled visually and designed to work with simple position sizing — perfect for discretionary traders and systematic setups alike.
Why traders like it
Clean visual signals reduce analysis paralysis and speed up decision-making.
Built-in momentum filter helps avoid chop and chase only the stronger moves.
Dynamic S/R zones provide objective areas for targets and stop placement.
Works with simple risk rules — position sizing and pyramiding kept conservative by default.
Who it’s for
Traders who want a reliable, low-friction strategy to trade intraday or swing setups without rebuilding indicators from scratch. Minimal tuning required; plug in your size and let the SuperBulls logic do the heavy lifting.
Use it, don’t overfit it, and try not to blame the indicator when you ignore risk management.
MTF 20 SMA Table - DXY**MTF 20 SMA Table - Multi-Timeframe Trend Analysis Dashboard**
**Overview:**
This indicator provides a comprehensive multi-timeframe analysis dashboard that displays the relationship between price and the 20-period Simple Moving Average (SMA) across four key timeframes: 15-minute, 1-hour, 4-hour, and Daily. It's designed to help traders quickly identify trend alignment and potential trading opportunities across multiple timeframes at a glance.  It's definitely not perfect but has helped me speed up my backtesting efforts as it's worked well for me eliminating flipping back and forth between timeframes excpet when I have confluence on the table, then I check the HTF.
**How It Works:**
The indicator creates a table overlay on your chart showing three critical metrics for each timeframe:
1. **Price vs SMA (Row 1):** Shows whether price is currently above (bullish) or below (bearish) the 20 SMA
   - Green = Price Above SMA
   - Red = Price Below SMA
2. **SMA Direction (Row 2):** Indicates the trend direction of the SMA itself over a lookback period
   - Green (↗ Rising) = Uptrend
   - Red (↘ Falling) = Downtrend
   - Gray (→ Flat) = Ranging/Consolidation
3. **Strength (Row 3):** Displays the distance between current price and the SMA in pips
   - Purple background = Strong move (>50 pips away)
   - Orange background = Moderate move (20-50 pips)
   - Gray background = Weak/consolidating (<20 pips)
   - Text color: Green for positive distance, Red for negative
**Key Features:**
- **Customizable Table Position:** Place the table anywhere on your chart (9 position options)
- **Adjustable SMA Lengths:** Modify the SMA period for each timeframe independently (default: 20)
- **Direction Lookback Settings:** Fine-tune how far back the indicator looks to determine SMA direction for each timeframe
- **Flat Threshold:** Set the pip threshold for determining when an SMA is "flat" vs trending (default: 5 pips)
- **DXY Optimized:** Calculations are calibrated for the US Dollar Index (1 pip = 0.01)
**Best Use Cases:**
1. **Trend Alignment:** Identify when multiple timeframes align in the same direction for higher probability trades
2. **Divergence Spotting:** Detect when lower timeframes diverge from higher timeframes (potential reversals)
3. **Entry Timing:** Use lower timeframe signals while higher timeframes confirm overall trend
4. **Strength Assessment:** Gauge how extended price is from the mean (SMA) to avoid overextended entries
**Settings Guide:**
- **SMA Settings Group:** Adjust the SMA period for each timeframe (15M, 1H, 4H, Daily)
- **SMA Direction Group:** Control lookback periods to determine trend direction
  - 15M: Default 5 candles
  - 1H: Default 10 candles
  - 4H: Default 15 candles
  - Daily: Default 20 candles
- **Flat Threshold:** Set sensitivity for "flat" detection (lower = more sensitive to ranging markets)
**Trading Strategy Examples:**
1. **Trend Following:** Look for all timeframes showing the same direction (all green or all red)
2. **Pullback Trading:** When Daily/4H are green but 15M/1H show red, wait for lower timeframes to flip green for entry
3. **Ranging Markets:** When multiple SMAs show "flat", consider range-bound strategies
**Important Notes:**
- This is a reference tool only, not a standalone trading system
- Always use proper risk management and combine with other analysis methods
- Best suited for trending instruments like indices and major forex pairs
- Calculations are optimized for DXY but can be used on other instruments (pip calculations may need adjustment)
**Credits:**
Feel free to modify and improve this code! Suggestions for enhancements are welcome in the comments.
---
**Installation Instructions:**
1. Add the indicator to your TradingView chart
2. Adjust the table position via settings to avoid overlap with price action
3. Customize SMA lengths and lookback periods to match your trading style
4. Monitor the table for timeframe alignment and trend confirmation
---
This indicator is published as open source for the community to learn from and improve upon. Happy trading! 📈
Z-Score Bands + SignalsZ-Score Statistical Market Analyzer 
 A multi-dimensional market structure indicator based on standardized deviation & regime logic 
 English Description 
Concept
This indicator builds a statistical model of price behaviour by converting every candle’s movement into a Z-score — how many standard deviations each close is away from its moving average.
It visualizes the normal distribution structure of returns and provides adaptive entry signals for both Mean Reversion and Breakout regimes.
Rather than predicting price direction, it measures statistical displacement from equilibrium and dynamically adjusts the decision logic according to the market’s volatility regime.
⚙️ Main Components
Z-Score Bands (±1σ, ±2σ, ±3σ)
– The core structure visualizes volatility boundaries based on rolling mean and standard deviation.
– Price outside ±2σ often indicates statistical extremes.
Dual Signal Systems
Mean Reversion (MRL / MRS): when price (or return z-score) crosses back inside ±2σ bands.
Breakout (BOL / BOS): when price continues to expand beyond ±2σ.
Volatility Regime Classification
The indicator detects whether the market is currently in a low-vol or high-vol regime using percentile statistics of σ.
Low vol → Mean Reversion preferred
High vol → Breakout preferred
🧠  Adaptive Switches 
 
 A. Freeze MA/σ - Use previous-bar stats to avoid repainting and lag.	
 B. Confirm on Close - Only generate signals once the base-timeframe bar closes (eliminates look-ahead bias).	
 C. Return-based Signal - Use log-return Z-score instead of price deviation — normalizes volatility across assets.	
 D. Outlier Filter - Exclude bars with abnormal single-bar returns (e.g., >20%). Reduces false spikes.	
 E. Regime Gating - Automatically switch between Mean Reversion and Breakout logic depending on volatility percentile.
 	
Each module can be toggled individually to test different statistical behaviours or tailor to a specific market condition.
📊 Interpretation
When the histogram of returns approximates a normal distribution, mean-reversion logic is often more effective.
When price persistently drifts beyond ±2σ or ±3σ, the distribution becomes leptokurtic (fat-tailed) — a breakout structure dominates.
Hence, this tool can help you:
Identify whether an asset behaves more “Gaussian” or “fat-tailed”;
Select the correct trading regime (MR or BO);
Quantitatively measure market tension and volatility clusters.
🧩 Recommended Use
Works on any timeframe and any asset.
Best used on liquid instruments (e.g., XAU/USD, indices, major FX pairs).
Combine with volume, sentiment or structural filters to confirm signals.
For strategy automation, pair with the companion script:
🧠 “Z-Score Strategy • Multi-Source Confirm (MRL/MRS/BOL/BOS)”.
⚠️ Disclaimer
This script is designed for educational and research purposes.
Statistical deviation ≠ directional prediction — use with sound risk management.
Past distribution patterns may shift under new volatility regimes.
==================================================================================
 中文说明(简体) 
概念简介
该指标基于价格的统计分布原理,将每根 K 线的波动转化为标准化的 Z-Score(标准差偏离值),用于刻画市场处于均衡或偏离状态。
它同时支持 均值回归(Mean Reversion) 与 突破延展(Breakout) 两种逻辑,并可根据市场波动结构自动切换策略模式。
⚙️ 主要功能模块
Z-Score 通道(±1σ / ±2σ / ±3σ)
用滚动均值与标准差动态绘制的统计波动带,价格超出 ±2σ 区域通常意味着极端偏离。
双信号系统
MRL / MRS(均值回归多空):价格重新回到 ±2σ 以内时触发。
BOL / BOS(突破延展多空):价格持续运行在 ±2σ 之外时触发。
波动率分层
自动识别市场处于高波动还是低波动区间:
低波动期 → 适合均值回归逻辑;
高波动期 → 适合突破趋势逻辑。
🧠 A–E 模块说明
A. 固定统计参数:使用上一根 K 线的均值和标准差,防止重绘。	
B. 收盘确认信号:仅在当前时间框架收盘后生成信号,避免前视偏差。	
C. 收益率信号模式:采用对数收益率的 Z-Score,更具普适性。	
D. 异常波过滤:忽略单根极端波动(如 >20%)的噪声信号。	
E. 波动率调节逻辑:根据市场处于高/低波动区间,自动切换 MRL/MRS 或 BOL/BOS。
	
📊 应用解读
如果收益率分布接近正态分布 → 市场倾向震荡,MRL/MRS 效果较佳;
若价格频繁偏离 ±2σ 或 ±3σ → 市场呈现“肥尾”分布,趋势延展占主导。
因此,该指标的核心目标是:
识别当前市场的统计结构类型;
根据波动特征自动切换交易逻辑;
提供结构化、可量化的市场状态刻画。
💡 使用建议
适用于所有时间框架与金融品种。
建议结合成交量或结构性指标过滤。
若用于策略回测,可搭配同名 “Z-Score Strategy • Multi-Source Confirm” 策略脚本。
⚠️ 免责声明
本指标仅用于研究与教学,不构成任何投资建议。
统计偏离 ≠ 趋势预测,实际市场行为可能在不同波动结构下改变。
Auto Downtrend Lines (Close-Based + Large Labels) v6DTL by DonaldDuck
DTL by DonaldDuck
DTL by DonaldDuck
RSI Divergence 1-20 Candlesthis is a rsi divergence setup used to see where all divergenece is rsi is formed. so this will help to trade.
Technical Checklist_DTBasic Checklist table for bullish condition checks for ADX, RSI, VWAP , CPR, Supertrend
True Average PriceTrue Average Price 
 Overview 
The indicator plots a single line representing the cumulative average closing price of any symbol you choose. It lets you project a long-term mean onto your active chart, which is useful when your favourite symbol offers limited history but you still want context from an index or data-rich feed.
 How It Works 
The script retrieves all available historical bars from the selected symbol, sums their closes, counts the bars, and divides the totals to compute the lifetime average. That value is projected onto the chart you are viewing so you can compare current price action to the broader historical mean.
 Inputs 
 
 Use Symbol : Toggle on to select an alternate symbol; leave off to default to the current chart.
 Symbol : Pick the data source used for the average when the toggle is enabled.
 Line Color : Choose the display color of the average line.
 Line Width : Adjust the thickness of the plotted line. 
 
 Usage Tips 
 
 Apply the indicator to exchanges with shallow history while sourcing the average from a complete index (e.g.,  INDEX:BTCUSD  for crypto pairs).
 Experiment with different symbols to understand how alternative data feeds influence the baseline level. 
 
 Disclaimer 
This indicator is designed as a technical analysis tool and should be used in conjunction with other forms of analysis and proper risk management. 
Past performance does not guarantee future results, and traders should thoroughly test any strategy before implementing it with real capital.






















