MyLibLibrary "MyLib"
TODO: add library description here
f_kdj2(x)
TODO: add function description here
Parameters:
x (float) : TODO: add parameter x description here
Returns: TODO: add what function returns
f_kdj(highSrc, lowSrc, closeSrc, ilong, isig)
Parameters:
highSrc (float)
lowSrc (float)
closeSrc (float)
ilong (int)
isig (simple int)
Penunjuk dan strategi
Multi-Band Trend LineThis Pine Script creates a versatile technical indicator called "Multi-Band Trend Line" that builds upon the concept of the popular "Follow Line Indicator" by Dreadblitz. While the original Follow Line Indicator uses simple trend detection to place a line at High or Low levels, this enhanced version combines multiple band-based trading strategies with dynamic trend line generation. The indicator supports five different band types and provides more sophisticated buy/sell signals based on price breakouts from various technical analysis bands.
Key Features
Multi-Band Support
The indicator supports five different band types:
- Bollinger Bands: Uses standard deviation to create bands around a moving average
- Keltner Channels: Uses ATR (Average True Range) to create bands around a moving average
- Donchian Channels: Uses the highest high and lowest low over a specified period
- Moving Average Envelopes: Creates bands as a percentage above and below a moving average
- ATR Bands: Uses ATR multiplier to create bands around a moving average
Dynamic Trend Line Generation (Enhanced Follow Line Concept)
- Similar to the Follow Line Indicator, the trend line is placed at High or Low levels based on trend direction
- Key Enhancement: Instead of simple trend detection, this version uses band breakouts to trigger trend changes
- When price breaks above the upper band (bullish signal), the trend line is set to the low (optionally adjusted with ATR) - similar to Follow Line's low placement
- When price breaks below the lower band (bearish signal), the trend line is set to the high (optionally adjusted with ATR) - similar to Follow Line's high placement
- The trend line acts as dynamic support/resistance, following the price action more precisely than the original Follow Line
ATR Filter (Follow Line Enhancement)
- Like the original Follow Line Indicator, an ATR filter can be selected to place the line at a more distance level than the normal mode settled at candles Highs/Lows
- When enabled, it adds/subtracts ATR value to provide more conservative trend line placement
- Helps reduce false signals in volatile markets
- This feature maintains the core philosophy of the Follow Line while adding more precision through band-based triggers
Signal Generation
- Buy Signal: Generated when trend changes from bearish to bullish (trend line starts rising)
- Sell Signal: Generated when trend changes from bullish to bearish (trend line starts falling)
- Signals are displayed as labels on the chart
Visual Elements
- Upper and lower bands are plotted in gray
- Trend line changes color based on direction (green for bullish, red for bearish)
- Background color changes based on trend direction
- Buy/sell signals are marked with labeled shapes
How It Works
Band Calculation: Based on the selected band type, upper and lower boundaries are calculated
Signal Detection: When price closes above the upper band or below the lower band, a breakout signal is generated
Trend Line Update: The trend line is updated based on the breakout direction and previous trend line value
Trend Direction: Determined by comparing current trend line with the previous value
Alert Generation: Buy/sell conditions trigger alerts and visual signals
Use Cases
Enhanced trend following strategies: More precise than basic Follow Line due to band-based triggers
Breakout trading: Multiple band types provide various breakout opportunities
Dynamic support/resistance identification: Combines Follow Line concept with band analysis
Multi-timeframe analysis with different band types: Choose the most suitable band for your timeframe
Reduced false signals: Band confirmation provides better entry/exit points compared to simple trend following
MTF Oscillator Stack [BigBeluga]🔵 OVERVIEW
The MTF Oscillator Stack brings powerful multi-timeframe momentum analysis directly into your price chart. You can select one oscillator— RSI , MFI , or Stochastic RSI —and display it across up to 4 different timeframes. Each panel is neatly stacked horizontally above price , offering quick insight into cross-timeframe conditions like trend direction, exhaustion zones, and momentum shifts.
🔵 CONCEPTS
Single Oscillator Mode: Select one oscillator type (RSI, MFI, or Stoch RSI) to analyze across all selected timeframes.
Top-Chart Horizontal Panels: Oscillator plots are aligned horizontally at the top of the chart for seamless top-down reading.
Signal Comparison Arrows: Arrows (🢁 / 🢃) indicate oscillator position relative to its signal line.
Overbought/Oversold Zones: Transparent 30–70 fill zones highlight key reversal areas.
Dynamic Display Logic: Only enabled panels are shown; spacing adjusts based on active timeframes.
Timeframe Tagging: Each oscillator panel is labeled with its corresponding timeframe (e.g., 1H, 2H, 4H).
🔵 FEATURES
Choose one oscillator (RSI, MFI, or Stoch RSI) and apply it across up to 4 timeframes.
Each oscillator panel includes: price-synced plot, signal line, and zone shading.
Scale alignment allows users to place charts at the bottom or top.
Clear arrow signals show whether oscillator is bullish or bearish.
Individual length and signal settings per timeframe.
Toggle for alignment mode: evenly spaced or floating layout.
All panels use a consistent layout for faster decision-making.
🔵 HOW TO USE
Select your preferred oscillator and activate 2–4 key timeframes (e.g., 1H, 4H, D1, W1).
Use signal crossovers as a bullish (🢁) or bearish (🢃) trend cue.
Look for aligned extremes (e.g., all timeframes overbought) to spot momentum exhaustion.
Ideal for momentum confluence strategies and top-down confirmation.
Use horizontal layout to stay focused on price while assessing broader structure.
🔵 CONCLUSION
MTF Oscillator Stack simplifies complex multi-timeframe momentum analysis into one clean, actionable visual. Whether you're tracking RSI, MFI, or Stoch RSI, this tool helps you stay aligned with the broader trend—without ever leaving your main chart.
OKX Contract Martin SAR SignalDescription:
This script combines the Parabolic SAR indicator with a Martingale trading strategy for OKX contracts, optimized for high-frequency trading on lower timeframes (e.g., 45-minute charts). It automatically identifies trend reversals, generates buy and sell signals, and provides real-time alerts for entry and exit points. Key features include:
Trend Reversal Detection: Automatically detects changes between uptrends and downtrends using SAR values.
Martingale Strategy: Incorporates a customizable acceleration factor for adapting to market volatility.
Real-Time Alerts: Sends JSON-formatted webhook alerts for automation and includes detailed signal labels on the chart.
Customizable Parameters: Fully adjustable SAR settings (start, increment, and maximum factors) for different trading styles.
This strategy is ideal for traders seeking precise contract signals with high-frequency execution. However, use caution and conduct thorough backtesting before deploying in live markets, especially for ultra-high-frequency trading.
Perfect Buy Entry Point Checklist (M15) V4 Of course. Here is a detailed script description you can use to publish your indicator on TradingView. You can copy and paste this directly into the "Describe your script..." box.
The description is formatted to be clear, professional, and easy for other traders to understand.
Script Title
Perfect Buy Entry Point Checklist (M15)
Script Description
(You can copy everything below this line)
Overview
This indicator is a comprehensive toolkit designed to identify high-probability buy setups based on Smart Money Concepts (SMC). It was specifically built for lower timeframes like the 15-minute (M15) chart to help traders align their entries with institutional order flow.
The core of this script is a real-time, on-chart checklist that validates five key criteria before signaling a potential entry. The goal is to move beyond single-indicator signals and provide a more confluent, rules-based approach to trading.
Key Features
Real-Time Checklist Dashboard: An intuitive panel in the corner of your chart shows the status (✅ / ❌) of each rule, so you can see a setup forming in real-time.
Automatic Zone Detection: The indicator automatically identifies and plots Bullish Order Blocks (OB) and Fair Value Gaps (FVG), highlighting key areas of interest.
Clear "BUY" Signals: A clear "BUY" label appears below the price bar only when all five checklist conditions are met simultaneously.
Integrated Risk/Reward Planner: When a valid signal appears, the script automatically plots a hypothetical Entry Line, Stop Loss, and Take Profit based on your customizable R/R ratio (defaulting to 1:2.5).
Higher Timeframe Trend Filter: Includes an optional "Daily Focus" filter that uses a Daily EMA to ensure your M15 entries are aligned with the broader market trend.
How It Works: The 5-Point Checklist
The script will only generate a "BUY" signal if all of the following conditions are true:
1. 🔹 Liquidity Was Swept
The script first checks if the price has recently dipped below a key swing low or equal lows, only to quickly reverse. This is often a sign that institutional players have "swept" retail stop losses before pushing the price higher.
2. 🔹 Price Tapped a Strong Bullish Zone
After the sweep, the price must react from a significant smart money zone. The script confirms if the price has touched a pre-identified Bullish Order Block or filled a nearby Fair Value Gap (FVG).
3. 🔹 Momentum Confirmed the Reversal
A price reversal needs momentum behind it. This condition is met if there is a bullish confirmation from one of the following:
MACD bullish crossover or histogram turning positive.
RSI bouncing up from the 30-40 oversold area.
A strong bullish candle pattern, such as a Bullish Engulfing.
4. 🔹 Price Broke Market Structure (BoS/ChoCh)
To confirm that buyers are in control, the script looks for a Break of Structure (BoS) or a Change of Character (ChoCh). This occurs when the price breaks above a recent minor swing high, signaling a shift from bearish to bullish momentum.
5. 🔹 Risk/Reward is Favorable (Visual Tool)
While not a condition for the signal, this is a crucial part of the tool. Once a signal is confirmed, the script places a Stop Loss just below the liquidity sweep low and projects a Take Profit target based on your desired Risk/Reward ratio.
How to Use
Apply to an M15 Chart: This script is optimized for the 15-minute timeframe but can be tested on others.
Monitor the Dashboard: Watch the checklist panel in the top-right corner. A potential setup is forming as more conditions turn green (✅).
Wait for the Signal: Do not enter a trade until the official "BUY" label appears below a candle. This confirms all rules have been met.
Manage Your Trade: Use the automatically plotted R/R lines as a guide for setting your Stop Loss and Take Profit levels. Always adjust based on your own analysis and risk management rules.
Low of day distanceA simple indicator that tells you the distance to the low of the day in percentage terms.
Useful for quick position sizing calculations when your strategy, for instance, uses low of day stops.
Batch Screener Template [YuL]This is a template for a screener that can take a list of any number of tickers (each on its own line), and split them into batches. Then you can choose which batch you want to display on the chart.
Create multiple copies of this indicator to display multiple batches on the same chart.
You can replace expr with your own indicator or expression you'd like to check.
It is also simple enough to add alerts.
Feel free to contact me if you want custom version, my contacts are in profile.
DowFi Zag by MathbotDowFi Zag Indicator by Mathbot
DowFi Zag is a universal trend-following indicator developed by Mathbot, combining the power of Fibonacci levels and Dow Theory.
It analyzes market structure and price movements to generate high-probability entry signals in the direction of the prevailing trend.
Whether you're trading crypto, forex, indices or metals — DowFi Zag adapts to any market and timeframe, helping you stay aligned with the bigger picture.
Ideal for traders who value structure, logic, and precision in their technical analysis.
[RealEdgeFX] - Manipulation CandleOverview
The Manipulation Candle indicator highlights potential liquidity grabs and false breakouts directly on the chart. It focuses on moments when price sweeps prior highs or lows but closes in the opposite direction, suggesting a possible manipulation before a market reversal.
Core Logic
The indicator compares the current candle against the previous one and colors the bar when specific conditions are met:
Sell Manipulation (dark red)
When the current candle breaks above the previous high but then closes below the prior low.
→ This often signals a stop hunt to the upside followed by bearish intent.
Buy Manipulation (light green)
When the current candle breaks below the previous low but then closes above the prior high.
→ This suggests a liquidity sweep to the downside before bullish continuation.
Neutral candles remain uncolored to avoid clutter and keep the focus on high-impact moments.
Design Approach
Clarity: Only the candles that meet strict criteria are marked, reducing noise.
Liquidity Focused : Built for traders who want to quickly spot manipulative price action.
Non-Repainting : Once a candle is identified as manipulation, the color stays fixed.
Usage
Add it as an overlay on your chart.
Watch for green or red manipulation candles as alerts of possible reversals or liquidity events.
Combine with your own market structure or bias tools to increase accuracy.
Volume Imbalance Analyzer - 70% & 80% Version1.01Here’s a clean “definition” you can drop into your docs. It explains **what** the indicator is, **what it helps with**, and **how** to use it—plain and practical.
# Definition
**Volume Imbalance Analyzer (70% & 80%)** flags bars where estimated buy vs. sell volume is heavily one-sided. It colors those bars, adds labels (B70/B80 or S70/S80), and can alert you in real time. The goal is to quickly spot spots of **aggressive participation** (buyers or sellers) that often act as magnets for a **retest** or as **exhaustion/continuation** areas.
# What it helps you do
* **Find high-energy bars** where one side dominates (potential turning or continuation points).
* **Plan retests:** Track when price comes back into the imbalance candle’s range (common entry/take-profit logic).
* **Filter trades:** Only act when the market shows unusual pressure (≥70% or ≥80%).
* **Add context to setups:** Combine with S/R, FVGs, or trend tools to time entries with less guesswork.
* **Alert-driven workflow:** Get notified the moment extreme pressure prints.
# How it helps (workflow)
1. **Scan for signals:**
* **B80/B70** = strong buying; **S80/S70** = strong selling.
* 80% is “extreme” and overrides 70%.
2. **Mark the zone:** The imbalance candle’s **high–low** defines a zone. Many traders wait for a **retest** into that range.
3. **Decide intent:**
* After **B80/B70**, look for pullbacks to buy (or fades if you see exhaustion).
* After **S80/S70**, look for rallies to sell (or fades if exhaustion).
4. **Confirm with context:** Check trend, key levels, liquidity, session timing, ATR/volatility.
5. **Manage risk:** Place stops beyond the zone; size trades so a failed retest doesn’t ruin the day.
# How it works (under the hood, briefly)
The script **estimates buy/sell volume** from each candle’s body, wicks, and total volume, then computes an **imbalance %**. If the % crosses **70%** or **80%** (scaled by a Sensitivity setting), it paints the bar, drops a label, and optionally fires an alert. It also stores the imbalance candle’s range so you can watch for a **retest**.
# Reading the signals (quick guide)
* **B80**: Extreme buyer pressure → watch for pullback buys or exhaustion shorts, depending on context.
* **B70**: Strong buyer pressure → mild continuation bias.
* **S80**: Extreme seller pressure → watch for rally sells or exhaustion longs.
* **S70**: Strong seller pressure → higher reversal probability noted in the table (informational).
# Configuration tips
* **Sensitivity**: Higher = more bars qualify (more signals).
* **Label distance**: Scales with ATR so labels don’t overlap candles.
* **Colors/opacity**: Separate for 70% vs 80% and buyer vs seller.
* **Alerts**: Enable to catch signals live without staring at the screen.
# Notes & limits
* Uses **estimation** (not true bid/ask) on most symbols; treat as a **context tool**, not a stand-alone system.
* The optional stats table’s “expected outcomes” are **informational**, not live probabilities.
* Works on any timeframe; results improve when combined with structure and risk controls.
ML for BtcSpecially designed for 1h K-line traders, specially born for BTC. Welcome to collect and use
RSI with more Horizontal linesIts Simple RSI with Extra customable horizontal lines.
That's all.
PEACE.
RSI by Tamil harmonic trader rajRSI Indicator will show RSI value on chart right side as per timeframe.
AI Fib Strategy (Full Trade Plan)This indicator automatically plots Fibonacci retracements and a Golden Zone box (61.8%–65% retracement) based on the 4H candle body high/low.
Features:
Auto-detects session breaks or daily breaks (configurable).
Draws standard Fib retracement levels (0%, 23.6%, 38.2%, 50%, 61.8%, 78.6%, 100%).
Highlights the Golden Zone for high-probability trade entries.
Optional Take Profit extensions (TP1, TP2, TP3).
Fully compatible with Pine Script v6.
Usage:
Best applied on intraday charts (15m, 30m, 1H).
Use the Golden Zone for entry confirmations.
Combine with candlestick patterns, order blocks, or volume for stronger signals.
VSA Auto Signals by ZeeshanThis indicator automatically marks VSA signals (ND, NS, UT, SO) on the chart, filters them with trend + ATR logic, and provides a clean dashboard with alerts for quick decision-making.
Script Info BannerThe script includes a small template displaying the username, script name, and date of analysis. This feature is implemented to establish credibility and prevent unauthorized use of the analysis.
Candle AnalyzerThis tool classifies candles based on their body size and wick proportions, helping you quickly identify:
"Strong" Candles: When the body dominates, showing clear bullish or bearish momentum.
"Rejection" Candles: Long wicks indicate price was pushed back, suggesting potential reversals.
"Indecisive" Candles: When neither buyers nor sellers are clearly in control, or if wicks are balanced.
"Doji/Indecision": Very small or non-existent bodies, highlighting significant uncertainty.
Features
Manual Entry Time (Defaults to NY Open): The indicator analyzes the candle at this specific time.
Current Bar Analysis: This feature classifies the current, developing candle in real-time.
Analysis Table: A table displays details for the last four completed bars, including body size and wick percentages.
Customizable Thresholds: Adjust the "Min Body vs Wick %" and "Dominant Wick vs Body Ratio" to fine-tune how "strong" or "rejection" candles are identified.
Crypto Strong Strategy Hariss 369The best strategy for all types of trades. Entry, stop loss and target has been set based emi and atr. Both stop loss and target are changed with respect to change in price. Panel is added to view multi time frame trend including rsi , rsi ema and rvol value. A single indicator caters for all types of trades and traders.
Impulse Convexity Trend Gate [T1][T69]OVERVIEW 🧭
• A price-only trend engine that opens a “gate” only when trend strength, acceleration, and impulse dominance align.
• Built from three cooperating parts: adaptive slope, directional convexity, and an impulse-vs-pullback ratio.
• Output is a bounded oscillator (−100…+100) plus side-specific gate states (bull/bear), with optional pullback and weakness highlights.
THE IDEA & USEFULNESS 🧪
• Not a simple mashup: each component plays a distinct role—slope for direction, convexity for acceleration agreement, and an impulse ratio to suppress correction noise.
• Adaptive EMA length (series-based) lets the midline adjust to conditions without external indicators.
• Approximation of hyperbolic tangent and clamp keep signals bounded and stable while avoiding library dependencies.
• Designed to help trend traders act only when continuation is likely, and stand down during pullbacks or chop.
HOW IT WORKS (PIPELINE) ⚙️
• Price transform
• Uses log price for scale stability.
• Adaptive midline
• Volatility-aware EMA length is clamped between minimum and maximum, then applied via a custom recursive EMA.
• Slope & convexity
• Slope (first difference of the midline) defines direction; convexity (second difference) verifies acceleration agrees with that direction.
• Impulse vs pullback ratio (R)
• Sums directional progress versus counter-direction pullbacks over a window; requires impulse to dominate.
• Normalization & score
• Slope and convexity are normalized by recent dispersion; combined into a raw score and squashed to −100…+100 using manual tanh.
• Trend gate
• Gate opens only when: R ≥ threshold, |normalized slope| ≥ threshold, and slope/convexity share the same sign.
• States & visuals
• Bull/Bear Gate Entry when gate is open, oscillator crosses ±15 in the correct direction, price is on the correct side of the midline, and slope/convexity agree.
• Pullbacks mark counter-moves while a gate is active; Weakness flags specific fade patterns after pullbacks.
FEATURES ✨
• Bull and Bear Gate Entries (green/red columns).
• Pullback shading and optional trend-weakness highlights (yellow/orange + teal/maroon).
• Background tint reflects the active side (bull or bear).
• Pure price logic; no volume or external filters required.
HOW TO USE 🎯
• Regime filter
• Trade only in the direction of the open gate; ignore signals when the gate is closed.
• Pullback entries
• During an open gate, wait for a pullback zone, then act on trend-resumption (e.g., oscillator re-push through ±15 or structure break in gate direction).
• Exits & risk
• Consider trimming when the oscillator relaxes toward 0 while the gate remains open, or when convexity flips against slope and R deteriorates.
• Timeframes & markets
• Suited for trend following on crypto/FX/indices from M30 to 4H/1D; raise thresholds on lower timeframes to reduce noise.
CONFIGURATION 🔧
• Impulse ratio gate (R ≥): raises/lowers the standard for continuation dominance.
• Slope strength gate (|sN| ≥): controls how strong a slope must be to count.
• Show Pullback Impulse (toggle): enable/disable pullback highlights.
• Show Trend Weakness (toggle): enable/disable weakness flags.
LIMITATIONS ⚠️
• As a trend tool, it can lag at regime transitions; expect whipsaws in tight ranges.
• Parameters are instrument- and timeframe-dependent; tune thresholds before live use.
• Pullback/weakness flags are contextual—not trade signals by themselves; use them with gate state and your execution rules.
ADVANCED TIPS 🛠️
• Tighten R and slope thresholds for lower timeframes; loosen for higher timeframes.
• Pair with NNFX-style money management and pair-level filters; let the gate be the confirmation layer, not the entry trigger by itself.
• Batch-test across 100+ symbols, export metrics, and run Monte Carlo to validate LLN reliability and Sharpe/IQR stability.
• For system hedging, disable entries when both sides trigger on the same asset to avoid internal conflict.
NOTES 📝
• Price-only construction reduces data-vendor differences and keeps behavior consistent across markets.
• Manual tanh/clamp ensure stable, bounded scores even during extremes.
DISCLAIMER 🛡️
• For research and education. No financial advice. Test thoroughly, size conservatively, and respect your risk rules.
Order Blocks + Order-Flow ProxiesOrder Blocks + Order-Flow Proxies
This indicator combines structural analysis of order blocks with lightweight order-flow style proxies, providing a tool for chart annotation and contextual study. It is designed to help users visualize where significant structural shifts occur and how simple volume-based signals behave around those areas. The script does not guarantee profitable outcomes, nor does it issue financial advice. It is intended purely for research, learning, and discretionary use.
Conceptual Background
Order Blocks
An “order block” is a term often used to describe a zone on the chart where price left behind a significant reversal or imbalance before continuing strongly in the opposite direction. In practice, this can mean the last bullish or bearish candle before a strong breakout. Traders sometimes study these regions because they believe that unfilled resting orders may exist there, or simply because they mark important pivots in price structure. This indicator detects such moments by scanning for breaks of structure (BOS). When price pushes above or below recent swing levels with sufficient displacement, the script identifies the prior opposite candle as the potential order block.
Break of Structure
A break of structure in this context is defined when the closing price moves beyond the highest high or lowest low of a short lookback window. The script compares the magnitude of this break to an ATR-based displacement filter. This helps ensure that only meaningful moves are marked rather than small, random fluctuations.
Order-Flow Proxies
Traditional order flow analysis may use bid/ask data, footprint charts, or volume profiles. Because TradingView scripts cannot access true order-book data, this indicator instead uses proxy signals derived from standard chart data:
Delta (proxy): Estimated imbalance of buying vs. selling pressure, approximated using bar direction and volume.
Imbalance ratio: Normalizes delta by total volume, ranging between -1 and +1 in theory.
Cumulative Delta (CVD): Running sum of delta over time.
Effort vs. Result (EvR): A comparison between volume and actual bar movement, highlighting cases where large effort produced little result (or vice versa).
These are not real order-flow measurements, but rather simple mathematical constructs that mimic some of its logic.
How the Script Works
Detecting Break of Structure
The user specifies a swing length. When price closes above the recent high (for bullish BOS) or below the recent low (for bearish BOS), a potential shift is recorded.
To qualify, the breakout must exceed a displacement filter proportional to the ATR. This helps filter out weak moves.
Locating the Order Block Candle
Once a BOS is confirmed, the script looks back within a short window to find the last opposite-colored candle.
The high/low or open/close of that candle (depending on user settings) is marked as the potential order block zone.
Drawing and Maintaining Zones
Each order block is represented as a colored rectangle extending forward in time.
Bullish zones are teal by default, bearish zones are red.
Zones extend until invalidated (price closing or wicking beyond them, depending on user preference) or until a user-defined lifespan expires.
A pruning mechanism ensures that only the most recent set number of zones remain, preventing chart overload.
Monitoring Touches
The script checks whether the current bar’s range overlaps any existing order block.
If so, the “closest” zone is considered touched, and a label may appear on the chart.
Confirmation Filters
Touches can optionally be confirmed by order-flow proxies.
For a bullish confirmation, the following must align:
Imbalance ratio above threshold,
Delta EMA positive,
Effort vs. Result positive.
For a bearish confirmation, the opposite holds true.
Optionally, a higher-timeframe EMA slope filter can gate these confirmations. For example, a bullish confirmation may only be accepted if the higher-timeframe EMA is sloping upward.
Alerts
Users may create alerts based on conditions such as “bullish touch confirmed” or “bearish touch confirmed.”
Alerts can be gated to only fire after bar close, reducing intrabar noise.
Standard alertcondition calls are provided, and optional inline alert() calls can be enabled.
Inputs and Customization
Structure & OB
Swing length: Defines how many bars back to check for BOS.
ATR length & displacement factor: Adjust sensitivity for structural breaks.
Body vs. wick reference: Choose whether zones are based on candle bodies or full ranges.
Invalidation rule: Pick between wick breach or close beyond the level.
Lifespan (bars): Limit how long a zone remains active.
Max keep: Cap the number of zones stored to reduce clutter.
Order-Flow Proxies
Delta mode: Choose between “Close vs Previous Close” or “Body” for delta calculation.
EMA length: Smooths the delta/imbalance series.
Z-score lookback: Defines the averaging window for EvR.
Confirmation thresholds: Adjust the imbalance levels required for long/short confirmation.
Higher Timeframe Filter
Enable HTF gate: Optional filter requiring higher-timeframe EMA slope alignment.
HTF timeframe & EMA length: Configurable for context alignment.
Style
Colors and transparency for bullish and bearish zones.
Border color customization.
Alerts
Enable inline alerts: Optional direct calls to alert().
Alerts on bar close only: Helps avoid multiple firings during bar formation.
Practical Use
This tool is best seen as a way to annotate charts and to study how simple volume-derived signals behave near important structural levels. Some users may:
Observe whether order blocks line up with later price reactions.
Study how imbalance or cumulative delta conditions align with these zones.
Use it in a discretionary workflow to highlight areas of interest for deeper analysis.
Because the proxies are based only on candle OHLCV data, they are approximations. They cannot replace true depth-of-market analysis. Similarly, order block detection here is one specific algorithmic interpretation; other traders may define order blocks differently.
Limitations and Disclaimers
This indicator does not predict future price movement.
It does not access real order book or tick-by-tick data. All signals are derived from bar OHLCV.
Past performance of signals or zones does not guarantee future results.
The script is for educational and informational purposes only. It is not financial advice.
Users should test thoroughly, adjust parameters to their own instruments and timeframes, and use it in combination with broader analysis.
Summary
The Order Blocks + Order-Flow Proxies script is an experimental study tool that:
Detects potential order blocks using a displacement-filtered break of structure.
Marks these zones as boxes that persist until invalidation or expiry.
Provides lightweight order-flow-style proxies such as delta, imbalance, CVD, and effort vs. result.
Allows confirmation of zone touches through these proxies and optional higher-timeframe context.
Offers flexible customization, alerting, and chart-style options.
It is not a trading system by itself but rather a framework for studying price/volume behavior around structurally significant areas. With careful exploration, it can give users new ways to visualize market structure and to understand how simple flow-like measures behave in those contexts.
Order Blocks + Order-Flow ProxiesOrder Blocks + Order-Flow Proxies
This indicator combines structural analysis of order blocks with lightweight order-flow style proxies, providing a tool for chart annotation and contextual study. It is designed to help users visualize where significant structural shifts occur and how simple volume-based signals behave around those areas. The script does not guarantee profitable outcomes, nor does it issue financial advice. It is intended purely for research, learning, and discretionary use.
Conceptual Background
Order Blocks
An “order block” is a term often used to describe a zone on the chart where price left behind a significant reversal or imbalance before continuing strongly in the opposite direction. In practice, this can mean the last bullish or bearish candle before a strong breakout. Traders sometimes study these regions because they believe that unfilled resting orders may exist there, or simply because they mark important pivots in price structure. This indicator detects such moments by scanning for breaks of structure (BOS). When price pushes above or below recent swing levels with sufficient displacement, the script identifies the prior opposite candle as the potential order block.
Break of Structure
A break of structure in this context is defined when the closing price moves beyond the highest high or lowest low of a short lookback window. The script compares the magnitude of this break to an ATR-based displacement filter. This helps ensure that only meaningful moves are marked rather than small, random fluctuations.
Order-Flow Proxies
Traditional order flow analysis may use bid/ask data, footprint charts, or volume profiles. Because TradingView scripts cannot access true order-book data, this indicator instead uses proxy signals derived from standard chart data:
Delta (proxy): Estimated imbalance of buying vs. selling pressure, approximated using bar direction and volume.
Imbalance ratio: Normalizes delta by total volume, ranging between -1 and +1 in theory.
Cumulative Delta (CVD): Running sum of delta over time.
Effort vs. Result (EvR): A comparison between volume and actual bar movement, highlighting cases where large effort produced little result (or vice versa).
These are not real order-flow measurements, but rather simple mathematical constructs that mimic some of its logic.
How the Script Works
Detecting Break of Structure
The user specifies a swing length. When price closes above the recent high (for bullish BOS) or below the recent low (for bearish BOS), a potential shift is recorded.
To qualify, the breakout must exceed a displacement filter proportional to the ATR. This helps filter out weak moves.
Locating the Order Block Candle
Once a BOS is confirmed, the script looks back within a short window to find the last opposite-colored candle.
The high/low or open/close of that candle (depending on user settings) is marked as the potential order block zone.
Drawing and Maintaining Zones
Each order block is represented as a colored rectangle extending forward in time.
Bullish zones are teal by default, bearish zones are red.
Zones extend until invalidated (price closing or wicking beyond them, depending on user preference) or until a user-defined lifespan expires.
A pruning mechanism ensures that only the most recent set number of zones remain, preventing chart overload.
Monitoring Touches
The script checks whether the current bar’s range overlaps any existing order block.
If so, the “closest” zone is considered touched, and a label may appear on the chart.
Confirmation Filters
Touches can optionally be confirmed by order-flow proxies.
For a bullish confirmation, the following must align:
Imbalance ratio above threshold,
Delta EMA positive,
Effort vs. Result positive.
For a bearish confirmation, the opposite holds true.
Optionally, a higher-timeframe EMA slope filter can gate these confirmations. For example, a bullish confirmation may only be accepted if the higher-timeframe EMA is sloping upward.
Alerts
Users may create alerts based on conditions such as “bullish touch confirmed” or “bearish touch confirmed.”
Alerts can be gated to only fire after bar close, reducing intrabar noise.
Standard alertcondition calls are provided, and optional inline alert() calls can be enabled.
Inputs and Customization
Structure & OB
Swing length: Defines how many bars back to check for BOS.
ATR length & displacement factor: Adjust sensitivity for structural breaks.
Body vs. wick reference: Choose whether zones are based on candle bodies or full ranges.
Invalidation rule: Pick between wick breach or close beyond the level.
Lifespan (bars): Limit how long a zone remains active.
Max keep: Cap the number of zones stored to reduce clutter.
Order-Flow Proxies
Delta mode: Choose between “Close vs Previous Close” or “Body” for delta calculation.
EMA length: Smooths the delta/imbalance series.
Z-score lookback: Defines the averaging window for EvR.
Confirmation thresholds: Adjust the imbalance levels required for long/short confirmation.
Higher Timeframe Filter
Enable HTF gate: Optional filter requiring higher-timeframe EMA slope alignment.
HTF timeframe & EMA length: Configurable for context alignment.
Style
Colors and transparency for bullish and bearish zones.
Border color customization.
Alerts
Enable inline alerts: Optional direct calls to alert().
Alerts on bar close only: Helps avoid multiple firings during bar formation.
Practical Use
This tool is best seen as a way to annotate charts and to study how simple volume-derived signals behave near important structural levels. Some users may:
Observe whether order blocks line up with later price reactions.
Study how imbalance or cumulative delta conditions align with these zones.
Use it in a discretionary workflow to highlight areas of interest for deeper analysis.
Because the proxies are based only on candle OHLCV data, they are approximations. They cannot replace true depth-of-market analysis. Similarly, order block detection here is one specific algorithmic interpretation; other traders may define order blocks differently.
Limitations and Disclaimers
This indicator does not predict future price movement.
It does not access real order book or tick-by-tick data. All signals are derived from bar OHLCV.
Past performance of signals or zones does not guarantee future results.
The script is for educational and informational purposes only. It is not financial advice.
Users should test thoroughly, adjust parameters to their own instruments and timeframes, and use it in combination with broader analysis.
Summary
The Order Blocks + Order-Flow Proxies script is an experimental study tool that:
Detects potential order blocks using a displacement-filtered break of structure.
Marks these zones as boxes that persist until invalidation or expiry.
Provides lightweight order-flow-style proxies such as delta, imbalance, CVD, and effort vs. result.
Allows confirmation of zone touches through these proxies and optional higher-timeframe context.
Offers flexible customization, alerting, and chart-style options.
It is not a trading system by itself but rather a framework for studying price/volume behavior around structurally significant areas. With careful exploration, it can give users new ways to visualize market structure and to understand how simple flow-like measures behave in those contexts.