Angle Market Structure [Mark804]Got it! Since I couldn’t find any existing public references to Angle Market Structure \ I’ll proceed based on the description you provided—rewriting it with improved clarity, flow, and impact. Let me know if you’d like to tweak anything further!
Angle Market Structure (Mark804) — Refined Overview
Angle Market Structure (Mark804) is an intelligent pivot-based indicator tailored for traders seeking early detection of breakouts and breakdowns. By dynamically angling its pivot levels toward current price action, it not only sharpens structural clarity but also accelerates signals for price movement.
Core Concepts
Adaptive Market Structure
Highlights pivot highs and lows as evolving support and resistance levels. These levels gradually converge toward price action using an angle derived from ATR (Average True Range), giving you faster, more responsive structure cues.
Breakout Acceleration
Each bar subtly shifts pivot-high levels downward and pivot-low levels upward—accelerating breakout detection and helping you act more decisively on emerging trends.
Deviation Zones
Upon a confirmed breakout or breakdown, the indicator projects three extension levels on either side (+1, +2, +3 or –1, –2, –3) to visually map price overextension and guide potential exit or trail-stop levels.
Sequential Break Count
Each structural break is numbered in sequence—providing real-time insight into trend strength and continuity.
Visual Intelligence
Utilizes color-coded pivot points, angling trend lines, and labeled deviation zones to ensure structure is intuitive and immediately actionable.
Feature Set
Pivot detection with customizable lookback length.
ATR-based “angle modifier” that dynamically tilts levels toward price.
Distinct breakout and breakdown line plotting with smooth visual extension.
Deviation level customization (+1 to +3 or –1 to –3).
Color-coded trend-break count labels (bullish or bearish).
Adaptive label sizing with theme awareness for light/dark modes.
Smart label placement to minimize visual clutter.
Cap on deviation layers to preserve performance and chart clarity.
Trading Guide
1. Use pivot-aligned structure levels to identify potential breakout/breakdown zones.
2. Monitor crossovers (for bullish continuation) or crossunders (for bearish) as potential entry signals.
3. Reference deviation levels for assessing overextension—use them to plan exits or trailing stops.
4. Watch the breakout sequence count—higher counts often correlate with stronger price momentum.
5. For validated entries, pair with volume or order-flow analysis during breakouts.
6. Adjust the ATR-based angle sensitivity based on market volatility to filter for ideal signal timing.
Final Thoughts
Angle Market Structure (Mark804) upgrades classic pivot analysis with angle-driven responsiveness and structured extension tracking. Whether scanning for impulsive moves or structural shifts, this tool brings precision, clarity, and momentum awareness to your charts—making it a go-to for proactive traders who value speed and structural insight.
Breadth Indicators
Stage + ATR Matrix + Extension LadderInspired by @SteveJacobs on X.com "Stage Analysis" and combined with ATR Extended Ladder.
Whaley Thrust — ADT / UDT / SPT (2010) + EDT (EMA) + Info BoxDescription
Implements Wayne Whaley’s 2010 Dow Award breadth-thrust framework on daily data, with a practical extension:
• ADT (Advances Thrust) — 5-day ratio of advances to (adv+dec). Triggers: > 73.66% (thrust), < 19.05% (capitulation).
• UDT (Up-Volume Thrust) — 5-day ratio of up-volume to (up+down). Triggers: > 77.88%, < 16.41%. Defaults to USI:UVOL / USI:DVOL (edit if your feed differs).
• SPT (Price Thrust) — 5-day % change of a benchmark (default SPY, toggle to use chart symbol). Triggers: > +10.05%, < −13.85%.
• EDT (EMA extension) — Declines-share thrust derived from WBT logic (not in Whaley’s paper): EMA/SMA of Declines / (Adv+Decl). Triggers: > 0.8095 (declines thrust), < 0.2634 (declines abating).
• All-Clear — Prints when ADT+ and UDT+ occur within N days (default 10); marks the second event and shades brighter green.
Visuals & Controls
• Shape markers for each event; toggle text labels on/off.
• Optional background shading (green for thrusts, red for capitulations; brighter green for All-Clear).
• Compact info box showing live ADT / UDT / SPT (white by default; turns green/red at thresholds).
• Min-spacing filter to prevent duplicate prints.
Tips
• Use on Daily charts (paper uses 5 trading days). Weekly views can miss mid-week crosses.
• If UDT shows 100%, verify your Down Volume symbol; the script requires both UVOL and DVOL to be > 0.
• Best use: treat capitulations (−) as setup context; act on thrusts (+)—especially when ADT+ & UDT+ cluster (All-Clear).
Credit
Core method from Wayne Whaley (2010), Planes, Trains and Automobiles (Dow Award). EDT is an added, complementary interpretation using WBT-style smoothing.
Gabriel's KusKus Starlight✨ Gabriel’s KusKus Starlight – Volume-Powered Momentum & Reversal Signals
Overview:
Gabriel’s KusKus Starlight is a powerful momentum and reversal indicator that uses Cumulative Volume Delta (CVD) to detect where the real market pressure is—behind the candles. Instead of just watching price, this tool listens to the story told by volume and trader aggression, making it especially effective during choppy or manipulative markets.
🧠 What Makes It Unique?
📦 Volume-Driven Core (CVD):
Tracks whether buyers or sellers are in control by accumulating volume differences between bullish and bearish candles.
🎯 Fisher Transform Smoothing:
Transforms CVD signals into a more readable, Gaussian-like curve to detect turning points more clearly.
🌀 Double Smoothing for Stability:
Adjustable smoothing settings give you full control over how reactive or calm the signal behaves.
📉 Jurik Moving Average (JMA) Signal Line:
Smooth, adaptive trendline that helps confirm entries and filters out noise. Think of it as a trend “compass” for your oscillator.
📊 Z-Score Highlighting:
Uses statistical normalization to flag overbought and oversold conditions with lime and fuchsia highlights when things get extreme.
🚀 Velocity of Z-Score (Bonus Signal):
Measures how fast momentum is changing, helping you spot accelerations in sentiment before price catches up. Typically Oscillator values below this shaded area, are underwater.
📊 Divergence Detection Suite
🔍 Supports
📈 Regular Divergences (trend reversal signals)
📉 Hidden Divergences (trend continuation signals)
🕰 Timeframe Flexibility
📊 Works on the primary chart or
⏳ Alternate timeframe for higher-timeframe confirmation
🎯 Pivot Sources
🌟 Starlight Momentum (Fisher-based)
📏 Jurik Signal Line
📊 Z-Score of Momentum
⚡ Velocity of Momentum
⚙ Customization
🎚 Configurable pivot sensitivity
📏 Adjustable maximum bars to check
🎨 Custom line styles/colors for easy chart interpretation
🔔 Alerts Included:
✅ Bullish CVD Signal: When momentum flips above zero and Z-Score is rising.
❌ Bearish CVD Signal: When momentum dips below zero and Z-Score is falling.
🎨 How to Read It:
Lime bars = Strong bullish breakout building
Green bars = Uptrend holding
Fuchsia bars = Strong bearish breakdown forming
Red bars = Downtrend continuing
Yellow line = Jurik signal MA (watch slope)
Blue area = Speed of change in momentum (Z-Score velocity)
Faded Teal and Maroon lines = Divergence Engine
🧪 Best Use Cases:
Spot early trend reversals powered by actual volume behavior.
Confirm or fade breakouts with real-time buyer/seller strength.
Pair with price action or divergence for high-conviction entries.
Use the Z-Score background highlight for potential exhaustion zones.
⚙️ Fully Customizable Inputs:
Input Description
CVD Range Periods Defines the lookback range for volume shifts
Fisher Smoothing Controls how reactive the Fisher transform is
Index Smoothing Smooths the Fisher output even further
Jurik MA Length Governs the adaptive smoothing of the signal line
📌 Final Word:
If you’re tired of laggy indicators or false signals in low-volume zones, Gabriel’s KusKus Starlight gives you true market intent—based on volume delta, not guesses. It's simple to read, surprisingly deep, and battle-tested.
TTM Squeeze(Squeeze Momentum Indicator [LazyBear] w/ ATR)-DejanTTM Squeeze (Squeeze Momentum Indicator w/ ATR) - Dejan Edition
This indicator is an enhanced version based on LazyBear's open-source release. Key modifications include:
- Added support for ATR-based Keltner Channels with customizable parameters
- Improved visual aesthetics with color enhancements
- Upgraded the original Pine Script v4 code to the latest Pine Script v6 syntax
中文:
TTM Squeeze(Squeeze Momentum Indicator w/ ATR) - Dejan 指标是基于LazyBear发布开源的版本改造的, 主要添加了肯特纳通道带ATR参数设置的支持和一些颜色上的美化, 并把原版旧的pine script v4语法代码升级为最新pine script v6语法代码。
Fractal Suite: MTF Fractals + BOS/CHOCH + OB + FVG + Targets Kese Way
Fractals (Multi-Timeframe): Automatically detects both current-timeframe and higher-timeframe Bill Williams fractals, with customizable left/right bar settings.
Break of Structure (BOS) & CHoCH: Marks structural breaks and changes of character in real time.
Liquidity Sweeps: Identifies sweep patterns where price takes out a previous swing high/low but closes back within range.
Order Blocks (OB): Highlights the last opposite candle before a BOS, with customizable extension bars.
Fair Value Gaps (FVG): Finds 3-bar inefficiencies with a minimum size filter.
Confluence Zones: Optionally require OB–FVG overlap for high-probability setups.
Entry, Stop, and Targets: Automatically calculates entry price, stop loss, and up to three take-profit targets based on risk-reward ratios.
Visual Dashboard: Mini on-chart table summarizing structure, last swing points, and settings.
Alerts: Set alerts for new fractals, BOS events, and confluence-based trade setups.
NIFTY SL Risk & Reversal Filter(Rravindra)//@version=5
indicator("NIFTY SL Risk & Reversal Filter", overlay=true, max_labels_count=500)
// ====== USER INPUTS ======
vixMin = input.float(13.5, "Min VIX to Allow Trade")
gapUpSafeMin = input.float(0.10, "Min Gap Up % (Low Risk)") // e.g., 0.10 = 0.10%
gapDownHighRisk = input.float(-0.30, "Gap Down % (High Risk)") // e.g., -0.30 = -0.30%
trendConfirmPct = input.float(0.20, "Min Early Trend % to Confirm Trade")
lossStreakDays = input.int(2, "Skip After X Consecutive SL Days")
// ====== GET DATA ======
// Get yesterday's close for gap calculation
prevClose = request.security(syminfo.tickerid, "D", close )
gapPerc = ((open - prevClose) / prevClose) * 100
// Get India VIX value (requires INDIAVIX to be available on TradingView)
vix = request.security("INDIAVIX", "D", close)
// Early 30-min session range on intraday 5-min chart (6 bars of 5 minutes = 30 minutes)
bars30 = 6
earlyMove = ((close - open) / open) * 100
// ====== LOSS STREAK TRACKER ======
// Simulated logic for now — needs manual tagging or separate logic for actual trade history
var streak = 0
if bar_index > 1
if streak >= lossStreakDays
streak := lossStreakDays
else
streak := streak
// ====== RISK CONDITIONS ======
lowVixRisk = vix < vixMin
largeGapDownRisk = gapPerc <= gapDownHighRisk
gapUpRevRisk = (gapPerc >= gapUpSafeMin) and (math.abs(earlyMove) < trendConfirmPct)
gapDownRevRisk = (gapPerc <= gapDownHighRisk) and (math.abs(earlyMove) < trendConfirmPct)
lossClusterRisk = streak >= lossStreakDays
// Combine all risk checks
highRiskDay = lowVixRisk or largeGapDownRisk or gapUpRevRisk or gapDownRevRisk or lossClusterRisk
// ====== PLOTTING & LABELS ======
plotshape(highRiskDay, title="NO TRADE", style=shape.labeldown, text="NO TRADE",
location=location.abovebar, color=color.red, size=size.small)
plotshape(not highRiskDay, title="TRADE OK", style=shape.labelup, text="TRADE OK",
location=location.belowbar, color=color.green, size=size.small)
bgcolor(highRiskDay ? color.new(color.red, 85) : na)
bgcolor(not highRiskDay ? color.new(color.green, 85) : na)
// ====== DEBUG PANEL ======
var label debugLbl = na
if barstate.islast
label.delete(debugLbl)
txt = "Gap%: " + str.tostring(gapPerc, format.mintick) +
" VIX: " + str.tostring(vix, format.mintick) +
" 30m Move: " + str.tostring(earlyMove, format.mintick) +
" Risk: " + (highRiskDay ? "HIGH" : "OK")
debugLbl := label.new(
bar_index, high, txt,
style=label.style_label_down,
color=color.white, textcolor=color.black, size=size.normal
)
RSI DJ GUTO 2025RSI do Samuca, tem de trocar as cores, esse e o usado nas lives, tem de trocar as cores pra ficar igual ao do Samuca pois aqui nao consegui trocar as cores.
Samuca's RSI, you have to change the colors, this is the one used in the lives, you have to change the colors to be the same as Samuca's because I couldn't change the colors here.
Calculateur Position Size Multi-ActifsThe Multi-Asset Position Size Calculator v6 is a fully customizable Pine Script indicator designed to help you determine the optimal position size based on your risk tolerance across any market: Forex, stocks, crypto, futures indices, or commodities. Features include:
Asset Type Selector: Choose between Forex, Stocks, Crypto, Futures Indices, or Commodities
Account Capital & Risk: Set your total account size and risk percentage per trade
Entry Price & Stop-Loss: Configure your entry and stop-loss levels directly
Automatic or Custom Pip/Point Value: Automatically calculates pip/point value by asset class or enter your own
Contract Size Adjustment: Define contract sizes (e.g., 100,000 units for Forex, 1 for stocks/crypto)
Margin & Leverage Display: View your used leverage and position value in real time
Risk Alerts: Warnings for invalid inputs, high leverage (>10×), and asset-specific risk settings (e.g., crypto leverage)
Integrated Table Interface: On-chart table with adjustable position and text size
Optional Price Level Drawing: Display entry and stop-loss lines on the chart
Trade any market confidently with precise, asset-tailored position sizing and risk management.
Multi-Symbol Option SL & VWAP Reversal Detector//@version=5
indicator("Multi-Symbol Option SL & VWAP Reversal Detector", overlay=true, max_labels_count=500)
//========== USER INPUTS ==========//
// Option symbols (must be available in TradingView)
ceSymbol = input.symbol("NIFTY24AUG22500CE", "Call Option Symbol (CE)")
peSymbol = input.symbol("NIFTY24AUG22500PE", "Put Option Symbol (PE)")
// Underlying (Spot/Futures for reversal check)
underlyingSymbol= input.symbol("NIFTY1!", "Underlying Futures/Spot Symbol")
// Entry Premiums for each leg (your actual sell prices)
ceEntryPrem = input.float(100.0, "CE Entry Premium")
peEntryPrem = input.float(100.0, "PE Entry Premium")
// Stop Loss % per leg (25% = 1.25x entry premium)
slPercent = input.float(25.0, "Stoploss % per Leg")
revLookbackBars = input.int(12, "Reversal Lookback Bars")
revThreshPct = input.float(0.20, "Reversal % Threshold after SL")
//========== REQUEST PRICE DATA ==========//
// Option leg close prices
ceClose = request.security(ceSymbol, timeframe.period, close)
peClose = request.security(peSymbol, timeframe.period, close)
// Underlying close price
uClose = request.security(underlyingSymbol, timeframe.period, close)
uHigh = request.security(underlyingSymbol, timeframe.period, high)
uLow = request.security(underlyingSymbol, timeframe.period, low)
//========== CALCULATE SL PRICES ==========
ceSLPrice = ceEntryPrem * (1 + slPercent/100)
peSLPrice = peEntryPrem * (1 + slPercent/100)
//========== TRACK SL HITS ==========
var bool ceSLHit = false
var bool peSLHit = false
if not ceSLHit and ceClose >= ceSLPrice
ceSLHit := true
if not peSLHit and peClose >= peSLPrice
peSLHit := true
// First Leg SL trigger
firstLegSLHit = ceSLHit or peSLHit
//========== RECORD PRICE AT SL ==========
var float uPriceAtSL = na
if firstLegSLHit and na(uPriceAtSL)
uPriceAtSL := uClose
//========== VWAP CALCULATION ==========
vwap = ta.vwap(uClose) // volume-weighted average price of underlying
//========== REVERSAL DETECTION ==========
reversalDetected = false
// Price change since first SL trigger
priceChangePct = 100 * (uClose - uPriceAtSL) / uPriceAtSL
// If CE SL hit (underlying moved up), reversal = cross below VWAP and drop >= threshold
if ceSLHit and priceChangePct <= -revThreshPct and ta.crossunder(uClose, vwap)
reversalDetected := true
// If PE SL hit (underlying moved down), reversal = cross above VWAP and rise >= threshold
if peSLHit and priceChangePct >= revThreshPct and ta.crossover(uClose, vwap)
reversalDetected := true
//========== EXIT SECOND LEG SIGNAL ==========
exitSecondLegSignal = firstLegSLHit and reversalDetected
//========== PLOTTING ==========
plot(vwap, "VWAP", color=color.orange, linewidth=2)
plotshape(ceSLHit, title="CE SL Hit", style=shape.labeldown, location=location.abovebar,
text="CE SL Hit", color=color.red, size=size.small)
plotshape(peSLHit, title="PE SL Hit", style=shape.labeldown, location=location.abovebar,
text="PE SL Hit", color=color.red, size=size.small)
plotshape(exitSecondLegSignal, title="Exit Second Leg", style=shape.labelup, location=location.belowbar,
text="EXIT 2nd LEG", color=color.green, size=size.normal)
// Alert condition for exit
alertcondition(exitSecondLegSignal, title="Exit Second Leg Alert",
message="VWAP Reversal detected after first SL hit — exit second leg!")
// Debug info panel
var label dbgLabel = na
if barstate.islast
label.delete(dbgLabel)
dbgText = "uPriceAtSL: " + str.tostring(uPriceAtSL, format.mintick) +
" PriceChange%: " + str.tostring(priceChangePct, "#.##") +
" First SL: " + (firstLegSLHit ? "Yes" : "No") +
" Exit Signal: " + (exitSecondLegSignal ? "YES" : "NO")
dbgLabel := label.new(bar_index, high, dbgText, style=label.style_label_down,
color=color.white, textcolor=color.black)
Intraday Reversal & SL Risk Filter//@version=5
indicator("Intraday Reversal & SL Risk Filter", overlay=true, max_labels_count=500)
// ==== INPUTS ====
gapUpAlert = input.float(0.1, "Gap Up % filter (min)") // e.g., 0.1 = 0.1%
gapDownAlert = input.float(0.3, "Gap Down % high risk level") // e.g., 0.3 = 0.3%
vixMin = input.float(13.5, "Min VIX to trade")
reversalThresh = input.float(0.2, "Reversal % Threshold after open")
firstHourMins = input.int(60, "First Hour Duration (minutes)")
// ==== GET PREVIOUS CLOSE ====
prevClose = request.security(syminfo.tickerid, "D", close )
gapPerc = ((open - prevClose) / prevClose) * 100
// ==== VIX FILTER ====
vixSymbol = "INDIAVIX"
vixVal = request.security(vixSymbol, "D", close)
// ==== INTRADAY REVERSAL DETECTION ====
barsInFirstHour = math.floor(firstHourMins / timeframe.multiplier)
dayOpen = request.security(syminfo.tickerid, "D", open)
firstHourHigh = ta.highest(high, barsInFirstHour)
firstHourLow = ta.lowest(low, barsInFirstHour)
gapUpReversal = (gapPerc >= gapUpAlert) and ((firstHourHigh - close) / dayOpen * 100 > reversalThresh)
gapDownReversal = (gapPerc <= -gapDownAlert) and ((close - firstHourLow) / dayOpen * 100 > reversalThresh)
lowVixRisk = vixVal < vixMin
largeGapDownRisk = gapPerc <= -gapDownAlert
firstHourRevRisk = gapUpReversal or gapDownReversal
highRisk = lowVixRisk or largeGapDownRisk or firstHourRevRisk
// ==== PLOTS & LABELS ====
plotshape(highRisk, title="High Risk Day", style=shape.labeldown, location=location.abovebar, color=color.red, text="NO TRADE", size=size.small)
plotshape(not highRisk, title="Safe Day", style=shape.labelup, location=location.belowbar, color=color.green, text="TRADE OK", size=size.small)
// ==== BACKGROUND COLOR ====
bgcolor(highRisk ? color.new(color.red, 85) : na)
bgcolor(not highRisk ? color.new(color.green, 85) : na)
// ==== DEBUG INFO (last bar only) ====
var label debugLbl = na
if barstate.islast
label.delete(debugLbl)
debugTxt = "Gap%: " + str.tostring(gapPerc, format.mintick) +
" VIX: " + str.tostring(vixVal, format.mintick) +
" Risk: " + (highRisk ? "HIGH" : "OK")
debugLbl := label.new(bar_index, high, debugTxt, color=color.white, textcolor=color.black, style=label.style_label_down)
連騰カウントCount arbitrary winning streaks and calculate their occurrence probability over a specified period.
For example, if a 5-day winning streak occurs only 0.3% of the time, it indicates that the price movement is not random, but rather a clear sign of capital inflows — making it a useful metric for analysis.
First Candle ChannelTo create a price channel on the 15-minute timeframe based on the first candle's highest and lowest points, follow these steps:
Identify the first 15-minute candle of the trading session or your observation period.
Note the high and low prices of this first candle.
Draw two horizontal lines on the chart:
The upper line at the highest price of the first candle.
The lower line at the lowest price of the first candle.
These two lines form the channel boundaries for subsequent price action.
You can use this channel to observe price movement, noting when price breaks above (bullish breakout) or below (bearish breakdown) the channel formed by the first candle.
This method creates a simple visual range reference based on the initial price movement of the session or period, often used to gauge early strength or rarity of breakout events.
Gamma & Max Pain HelperGamma & Max Pain Helper
Plots Call Wall, Put Wall, and Max Pain levels directly on your chart so you can see where options positioning might influence price.
Features:
Manually enter Call Wall, Put Wall, and Max Pain strike prices.
Lines auto-update each bar — no redrawing needed.
Labels display name + strike price.
Option to only show lines near current price (within a % you choose).
Color-coded:
Red = Call Wall (potential resistance)
Green = Put Wall (potential support)
Blue = Max Pain (price magnet into expiry)
Adjustable line width & extension.
Use Case:
Perfect for traders combining options open interest/gamma analysis with price action, pivots, VWAP, and other intraday levels. Quickly spot overlaps between option walls and technical barriers for high-probability reaction zones.
cp100 Risk Filter(Ravindra purphit)This script flags NO TRADE days for options trading based on three risk filters: (1) large opening gap, (2) low VIX, and (3) reversal in the first hour following a gap. It also shows "TRADE OK" on safe days. Intended for NIFTY intraday risk management.
VP-Period with Previous Day Levels & Historical POC# Volume Profile with Previous Day Levels & Historical POCs
## Description
Comprehensive indicator combining Volume Profile analysis, previous day levels, and historical POC (Point of Control) levels for advanced technical analysis.
## Key Features
### Volume Profile
- **Customizable period**: 3 to 500 days
- **Calculation resolution**: 400 to 700 points
- **Current VPOC**: Point of Control line for current period
- **Volume bars**: graphical display of volume profile distribution
### Historical POCs
- **POC history**: up to 20 previous days
- **Time labels**: shows how many days ago for each POC
- **Dashed lines**: easy identification of historical levels
### Previous Day Levels (last 5 days)
- **High/Low**: daily highs and lows
- **Midpoint**: 50% level (High+Low)/2
- **Open/Close**: opening and closing prices
- **Progressive thickness**: day 1 thicker, decreasing for previous days
## Customization
- Fully configurable colors for each element
- Toggle on/off switches for every component
- Different line styles (solid, dashed, dotted)
## Usage
Perfect for traders using volume analysis and support/resistance based on previous daily levels. Ideal for identifying key zones and significant breakout points.
4 Moving Averages 4 Moving Averages
An indicator with four moving averages with ready-to-use settings. Use them as support and resistance.
Linh's Anomaly Radar v2What this script does
It’s an event detector for price/volume anomalies that often precede or confirm moves.
It watches a bunch of patterns (Wyckoff tests, squeezes, failed breakouts, turnover bursts, etc.), applies robust z-scores, optional trend filters, cooldowns (to avoid spam), and then fires:
A shape/label on the bar,
A row in the mini panel (top-right),
A ready-made alertcondition you can hook into.
How to add & set up (TradingView)
Paste the script → Save → Add to chart on Daily first (works on any TF).
Open Settings → Inputs:
General
• Use Robust Z (MAD): more outlier-resistant; keep on.
• Z Lookback: 60 bars is ~3 months; bump to 120 for slower regimes.
• Cooldown: min bars to wait before the same signal can fire again (default 5).
• Use trend filter: if on, “bullish” signals only fire above SMA(tfLen), “bearish” below.
Thresholds: fine-tune sensitivity (defaults are sane).
To create alerts: Right-click chart → Add alert
Condition: Linh’s Anomaly Radar v2 → choose a specific signal or Composite (Σ).
Options: “Once per bar close” (recommended).
Customize message if you want ticker/timeframe in your phone push.
The mini panel (top-right)
Signal column: short code (see cheat sheet below).
Fired column: a dot “•” means that on the latest bar this signal fired.
Score (right column): total count of signals that fired this bar.
Σ≥N shows your composite threshold (how many must fire to trigger the “Composite” alert).
Shapes & codes (what’s what)
Code Name (category) What it’s looking for Why it matters
STL Stealth Volume z(volume)>5 & ** z(return)
EVR Effort vs Result squeeze z(vol)>3 & z(TR)<−0.5 Heavy effort, tiny spread → absorption
TGV Tight+Heavy (HL/ATR)<0.6 & z(vol)>3 Tight bar + heavy tape → pro activity
CLS Accumulation cluster ≥3 of last 5 bars: up, vol↑, close near high Classic accumulation footprint
GAP Open drive failure Big gap not filled (≥80%) & vol↑ One-sided open stalls → fade risk
BB↑ BB squeeze breakout Squeeze (z(BBWidth)<−1.3) → close > upperBB & vol↑ Regime shift with confirmation
ER↑ Effort→Result inversion Down day on vol then next bar > prior high Demand overwhelms supply
OBV OBV divergence OBV slope up & ** z(ret20)
WER Wide Effort, Opposite Result z(vol)>3, close+1 Selling into strength / distribution
NS No-Supply (Wyckoff) Down bar, HL<0.6·ATR, vol << avg Sellers absent into weakness
ND No-Demand (Wyckoff) Up bar, HL<0.6·ATR, vol << avg Buyers absent into strength
VAC Liquidity Vacuum z(vol)<−1.5 & ** z(ret)
UTD UTAD (failed breakout) Breaks swing-high, closes back below, vol↑ Stop-run, reversal risk
SPR Spring (failed breakdown) Breaks swing-low, closes back above, vol↑ Bear trap, reversal risk
PIV Pocket Pivot Up bar; vol > max down-vol in lookback Quiet base → sudden demand
NR7 Narrow Range 7 + Vol HL is 7-bar low & z(vol)>2 Coiled spring with participation
52W 52-wk breakout quality New 52-wk close high + squeeze + vol↑ High-quality breakouts
VvK Vol-of-Vol kink z(ATR20,200)>0.5 & z(ATR5,60)<0 Long-vol wakes up, short-vol compresses
TAC Turnover acceleration SMA3 vol / SMA20 vol > 1.8 & muted return Participation surging before move
RBd RSI Bullish div Price LL, RSI HL, vol z>1 Exhaustion of sellers
RS↑ RSI Bearish div Price HH, RSI LH, vol z>1 Exhaustion of buyers
Σ Composite Count of all fired signals ≥ threshold High-conviction bar
Placement:
Triangles up (below bar) → bullish-leaning events.
Triangles down (above bar) → bearish-leaning events.
Circles → neutral context (VAC, VvK, Composite).
Key inputs (quick reference)
General
Use Robust Z (MAD): keep on for noisy tickers.
Z Lookback (lenZ): 60 default; 120 if you want fewer alerts.
Trend filter: when on, bullish signals require close > SMA(tfLen), bearish require <.
Cooldown: prevents repeated firing of the same signal within N bars.
Phase-1 thresholds (core)
Stealth: vol z > 5, |ret z| < 1.
EVR: vol z > 3, TR z < −0.5.
Tight+Heavy: (HL/ATR) < 0.6, vol z > 3.
Cluster: window=5, min=3 strong bars.
GapFail: gap/ATR ≥1.5, fill <80%, vol z > 2.
BB Squeeze: z(BBWidth)<−1.3 then breakout with vol z > 2.
Eff→Res Up: prev bar heavy down → current bar > prior high.
OBV Div: OBV uptrend + |z(ret20)|<0.3.
Phase-2 thresholds (extras)
WER: vol z > 3, close1.
No-Supply/No-Demand: tight bar & very light volume vs SMA20.
Vacuum: vol z < −1.5, |ret z|>1.5.
UTAD/Spring: swing lookback N (default 20), vol z > 2.
Pocket Pivot: lookback for prior down-vol max (default 10).
NR7: 7-bar narrowest range + vol z > 2.
52W Quality: new 52-wk high + squeeze + vol z > 2.
VoV Kink: z(ATR20,200)>0.5 AND z(ATR5,60)<0.
Turnover Accel: SMA3/SMA20 > 1.8 and |ret z|<1.
RSI Divergences: compare to n bars back (default 14).
How to use it (playbooks)
A) Daily scan workflow
Run on Daily for your VN watchlist.
Turn Composite (Σ) alert on with Σ≥2 or ≥3 to reduce noise.
When a bar fires Σ (or a fav combo like STL + BB↑), drop to 60-min to time entries.
B) Breakout quality check
Look for 52W together with BB↑, TAC, and OBV.
If WER/ND appear near highs → downgrade the breakout.
C) Spring/UTAD reversals
If SPR fires near major support and RBd confirms → long bias with stop below spring low.
If UTD + WER/RS↑ near resistance → short/fade with stop above UTAD high.
D) Accumulation basing
During bases, you want CLS, OBV, TGV, STL, NR7.
A pocket pivot (PIV) can be your early add; manage risk below base lows.
Tuning tips
Too many signals? Raise stealthVolZ to 5.5–6, evrVolZ to 3.5, use Σ≥3.
Fast movers? Lower bbwZthr to −1.0 (less strict squeeze), keep trend filter on.
Illiquid tickers? Keep MAD z-scores on, increase lookbacks (e.g., lenZ=120).
Limitations & good habits
First lenZ bars on a new symbol are less reliable (incomplete z-window).
Some ideas (VWAP magnet, close auction spikes, ETF/foreign flows, options skew) need intraday/external feeds — not included here.
Pine can’t “screen” across the whole market; set alerts or cycle your watchlist.
Quick troubleshooting
Compilation errors: make sure you’re on Pine v6; don’t nest functions in if blocks; each var int must be declared on its own line.
No shapes firing: check trend filter (maybe price is below SMA and you’re waiting for bullish signals), and verify thresholds aren’t too strict.
VN30 Effort-vs-Result Multi-Scanner — LinhVN30 Effort-vs-Result Multi-Scanner (Pine v5)
Cross-section scanner for Vietnam’s VN30 stocks that surfaces Effort vs Result footprints and related accumulation/distribution and volatility tells. It renders a ranked table (Top-N) with per-ticker signals and key metrics.
What it does
Scans up to 30 tickers (editable input.symbol slots) using one security() call per symbol → stays under Pine’s 40-call limit and runs reliably on any chart.
Scores each ticker by counting active signals, then ranks and lists the top names.
Optional metrics columns: zVol(60), zTR(60), ATR(20), HL/ATR(20).
Signals (toggleable)
Price/Volume – Effort vs Result
EVR Squeeze (stealth): z(Vol,60) > 4 & z(TR,60) < −0.5
5σ Vol, ≤1σ Ret: z(Vol,60) > 5 & |z(Return,60)| < 1
Wide Effort, Opposite Result: z(Vol,60) > 3 & close < open & z(CLV×Vol,60) > 1
Spread Compression, Heavy Tape: (H−L)/ATR(20) < 0.6 & z(Vol,60) > 3
No-Supply / No-Demand: close < close & range < 0.6×ATR(20) & vol < 0.5×SMA(20)
Momentum & Volatility
Vol-of-Vol Kink: z(ATR20,200) rising & z(ATR5,60) falling
BB Squeeze → Expansion: BBWidth(20) in low regime (z<−1.3) then close > upper band & z(Vol,60) > 2
RSI Non-Confirmation: Price LL/HH with RSI HL/LH & z(Vol,60) > 1
Accumulation/Distribution
OBV Divergence w/ Flat Price: OBV slope > 0 & |z(ret20,260)| < 0.3
Accumulation Days Cluster: ≥3/5 bars: up close, higher vol, close near high
Effort-Result Inversion (Down): big vol on down day then next day close > prior high
How to use
Set the timeframe (works best on 1D for EOD scans).
Edit the 30 symbol slots to your VN30 constituents.
Choose Top N, toggle Show metrics/Only matches and enable/disable scenarios.
Read the table: Rank, Ticker, (metrics), Score, and comma-separated Signals fired.
Method notes
Z-scores use a population-std estimate; CLV×Vol is used for effort/location.
Rolling counts avoid ta.sum; OBV is computed manually; all logic is Pine v5-safe.
Intraday-only ideas (true VWAP magnets, auction volume, flows, futures/options) are not included—Pine can’t cross-scan those datasets.
Disclaimer: Educational tool, not financial advice. Always confirm signals on the chart and with your process.
ADVANCE HULL EMA + VWAP//@version=6
indicator("ADVANCE HULL EMA + VWAP", shorttitle="Adv Hull EMA VWAP", overlay=true, max_lines_count=500, max_labels_count=500)
// ========================================
// MOVING AVERAGE SETTINGS
// ========================================
MA_GROUP = "Moving Average Settings"
modeSwitch = input.string("Ehma", title="MA Mode", options= , group=MA_GROUP)
ma_length = input.int(16, title="MA Length", minval=1, group=MA_GROUP)
useHtf = input.bool(false, title="Use Higher Time Frame", group=MA_GROUP)
htf = input.timeframe("240", title="HTF", group=MA_GROUP)
switchColor = input.bool(true, title="Switch Color", group=MA_GROUP)
visualSwitch = input.bool(true, title="Visual Switch", group=MA_GROUP)
thicknessSwitch = input.int(1, title="Line Thickness", minval=1, group=MA_GROUP)
showEMA100 = input.bool(true, title="Show EMA 100", group=MA_GROUP)
// ========================================
// VWAP SETTINGS
// ========================================
VWAP_GROUP = "VWAP Settings"
hideonDWM = input(false, title="Hide VWAP on 1D or Above", group=VWAP_GROUP, display = display.data_window)
var anchor = input.string(defval = "Session", title="Anchor Period",
options= , group=VWAP_GROUP)
src = input(title = "Source", defval = hlc3, group=VWAP_GROUP, display = display.data_window)
offset = input.int(0, title="Offset", group=VWAP_GROUP, minval=0, display = display.data_window)
BANDS_GROUP = "VWAP Bands Settings"
CALC_MODE_TOOLTIP = "Determines the units used to calculate the distance of the bands. When 'Percentage' is selected, a multiplier of 1 means 1%."
calcModeInput = input.string("Standard Deviation", "Bands Calculation Mode", options = , group = BANDS_GROUP, tooltip = CALC_MODE_TOOLTIP, display = display.data_window)
showBand_1 = input(true, title = "", group = BANDS_GROUP, inline = "band_1", display = display.data_window)
bandMult_1 = input.float(1.0, title = "Bands Multiplier #1", group = BANDS_GROUP, inline = "band_1", step = 0.5, minval=0, display = display.data_window)
showBand_2 = input(false, title = "", group = BANDS_GROUP, inline = "band_2", display = display.data_window)
bandMult_2 = input.float(2.0, title = "Bands Multiplier #2", group = BANDS_GROUP, inline = "band_2", step = 0.5, minval=0, display = display.data_window)
showBand_3 = input(false, title = "", group = BANDS_GROUP, inline = "band_3", display = display.data_window)
bandMult_3 = input.float(3.0, title = "Bands Multiplier #3", group = BANDS_GROUP, inline = "band_3", step = 0.5, minval=0, display = display.data_window)
// ========================================
// TRENDLINES SETTINGS
// ========================================
TRENDLINES_GROUP = "Trendlines Settings"
tl_length = input.int(14, 'Swing Detection Lookback', group=TRENDLINES_GROUP)
mult = input.float(1., 'Slope', minval = 0, step = .1, group=TRENDLINES_GROUP)
calcMethod = input.string('Atr', 'Slope Calculation Method', options = , group=TRENDLINES_GROUP)
backpaint = input(true, tooltip = 'Backpainting offset displayed elements in the past. Disable backpainting to see real time information returned by the indicator.', group=TRENDLINES_GROUP)
//Style
upCss = input.color(color.teal, 'Up Trendline Color', group = TRENDLINES_GROUP)
dnCss = input.color(color.red, 'Down Trendline Color', group = TRENDLINES_GROUP)
showExt = input(true, 'Show Extended Lines', group = TRENDLINES_GROUP)
// ========================================
// MOVING AVERAGE FUNCTIONS
// ========================================
HMA(src_ma, length_ma) => ta.wma(2 * ta.wma(src_ma, length_ma / 2) - ta.wma(src_ma, length_ma), math.round(math.sqrt(length_ma)))
EHMA(src_ma, length_ma) => ta.ema(2 * ta.ema(src_ma, length_ma) - ta.ema(src_ma, length_ma), math.round(math.sqrt(length_ma)))
THMA(src_ma, length_ma) => ta.wma(ta.wma(src_ma, length_ma / 3) * 3 - ta.wma(src_ma, length_ma / 2) - ta.wma(src_ma, length_ma), length_ma)
// ========================================
// MOVING AVERAGE CALCULATIONS
// ========================================
ema100 = ta.ema(close, 100)
selectedMA = modeSwitch == "Hma" ? HMA(close, ma_length) :
modeSwitch == "Ehma" ? EHMA(close, ma_length) :
modeSwitch == "Thma" ? THMA(close, ma_length / 2) : na
_hull = useHtf ? request.security(syminfo.tickerid, htf, selectedMA) : selectedMA
MHULL = _hull
SHULL = ta.valuewhen(not na(MHULL), MHULL , 0)
// ========================================
// VWAP CALCULATIONS
// ========================================
cumVolume = ta.cum(volume)
if barstate.islast and cumVolume == 0
runtime.error("No volume is provided by the data vendor.")
new_earnings = request.earnings(syminfo.tickerid, earnings.actual, barmerge.gaps_on, barmerge.lookahead_on, ignore_invalid_symbol=true)
new_dividends = request.dividends(syminfo.tickerid, dividends.gross, barmerge.gaps_on, barmerge.lookahead_on, ignore_invalid_symbol=true)
new_split = request.splits(syminfo.tickerid, splits.denominator, barmerge.gaps_on, barmerge.lookahead_on, ignore_invalid_symbol=true)
isNewPeriod = switch anchor
"Earnings" => not na(new_earnings)
"Dividends" => not na(new_dividends)
"Splits" => not na(new_split)
"Session" => timeframe.change("D")
"Week" => timeframe.change("W")
"Month" => timeframe.change("M")
"Quarter" => timeframe.change("3M")
"Year" => timeframe.change("12M")
"Decade" => timeframe.change("12M") and year % 10 == 0
"Century" => timeframe.change("12M") and year % 100 == 0
=> false
isEsdAnchor = anchor == "Earnings" or anchor == "Dividends" or anchor == "Splits"
if na(src ) and not isEsdAnchor
isNewPeriod := true
float vwapValue = na
float upperBandValue1 = na
float lowerBandValue1 = na
float upperBandValue2 = na
float lowerBandValue2 = na
float upperBandValue3 = na
float lowerBandValue3 = na
if not (hideonDWM and timeframe.isdwm)
= ta.vwap(src, isNewPeriod, 1)
vwapValue := _vwap
stdevAbs = _stdevUpper - _vwap
bandBasis = calcModeInput == "Standard Deviation" ? stdevAbs : _vwap * 0.01
upperBandValue1 := _vwap + bandBasis * bandMult_1
lowerBandValue1 := _vwap - bandBasis * bandMult_1
upperBandValue2 := _vwap + bandBasis * bandMult_2
lowerBandValue2 := _vwap - bandBasis * bandMult_2
upperBandValue3 := _vwap + bandBasis * bandMult_3
lowerBandValue3 := _vwap - bandBasis * bandMult_3
// ========================================
// TRENDLINES CALCULATIONS
// ========================================
var upper_tl = 0.
var lower_tl = 0.
var slope_ph = 0.
var slope_pl = 0.
var tl_offset = backpaint ? tl_length : 0
n = bar_index
ph = ta.pivothigh(tl_length, tl_length)
pl = ta.pivotlow(tl_length, tl_length)
// Fix for the conditional operator issue
is_ph = not na(ph)
is_pl = not na(pl)
//Slope Calculation Method
slope = switch calcMethod
'Atr' => ta.atr(tl_length) / tl_length * mult
'Stdev' => ta.stdev(close, tl_length) / tl_length * mult
'Linreg' => math.abs(ta.sma(close * n, tl_length) - ta.sma(close, tl_length) * ta.sma(n, tl_length)) / ta.variance(n, tl_length) / 2 * mult
//Get slopes and calculate trendlines
slope_ph := is_ph ? slope : slope_ph
slope_pl := is_pl ? slope : slope_pl
upper_tl := is_ph ? ph : upper_tl - slope_ph
lower_tl := is_pl ? pl : lower_tl + slope_pl
var upos = 0
var dnos = 0
upos := is_ph ? 0 : close > upper_tl - slope_ph * tl_length ? 1 : upos
dnos := is_pl ? 0 : close < lower_tl + slope_pl * tl_length ? 1 : dnos
// ========================================
// EXTENDED TRENDLINES
// ========================================
var uptl = line.new(na,na,na,na, color = upCss, style = line.style_dashed, extend = extend.right)
var dntl = line.new(na,na,na,na, color = dnCss, style = line.style_dashed, extend = extend.right)
if is_ph and showExt
uptl.set_xy1(n-tl_offset, backpaint ? ph : upper_tl - slope_ph * tl_length)
uptl.set_xy2(n-tl_offset+1, backpaint ? ph - slope : upper_tl - slope_ph * (tl_length+1))
if is_pl and showExt
dntl.set_xy1(n-tl_offset, backpaint ? pl : lower_tl + slope_pl * tl_length)
dntl.set_xy2(n-tl_offset+1, backpaint ? pl + slope : lower_tl + slope_pl * (tl_length+1))
// ========================================
// PLOTTING - MOVING AVERAGES
// ========================================
hullColor = switchColor ? (MHULL > MHULL ? color.new(color.blue, 0) : color.new(color.red, 0)) : color.new(color.red, 0)
MHULL_plot = plot(MHULL, title="Main MA Band", color=hullColor, linewidth=thicknessSwitch)
SHULL_plot = plot(visualSwitch ? SHULL : na, title="Secondary MA Band", color=hullColor, linewidth=thicknessSwitch)
fill(MHULL_plot, SHULL_plot, color=color.new(hullColor, 80))
plot(showEMA100 ? ema100 : na, title="EMA 100", color=color.purple, linewidth=4)
// ========================================
// PLOTTING - VWAP & BANDS
// ========================================
plot(vwapValue, title = "VWAP", color = #2962FF, offset = offset, linewidth=2)
upperBand_1 = plot(upperBandValue1, title="VWAP Upper Band #1", color = color.green, offset = offset, display = showBand_1 ? display.all : display.none, editable = showBand_1)
lowerBand_1 = plot(lowerBandValue1, title="VWAP Lower Band #1", color = color.green, offset = offset, display = showBand_1 ? display.all : display.none, editable = showBand_1)
fill(upperBand_1, lowerBand_1, title="VWAP Bands Fill #1", color = color.new(color.green, 95), display = showBand_1 ? display.all : display.none, editable = showBand_1)
upperBand_2 = plot(upperBandValue2, title="VWAP Upper Band #2", color = color.olive, offset = offset, display = showBand_2 ? display.all : display.none, editable = showBand_2)
lowerBand_2 = plot(lowerBandValue2, title="VWAP Lower Band #2", color = color.olive, offset = offset, display = showBand_2 ? display.all : display.none, editable = showBand_2)
fill(upperBand_2, lowerBand_2, title="VWAP Bands Fill #2", color = color.new(color.olive, 95), display = showBand_2 ? display.all : display.none, editable = showBand_2)
upperBand_3 = plot(upperBandValue3, title="VWAP Upper Band #3", color = color.teal, offset = offset, display = showBand_3 ? display.all : display.none, editable = showBand_3)
lowerBand_3 = plot(lowerBandValue3, title="VWAP Lower Band #3", color = color.teal, offset = offset, display = showBand_3 ? display.all : display.none, editable = showBand_3)
fill(upperBand_3, lowerBand_3, title="VWAP Bands Fill #3", color = color.new(color.teal, 95), display = showBand_3 ? display.all : display.none, editable = showBand_3)
// ========================================
// PLOTTING - TRENDLINES
// ========================================
plot(backpaint ? upper_tl : upper_tl - slope_ph * tl_length, 'Upper Trendline', color = is_ph ? na : upCss, offset = -tl_offset, linewidth=2)
plot(backpaint ? lower_tl : lower_tl + slope_pl * tl_length, 'Lower Trendline', color = is_pl ? na : dnCss, offset = -tl_offset, linewidth=2)
//Breakout Signals
plotshape(upos > upos ? low : na, "Upper Break"
, shape.labelup
, location.absolute
, upCss
, text = "B"
, textcolor = color.white
, size = size.tiny)
plotshape(dnos > dnos ? high : na, "Lower Break"
, shape.labeldown
, location.absolute
, dnCss
, text = "B"
, textcolor = color.white
, size = size.tiny)
// ========================================
// ALERTS
// ========================================
alertcondition(upos > upos , 'Upward Breakout', 'Price broke the down-trendline upward')
alertcondition(dnos > dnos , 'Downward Breakout', 'Price broke the up-trendline downward')
// Additional alerts for MA crossovers
alertcondition(ta.crossover(close, MHULL), 'Price Above MA', 'Price crossed above the main moving average')
alertcondition(ta.crossunder(close, MHULL), 'Price Below MA', 'Price crossed below the main moving average')
// VWAP alerts
alertcondition(ta.crossover(close, vwapValue), 'Price Above VWAP', 'Price crossed above VWAP')
alertcondition(ta.crossunder(close, vwapValue), 'Price Below VWAP', 'Price crossed below VWAP')
Multi Timeframe 7 Bollinger Bands by CSPMulti Timeframe 7 Bollinger Bands by CSP IT SHOW 1MT,5MT,10MT,1HR,D, W,M BOLLINGER BAND IN ASINGLE CHART.
Test Wick Simple + VolumeExplanation of the “Wick + Volume” Indicator
This indicator identifies areas where the price forms a high pivot or a low pivot combined with a significant wick on the pivot candle, along with increased volume.
High pivot / low pivot: local points where the price reaches a temporary peak or trough.
Significant wick: the thin line (shadow) extending from the candle body, indicating price rejection at that level.
Increased volume: the pivot candle’s volume is higher than the recent average volume, showing strong market activity.
When these three conditions are met, the indicator displays a red label (sell signal) or green label (buy signal) on the chart.
These signals often correspond to liquidity grabs, meaning the market “hunts” stop orders before reversing, presenting potential trading opportunities.
It is recommended to use this indicator alongside other analysis tools to confirm signals and reduce false positives.
Daily 16:00 Vertical Lines//@version=5
indicator("Daily 16:00 Vertical Lines", overlay=true, max_lines_count=500)
// Input for session time
hourMark = input.int(16, "Hour to Mark (24hr)", minval=0, maxval=23)
minuteMark = input.int(0, "Minute to Mark", minval=0, maxval=59)
// Check if the current bar is at the chosen time
isMarkTime = (hour == hourMark) and (minute == minuteMark)
// Draw the vertical line when condition matches
if (isMarkTime)
line.new(x1=bar_index, y1=low, x2=bar_index, y2=high,
color=color.red, style=line.style_dotted, width=1)
My script
//@version=5
indicator(title = "Trader Club 5in1", shorttitle="Trader Club 5in1", overlay=true, format=format.price, precision=2,max_lines_count = 500, max_labels_count = 500, max_bars_back=500)
showEma200 = input(true, title="EMA 200")
showPmax = input(true, title="Pmax")
showLinreg = input(true, title="Linreg")
showMavilim = input(true, title="Mavilim")
showNadaray = input(true, title="Nadaraya Watson")
ma(source, length, type) =>
switch type
"SMA" => ta.sma(source, length)
"EMA" => ta.ema(source, length)
"SMMA (RMA)" => ta.rma(source, length)
"WMA" => ta.wma(source, length)
"VWMA" => ta.vwma(source, length)
//Ema200
timeFrame = input.timeframe(defval = '240',title= 'EMA200 TimeFrame',group = 'EMA200 Settings')
len200 = input.int(200, minval=1, title="Length",group = 'EMA200 Settings')
src200 = input(close, title="Source",group = 'EMA200 Settings')
offset200 = input.int(title="Offset", defval=0, minval=-500, maxval=500,group = 'EMA200 Settings')
out200 = ta.ema(src200, len200)
higherTimeFrame = request.security(syminfo.tickerid,timeFrame,out200 ,barmerge.gaps_on,barmerge.lookahead_on)
ema200Plot = showEma200 ? higherTimeFrame : na
plot(ema200Plot, title="EMA200", offset=offset200)
//Linreq
group1 = "Linreg Settings"
lengthInput = input.int(100, title="Length", minval = 1, maxval = 5000,group = group1)
sourceInput = input.source(close, title="Source")
useUpperDevInput = input.bool(true, title="Upper Deviation", inline = "Upper Deviation", group = group1)
upperMultInput = input.float(2.0, title="", inline = "Upper Deviation", group = group1)
useLowerDevInput = input.bool(true, title="Lower Deviation", inline = "Lower Deviation", group = group1)
lowerMultInput = input.float(2.0, title="", inline = "Lower Deviation", group = group1)
group2 = "Linreg Display Settings"
showPearsonInput = input.bool(true, "Show Pearson's R", group = group2)
extendLeftInput = input.bool(false, "Extend Lines Left", group = group2)
extendRightInput = input.bool(true, "Extend Lines Right", group = group2)
extendStyle = switch
extendLeftInput and extendRightInput => extend.both
extendLeftInput => extend.left
extendRightInput => extend.right
=> extend.none
group3 = "Linreg Color Settings"
colorUpper = input.color(color.new(color.blue, 85), "Linreg Renk", inline = group3, group = group3)
colorLower = input.color(color.new(color.red, 85), "", inline = group3, group = group3)
calcSlope(source, length) =>
max_bars_back(source, 5000)
if not barstate.islast or length <= 1
else
sumX = 0.0
sumY = 0.0
sumXSqr = 0.0
sumXY = 0.0
for i = 0 to length - 1 by 1
val = source
per = i + 1.0
sumX += per
sumY += val
sumXSqr += per * per
sumXY += val * per
slope = (length * sumXY - sumX * sumY) / (length * sumXSqr - sumX * sumX)
average = sumY / length
intercept = average - slope * sumX / length + slope
= calcSlope(sourceInput, lengthInput)
startPrice = i + s * (lengthInput - 1)
endPrice = i
var line baseLine = na
if na(baseLine) and not na(startPrice) and showLinreg
baseLine := line.new(bar_index - lengthInput + 1, startPrice, bar_index, endPrice, width=1, extend=extendStyle, color=color.new(colorLower, 0))
else
line.set_xy1(baseLine, bar_index - lengthInput + 1, startPrice)
line.set_xy2(baseLine, bar_index, endPrice)
na
calcDev(source, length, slope, average, intercept) =>
upDev = 0.0
dnDev = 0.0
stdDevAcc = 0.0
dsxx = 0.0
dsyy = 0.0
dsxy = 0.0
periods = length - 1
daY = intercept + slope * periods / 2
val = intercept
for j = 0 to periods by 1
price = high - val
if price > upDev
upDev := price
price := val - low
if price > dnDev
dnDev := price
price := source
dxt = price - average
dyt = val - daY
price -= val
stdDevAcc += price * price
dsxx += dxt * dxt
dsyy += dyt * dyt
dsxy += dxt * dyt
val += slope
stdDev = math.sqrt(stdDevAcc / (periods == 0 ? 1 : periods))
pearsonR = dsxx == 0 or dsyy == 0 ? 0 : dsxy / math.sqrt(dsxx * dsyy)
= calcDev(sourceInput, lengthInput, s, a, i)
upperStartPrice = startPrice + (useUpperDevInput ? upperMultInput * stdDev : upDev)
upperEndPrice = endPrice + (useUpperDevInput ? upperMultInput * stdDev : upDev)
var line upper = na
lowerStartPrice = startPrice + (useLowerDevInput ? -lowerMultInput * stdDev : -dnDev)
lowerEndPrice = endPrice + (useLowerDevInput ? -lowerMultInput * stdDev : -dnDev)
var line lower = na
if na(upper) and not na(upperStartPrice) and showLinreg
upper := line.new(bar_index - lengthInput + 1, upperStartPrice, bar_index, upperEndPrice, width=1, extend=extendStyle, color=color.new(colorUpper, 0))
else
line.set_xy1(upper, bar_index - lengthInput + 1, upperStartPrice)
line.set_xy2(upper, bar_index, upperEndPrice)
na
if na(lower) and not na(lowerStartPrice) and showLinreg
lower := line.new(bar_index - lengthInput + 1, lowerStartPrice, bar_index, lowerEndPrice, width=1, extend=extendStyle, color=color.new(colorUpper, 0))
else
line.set_xy1(lower, bar_index - lengthInput + 1, lowerStartPrice)
line.set_xy2(lower, bar_index, lowerEndPrice)
na
showLinregPlotUpper = showLinreg ? upper : na
showLinregPlotLower = showLinreg ? lower : na
showLinregPlotBaseLine = showLinreg ? baseLine : na
linefill.new(showLinregPlotUpper, showLinregPlotBaseLine, color = colorUpper)
linefill.new(showLinregPlotBaseLine, showLinregPlotLower, color = colorLower)
// Pearson's R
var label r = na
label.delete(r )
if showPearsonInput and not na(pearsonR) and showLinreg
r := label.new(bar_index - lengthInput + 1, lowerStartPrice, str.tostring(pearsonR, "#.################"), color = color.new(color.white, 100), textcolor=color.new(colorUpper, 0), size=size.normal, style=label.style_label_up)
//Mavilim
group4 = "Mavilim Settings"
mavilimold = input(false, title="Show Previous Version of MavilimW?",group=group4)
fmal=input(3,"First Moving Average length",group = group4)
smal=input(5,"Second Moving Average length",group = group4)
tmal=fmal+smal
Fmal=smal+tmal
Ftmal=tmal+Fmal
Smal=Fmal+Ftmal
M1= ta.wma(close, fmal)
M2= ta.wma(M1, smal)
M3= ta.wma(M2, tmal)
M4= ta.wma(M3, Fmal)
M5= ta.wma(M4, Ftmal)
MAVW= ta.wma(M5, Smal)
col1= MAVW>MAVW
col3= MAVWpmaxsrc ? pmaxsrc-pmaxsrc : 0
vdd1=pmaxsrc
ma = 0.0
if mav == "SMA"
ma := ta.sma(pmaxsrc, length)
ma
if mav == "EMA"
ma := ta.ema(pmaxsrc, length)
ma
if mav == "WMA"
ma := ta.wma(pmaxsrc, length)
ma
if mav == "TMA"
ma := ta.sma(ta.sma(pmaxsrc, math.ceil(length / 2)), math.floor(length / 2) + 1)
ma
if mav == "VAR"
ma := VAR
ma
if mav == "WWMA"
ma := WWMA
ma
if mav == "ZLEMA"
ma := ZLEMA
ma
if mav == "TSF"
ma := TSF
ma
ma
MAvg=getMA(pmaxsrc, length)
longStop = Normalize ? MAvg - Multiplier*atr/close : MAvg - Multiplier*atr
longStopPrev = nz(longStop , longStop)
longStop := MAvg > longStopPrev ? math.max(longStop, longStopPrev) : longStop
shortStop = Normalize ? MAvg + Multiplier*atr/close : MAvg + Multiplier*atr
shortStopPrev = nz(shortStop , shortStop)
shortStop := MAvg < shortStopPrev ? math.min(shortStop, shortStopPrev) : shortStop
dir = 1
dir := nz(dir , dir)
dir := dir == -1 and MAvg > shortStopPrev ? 1 : dir == 1 and MAvg < longStopPrev ? -1 : dir
PMax = dir==1 ? longStop: shortStop
// plot(showsupport ? MAvg : na, color=#0585E1, linewidth=2, title="EMA9")
pmaxPlot = showPmax ? PMax : na
pALL=plot(pmaxPlot, color=color.new(#FF5252, transp = 0), linewidth=2, title="PMax")
alertcondition(ta.cross(MAvg, PMax), title="Cross Alert", message="PMax - Moving Avg Crossing!")
alertcondition(ta.crossover(MAvg, PMax), title="Crossover Alarm", message="Moving Avg BUY SIGNAL!")
alertcondition(ta.crossunder(MAvg, PMax), title="Crossunder Alarm", message="Moving Avg SELL SIGNAL!")
alertcondition(ta.cross(pmaxsrc, PMax), title="Price Cross Alert", message="PMax - Price Crossing!")
alertcondition(ta.crossover(pmaxsrc, PMax), title="Price Crossover Alarm", message="PRICE OVER PMax - BUY SIGNAL!")
alertcondition(ta.crossunder(pmaxsrc, PMax), title="Price Crossunder Alarm", message="PRICE UNDER PMax - SELL SIGNAL!")
buySignalk = ta.crossover(MAvg, PMax)
plotshape(buySignalk and showsignalsk and showPmax ? PMax*0.995 : na, title="Buy", text="Buy", location=location.absolute, style=shape.labelup, size=size.tiny, color=color.new(color.green, transp = 0), textcolor=color.white)
sellSignallk = ta.crossunder(MAvg, PMax)
plotshape(sellSignallk and showsignalsk and showPmax ? PMax*1.005 : na, title="Sell", text="Sell", location=location.absolute, style=shape.labeldown, size=size.tiny, color=color.new(color.red, transp = 0), textcolor=color.white)
// buySignalc = ta.crossover(pmaxsrc, PMax)
// plotshape(buySignalc and showsignalsc ? PMax*0.995 : na, title="Buy", text="Buy", location=location.absolute, style=shape.labelup, size=size.tiny, color=#0F18BF, textcolor=color.white)
// sellSignallc = ta.crossunder(pmaxsrc, PMax)
// plotshape(sellSignallc and showsignalsc ? PMax*1.005 : na, title="Sell", text="Sell", location=location.absolute, style=shape.labeldown, size=size.tiny, color=#0F18BF, textcolor=color.white)
// mPlot = plot(ohlc4, title="", style=plot.style_circles, linewidth=0,display=display.none)
longFillColor = highlighting ? (MAvg>PMax ? color.new(color.green, transp = 90) : na) : na
shortFillColor = highlighting ? (MAvg math.exp(-(math.pow(x, 2)/(h * h * 2)))
//-----------------------------------------------------------------------------}
//Append lines
//-----------------------------------------------------------------------------{
n = bar_index
var ln = array.new_line(0)
if barstate.isfirst and repaint
for i = 0 to 499
array.push(ln,line.new(na,na,na,na))
//-----------------------------------------------------------------------------}
//End point method
//-----------------------------------------------------------------------------{
var coefs = array.new_float(0)
var den = 0.
if barstate.isfirst and not repaint
for i = 0 to 499
w = gauss(i, h)
coefs.push(w)
den := coefs.sum()
out = 0.
if not repaint
for i = 0 to 499
out += src * coefs.get(i)
out /= den
mae = ta.sma(math.abs(src - out), 499) * mult
upperN = out + mae
lowerN = out - mae
//-----------------------------------------------------------------------------}
//Compute and display NWE
//-----------------------------------------------------------------------------{
float y2 = na
float y1 = na
nwe = array.new(0)
if barstate.islast and repaint
sae = 0.
//Compute and set NWE point
for i = 0 to math.min(499,n - 1)
sum = 0.
sumw = 0.
//Compute weighted mean
for j = 0 to math.min(499,n - 1)
w = gauss(i - j, h)
sum += src * w
sumw += w
y2 := sum / sumw
sae += math.abs(src - y2)
nwe.push(y2)
sae := sae / math.min(499,n - 1) * mult
for i = 0 to math.min(499,n - 1)
if i%2 and showNadaray
line.new(n-i+1, y1 + sae, n-i, nwe.get(i) + sae, color = upCss)
line.new(n-i+1, y1 - sae, n-i, nwe.get(i) - sae, color = dnCss)
if src > nwe.get(i) + sae and src < nwe.get(i) + sae and showNadaray
label.new(n-i, src , '▼', color = color(na), style = label.style_label_down, textcolor = dnCss, textalign = text.align_center)
if src < nwe.get(i) - sae and src > nwe.get(i) - sae and showNadaray
label.new(n-i, src , '▲', color = color(na), style = label.style_label_up, textcolor = upCss, textalign = text.align_center)
y1 := nwe.get(i)
//-----------------------------------------------------------------------------}
//Dashboard
//-----------------------------------------------------------------------------{
var tb = table.new(position.top_right, 1, 1
, bgcolor = #1e222d
, border_color = #373a46
, border_width = 1
, frame_color = #373a46
, frame_width = 1)
if repaint
tb.cell(0, 0, 'Repainting Mode Enabled', text_color = color.white, text_size = size.small)
//-----------------------------------------------------------------------------}
//Plot
//-----------------------------------------------------------------------------}
// plot(repaint ? na : out + mae, 'Upper', upCss)
// plot(repaint ? na : out - mae, 'Lower', dnCss)
//Crossing Arrows
// plotshape(ta.crossunder(close, out - mae) ? low : na, "Crossunder", shape.labelup, location.absolute, color(na), 0 , text = '▲', textcolor = upCss, size = size.tiny)
// plotshape(ta.crossover(close, out + mae) ? high : na, "Crossover", shape.labeldown, location.absolute, color(na), 0 , text = '▼', textcolor = dnCss, size = size.tiny)
//-----------------------------------------------------------------------------}