Simple Moving Average (SMA)## Overview and Purpose
The Simple Moving Average (SMA) is one of the most fundamental and widely used technical indicators in financial analysis. It calculates the arithmetic mean of a selected range of prices over a specified number of periods. Developed in the early days of technical analysis, the SMA provides traders with a straightforward method to identify trends by smoothing price data and filtering out short-term fluctuations. Due to its simplicity and effectiveness, it remains a cornerstone indicator that forms the basis for numerous other technical analysis tools.
## What’s Different in this Implementation
- **Constant streaming update:**
On each bar we:
1) subtract the value leaving the window,
2) add the new value,
3) divide by the number of valid samples (early) or by `period` (once full).
- **Deterministic lag, same as textbook SMA:**
Once full, lag is `(period - 1)/2` bars—identical to the classic SMA. You just **don’t lose the first `period-1` bars** to `na`.
- **Large windows without penalty:**
Complexity is constant per tick; memory is bounded by `period`. Very long SMAs stay cheap.
## Behavior on Early Bars
- **Bars < period:** returns the arithmetic mean of **available** samples.
Example (period = 10): bar #3 is the average of the first 3 inputs—not `na`.
- **Bars ≥ period:** behaves exactly like standard SMA over a fixed-length window.
> Implication: Crosses and signals can appear earlier than with `ta.sma()` because you’re not suppressing the first `period-1` bars.
## When to Prefer This
- Backtests needing early bars: You want signals and state from the very first bars.
- High-frequency or very long SMAs: O(1) updates avoid per-bar CPU spikes.
- Memory-tight scripts: Single circular buffer; no large temp arrays per tick.
## Caveats & Tips
Backtest comparability: If you previously relied on na gating from ta.sma(), add your own warm-up guard (e.g., only trade after bar_index >= period-1) for apples-to-apples.
Missing data: The function treats the current bar via nz(source); adjust if you need strict NA propagation.
Window semantics: After warm-up, results match the textbook SMA window; early bars are a partial-window mean by design.
## Math Notes
Running-sum update:
sum_t = sum_{t-1} - oldest + newest
SMA_t = sum_t / k where k = min(#valid_samples, period)
Lag (full window): (period - 1) / 2 bars.
## References
- Edwards & Magee, Technical Analysis of Stock Trends
- Murphy, Technical Analysis of the Financial Markets
Chỉ báo và chiến lược
Session 30 Second OR DeviationsThis indicator will plot the -4, -6, and -8 levels in color coded fashion based on session. We look for price reactions at these levels. It will plot the Asia session first 30 second candle, same with London, and New York.
Todays Session Open LN,NYWhen are the Asian, London and New York open for each session simple stuff trading view made me right more stuff so i can publish this what to do c'est la vie
DXY ChecklistDxy Checklist
Used to stay on track on what the market is performing on index market.
Check list asks questions, when performed we acknowledge the deal done on index.
Sessions High/Low with Break LogicSessions High/Low with Break Logic – Indicator Description
Update 27.10.25
Overview
This indicator marks the highs and lows of key trading sessions (Tokyo, London, New York) and highlights when these levels are broken. It is ideal for traders using session-based strategies to monitor breakouts or support/resistance levels in real time.
Key Features
Session-Based Highs/Lows:
Tracks highs and lows for three trading sessions:
Tokyo: 02:00–09:00 (UTC+1)
London: 09:00–17:00 (UTC+1)
New York: 15:30–22:00 (UTC+1)
Break Logic:
Detects when the current price breaks a session high or low.
Labels are updated with a "Break" note when a level is breached.
Visual Display:
Draws horizontal lines for highs and lows of each session.
Adds labels with values (optionally including price).
Colors are customizable for each session:
Tokyo: Purple
London: Teal
New York: Orange
Customizable Settings:
Horizontal Offset: Shifts lines and labels horizontally for clarity.
Time Zone: Adjustable to UTC+1 (default).
Price Display: Option to show the exact price next to the label.
Settings and Translations
Display Settings
Horizontal Offset: Horizontal shift for lines and labels.
Show Price with Text: Displays the price next to the label (e.g., "London High: 123.45").
Time Settings
UTC: Time zone (default: UTC+1).
Session 1 (Tokyo)
Session 1: 02:00–09:00
High Text: "Tokyo High"
Low Text: "Tokyo Low"
High Color: Purple
Low Color: Purple
Session 2 (London)
Session 2: 09:00–17:00
High Text: "London High"
Low Text: "London Low"
High Color: Teal
Low Color: Teal
Session 3 (New York)
Session 3: 15:30–22:00
High Text: "New York High"
Low Text: "New York Low"
High Color: Orange
Low Color: Orange
FX Realized Volatility *The downward signal for Euqities!?*The Russel 2000 put in a new ath today as capital is moving further out the risk curve. Risk-Assets continue to rally to the upside.
This will last until we see a lasting driver happening on a real time basis that drag pull equties down
When volatility rises, we need to see the DRIVER of the volatility have persistence behind it as opposed to one off shocks.
We are not there yet as volatility in FX and bonds continues to compress since the April lows in equities.
Equities will continue to rally until long end yields blow out or the carry trade unwinds. Long end yields blowing out is not occuring on an imminent basis but the FX side of things could be a significant risk soon.
Its all about: When will that liquidity beginn to create inflation or a problem in the currency
Monitoring the equity vol, Bond vol and FX volatiliy is crucial here
You can watch them via:
VIX,
Move,
+ i build an Trading view modell which conducts the vol of the major FX pairs.
(its 100% free)
If you just want it simple, just look at USD & EUR vol as they are the most trades foreign exchange currencies.
Watching these 2 Risks (Vol & long-end) will put you upfront most people in the market.
Once we see information in the underlying economy shifting i will adjust my views as they relate to every major asset class.
But for now we are likely moving higher in basically every risky asset.
**Feel free to ask me any questions**
50-Minute Opening Range BreakoutThis is a test of the opening range with Bearish/Bullish confirmation
Bullish/Bearish Engulfing Candle ScannerFinds instances on any time frame of bullish or bearish engulfing candles, those with some increased average volume showing green arrows to highlight, otherwise red.
Candle Size MonitorCandle Size Monitor – Description
Update 27.10.25
Objective Volatility Assessment
The Candle Size Monitor helps traders assess actual market movement—regardless of whether candles appear visually large or small on the chart. It supports evaluating whether your planned trade structure (e.g., stop-loss, take-profit) aligns with current volatility.
Key Features
Volatility Analysis:
Calculates the average candle size (difference between high and low) over a user-defined number of candles.
Identifies the largest candle in the selected period.
Displays results in a compact table on the chart.
Exchange Rate Integration (optional):
Shows the current USD-EUR exchange rate (formatted with German-style comma and four decimal places).
Useful for traders in USD-denominated markets who apply EUR-based risk management rules.
Customizable Display:
Text Size: Small, medium, or large.
Colors: Customizable text and background colors.
Table Position: Top/bottom left/right.
Number of Candles: User-defined (default: 20).
Dynamic Updates:
The table updates with each new bar.
The exchange rate is fetched in real-time from OANDA:EURUSD.
Settings and Translations
Settings
Anzahl Kerzen → Number of Candles (Number of candles for calculation, default: 20).
Textgröße → Text Size (Text size in the table: small, medium, large).
Textfarbe → Text Color (Text color, default: white).
Hintergrundfarbe → Background Color (Background color of the table, default: black).
Position → Position (Table position: Top Left, Top Right, Bottom Left, Bottom Right).
Wechselkurs anzeigen (USD → EUR) → Show Exchange Rate (USD → EUR) (Option to display the exchange rate).
Table Contents and Translations
The table displays the following information (with German formatting):
Ø Größe (N):
English: "Avg Size (N): " (Average candle size over the last N candles).
Example: "Ø Größe (20): 15,3" → "Avg Size (20): 15.3".
Größte Kerze:
English: "Largest Candle: " (Largest candle size in the selected period).
Example: "Größte Kerze: 42,7" → "Largest Candle: 42.7".
1 USD = € (only if enabled)
English: "1 USD = EUR" (Current USD-EUR exchange rate, formatted with a comma).
Example: "1 USD = 0,9234 €" → "1 USD = 0.9234 EUR".
Gap Finder v6Detects unfilled price gaps with clean lines and labels with percentage size of the gap. Lines extend 16 bars and labels extend 14 bars past last bar.
CEO_IndicatorCEO Indicator
Liquidity Levels:
PDH / PDL (Previous Day High/Low)
PWH / PWL (Previous Week High/Low)
PMH / PML (Previous Month High/Low)
DO, NYM, WO, TWO, MO (Daily/Weekly/Monthly Opens + True Opens)
Asia Midpoint (0.5) — midline between Asian session high and low
Customization: colors, opacity, line thickness
Trading Sessions:
4H Display: On the 4H timeframe and above, session boxes may appear cluttered or overlapping.
You can disable session display for higher timeframes to keep the chart clean.
Overlap: When Overlap is turned off, sessions will not be drawn on top of each
other — improving visual clarity during overlapping markets (e.g. London + New York).
Supports: Asia, Frankfurt, London, New York, Lunch
Display modes: Box, Streamlined, Fill, High-Low zones
Customized labels
Time zone auto-adjust & custom time zones
Fractals & FVG:
Automatic fractal high/low detection
Displays Fair Value Gaps (FVG) — bullish & bearish
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)”을 쉽게 인식할 수 있습니다.
✨ 면책
이 지표는 교육 및 연구 목적으로만 제공됩니다.
투자 판단의 책임은 사용자 본인에게 있으며, 본 지표는 매매 신호를 보장하지 않습니다.
Star delta // This source code is subject to the terms of the Mozilla Public License 2.0 at mozilla.org
// © noop42
//@version=5
indicator("Realtime Volume Analysis Toolbar", shorttitle="RVAT", overlay=false, max_boxes_count=10000, max_lines_count=500, max_labels_count=500)
// Tooltips
// Options
varip cumulative_vol = 0.0
varip lastPrice = close
varip lastVolume = 0.0
varip upvol = 0.0
varip downvol = 0.0
varip ticknumber = 0
if barstate.isrealtime
v = ticknumber == 0 ? volume : volume - lastVolume
if close > lastPrice
//cumulative_vol += v
upvol += v
else
downvol += v
delta = upvol - downvol
delta_col = delta > 0 ? color.lime : color.red
float askv_per = (upvol / (upvol + downvol)) *100
askv_color = askv_per > 50.0 ? color.lime : color.red
label.new(bar_index, 4.5, text=str.tostring(volume), style=label.style_none, textcolor=color.white)
label.new(bar_index, 3.5, text="↑ "+str.tostring(upvol), style=label.style_none, textcolor=color.lime)
label.new(bar_index, 2.5, text="↓ "+str.tostring(downvol), style=label.style_none, textcolor=color.red)
label.new(bar_index, 1.5, text="⍙ "+str.tostring(delta), style=label.style_none, textcolor=delta_col)
label.new(bar_index, 0.5, text="⇅ "+str.tostring(askv_per, "#.#")+"%", style=label.style_none, textcolor=askv_color)
lastVolume := volume
lastPrice := close
ticknumber += 1
if barstate.isconfirmed
lastVolume := 0.0
lastPrice := close
cumulative_vol := 0.0
upvol := 0.0
downvol := 0.0
ticknumber := 0
hline(4.25, linestyle=hline.style_solid)
hline(3.25, linestyle=hline.style_dotted)
hline(2.25, linestyle=hline.style_dotted)
hline(1.25, linestyle=hline.style_dotted)
hline(0.25, linestyle=hline.style_dotted)
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.
SOL 15分钟MACD全自动策略//@version=5
strategy("30分钟高胜率MACD+RSI全自动策略", overlay=true, shorttitle="HighWin-30min Auto",
initial_capital=10000, // 初始资金
default_qty_type=strategy.cash, // 按资金比例开仓
default_qty_value=2000, // 单次开仓金额(可调整)
commission_type=strategy.commission.percent,
commission_value=0.1, // 匹配欧易0.1%默认手续费
margin_long=100, margin_short=100, // 现货交易无杠杆
pyramiding=0, // 禁止加仓,控制风险
close_entries_rule=strategy.close_entries_rule.all,
calc_on_every_tick=false, // 关闭逐Tick计算,避免报错
title_color=#1E90FF, line_color=#FF6347)
// ———— 1. 核心参数设置(高胜率优化版,可微调) ————
// MACD参数(30分钟周期适配,比默认更稳定)
macd_fast = input.int(12, title="MACD快线周期", minval=1)
macd_slow = input.int(26, title="MACD慢线周期", minval=1)
macd_signal = input.int(9, title="MACD信号线周期", minval=1)
// RSI参数(过滤超买超卖,避免追涨杀跌)
rsi_length = input.int(14, title="RSI周期", minval=1)
rsi_long_thresh = input.int(40, title="多头RSI阈值(低于该值可开多)", minval=10, maxval=50)
rsi_short_thresh = input.int(60, title="空头RSI阈值(高于该值可开空)", minval=50, maxval=90)
// 成交量参数(验证资金动能)
vol_multiplier = input.float(1.5, title="成交量放大倍数", step=0.1, minval=1.0)
// ATR止损与止盈参数(科学风控)
atr_length = input.int(14, title="ATR周期(衡量波动)", minval=1)
atr_sl_multi = input.float(2.0, title="止损ATR倍数(2倍更安全)", step=0.1, minval=1.0)
risk_reward = input.float(2.0, title="风险回报比(1:2,赚2倍于亏)", step=0.1, minval=1.5)
// 信号过滤(避免连续交易)
signal_gap = input.int(4, title="多空信号最小间隔K线数", minval=2)
// ———— 2. 指标计算(三重验证,降低假信号) ————
// 2.1 MACD计算(多空趋势核心)
= ta.macd(close, macd_fast, macd_slow, macd_signal)
// 多头趋势:MACD在零轴上+红柱放大;空头趋势:MACD在零轴下+绿柱放大
macd_long_trend = macd_line > 0 and hist_line > hist_line
macd_short_trend = macd_line < 0 and hist_line < hist_line
// 2.2 RSI计算(过滤超买超卖)
rsi_value = ta.rsi(close, rsi_length)
rsi_long_condition = rsi_value < rsi_long_thresh // 未超买,有上涨空间
rsi_short_condition = rsi_value > rsi_short_thresh // 未超卖,有下跌空间
// 2.3 成交量计算(验证资金动能)
vol_condition = volume >= volume * vol_multiplier and volume > 0 // 成交量比前根放大50%+
vol_long = vol_condition and close > open // 放量上涨,多头资金进场
vol_short = vol_condition and close < open // 放量下跌,空头资金进场
// 2.4 ATR计算(动态止损基础)
atr_value = ta.atr(atr_length)
atr_value := nz(atr_value, ta.sma(ta.tr, atr_length)) // 空值兜底,避免报错
// ———— 3. 多空信号生成(三重条件共振,高胜率核心) ————
// 3.1 多头信号(4个条件同时满足)
var int last_long_bar = 0
long_condition = ta.crossover(macd_line, signal_line) // MACD金叉
and macd_long_trend // 多头趋势
and rsi_long_condition // RSI未超买
and vol_long // 放量上涨
and (bar_index - last_long_bar) >= signal_gap // 间隔过滤
final_long = long_condition
// 3.2 空头信号(4个条件同时满足)
var int last_short_bar = 0
short_condition = ta.crossunder(macd_line, signal_line) // MACD死叉
and macd_short_trend // 空头趋势
and rsi_short_condition // RSI未超卖
and vol_short // 放量下跌
and (bar_index - last_short_bar) >= signal_gap // 间隔过滤
final_short = short_condition
// ———— 4. 动态止盈止损计算(适配30分钟波动,不被洗盘) ————
// 4.1 记录开仓关键数据
var float long_entry = na // 多头入场价
var float short_entry = na // 空头入场价
var float long_entry_low = na // 多头开仓K线低点
var float short_entry_high = na // 空头开仓K线高点
var float entry_atr = na // 开仓时ATR值
// 多头开仓数据记录
if final_long
long_entry := close
long_entry_low := low
entry_atr := atr_value
last_long_bar := bar_index // 更新最后多头信号K线
// 空头开仓数据记录
if final_short
short_entry := close
short_entry_high := high
entry_atr := atr_value
last_short_bar := bar_index // 更新最后空头信号K线
// 4.2 多头止盈止损(双逻辑防护)
long_sl = math.max(long_entry - (entry_atr * atr_sl_multi), long_entry_low * 0.997) // 0.3%缓冲防插针
long_loss = long_entry - long_sl // 止损幅度
long_tp = long_entry + (long_loss * risk_reward) // 1:2风险回报比止盈
// 额外绑定中期压力:前10根K线高点(30分钟周期趋势更稳,周期稍长)
long_resistance = ta.highest(high, 10)
long_tp = math.min(long_tp, long_resistance * 1.003) // 0.3%缓冲防踏空
// 4.3 空头止盈止损(对称逻辑)
short_sl = math.min(short_entry + (entry_atr * atr_sl_multi), short_entry_high * 1.003)
short_loss = short_sl - short_entry
short_tp = short_entry - (short_loss * risk_reward)
// 额外绑定中期支撑:前10根K线低点
short_support = ta.lowest(low, 10)
short_tp = math.max(short_tp, short_support * 0.997)
// ———— 5. 全自动交易执行(严格仓位控制,避免冲突) ————
// 多头开仓:无仓位时执行(避免多空对冲)
if final_long and strategy.position_size == 0
strategy.entry("Long-Position", strategy.long)
strategy.exit("Long-Exit", "Long-Position", stop=long_sl, limit=long_tp) // 自动挂止盈止损
// 空头开仓:无仓位时执行
if final_short and strategy.position_size == 0
strategy.entry("Short-Position", strategy.short)
strategy.exit("Short-Exit", "Short-Position", stop=short_sl, limit=short_tp)
// ———— 6. 可视化与预警(清晰监控,欧易同步提醒) ————
// 6.1 多空信号标记(直观区分)
plotshape(final_long, title="多头信号", location=location.belowbar,
color=color.new(color.green, 0), style=shape.labelup,
text="多", textcolor=color.white, size=size.small)
plotshape(final_short, title="空头信号", location=location.abovebar,
color=color.new(color.red, 0), style=shape.labeldown,
text="空", textcolor=color.white, size=size.small)
// 6.2 止盈止损线(开仓后自动显示,红色止损、绿色止盈)
plot(strategy.position_size > 0 ? long_sl : na, title="多头止损",
color=color.red, linewidth=2, style=plot.style_linebr)
plot(strategy.position_size > 0 ? long_tp : na, title="多头止盈",
color=color.green, linewidth=2, style=plot.style_linebr)
plot(strategy.position_size < 0 ? short_sl : na, title="空头止损",
color=color.red, linewidth=2, style=plot.style_linebr)
plot(strategy.position_size < 0 ? short_tp : na, title="空头止盈",
color=color.green, linewidth=2, style=plot.style_linebr)
// 6.3 副图指标(辅助验证趋势)
// MACD副图
plot(macd_line, title="MACD线", color=color.blue, linewidth=1)
plot(signal_line, title="MACD信号线", color=color.orange, linewidth=1)
barcolor(hist_line > 0 ? color.new(color.green, 60) : color.new(color.red, 60), title="MACD柱")
hline(0, "MACD零轴线", color=color.gray, linestyle=hline.style_dashed)
// RSI副图(显示超买超卖区间)
plot(rsi_value, title="RSI", color=color.purple, linewidth=1, display=display.data_window)
hline(rsi_long_thresh, "多头RSI阈值", color=color.green, linestyle=hline.style_dotted)
hline(rsi_short_thresh, "空头RSI阈值", color=color.red, linestyle=hline.style_dotted)
hline(30, "超卖线", color=color.gray, linestyle=hline.style_dashed)
hline(70, "超买线", color=color.gray, linestyle=hline.style_dashed)
// 6.4 关键预警(欧易同步通知,无需盯盘)
alertCondition(final_long, title="多头开仓提醒",
message="30分钟触发高胜率多头信号,入场价:" + str.tostring(long_entry) + ",止损:" + str.tostring(long_sl))
alertCondition(final_short, title="空头开仓提醒",
message="30分钟触发高胜率空头信号,入场价:" + str.tostring(short_entry) + ",止损:" + str.tostring(short_sl))
alertCondition(strategy.position_size > 0 and close <= long_sl, title="多头止损提醒",
message="多头触及止损位:" + str.tostring(long_sl) + ",已自动平仓")
alertCondition(strategy.position_size > 0 and close >= long_tp, title="多头止盈提醒",
message="多头触及止盈位:" + str.tostring(long_tp) + ",已自动平仓")
alertCondition(strategy.position_size < 0 and close >= short_sl, title="空头止损提醒",
message="空头触及止损位:" + str.tostring(short_sl) + ",已自动平仓")
alertCondition(strategy.position_size < 0 and close <= short_tp, title="空头止盈提醒",
message="空头触及止盈位:" + str.tostring(short_tp) + ",已自动平仓")
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” 策略脚本。
⚠️ 免责声明
本指标仅用于研究与教学,不构成任何投资建议。
统计偏离 ≠ 趋势预测,实际市场行为可能在不同波动结构下改变。
Technical Checklist_DTBasic Checklist table for bullish condition checks for ADX, RSI, VWAP , CPR, Supertrend
MTF Dashboard Title: Multi-Timeframe Analysis Dashboard
Description:
A comprehensive multi-timeframe analytics panel that displays key technical indicators across five timeframes (Daily, 4H, 15min, 5min, 1min) in an easy-to-read dashboard format.
Features:
Clean, color-coded table showing market conditions at a glance
Tracks 6 key metrics per timeframe:
• Candle Change % (green for up, red for down)
• MACD Signal (bullish/bearish)
• RSI (with overbought/oversold zones highlighted)
• Volume Ratio vs 20-period average
• Trend Direction (EMA 20 vs EMA 50)
Use Cases:
Perfect for day traders who need to align multiple timeframes
Quickly spot divergences between timeframes
Identify when all timeframes align for high-probability setups
Monitor momentum shifts across different time horizons
Ideal for scalping and swing trading strategies
Color Coding:
Green = Bullish/Up/Positive
Red = Bearish/Down/Negative
Gray = Neutral
Orange = High volume
Customization:
Toggle any timeframe on/off in the settings to focus on your preferred trading style.
Best For:
Momentum traders, scalpers, and swing traders who use top-down analysis and need a quick visual reference of market conditions across multiple timeframes.





















