BTC Halvings**BTC Halvings — Vertical Lines**
* 🎯 Marks every Bitcoin halving with an infinite vertical line.
* 🕰️ UTC timestamps: 2012-11-28 15:24, 2016-07-09 16:46, 2020-05-11 19:23, 2024-04-20 00:09.
* 📊 Works on any symbol and timeframe; lines anchor by exact bar time.
* 🧱 No repaint, no external data, overlay only.
* 🎨 Edit color/width in code to match your theme.
* 🔁 Static list; update when future halvings occur.
* ⚠️ Informational only; not financial advice.
指標和策略
US Gov Shutdowns🟪 Shades the chart background during US federal government shutdowns since 1980.
🗓 Uses UTC date ranges; bars are painted if the bar interval overlaps the shutdown interval.
📅 On monthly charts, a whole month is shaded if any day in that month overlaps a shutdown.
⚙️ Color is user-configurable via input.
📈 Works on any symbol and timeframe; overlay enabled.
🧾 Included ranges: 1980-05-01, 1981-11-23, 1984-10-04, 1986-10-17, 1990-10-06, 1995-11-14, 1995-12-16, 2013-10-01, 2018-01-20, 2018-02-09, 2018-12-22 to 2019-01-25.
🔄 Static list; update when new shutdowns occur.
Directional Strength and Momentum Index█ OVERVIEW
“Directional Strength and Momentum Index” (DSMI) is a technical analysis indicator inspired by DMI, but due to different source data, it produces distinct results. DSMI combines direction measurement, trend strength, and overheat levels into a single index, enhanced with gradient fills, extreme zones, entry signals, candle coloring, and a summary table.
█ CONCEPT
The classic DMI, despite its relatively simple logic, can seem somewhat chaotic due to separate +DI and -DI lines and the need for manual interpretation of their relationships. The DSMI indicator was created to increase clarity and speed up results, consolidating key information into a single index from 0 to 100 that simultaneously:
- Indicates trend direction (bullish/bearish)
- Measures movement strength
- Identifies overheat levels
- Generates ready entry signals
DMI (ADX + +DI / -DI) measures trend direction and strength, but does so based solely on comparing price movements between candles. ADX shows whether the trend is orderly and growing (e.g., above 20–30), but does not assess how dynamic the movement is.
DSMI, on the other hand, takes into account candle size and actual market aggression, thus showing directional momentum — whether the trend has real “fuel” to sustain or accelerate, not just whether it is orderly.
The main calculation difference involves replacing True Range with candle size (high-low) and using directional EMA instead of Wilder smoothing. This allows DSMI to react faster to momentum changes, eliminating delays typical of classic DMI based on TR.
This gives the trader an immediate picture of the market situation without analyzing multiple lines.
█ FEATURES
DSMI Main Line:
- EMA(Directional Index) based on +DS and -DS
- Scale 0–100, smooth color gradient depending on strength
+DS / -DS:
- Positive and Negative Directional Strength
- Gradient fill between lines — more intense with stronger trend
Extreme Zones:
- Default 20 and 80
- Gradient fill outside zones
Trend Strength Levels:
- Weak (<10) → neutral
- Moderate (up to 35)
- Strong (up to 45)
- Overheated (up to 55)
- Extreme (>55)
All levels editable
Entry Signals:
- Activated on crossing entry level (default 20)
Or on direction change when DSMI already ≥ entry level
- Highlighted background (green/red)
Candle Coloring:
- According to current trend
Trend Strength Table:
- Top-right corner
- Shows current strength (WEAK/STRONG etc.) + DSMI value
Alerts:
- DSMI Bullish Entry
- DSMI Bearish Entry
█ HOW TO USE
Add to Chart: Paste code in Pine Editor or find in indicator library.
Settings:
DSMI Parameters:
- DSMI Period → default 20
- Show DSMI Line → on/off
Extreme Zones:
- Lower Level → default 20
- Upper Level → default 80
Trend Strength Levels:
- Weak, Moderate, Strong, Overheated → adjust to strategy
Trend Colors:
- BULLISH → default green
- BEARISH → default red
- NEUTRAL → gray
Entry Signals:
- Show Highlight → on/off
- DSMI Entry Level → default 20
Signal Interpretation:
- DSMI Line: Main strength indicator.
- Gradient between +DS and -DS: Visualizes side dominance.
- Crossing 18 with direction confirmation → entry signal.
- Extreme Zones: Potential reversal or continuation points after correction.
- Table: Quick overview of current trend condition.
█ APPLICATIONS
The indicator works well in:
- Trend-following: Enter on signal, exit on direction change or overheat. When a new trend appears, consider entering a position, preferably with a rising trend strength indicator.
- Scalping/daytrading: Shorter period (7–10), lower entry level.
- Swing/position: Longer period (20–30), higher entry level, extreme zones as filters.
- Noise filtering: Ignores consolidation below “Weak” – increasing value e.g. to 15 highlights consolidation zones, but no signals appear there.
Style Adjustment:
- Aggressive strategies → shorten period and entry level
- Conservative → extend period, raise entry level (25–30), watch “Overheated”
“Weak” level (<10 default) → neutral; increasing it e.g. to 15 gives fewer but higher-quality signals. The Weak zone value controls the level below which no signals appear, and the gradient turns gray (often aligned with consolidation zones).
Combine with:
- Support/resistance levels
- Fair Value Gaps (FVG)
- Volume (Volume Profile, VWAP)
- Other oscillators (RSI, Stochastic)
█ NOTES
- Works on all markets and timeframes.
- Adjust period and levels to instrument volatility.
- Higher entry level → fewer signals, higher quality.
- Neutral color below “Weak” – avoids trading in consolidation.
- Gradient and table enable quick assessment without line analysis.
Institutional Accumulation Score (IAS) v4.1 Lite - IbotradeInstitutional Accumulation Score (IAS) v4.0 – Ibotrade Strategies (TM)
The Institutional Accumulation Score (IAS) is designed to highlight moments when professional buying pressure may be building beneath the surface of a trend.
IAS analyzes each candle using five measurable conditions that often appear during institutional accumulation phases:
Up Bar → Close > Open (positive session)
Strong Close → Close finishes in the upper portion of the range
High Relative Volume → Volume exceeds its moving average × user-set multiple
Wide Range → True range greater than ATR × threshold
Trend Alignment → Price trades above the longer-term SMA
Each fulfilled condition adds +1 point to the IAS Score (0–5).
Bars scoring 4 (S4) or 5 (S5) are flagged as potential accumulation events—often appearing near the start or continuation of strong uptrends.
🎨 Visualization & Customization
EMA Ribbon Filter: Eight-layer Madrid-style ribbon (8 → 200 EMA) defines the market trend; signals can be gated to appear only when the ribbon is green.
Arrows: Plot S4/S5 triangles below bars; full color and text customization for any chart theme.
Spacing Filter: Controls the minimum number of bars between signals to avoid clutter.
Legacy Labels: Optional “Accumulation Score” text labels for detailed study.
⚙️ Key Inputs
Volume MA Length & ATR Length
Trend SMA Length
Relative Volume and Range Multipliers
Minimum Close Position %
Ribbon Filter ON/OFF
Arrow size, colors, text visibility
Minimum Bars Between Signals
💡 How to Use
Apply IAS to daily or multi-day charts.
Focus on S4/S5 signals forming above the EMA Ribbon or major trend lines.
Combine with your breakout, volume-dry-up, or volatility-contraction setups for confirmation.
Use clustering of IAS signals to gauge institutional interest and trend conviction.
IAS works best when integrated into a broader trend-following or momentum-based strategy.
⚠️ Disclaimer
This script is for educational and informational purposes only.
It does not constitute financial advice, investment guidance, or a solicitation to buy or sell any security.
Trading and investing carry significant risk; always perform your own due diligence.
Past performance does not guarantee future results.
Analog Flow [KedArc Quant]🧭Overview
AnalogFlow is an advanced analogue-based market projection engine that reconstructs future price tendencies by matching current price behavior to historical analogues in the same instrument. Instead of using traditional indicators (moving averages, RSI, or regression), AnalogFlow applies pattern vector similarity analysis — a data-driven technique that identifies historically similar sequences and aggregates their subsequent movements into a smooth, forward-looking curve.
Think of it as a market memory system:
If the current pattern looks like one we’ve seen before, how did price move afterward?
💡 Why AnalogFlow Is Unique
- Pattern-centric — it doesn’t rely on any standard indicator formula; it directly analyzes price movement vectors.
- Adaptive — it learns from the same instrument’s past behavior, making it self-calibrating to volatility and regime shifts.
- Non-repainting — the projection is generated on the latest completed bar and remains fixed until new data is available.
- Noise-resistant — the EMA-Blend engine smooths the projected trajectory, reducing random variance between analogues.
This isn’t a combination of existing tools — it’s an original implementation of analogue-based projection theory
⚙️ Inputs & Configuration
Pattern Bars
Number of bars in the reference pattern window 40
Projection Bars
Number of bars forward to project 30
Search Depth
Number of bars back to look for matching analogues 600
Distance Metric
Comparison method: `Euclidean`, `Manhattan`, or `Cosine` Euclidean
Matches
Number of top analogues to blend (1–5) Top-3
Build Mode
Projection type: `Cumulative`, `MeanStep`, or `EMA-Blend` EMA-Blend
EMA Blend Length
Smoothness of the projected path 15
Normalize Pattern
Enable Z-score normalization for shape matching true
Dissimilarity Mode
If true, finds inverse analogues (mean-reversion analysis) false
Line Color / Width
Style settings for projection curve Blue / 2
📈 How It Works with Past Data
- The system builds a memory bank of patterns from the last N bars
- It compares the latest Pattern Bars segment to each historical segment.
- It selects the Top-K most similar (or dissimilar) analogues.
- For each analogue, it retrieves what happened after that pattern historically.
- It averages or smooths those forward moves into a single composite forecast curve.
- The forecast (blue line) is drawn ahead of the current candle.
🔍 Output Explained
Blue Path:
The weighted mean future trajectory based on historical analogues.
Smoother when EMA-Blend mode is on.
Flat Section:
Indicates low directional consensus or equilibrium across analogues.
Upward / Downward Slope:
Historical tendency toward continuation or reversal following similar conditions.
📆 Recommended Timeframes
Scalping / Short-term
1m–5m --> Short `winLen` (20–30), small `ahead` (10–15)
Swing Trading
15m–1h --> Balanced settings (winLen=40–60, ahead=20–30)
Positional / Multi-Day
4h–1D --> Large windows (winLen=80–120, ahead=30–50)
🌍 Instrument Compatibility
✅ Works seamlessly on:
- Stocks / ETFs
- Indices
- Cryptocurrency
- Commodities (Gold, Crude, etc.)
- Futures & F&O (both intraday and positional)
- Forex
No symbol-specific calibration needed — it self-adapts to volatility.
🧭 How Traders Can Use It
Use Case
Forecast Context
- Identify likely short-term price path or drift direction.
Reversal Detection
- Flip `seekOpp` to true for mean-reversion pattern analysis.
Scenario Comparison
- Observe whether current regime tends to continue or stall.
Momentum Confirmation
- Combine with trend tools (e.g., EMA or MACD) for direction bias.
Backtesting Support
- Compare projected path vs. realized price to evaluate reliability.
❓ FAQ
Q1. Does AnalogFlow repaint?
→ No. It calculates only once per completed bar and projects forward. Future path remains static until a new bar closes.
Q2. Is it a neural network or AI model?
→ Not in the ML sense — it’s a deterministic analogue-matching engine using statistical distance metrics.
Q3. Why does the projection sometimes flatten?
→ That means similar historical setups had no clear consensus in direction (neutral expectation).
Q4. Can I use it for live trading signals?
→ AnalogFlow is not a signal generator. It provides *probabilistic context* for upcoming movement.
Q5. Does higher `scanDepth` improve accuracy?
→ Up to a point. More depth gives more analogues, but too much can dilute recency. Try 400–800.
📘 Glossary
Analogue
A past pattern similar to the current price behavior.
Distance Metric
Mathematical formula for pattern similarity.
Step Vector
Difference between consecutive closing prices.
EMA-Blend
Exponential smoothing of projected path.
Cumulative Mode
Adds sequential historical deltas directly.
Z-Score Normalization
Rescaling to mean 0, variance 1 for shape comparison.
🧩 Summary
AnalogFlow converts the market’s historical echoes into a structured, statistically weighted forward projection. It gives traders a contextual roadmap — not a signal — showing how similar past setups evolved, allowing better-informed entries, exits, and scenario planning across all asset classes.
⚠️ Disclaimer
This script is provided for educational purposes only.
Past performance does not guarantee future results.
Trading involves risk, and users should exercise caution and use proper risk management when applying this strategy.
HITESH SOMANI Strategy Technical based strategy. Strong chart pattern based strategy for working professionals who dont have much time for trading
Multiple Moving Average v2 super Multiple Moving Average v2 super
for those who need it Enjoy
ema 50 100 20 100 200 al in 1
Turtles StrategyBorn from the 1980s "Turtle" experiment, this method of trading captures breakouts and places or closes trades with intrabar entries or exits and realized-equity risk controls.
How It Works
The strategy buys/sells on breakouts from recent highs/lows, using ATR for volatility-adjusted stops and sizing. It risks a fixed % (default 1%) of realized equity per trade—initial capital plus closed P&L, ignoring open positions for conservatism. Drawdown protection auto-reduces risk by 20% at 10% drops (up to three times), resetting only on full peak recovery. Single positions only, with 1-tick slippage simulated for realistic fills. Best for trending assets like forex,commodities, crypto, stocks. Backtest for optimal parameters.
Main Operations
The strategy works on any timeframe but it's meant to be used on daily charts.
Entry Signals:
Long: Buy-stop 1 tick above 20-bar high (default "Entry Period") when no position—enters intrabar on breakout.
Short: Sell-stop 1 tick below 20-bar low. OCA cancels opposites.
Size: (Realized equity × adjusted risk %) ÷ (2× ATR stop distance), scaled by point value.
Exit Signals:
Longs: Stop at tighter of (entry - 2× ATR) or (10-bar low - 1 tick trailing, default "Exit Period").
Shorts: Stop at tighter of (entry + 2× ATR) or (10-bar high + 1 tick trailing).
Locks profits in trends, exits fast on fades.
Risk Controls:
Tracks realized equity peak.
10% drawdown: Risk ×0.8; 20%/30%: Further ×0.8 (max 3x).
Full reset above peak—preserves capital in slumps.
VWAP/MVWAP v6 VWAP/MVWAP v6
version 6 compatible as in trading view v6 . original script was not v6 compatible.
i added ema boillanger band and super trend
Enjoy
Amir mohammad lorProfessional-Grade Visualization: It employs a clean, multi-layered visual approach:
Table: Displays a real-time status table in the top corner, showing the current state of all strategy conditions (e.g., "Trend: BULLISH", "Momentum: WEAK").
Zones & Lines: Draws key support/resistance zones and trendlines automatically
Volume Spike & RSI | Buy/Sell SignalsThis indicator is designed for intraday traders who seek clean, actionable buy and sell signals using a blend of momentum (RSI) and volume analysis. It automatically detects momentum bursts based on the RSI crossing user-defined levels with a simultaneous volume spike—helping filter out weak or late signals. Signals are highlighted by discrete, color-coded arrows and non-overlapping labels for easy chart interpretation without clutter.
How it works
Buy signal: Generated when the RSI crosses above your chosen “Buy Threshold” (default 60) AND the volume on that bar is above its 20-period average. This suggests strong momentum with real volume support.
Sell signal: Generated when the RSI crosses below your chosen “Sell Threshold” (default 40) AND the volume on that bar is above average, signaling momentum loss or bearish pressure.
Visuals:
Buy signals are illustrated by green upward labels/arrows beneath candles.
Sell signals feature red downward labels/arrows above candles.
All signals adjust spacing dynamically, so they never overlap the price bar.
Bars are colored lime when momentum and volume are both high.
Customization
Fully adjustable RSI “Buy” and “Sell” levels.
Customizable sensitivity for the volume spike via the SMA period input.
Label spacing can be tuned in settings so signals always remain visible, regardless of volatility.
Alerts
Built-in alert conditions for both buy and sell events, compatible with TradingView’s native alerting system.
How to use
1. Add the indicator to your intraday chart (works on any timeframe).
2. When a buy or sell label/arrow appears, it marks a technical momentum burst with real volume conviction. Use these as actionable entries or exits—always manage risk with your personal trading plan.
3. Adjust parameters in the script’s settings as needed for your market or style.
Originality & credits
The logic and code were developed specifically for this script, combining classic RSI levels with volume confirmation and careful non-overlapping visual presentation to ensure clarity for intraday trading.
This tool is for educational and informational purposes only. It is not financial advice or a guarantee of performance. Always test on demo before using in live trading.
Magik- OB findermarks Magic Orderblocks 15 min time frame... when price visits the ob go to 1 min tf.. after price makes a mss.. enter.. enjoy!!!
Amir mohammad lorA "nice" Pine Script is a professional, user-friendly tool that provides clear trading signals while respecting the clarity of the chart. It moves beyond a simple indicator into a robust trading system.
Alladin call Alladin Call .
As always Buy signal is reliable.. sell is not sell u decide. have a stop loss. sell its there just for formality ..
Enjoy
MACD Pro with RSI Combo MACD Pro + RSI combo
Its space saving and 2 in 1 indicator . works good For those who ned it . Made it public enjoy
wow .
Alladin PUT v1Alladin use in 1 hrs charts .. For buy signal is excellent .. sell you have to decide . sell is not that reliable but its there ..
MirPapa_Lib_candleLibrary "MirPapa_Lib_candle"
calculateBoxDimensions(_boxW, _extraW, _spacingVal)
Parameters:
_boxW (int)
_extraW (int)
_spacingVal (int)
calculateBoxPosition(_index, _currentBar, _offset, _dims)
Parameters:
_index (int)
_currentBar (int)
_offset (int)
_dims (BoxDimensions)
createCandleData(_o, _h, _l, _c, _idx)
Parameters:
_o (float)
_h (float)
_l (float)
_c (float)
_idx (int)
createCandleObjects(_idx, _config)
Parameters:
_idx (int)
_config (RenderConfig)
deleteCandleObjects(_obj)
Parameters:
_obj (CandleObjects)
renderBox(_b, _data, _pos, _bull, _bear, _border)
Parameters:
_b (box)
_data (CandleData)
_pos (BoxPosition)
_bull (color)
_bear (color)
_border (color)
renderWicks(_wickT, _wickB, _data, _pos)
Parameters:
_wickT (line)
_wickB (line)
_data (CandleData)
_pos (BoxPosition)
renderExtendLines(_ol, _hl, _ll, _cl, _data, _rightX, _show)
Parameters:
_ol (line)
_hl (line)
_ll (line)
_cl (line)
_data (CandleData)
_rightX (int)
_show (bool)
renderValueLabels(_lo, _lh, _ll, _lc, _data, _rightX, _show)
Parameters:
_lo (label)
_lh (label)
_ll (label)
_lc (label)
_data (CandleData)
_rightX (int)
_show (bool)
generateStatsText(_data)
Parameters:
_data (CandleData)
calculateStatsColor(_data, _config)
Parameters:
_data (CandleData)
_config (StatsConfig)
renderStatsLabel(_lbl, _data, _rightX, _show, _config, _labelStyle, _labelSize)
Parameters:
_lbl (label)
_data (CandleData)
_rightX (int)
_show (bool)
_config (StatsConfig)
_labelStyle (string)
_labelSize (string)
createPrevDailyLines(_dayStart, _high, _low, _currentTime, _highCol, _lowCol, _vertCol, _lineWidth, _lineStyle)
Parameters:
_dayStart (int)
_high (float)
_low (float)
_currentTime (int)
_highCol (color)
_lowCol (color)
_vertCol (color)
_lineWidth (int)
_lineStyle (string)
updatePrevDailyLines(_lines, _dayStart, _high, _low)
Parameters:
_lines (PrevDailyLines)
_dayStart (int)
_high (float)
_low (float)
extendPrevDailyLines(_lineH, _lineL, _currentTime)
Parameters:
_lineH (line)
_lineL (line)
_currentTime (int)
renderCandle(_obj, _data, _pos, _bull, _bear, _border, _showExt, _showLbl)
Parameters:
_obj (CandleObjects)
_data (CandleData)
_pos (BoxPosition)
_bull (color)
_bear (color)
_border (color)
_showExt (bool)
_showLbl (bool)
CandleData
Fields:
_top (series float)
_bottom (series float)
_high (series float)
_low (series float)
_open (series float)
_close (series float)
_isBull (series bool)
_barIndex (series int)
CandleObjects
Fields:
_boxObj (series box)
_wickTop (series line)
_wickBottom (series line)
_highLine (series line)
_lowLine (series line)
_openLine (series line)
_closeLine (series line)
_lblO (series label)
_lblH (series label)
_lblL (series label)
_lblC (series label)
PrevDailyLines
Fields:
_high (series float)
_low (series float)
_dayStart (series int)
_lineHigh (series line)
_lineLow (series line)
_lineVertical (series line)
BoxPosition
Fields:
_leftX (series int)
_rightX (series int)
_midX (series int)
BoxDimensions
Fields:
_width (series int)
_gap (series int)
RenderConfig
Fields:
_bullColor (series color)
_bearColor (series color)
_borderColor (series color)
_wickColor (series color)
_lineColor (series color)
_labelBgColor (series color)
_labelTextColor (series color)
_labelStyle (series string)
_labelSize (series string)
_lineStyle (series string)
_lineExtend (series string)
StatsConfig
Fields:
_positiveColor (series color)
_negativeColor (series color)
_transparency (series int)
Market Structure Trailing Stop MTF [Inspired by LuxAlgo]# Market Structure Trailing Stop MTF
**OPEN-SOURCE SCRIPT**
*208k+ views on original · Modified for MTF Support*
This indicator is a direct adaptation of the renowned **Market Structure Trailing Stop** by **LuxAlgo** (original script: [Market Structure Trailing Stop ]()). The core logic remains untouched, providing dynamic trailing stops based on market structure breaks (CHoCH/BOS). The **only modification** is the addition of **Multi-Timeframe (MTF) support**, allowing users to apply the trailing stops and structures from **higher timeframes (HTF)** directly on their current chart. This enhances usability for traders analyzing cross-timeframe confluence without switching charts.
**Special thanks to LuxAlgo** for releasing this powerful open-source tool under CC BY-NC-SA 4.0. Your contributions to the TradingView community have inspired countless traders—grateful for the solid foundation!
## 🔶 How the Script Works: A Deep Dive
At its heart, this indicator detects **market structure shifts** (bullish or bearish breaks of swing highs/lows) and uses them to generate **adaptive trailing stops**. These stops trail the price while protecting profits and acting as dynamic support/resistance levels. The MTF enhancement pulls this logic from user-specified higher timeframes, overlaying HTF structures and stops on the lower timeframe chart for seamless multi-timeframe analysis.
### Core Logic (Unchanged from LuxAlgo's Original)
1. **Pivot Detection**:
- Uses `ta.pivothigh()` and `ta.pivotlow()` with a user-defined lookback (`length`) to identify swing highs (PH) and lows (PL).
- Coordinates (price `y` and bar index/time `x`) are stored in persistent variables (`var`) for tracking recent pivots.
2. **Market Structure Detection**:
- **Bullish Structure (BOS/CHoCH)**: Triggers when `close > recent PH` (break above swing high).
- If `resetOn = 'CHoCH'`, resets only on major shifts (Change of Character); otherwise, on all breaks.
- Sets trend state `os = 1` (bullish) and highlights the break with a horizontal line (dashed for CHoCH, dotted for BOS).
- Initializes trailing stop at the local minimum (lowest low since the pivot) using a backward loop: `btm = math.min(low , btm)`.
- **Bearish Structure**: Triggers when `close < recent PL`, mirroring the bullish logic (`os = -1`, local maximum for stop).
- Structure state `ms` tracks the break type (1 for bull, -1 for bear, 0 neutral), resetting based on user settings.
3. **Trailing Stop Calculation**:
- Tracks **trailing max/min**:
- On new bull structure: Reset `max = close`.
- On new bear: Reset `min = close`.
- Otherwise: `max = math.max(close, max)` / `min = math.min(close, min)`.
- **Stop Adjustment** (the "trailing" magic):
- On fresh structure: `ts = btm` (bull) or `top` (bear).
- In ongoing trend: Increment/decrement by a percentage of the max/min change:
- Bull: `ts += (max - max ) * (incr / 100)`
- Bear: `ts += (min - min ) * (incr / 100)`
- This creates a **ratcheting effect**: Stops move favorably with the trend but never against it, converging toward price at a controlled rate.
- **Visuals**:
- Plots `ts` line colored by trend (teal for bull, red for bear).
- Fills area between `close` and `ts` (orange on retracements).
- Draws structure lines from pivot to break point.
4. **Edge Cases**:
- Variables like `ph_cross`/`pl_cross` prevent multiple triggers on the same pivot.
- Neutral state (`ms = 0`) preserves prior `max/min` until a new structure.
### MTF Enhancement (Our Addition)
- **request.security() Integration**:
- Wraps the entire core function `f()` in a security call for each timeframe (`tf1`, `tf2`).
- Returns HTF values (e.g., `ts1`, `os1`, structure times/prices) to the chart's context.
- Uses `lookahead=barmerge.lookahead_off` for accurate historical repainting-free data.
- Structures are drawn using `xloc.bar_time` to align HTF lines precisely on the LTF chart.
- **Multi-Output Handling**:
- Separate plots/fills/lines for each TF (e.g., `plot_ts1`, `plot_ts2`).
- Colors and toggles per TF to distinguish HTF1 (e.g., teal/red) from HTF2 (e.g., blue/maroon).
- **Benefits**: Spot HTF bias on LTF entries, e.g., enter longs only if both TF1 (1H) and TF2 (4H) show bullish `os=1`.
This keeps the script lightweight—**no repainting, max 500 lines**, and fully compatible with LuxAlgo's original behavior when TFs are set to the chart's timeframe.
## 🔶 SETTINGS
### Core Parameters
- **Pivot Lookback** (`length = 14`): Bars left/right for pivot detection. Higher = smoother structures, fewer signals; lower = more noise.
- **Increment Factor %** (`incr = 100`): Speed of stop convergence (0-∞). 100% = full ratchet (mirrors max/min exactly); <100% = slower trail, reduces whipsaws.
- **Reset Stop On** (`'CHoCH'`): `'CHoCH'` = Reset only on major reversals (dashed lines); `'All'` = Reset on every BOS/CHoCH (tighter stops).
### MTF Support
- **Timeframe 1** (`tf1 = ""`): HTF for first set (e.g., "1H"). Empty = current chart.
- **Timeframe 2** (`tf2 = ""`): Second HTF (e.g., "4H"). Enables dual confluence.
### Display Toggles
- **Show Structures** (`true`): Draws horizontal lines for breaks (per TF colors).
- **Show Trailing Stop TF1/TF2** (`true`): Plots the stop line.
- **Show Fill TF1/TF2** (`true`): Area fill between close and stop.
### Candle Coloring (Optional)
- **Color Candles** (`false`): Enables custom `plotcandle` for body/wick/border.
- **Candle Color Based On TF** (`"None"`): `"TF1"`, `"TF2"`, or none. Colors bull trend green, bear red.
- **Candle Colors**: Separate inputs for bull/bear body, wick, border (e.g., solid green body, transparent wick).
### Alerts
- **Enable MS Break Alerts** (`false`): Notifies on structure breaks (bull/bear per TF) **only on bar close** (`barstate.isconfirmed` + `alert.freq_once_per_bar_close`).
- **Enable Stop Hit Alerts** (`false`): Triggers on stop breaches (long/short per TF), using `ta.crossunder/crossover`.
### Colors
- **TF1 Colors**: Bullish (teal), Bearish (red), Retracement (orange).
- **TF2 Colors**: Bullish (blue), Bearish (maroon), Retracement (orange).
- **Area Transparency** (`80`): Fill opacity (0-100).
## 🔶 USAGE
Trailing stops shine in **trend-following strategies**:
- **Entries**: Use structure breaks as signals (e.g., long on bullish BOS from HTF1).
- **Exits**: Trail stops for profit-locking; alert on hits for automation.
- **Confluence**: Overlay HTF1 (e.g., 1H) for bias, HTF2 (e.g., Daily) for major levels—enter LTF only on alignment.
- **Risk Management**: Lower `incr` avoids early stops in chop; reset on `'All'` for aggressive trailing.
! (i.imgur.com)
*HTF1 shows bullish structure (teal line), trailing stop ratchets up—long entry confirmed on LTF pullback.*
! (i.imgur.com)
*TF1 (blue) bearish, TF2 (red) neutral—avoid shorts until alignment.*
! (i.imgur.com)
*Colored based on TF1 trend: Green bodies on bull `os=1`.*
Pro Tip: Test on demo—pair with LuxAlgo's other tools like Smart Money Concepts for full structure ecosystem.
## 🔶 DETAILS: Mathematical Breakdown
On bullish break:
- Local min: `btm = ta.lowest(n - ph_x)` (optimized loop equivalent).
- Stop init: `ts = btm`.
- Update: `Δmax = max - max `, `ts_new = ts + Δmax * (incr/100)`.
Bearish mirrors with `Δmin` (negative, so decrements `ts`).
In MTF: HTF `time` aligns lines via `line.new(htf_time, level, current_time, level, xloc.bar_time)`.
No logs/math libs needed—pure Pine v5 efficiency.
## Disclaimer
This is for educational purposes. Not financial advice. Backtest thoroughly. Original by LuxAlgo—modify at your risk. See TradingView's (www.tradingview.com). Licensed under CC BY-NC-SA 4.0 (attribution to LuxAlgo required).
SSL Hybrid ScalperIt's a ready to trade script V5, that takes the original SSL Hybrid logic and optimizes it for XAUUSD scalping on 1min to 15min charts for buy & sell signals.
Oversold Screener · v4# Step-2 Oversold Screener · v3.3
US equities · 15-minute event engine · AVWAP entries A–F · optional CVD/RSI/Z guards
## What this script does
Finds short, emotion-driven selloffs in large, healthy US stocks and turns them into actionable, right-side opportunities.
On a qualified 15-minute close it:
1. emits a minimal webhook so your backend/AI can vet the news and fundamentals, and
2. anchors an Event-AVWAP and plots ±1/±2/±3σ bands to guide entries A–F as price mean-reverts.
The logic runs in a fixed 15-minute space, independent of the chart timeframe you view.
## How an event is detected (Step-2 signal)
All conditions are evaluated on 15-minute data, including extended hours.
Depth, measured vs yesterday’s RTH reference
* Reference = min(yesterday’s RTH VWAP proxy, yesterday’s Close).
* 4h depth: current price vs reference across 16×15m bars ≤ threshold (default −4%).
* 8h depth: lowest close across the last 32×15m bars vs reference ≤ threshold (default −6%).
Relative underperformance
* Versus market ETF (SPY/QQQ) and sector ETF (XLK/XLF/XLY… or KWEB/CQQQ).
* Uses the same 16/32×15m windows; stock must be weaker by at least the set margins (default −3%).
Macro circuit breakers (any one trips = suppress signal)
* VIX level ≥ fuse (default 28).
* Market 4h/8h drawdown ≤ limits (default −2.0% / −3.5%).
* Sector 4h/8h drawdown ≤ limits (default −2.5% / −4.0%).
Momentum and distribution guards
* RSI(1h) < 30 by default (computed from 15m series).
* Optional Z-score filters: stock Z ≤ zTrig, and macro Z floors for market/sector.
* Cooldown per symbol so you don’t get spammed by repeated events.
When the event closes, the script posts a tiny JSON to your alert webhook and pins an on-chart “S2” marker at the event bar.
## Event-AVWAP and bands
From the event bar forward the script computes AVWAP natively in 15m space and draws bands at ±1σ/±2σ/±3σ.
σ is a rolling standard deviation of typical price with optional EMA smoothing and an optional cap.
Why this helps
* AVWAP from the shock timestamp approximates the crowd’s average position after the selloff.
* Reclaiming key bands often marks the start of orderly mean reversion rather than a dead-cat bounce.
## Entry proposals A–F (right-side confirmations)
Each entry requires first touching a lower band, then reclaiming a higher band.
A touch ≤ −2σ, then cross up through −1σ
B touch ≤ −1σ, then reclaim AVWAP
C break above −1σ, retest near −1σ within N bars, then bounce
D after compression (low ATR%), reclaim AVWAP
E touch ≤ −3σ, then cross up through −2σ
F touch ≤ −3σ, then cross up through −1σ (fast, aggressive)
Labeling hygiene
* Only the first three occurrences of each type A–F are shown within a one-week window after the event.
* A debounce interval avoids over-labeling across adjacent bars.
## Optional CVD gate (order-flow confirmation)
When enabled, entries must also pass a 15-minute CVD gate that looks for sell pressure exhaustion and a turn-up in cumulative delta.
Defaults are conservative; start with CVD off until you’re comfortable, then enable to filter chop after capitulations.
## Alert payload (minimal by design)
On the event bar close the script fires one alert with a tiny JSON that is easy to route and process in bulk:
```json
{
"event": "Crash_signal_15m",
"symbol": "NVDA",
"symbol_id": "NASDAQ:NVDA",
"ts_alert_15m_ms": 1730898900000,
"ts_alert_15m_local": "2025-11-06 10:45"
}
```
Notes
* ts_alert_15m_ms is the 15-minute close time in milliseconds since epoch (UTC reference).
* ts_alert_15m_local uses your chart’s timezone for readability.
Optional: a 24-hour streaming mode can resend this minimal payload on every 15-minute close during the day after the event (tiny patch available on request).
## Inputs you will actually touch
Bench/Sector symbols
* Bench: SPY or QQQ. Sector: XLK/XLF/XLY… or KWEB/CQQQ depending on the name.
Depth and relative thresholds
* 4h depth ≤ −4%, 8h depth ≤ −6%.
* Relative to market/sector ≤ −3% each.
Macro fuses
* VIX ≥ 28; market ≤ −2.0%/−3.5%; sector ≤ −2.5%/−4.0%.
Z/RSI guards
* Z window 80 bars (15m), stock zTrig ≤ −1.5, macro floors ≥ −1.0.
* RSI(1h) < 30.
AVWAP band engine
* σ EMA length 3; σ cap off by default.
* Retest window for entry C: 24 bars (≈6 hours).
Presentation and hygiene
* One-week entry window; per-type cap 3; debounce 8×15m bars.
* Signal table on/off, label pinning on/off.
## How to run it
1. Open a 15-minute chart (extended hours enabled recommended).
2. Add the indicator and choose Bench/Sector for the names you are reviewing.
3. Create a single alert per chart with Condition = Any alert() function call and Options = Once per bar close.
4. Point the alert to your webhook URL (or use app/email if you don’t have a URL).
5. Let your backend/AI receive the minimal JSON, do the news/fundamentals check, and decide Allow / Hold / Reject.
6. For Allowed names, use the on-chart A–F markers to stage in; manage risk against Event-AVWAP and upper HVNs/POC.
## Defaults that work well
* RSI(1h) < 30
* Depth 4h/8h ≤ −4%/−6% vs yesterday’s reference
* Relative to market/sector ≤ −3%
* Z: stock ≤ −1.5; macro floors ≥ −1.0
* Fuses: VIX ≥ 28; market ≤ −2.0%/−3.5%; sector ≤ −2.5%/−4.0%
* Bands: σ EMA = 3; no σ cap; one-week window; 3 labels per type
## Notes and limitations
* This is an indicator, not an auto-trader. Position sizing and exits are up to you.
* Designed for liquid US equities; thin ADRs and micro-caps are noisy.
* All event logic and entries are evaluated on bar close; AVWAP and bands do not repaint.
* If you need to monitor many symbols without a server, a Scanner variant can batch 10–17 tickers per script and alert without a webhook.
Squeeze Ultimate MTF DashboardThis script provides real time data on the following across 3 TF of your choice all displayed in a clear table on your chart:
1) Momentum - do we have expanding positive or negative momentum
2) Do we have stacked averages - any choices of 4 EMA's
3) Are we in a squeeze
4) How many bars since the squeeze fired have passed
This allows you to gauge, on MTF, whether we have expanding momentum, in a stacked moving average environment and whether the squeeze is getting ready to fire or has already fired, and if so, how long ago.
Credit to John carter for developing the original squeeze






















