Venkat HA Trend Change Triangles# 📘 Venkat HA Trend Change Triangles – Description & User Guide
## 🔎 What It Does
This indicator highlights potential **trend change points** on **Heikin Ashi (HA)** candles.
It detects when a candle color flips from **green → red** (possible bearish shift) or **red → green** (possible bullish shift) under four scenarios, and then plots a triangle marker:
* 🟢 **Green Up Triangle (below bar):** Potential bullish trend change (Red → Green).
* 🔴 **Red Down Triangle (above bar):** Potential bearish trend change (Green → Red).
This helps traders quickly spot moments where momentum may be reversing.
---
## ⚙️ How It Works
The script evaluates **the current HA candle vs. the previous one** and classifies the change into four scenarios:
1. **Green → Red, inside bar** (weaker bearish shift).
2. **Green → Red, engulfing (crosses both high & low)** (stronger bearish shift).
3. **Red → Green, inside bar** (weaker bullish shift).
4. **Red → Green, engulfing (crosses both high & low)** (stronger bullish shift).
From these, it plots:
* **Trend Down (Bearish):** If scenario 1 or 2 occurs.
* **Trend Up (Bullish):** If scenario 3 or 4 occurs.
---
## 📊 Chart Display
* 🟢 **Triangle Up (Green)** → Appears **below bar** when the script detects a bullish shift.
* 🔴 **Triangle Down (Red)** → Appears **above bar** when the script detects a bearish shift.
---
## 🔔 Alerts
You can set alerts to be notified of trend changes:
* **Trend Up (Red → Green)** → "Heikin Ashi Trend Change Up"
* **Trend Down (Green → Red)** → "Heikin Ashi Trend Change Down"
This way, you won’t miss potential reversal signals even if you’re away from the chart.
---
## 📖 How to Use
1. Apply the indicator on a **Heikin Ashi chart** (not regular candles).
2. Watch for:
* 🟢 Green Up Triangles as potential **entry signals for longs**.
* 🔴 Red Down Triangles as potential **entry signals for shorts**.
3. Use with other tools (moving averages, RSI, support/resistance) to confirm signals — don’t rely on this alone.
4. For stronger signals, you may choose to focus only on **engulfing scenarios (2 & 4)** and ignore inside bars (1 & 3).
---
## ⚠️ Important Notes
* This indicator does **not repaint** (it uses completed candles).
* It’s best used as a **visual aid**, not a standalone strategy.
* Always backtest and combine with other confirmations before trading.
---
Penunjuk dan strategi
Dave Trading Indicator (with Arrows)//@version=5
indicator("A1 SMC Clean Entry (Arrows + SL/TP) - Publishable", overlay=true,
max_labels_count=500, max_lines_count=500, max_boxes_count=200)
// === USER SETTINGS ===
rsiLength = input.int(14, "RSI Length")
slATRMult = input.float(1.5, "Stop Loss (ATR Multiplier)", step=0.1)
tpRR = input.float(2.0, "Take Profit (R:R)", step=0.1)
htfEMA = input.int(200, "Trend EMA (filter)", minval=1)
lookbackHigh = input.int(20, "Liquidity High Lookback")
lookbackLow = input.int(20, "Liquidity Low Lookback")
obLookback = input.int(8, "Order Block Lookback")
keepOnlyLast = input.bool(true, "Keep only latest drawings", tooltip="Deletes previous label/box/lines when a new signal appears")
// === INDICATORS / FILTERS ===
rsi = ta.rsi(close, rsiLength)
atr = ta.atr(14)
trendEMA = ta.ema(close, htfEMA)
// === LIQUIDITY SWEEP LOGIC ===
// A "grab" means price briefly sweeps the recent extreme then closes back beyond it
liqHigh = ta.highest(high, lookbackHigh)
liqLow = ta.lowest(low, lookbackLow)
grabHigh = high > liqHigh and close < liqHigh // stop-hunt above recent highs
grabLow = low < liqLow and close > liqLow // stop-hunt below recent lows
// === CORE ENTRY RULES ===
// Multi-confirmation: liquidity sweep + RSI + EMA trend
longCondition = grabLow and rsi > 50 and close > trendEMA
shortCondition = grabHigh and rsi < 50 and close < trendEMA
// === GLOBAL ARROWS (must be in global scope) ===
plotshape(longCondition, title="BUY Arrow", location=location.belowbar, color=color.green, style=shape.triangleup, size=size.large, text="BUY")
plotshape(shortCondition, title="SELL Arrow", location=location.abovebar, color=color.red, style=shape.triangledown, size=size.large, text="SELL")
// === ALERTS ===
alertcondition(longCondition, title="BUY setup", message="{{ticker}} BUY setup")
alertcondition(shortCondition, title="SELL setup", message="{{ticker}} SELL setup")
// === OBJECT MANAGEMENT: keep only last drawings if enabled ===
var label lastLabel = na
var line lastSL = na
var line lastTP = na
var box lastBox = na
f_delete_prev() =>
if not na(lastLabel)
label.delete(lastLabel)
lastLabel := na
if not na(lastSL)
line.delete(lastSL)
lastSL := na
if not na(lastTP)
line.delete(lastTP)
lastTP := na
if not na(lastBox)
box.delete(lastBox)
lastBox := na
// === WHEN LONG TRIGGERS ===
if longCondition
if keepOnlyLast
f_delete_prev()
entryPrice = close
stopLoss = entryPrice - atr * slATRMult
takeProfit = entryPrice + (entryPrice - stopLoss) * tpRR
// Label (entry)
lastLabel := label.new(bar_index, entryPrice, text="BUY", style=label.style_label_up, color=color.green, textcolor=color.white, size=size.small)
// SL and TP lines (extend a few bars to the right)
lastSL := line.new(bar_index, stopLoss, bar_index + 20, stopLoss, color=color.red, style=line.style_dashed, width=1)
lastTP := line.new(bar_index, takeProfit, bar_index + 20, takeProfit, color=color.green, style=line.style_dashed, width=1)
// Order Block (approx): use last bearish range before move up
bearOB_top = ta.highest(high, obLookback)
bearOB_bot = ta.lowest(low, obLookback)
// draw a box that covers last obLookback candles and spans bot..top
lastBox := box.new(bar_index - obLookback, bearOB_top, bar_index, bearOB_bot, bgcolor=color.new(color.green, 85), border_color=color.green)
// === WHEN SHORT TRIGGERS ===
if shortCondition
if keepOnlyLast
f_delete_prev()
entryPrice = close
stopLoss = entryPrice + atr * slATRMult
takeProfit = entryPrice - (stopLoss - entryPrice) * tpRR
// Label (entry)
lastLabel := label.new(bar_index, entryPrice, text="SELL", style=label.style_label_down, color=color.red, textcolor=color.white, size=size.small)
// SL and TP lines
lastSL := line.new(bar_index, stopLoss, bar_index + 20, stopLoss, color=color.red, style=line.style_dashed, width=1)
lastTP := line.new(bar_index, takeProfit, bar_index + 20, takeProfit, color=color.green, style=line.style_dashed, width=1)
// Order Block (approx): last bullish range before move down
bullOB_top = ta.highest(high, obLookback)
bullOB_bot = ta.lowest(low, obLookback)
lastBox := box.new(bar_index - obLookback, bullOB_top, bar_index, bullOB_bot, bgcolor=color.new(color.red, 85), border_color=color.red)
// === OPTIONAL DEBUG PLOTS (comment out if you don't want them) ===
// plot(rsi, title="RSI", color=color.orange) // off by default to keep chart clean
// plot(trendEMA, title="EMA200", color=color.blue)
// keep indicator valid even if nothing plotted
plot(na)
Volume Range Ratio EFFORTVolume Divided by Range Histogram
With an adjustable high line to see when there is a struggle between buyers and sellers
and an adjustable EMA for the histogram
Setup Cripto EMA + Volume//@version=5 indicator("Sinais Multi-Cripto – EMA+Volume (BTC/ETH/BNB/SOL/XRP)", overlay=false)
// Inputs emaFast = input.int(50, "EMA Curta") emaSlow = input.int(200, "EMA Longa") emaPull = input.int(20, "EMA Pullback") volLen = input.int(20, "Média Volume")
symBTC = input.symbol(defval="BINANCE:BTCUSDT", title="BTC") symETH = input.symbol(defval="BINANCE:ETHUSDT", title="ETH") symBNB = input.symbol(defval="BINANCE:BNBUSDT", title="BNB") symSOL = input.symbol(defval="BINANCE:SOLUSDT", title="SOL") symXRP = input.symbol(defval="BINANCE:XRPUSDT", title="XRP")
f_sig(sym) => c = request.security(sym, timeframe.period, close) v = request.security(sym, timeframe.period, volume) e50 = ta.ema(c, emaFast) e200 = ta.ema(c, emaSlow) e20 = ta.ema(c, emaPull) vma = ta.sma(v, volLen) long = (e50 > e200) and (c > e20) and (v > vma) short = (e50 < e200) and (c < e20) and (v > vma)
= f_sig(symBTC) = f_sig(symETH) = f_sig(symBNB) = f_sig(symSOL) = f_sig(symXRP)
// Exibição plotchar(btcL, title="BTC Long", char="▲", location=location.top) plotchar(btcS, title="BTC Short", char="▼", location=location.bottom) plotchar(ethL, title="ETH Long", char="▲", location=location.top) plotchar(ethS, title="ETH Short", char="▼", location=location.bottom) plotchar(bnbL, title="BNB Long", char="▲", location=location.top) plotchar(bnbS, title="BNB Short", char="▼", location=location.bottom) plotchar(solL, title="SOL Long", char="▲", location=location.top) plotchar(solS, title="SOL Short", char="▼", location=location.bottom) plotchar(xrpL, title="XRP Long", char="▲", location=location.top) plotchar(xrpS, title="XRP Short", char="▼", location=location.bottom)
Session Asiatique (1h à 6h - Heure de Paris)//@version=5
indicator("Session Asiatique (1h à 6h - Heure de Paris)", overlay=true)
// Variables pour le rectangle de la session
var box sessionBox = na
var float sessionHigh = na
var float sessionLow = na
// Heure actuelle en UTC
utcHour = hour(time)
// Heure actuelle en heure de Paris
parisHour = hour(time, "Europe/Paris")
// Détection de la session asiatique (1h à 6h heure de Paris)
inSession = parisHour >= 1 and parisHour < 6
startSession = inSession and not inSession
endSession = not inSession and inSession
// Début de la session : création du rectangle et initialisation des bornes
if startSession
sessionLow := low
sessionHigh := high
sessionBox := box.new(left=bar_index, right=bar_index, top=high, bottom=low, border_color=color.rgb(118, 118, 119), bgcolor=color.new(#404140, 85))
// Mise à jour du rectangle pendant la session
if inSession and not na(sessionBox)
sessionHigh := math.max(sessionHigh, high)
sessionLow := math.min(sessionLow, low)
box.set_right(sessionBox, bar_index)
box.set_top(sessionBox, sessionHigh)
box.set_bottom(sessionBox, sessionLow)
// Fin de la session : finalisation du rectangle
if endSession and not na(sessionBox)
box.set_right(sessionBox, bar_index)
Signal Validator - Signal Validator with Volume and IV ProxySignal Validator - Signal Validator with Volume and IV Proxy
Estrategy EURUSD M3 Scalping Estrategia para operar el EURUSD en temp de 3 min, indica sl y tp 6 pips sl y 10 pips tp
Vegas Touch EMA12 切換 EMA-12 Based Switching Rules (No RSI)
For Long trades:
Tunnel Mode → If EMA-12 is between EMA-144 and EMA-169 → use the Tunnel (144/169) lines as the touch reference.
Base Mode → If EMA-12 is below EMA-169 but still above EMA-676 → use the Base (576/676) lines as the touch reference.
No Long → If EMA-12 is below EMA-676, no long trade is allowed.
For Short trades (mirror logic):
Tunnel Mode → If EMA-12 is between EMA-144 and EMA-169 → use the Tunnel (144/169) lines as the touch reference.
Base Mode → If EMA-12 is above EMA-169 but still below EMA-676 → use the Base (576/676) lines as the touch reference.
No Short → If EMA-12 is above EMA-676, no short trade is allowed.
Vegas ema 過濾 Vegas Channel with EMA-Filter — Trading Rules
Components
Tunnel: EMA 144 & 169 (upper = max, lower = min).
Base: EMA 576 & 676 (upper = max, lower = min).
Fast filter: EMA12.
Touch threshold: ATR-based or % of the reference line.
Long touch = low ≤ line + thr; Short touch = high ≥ line − thr.
Trend gate
LongTrendOK: EMA144 > EMA576 and EMA169 > EMA676 and close > BaseUpper.
ShortTrendOK: EMA144 < EMA576 and EMA169 < EMA676 and close < BaseLower.
Price-action pattern (either one)
Pin40: bullish pin = close>open & lower wick ≥ 40% of range; bearish pin = close 169 → use Base.
Else → use Tunnel.
EMA12 hard locks (coarse filter)
Lock longs if EMA12 < 676 (no long signals at all).
Lock shorts if EMA12 > 676 (no short signals at all).
(Optional) Tunnel lock/unlock (fine filter)
Lock longs when EMA12 drops below TunnelLower; unlock when
A) EMA12 crosses back above 144/169/TunnelUpper, or
B) a bullish Pin/Eng appears at BaseUpper and EMA12 is back ≥ TunnelLower.
Lock shorts when EMA12 breaks above TunnelUpper; unlock when
A) EMA12 crosses back below 144/169/TunnelLower, or
B) a bearish Pin/Eng appears at BaseLower and EMA12 is ≤ TunnelUpper.
Final signal
LONG fires when: Close-bar confirmed ∧ Cooldown passed ∧ LongTrendOK ∧ ActiveBand lower touch ∧ Pin40 or Eng60 ∧ not hard-locked ∧ (not tunnel-locked if enabled).
SHORT symmetrical with upper touch.
Quality-of-life
Close-bar confirmation to avoid repaint.
Cooldown (e.g., 10 bars) to prevent signal clusters.
Alerts include a compact lock status string (LckL/LckS/HardL/HardS).
Optional “BLOCK:” labels show why a bar didn’t trigger (noTouch, EMA12<676/>676, TunnelLock, cooldown, notClose).
Suggested defaults
ATR(14), ATR multiplier 0.35 (or 0.20% if using Percent mode).
autoSwitchByEMA12_* = ON, hardLockBelow676/Above676 = ON, useTunnelLock* = OFF.
useCloseBar = ON, signalCooldown = 10.
Design intent
Tunnel (144/169) captures the working trend; Base (576/676) defines the structural bias.
EMA12 drives regime selection (Tunnel vs Base) and hard locks to keep signals sparse and aligned with momentum.
Prev Day Close Line + Label — White Text / Royal Blue (v6)Previous Day Close line with clear labeling.
- Gap up vs PDC
- Gap down vs PDC
Helps analyze what yesterday attempted to do helps to confirm whether the attempt was successful.
Previous High/Low Range (D,W,M,Q)Previous High/Low Range (D, W, M, Q)
This indicator displays the previous period’s high, low, and midpoint levels across multiple timeframes: Daily, Weekly, Monthly, and Quarterly. It extends these key price levels into the future, allowing traders to quickly identify important support and resistance zones based on historical price action.
Features:
Shows previous Daily, Weekly, Monthly, and Quarterly highs, lows, and midpoints.
Optionally extends these levels forward for easy visualization.
Configurable colors and visibility for each timeframe.
Includes optional midpoint lines at 50% between high and low to identify equilibrium points.
Supports logarithmic scale calculations for midpoints to maintain accuracy on log charts.
Optional labels that display exact price values for each level.
Designed to help traders recognize key levels for entries, exits, and risk management.
Use this indicator to gain a multi-timeframe perspective on significant price ranges and anticipate potential reversal or breakout zones.
CPR • VWAP • Keltner • Supertrend • Chandelier • LRC - KidevFeatures included
CPR (Central Pivot Range)
VWAP (Volume Weighted Average Price)
Keltner Channel (KC)
Supertrend
Chandelier Exit (CE)
Linear Regression Channel (LRC)
Each tool has a toggle (on/off).
If off → plots are hidden (using display.none).
Fill shading (fill()) is controlled by conditional colors (na to hide).
VPOC Harmonics - Liquidity-Weighted Price / Time RatiosVPOC Harmonics - Liquidity-Weighted Price / Time Ratios
Summary
This indicator transforms a swing’s price range, duration, and liquidity profile into a structured set of price-per-bar ratios. By anchoring two points and manually entering the swing’s VPOC (highest-volume price), it generates candidate compression values that unify price, time, and liquidity structure. These values can be applied to chart scaling, harmonic testing, and liquidity-aware market geometry.
________________________________________
Overview
Most swing analysis tools only consider price (ΔP) and time (N bars). This script goes further by incorporating the VPOC (Point of Control) — the price with the highest traded volume — directly into swing geometry.
• Anchors define the swing’s Low (L), High (H), and bar count (N).
• The user manually enters the VPOC (highest-volume price).
• The indicator then computes a suite of ratios that integrate range, duration, and liquidity placement.
The output is a table of liquidity-weighted price-per-bar candidates, designed for compression testing and harmonic analysis across swings and instruments.
________________________________________
How to Use
1. Select a Swing
- Place Anchor A and Anchor B to define the swing’s Low, High, and bar count.
2. Find the VPOC
- Apply TradingView’s Fixed Range Volume Profile tool over the same swing.
- Identify the Point of Control (POC) — the price level with the highest traded volume.
3. Enter the VPOC
- Manually input the POC into the indicator settings.
4. Review Outputs
- The table will display candidate ratios expressed mainly as price-per-bar values.
5. Apply in Practice
- Use the ratios as chart compression inputs or as benchmarks for testing harmonic alignments across swings.
________________________________________
Outputs
Swing & Inputs
• Bars (N): total bar count of the swing.
• Low (L): swing low price.
• High (H): swing high price.
• ΔP = H − L: price range.
• Mid = (L + H) ÷ 2: midpoint price.
• VPOC (V): user-entered highest-volume price.
• Base slope s0 = ΔP ÷ N: average change per bar.
• π-adjusted slope sπ = (π × ΔP) ÷ (2 × N): slope adjusted for half-cycle arc geometry.
________________________________________
VPOC Harmony Ratios (L, H, V, N)
• λ = (V − L) ÷ ΔP: normalized VPOC position within the range.
• R = (V − L) ÷ (H − V): symmetry ratio comparing lower vs. upper segment.
• s1 = (V − L) ÷ N: slope from Low → VPOC.
• s2 = (H − V) ÷ N: slope from VPOC → High.
________________________________________
Blended Means (s1, s2)
These combine the two segment slopes in different ways:
• HM(s1,s2) = 2 ÷ (1/s1 + 1/s2): Harmonic mean, emphasizes the smaller slope.
• GM(s1,s2) = sqrt(s1 × s2): Geometric mean, balances both slopes proportionally.
• RMS(s1,s2) = sqrt((s1² + s2²) ÷ 2): Root-mean-square, emphasizes the larger slope.
• L2 = sqrt(s1² + s2²): Euclidean norm, the vector length of both slopes combined.
________________________________________
Slope Blends
• Quadratic weighting: s_quad = s0 × ((V−L)² + (H−V)²) ÷ (ΔP²)
• Tilted slope: s_tilt = s0 × (0.5 + λ)
• Entropy-scaled slope: s_ent = s0 × H2(λ), with H2(λ) = −
________________________________________
Curvature & Liquidity Extensions
• π-arc × λ: s_arc = sπ × λ
• Liquidity-π: s_piV = sπ × (V ÷ Mid)
________________________________________
Scale-Normalized Families
With k = sqrt(H ÷ L):
• k (scale factor) = sqrt(H ÷ L)
• s_comp = s0 ÷ k: compressed slope candidate
• s_exp = s0 × k: expanded slope candidate
• Exponentiated blends:
- s_kλ = s0 × k^(2λ−1)
- s_φλ = s0 × φ^(2λ−1), with φ = golden ratio ≈ 1.618
- s_√2λ = s0 × (√2)^(2λ−1)
________________________________________
Practical Application
All formulas generate liquidity-weighted price-per-bar ratios that integrate range, time, and VPOC placement.
These values are designed for:
• Chart compression settings
• Testing harmonic alignments across swings
• Liquidity-aware scaling experiments
________________________________________
Auto Trend Lines v1.0 This advanced Pine Script indicator automatically detects and draws support and resistance trendlines for any instrument based on two independent lookback periods—short-term and long-term—making it suitable for all types of traders. The indicator identifies pivot highs and lows for both user-configurable lookback lengths, draws trendlines from each anchor point to the current bar, and supports a visually intuitive chart by coloring and labeling each line type separately.
Key features:
Dual lookback: Choose separate short-term and long-term sensitivity for pivots and trendlines.
Customizable: Select the number of displayed lines, colors, and line widths to suit your preferences.
Auto-updating: Trendlines update dynamically with new pivots and extend to the latest bar.
This indicator is ideal for those who want to automate trendline analysis, spot key breakout and reversal areas, and streamline technical trading.
RSI Multi Length + Normalized BBW (Butrait)RSI + BB: este indicador muestra cuando el valor esta en sobre venta o sobre compra.
Constance Brown Composite Index EnhancedWhat This Indicator Does
Implements Constance Brown's copyrighted Composite Index formula (1996) from her Master's thesis - a breakthrough oscillator that solves the critical problem where RSI fails to show divergences in long-horizon trends, providing early warning signals for major market reversals.
The Problem It Solves
Traditional RSI frequently fails to display divergence signals in Global Equity Indexes and long-term charts, leaving asset managers without warning of major price reversals. Brown's research showed RSI failed to provide divergence signals 42 times across major markets - failures that would have been "extremely costly for asset managers."
Key Components
Composite Line: RSI Momentum (9-period) + Smoothed RSI Average - the core breakthrough formula
Fast/Slow Moving Averages: Trend direction confirmation (13/33 periods default)
Bollinger Bands: Volatility envelope around the composite signal
Enhanced Divergence Detection: Significantly improved trend reversal timing vs standard RSI
Research-Proven Performance
Based on Brown's extensive study across 6 major markets (1919-2015):
42 divergence signals triggered where RSI showed none
33 signals passed with meaningful reversals (78% success rate)
Only 5 failures - exceptional performance in monthly/2-month timeframes
Tested on: German DAX, French CAC 40, Shanghai Composite, Dow Jones, US/Japanese Government Bonds
New Customization Features
Moving Average Types: Choose SMA or EMA for fast/slow lines
Optional Fills: Toggle composite and Bollinger band fills on/off
All Periods Adjustable: RSI length, momentum, smoothing periods
Visual Styling: Customize colors and line widths in Style tab
Default Settings (Original Formula)
RSI Length: 14
RSI Momentum: 9 periods
RSI MA Length: 3
SMA Length: 3
Fast SMA: 13, Slow SMA: 33
Bollinger STD: 2.0
Applications
Long-term investing: Monthly/2-month charts for major trend changes
Elliott Wave analysis: Maximum displacement at 3rd-of-3rd waves, divergence at 5th waves
Multi-timeframe: Pairs well with MACD, works across all timeframes
Global markets: Proven effective on equities, bonds, currencies, commodities
Perfect for serious traders and asset managers seeking the proven mathematical edge that traditional RSI cannot provide.
AmazingGPT//@version=6
indicator("AmazingGPT", shorttitle="AmazingGPT", overlay=true, max_lines_count=500, max_labels_count=500)
// ─────────────────────────── Inputs
group_ma = "SMMA"
group_avwap = "AVWAP"
group_fibo = "Fibo"
group_toler = "Yakınlık (2/3)"
group_trig = "Trigger & Onay"
group_misc = "Görsel/HUD"
// SMMA
len21 = input.int(21, "SMMA 21", group=group_ma, minval=1)
len50 = input.int(50, "SMMA 50", group=group_ma, minval=1)
len200 = input.int(200, "SMMA 200", group=group_ma, minval=1)
// AVWAP
const int anchorDefault = timestamp("2025-06-13T00:00:00")
anchorTime = input.time(anchorDefault, "AVWAP Anchor (tarih)", group=group_avwap)
bandMode = input.string("ATR", "Band mode", options= , group=group_avwap)
band1K = input.float(1.0, "Band 1 (×Unit)", step=0.1, group=group_avwap)
band2K = input.float(0.0, "Band 2 (×Unit)", step=0.1, group=group_avwap)
// Fibo
useAutoFib = input.bool(false, "Auto Fib (son 252 bar HL)", group=group_fibo)
fibL_in = input.float(0.0, "Swing Low (fiyat)", group=group_fibo, step=0.01)
fibH_in = input.float(0.0, "Swing High (fiyat)", group=group_fibo, step=0.01)
// Yakınlık (2/3) – ayrı eşikler
tolMA = input.float(1.00, "Yakınlık eşiği – SMMA (×ATR)", minval=0.0, step=0.05, group=group_toler)
tolAV = input.float(0.80, "Yakınlık eşiği – AVWAP (×ATR)", minval=0.0, step=0.05, group=group_toler)
tolFibo = input.float(0.60, "Yakınlık eşiği – Fibo (×ATR)", minval=0.0, step=0.05, group=group_toler)
starterTolMA = input.float(1.00, "Starter SMMA eşiği (×ATR)", minval=0.0, step=0.05, group=group_toler)
// Trigger & Onay
useDailyLock = input.bool(true, "Lock core calcs to Daily (1D)", group=group_trig)
triggerSrc = input.string("Auto", "Trigger Source", options= , group=group_trig)
useCH3auto = input.bool(true, "Auto: CH3 fallback ON", group=group_trig)
fallbackBars = input.int(3, "Fallback after N bars", minval=1, group=group_trig)
tamponTL = input.float(0.10, "Tampon (TL)", step=0.01, group=group_trig)
tamponATRf = input.float(0.15, "Tampon (×ATR)", step=0.01, group=group_trig)
capATR = input.float(0.60, "Cap (kovalama) ≤ ×ATR", step=0.05, group=group_trig)
vetoATR = input.float(1.00, "Veto (asla kovala) ≥ ×ATR", step=0.05, group=group_trig)
useRSIbreak = input.bool(false, "RSI≥50 (sadece kırılımda)", group=group_trig)
nearCloseStarter = input.bool(true, "Starter (reclaim gününde) ENABLE", group=group_trig)
// Görsel
showHud = input.bool(true, "HUD göster", group=group_misc)
showBands = input.bool(true, "AVWAP bantlarını göster", group=group_misc)
// ─────────────────────────── Daily sources (lock)
smma21D = request.security(syminfo.tickerid, "D", ta.rma(close, len21))
smma50D = request.security(syminfo.tickerid, "D", ta.rma(close, len50))
smma200D = request.security(syminfo.tickerid, "D", ta.rma(close, len200))
atrD = request.security(syminfo.tickerid, "D", ta.atr(14))
rsiD = request.security(syminfo.tickerid, "D", ta.rsi(close, 14))
v20D = request.security(syminfo.tickerid, "D", ta.sma(volume, 20))
dHighD = request.security(syminfo.tickerid, "D", high)
h3HighD = request.security(syminfo.tickerid, "D", ta.highest(high, 3))
ch3CloseD= request.security(syminfo.tickerid, "D", ta.highest(close, 3))
// ─────────────────────────── Core calcs (lock uygulanmış)
smma21 = useDailyLock ? smma21D : ta.rma(close, len21)
smma50 = useDailyLock ? smma50D : ta.rma(close, len50)
smma200 = useDailyLock ? smma200D : ta.rma(close, len200)
atr = useDailyLock ? atrD : ta.atr(14)
rsi = useDailyLock ? rsiD : ta.rsi(close, 14)
v20 = useDailyLock ? v20D : ta.sma(volume, 20)
// ─────────────────────────── AVWAP (anchor sonrası)
tp = hlc3
isAfter = time >= anchorTime
var float cumV = na
var float cumTPV = na
var float cumTP2V = na
if isAfter
cumV := nz(cumV ) + volume
cumTPV := nz(cumTPV ) + tp * volume
cumTP2V := nz(cumTP2V ) + (tp*tp) * volume
else
cumV := na
cumTPV := na
cumTP2V := na
avwap = isAfter ? (cumTPV / cumV) : na
// Band birimi: ATR veya VWAP-σ
vwVar = isAfter ? math.max(0.0, cumTP2V/cumV - avwap*avwap) : na
vwStd = isAfter ? math.sqrt(vwVar) : na
bandUnit = bandMode == "ATR" ? atr : nz(vwStd, 0)
upper1 = isAfter and showBands ? avwap + band1K*bandUnit : na
lower1 = isAfter and showBands ? avwap - band1K*bandUnit : na
upper2 = isAfter and showBands and band2K>0 ? avwap + band2K*bandUnit : na
lower2 = isAfter and showBands and band2K>0 ? avwap - band2K*bandUnit : na
// ─────────────────────────── Fibo (manuel/auto)
var float swingL = na
var float swingH = na
if useAutoFib
swingL := ta.lowest(low, 252)
swingH := ta.highest(high, 252)
else
swingL := fibL_in
swingH := fibH_in
float L = na(swingL) or na(swingH) ? na : math.min(swingL, swingH)
float H = na(swingL) or na(swingH) ? na : math.max(swingL, swingH)
fib382 = na(L) ? na : H - 0.382 * (H - L)
fib500 = na(L) ? na : H - 0.500 * (H - L)
fib618 = na(L) ? na : H - 0.618 * (H - L)
// ─────────────────────────── 2/3 yakınlık (ayrı eşikler)
d21ATR = math.abs(close - smma21) / atr
dAVATR = na(avwap) ? 10e6 : math.abs(close - avwap) / atr
dFATR = na(fib382) ? 10e6 : math.min(math.abs(close - fib382), math.min(math.abs(close - fib500), math.abs(close - fib618))) / atr
near21 = d21ATR <= tolMA
nearAV = dAVATR <= tolAV
nearFib = dFATR <= tolFibo
countConfluence = (near21?1:0) + (nearAV?1:0) + (nearFib?1:0)
twoOfThree = countConfluence >= 2
// ─────────────────────────── Trigger (Auto → CH3 fallback)
d1High = useDailyLock ? dHighD : high
h3High = useDailyLock ? h3HighD : ta.highest(high, 3)
ch3Close = useDailyLock ? ch3CloseD : ta.highest(close, 3)
stretch = d21ATR
grindCond = close > smma21 and close > avwap and close > smma21 and close > avwap and close > smma21 and close > avwap and stretch <= 0.6
reclaimCond = (close >= smma21) and (close >= avwap) and twoOfThree
tampon = math.max(tamponTL, tamponATRf*atr)
manualHigh =
triggerSrc == "D-1 High" ? d1High :
triggerSrc == "H3 High" ? h3High : na
manualTrig = not na(manualHigh) ? math.ceil((manualHigh + tampon)/syminfo.mintick)*syminfo.mintick :
triggerSrc == "CH3 Close" ? math.ceil((ch3Close + tampon)/syminfo.mintick)*syminfo.mintick : na
baseHighAuto = grindCond ? h3High : d1High
brokeHigh = high > baseHighAuto
barsNoBreak = ta.barssince(brokeHigh)
useCH3 = useCH3auto and reclaimCond and (barsNoBreak >= fallbackBars)
autoTrig = useCH3 ? math.ceil((ch3Close + tampon)/syminfo.mintick)*syminfo.mintick
: math.ceil((baseHighAuto + tampon)/syminfo.mintick)*syminfo.mintick
trigger = triggerSrc == "Auto" ? autoTrig : manualTrig
// Mesafe filtreleri (cap/veto) ve RSI kırılım filtresi
dist = close - trigger
okCap = dist <= capATR*atr
veto = dist >= vetoATR*atr
rsiOK = not useRSIbreak or (rsi >= 50)
// Starter (sadece reclaim gününde, cap'e değil SMMA yakınlığına bakar)
starterToday = nearCloseStarter and reclaimCond and (d21ATR <= starterTolMA) and (volume >= v20*1.0)
// ─────────────────────────── Plots
plot(smma21, "SMMA21", color=color.new(color.white, 0), linewidth=2)
plot(smma50, "SMMA50", color=color.new(color.blue, 0), linewidth=2)
plot(smma200, "SMMA200", color=color.new(color.red, 0), linewidth=2)
plot(avwap, "AVWAP", color=color.new(color.orange, 0), linewidth=2)
pU1 = plot(upper1, "AVWAP Band1+", color=color.new(color.lime, 40))
pL1 = plot(lower1, "AVWAP Band1-", color=color.new(color.lime, 40))
pU2 = plot(upper2, "AVWAP Band2+", color=color.new(color.green, 70))
pL2 = plot(lower2, "AVWAP Band2-", color=color.new(color.green, 70))
trigColor = okCap ? color.teal : (veto ? color.red : color.gray)
plot(trigger, "Trigger", color=color.new(trigColor, 0), style=plot.style_circles, linewidth=2)
// İşaretler
plotshape(starterToday, title="Starter", style=shape.triangleup, location=location.belowbar, color=color.new(color.teal, 0), size=size.tiny, text="Starter")
breakoutNow = (close >= trigger) and okCap and rsiOK
plotshape(breakoutNow, title="Breakout", style=shape.triangledown, location=location.abovebar, color=color.new(color.fuchsia, 0), size=size.tiny, text="BRK")
// ─────────────────────────── Alerts
alertcondition(starterToday, title="Starter_Ready", message="Starter: reclaim + Δ21 ≤ starterTolMA + v≥v20")
alertcondition(breakoutNow, title="Trigger_Breakout", message="Trigger üstü kapanış (cap OK, RSI filtresi OK)")
// ─────────────────────────── HUD
var label hudLbl = na
if barstate.islast and showHud
hudTxt = "2/3:" + (twoOfThree ? "✅" : "❌") +
" Trg:" + str.tostring(trigger, format.mintick) +
" ATR:" + str.tostring(atr, format.mintick) +
" Δ21:" + str.tostring(d21ATR, "#.##") + "≤" + str.tostring(tolMA, "#.##") +
" ΔAV:" + str.tostring(dAVATR, "#.##") + "≤" + str.tostring(tolAV, "#.##") +
" ΔF:" + str.tostring(dFATR, "#.##") + "≤" + str.tostring(tolFibo, "#.##") +
" RSI50:" + (rsiOK ? "✅" : "❌") +
" Cap:" + (okCap ? "≤"+str.tostring(capATR, "#.##")+" OK" : (veto ? "≥"+str.tostring(vetoATR, "#.##")+" VETO" : ">"+str.tostring(capATR, "#.##")+" FAR"))
if not na(hudLbl)
label.delete(hudLbl)
hudLbl := label.new(bar_index, high, hudTxt, style=label.style_label_upper_left, textcolor=color.white, color=color.new(color.black, 60))