Daily contextThis indicator automatically marks the Previous Day’s High and Low, as well as the market’s midnight opening price.
These levels are updated at the start of each new trading day and remain visible throughout the entire session.
By providing key daily reference points, the indicator helps establish a clear market context and allows traders to immediately understand where price is positioned relative to the previous day’s range and the daily open.
อินดิเคเตอร์และกลยุทธ์
PEAD ScreenerPEAD Screener - Post-Earnings Announcement Drift Scanner
═══════════════════════════════════════════════════════════════
WHY EARNINGS ANNOUNCEMENTS CREATE OPPORTUNITY
═══════════════════════════════════════════════════════════════
The days immediately following an earnings announcement are among the noisiest periods for any stock. Within hours, the market must digest new information about a company's profits, revenue, and future outlook. Analysts scramble to update their models. Institutions rebalance positions. Retail traders react to headlines.
This chaos creates a well-documented phenomenon called Post-Earnings Announcement Drift (PEAD): stocks that beat expectations tend to keep rising, while those that miss tend to keep falling - often for weeks after the initial announcement. Academic research has confirmed this pattern persists across decades and markets.
But not every earnings surprise is equal. A company that beats estimates by 5 cents might move very differently than one that beats by 5 cents with unusually high volume, or one where both earnings AND revenue exceeded expectations. Raw numbers alone don't tell the full story.
═══════════════════════════════════════════════════════════════
HOW "STANDARDIZED UNEXPECTED" METRICS CUT THROUGH THE NOISE
═══════════════════════════════════════════════════════════════
This screener uses a statistical technique to measure how "surprising" a result truly is - not just whether it beat or missed, but how unusual that beat or miss was compared to the company's own history.
The core idea: convert raw surprises into Z-scores.
A Z-score answers the question: "How many standard deviations away from normal is this result?"
- A Z-score of 0 means the result was exactly average
- A Z-score of +2 means the result was unusually high (better than ~95% of historical results)
- A Z-score of -2 means the result was unusually low
By standardizing surprises this way, we can compare apples to apples. A small-cap biotech's $0.02 beat might actually be more significant than a mega-cap's $0.50 beat, once we account for each company's typical variability.
This screener applies this standardization to three dimensions: earnings (SUE), revenue (SURGE), and volume (SUV).
═══════════════════════════════════════════════════════════════
THE 9 SCREENING CRITERIA
═══════════════════════════════════════════════════════════════
─────────────────────────────────────────
1. SUE (Standardized Unexpected Earnings)
─────────────────────────────────────────
WHAT IT IS:
SUE measures how surprising an earnings result was, adjusted for the company's historical forecast accuracy.
Calculation: Take the earnings surprise (actual EPS minus analyst estimate), then divide by the standard deviation of past forecast errors. This uses a rolling window of the last 8 quarters by default.
Formula: SUE = (Actual EPS - Estimated EPS) / Standard Deviation of Past Errors
HOW TO INTERPRET:
- SUE > +2.0: Strongly positive surprise - earnings beat expectations by an unusually large margin. These stocks often continue drifting higher.
- SUE between 0 and +2.0: Modest positive surprise - beat expectations, but within normal range.
- SUE between -2.0 and 0: Modest negative surprise - missed expectations, but within normal range.
- SUE < -2.0: Strongly negative surprise - significant miss. These stocks often continue drifting lower.
For long positions, look for SUE values above +2.0, ideally combined with positive SURGE.
─────────────────────────────────────────
2. SURGE (Standardized Unexpected Revenue)
─────────────────────────────────────────
WHAT IT IS:
SURGE applies the same standardization technique to revenue surprises. While earnings can be manipulated through accounting choices, revenue is harder to fake - it represents actual sales.
Calculation: Take the revenue surprise (actual revenue minus analyst estimate), then divide by the standard deviation of past revenue forecast errors.
Formula: SURGE = (Actual Revenue - Estimated Revenue) / Standard Deviation of Past Errors
HOW TO INTERPRET:
- SURGE > +1.5: Strongly positive revenue surprise - the company sold significantly more than expected.
- SURGE between 0 and +1.5: Modest positive surprise.
- SURGE < 0: Revenue missed expectations.
The most powerful signals occur when BOTH SUE and SURGE are positive and elevated (ideally SUE > 2.0 AND SURGE > 1.5). This indicates the company beat on both profitability AND top-line growth - a much stronger signal than either alone.
When SUE and SURGE diverge significantly (e.g., high SUE but negative SURGE), treat with caution - the earnings beat may have come from cost-cutting rather than genuine growth.
─────────────────────────────────────────
3. SUV (Standardized Unexpected Volume)
─────────────────────────────────────────
WHAT IT IS:
SUV detects unusual trading volume after accounting for how volatile the stock is. More volatile stocks naturally have higher volume, so raw volume comparisons can be misleading.
Calculation: This uses regression analysis to model the expected relationship between price volatility and volume. The "unexpected" volume is the residual - how much actual volume deviated from what the model predicted. This residual is then standardized into a Z-score.
In plain terms: SUV asks "Given how much this stock typically moves, is today's volume unusually high or low?"
HOW TO INTERPRET:
- SUV > +2.0: Exceptionally high volume relative to the stock's volatility. This often signals institutional activity - big players moving in or out.
- SUV between +1.0 and +2.0: Elevated volume - above normal interest.
- SUV between -1.0 and +1.0: Normal volume range.
- SUV < -1.0: Unusually quiet - less activity than expected.
High SUV combined with positive price movement suggests accumulation (buying). High SUV combined with negative price movement suggests distribution (selling).
─────────────────────────────────────────
4. % From D0 Close
─────────────────────────────────────────
WHAT IT IS:
This measures how far the current price has moved from the closing price on its initial earnings reaction day (D0). The "reaction day" is the first trading day that fully reflects the earnings news - typically the day after an after-hours announcement, or the announcement day itself for pre-market releases.
Calculation: ((Current Price - D0 Close) / D0 Close) × 100
HOW TO INTERPRET:
- Positive values: Stock has gained ground since earnings. The higher the percentage, the stronger the post-earnings drift.
- 0% to +5%: Modest positive drift - earnings were received well but momentum is limited.
- +5% to +15%: Strong drift - buyers continue accumulating.
- > +15%: Exceptional drift - significant institutional interest likely.
- Negative values: Stock has given back gains or extended losses since earnings. May indicate the initial reaction was overdone, or that sentiment is deteriorating.
This metric is most meaningful within the first 5-20 trading days after earnings. Extended drift (maintaining gains over 2+ weeks) is a stronger signal than a quick spike that fades.
─────────────────────────────────────────
5. # Pocket Pivots
─────────────────────────────────────────
WHAT IT IS:
Pocket Pivots are a volume-based pattern developed by Chris Kacher and Gil Morales. They identify days where institutional buyers are likely accumulating shares without causing obvious breakouts.
Calculation: A Pocket Pivot occurs when:
- The stock closes higher than it opened (up day)
- The stock closes higher than the previous day's close
- Today's volume exceeds the highest down-day volume of the prior 10 trading sessions
The screener counts how many Pocket Pivots have occurred since the earnings announcement.
HOW TO INTERPRET:
- 0 Pocket Pivots: No detected institutional accumulation patterns since earnings.
- 1-2 Pocket Pivots: Some institutional buying interest - worth monitoring.
- 3+ Pocket Pivots: Strong accumulation signal - institutions appear to be building positions.
Pocket Pivots are most significant when they occur:
- Immediately following earnings announcements
- Near moving average support (10-day, 21-day, or 50-day)
- On above-average volume
- After a period of price consolidation
Multiple Pocket Pivots in a short period suggest sustained institutional demand, not just a one-day event.
─────────────────────────────────────────
6. ADX/DI (Trend Strength and Direction)
─────────────────────────────────────────
WHAT IT IS:
ADX (Average Directional Index) measures trend strength regardless of direction. DI (Directional Indicator) shows whether the trend is bullish or bearish.
Calculation: ADX uses a 14-period lookback to measure how directional (trending) price movement is. Values range from 0 to 100. The +DI and -DI components compare upward and downward movement.
The screener shows:
- ADX value (trend strength)
- Direction indicator: "+" for bullish (price trending up), "-" for bearish (price trending down)
HOW TO INTERPRET:
- ADX < 20: Weak trend - the stock is moving sideways, choppy. Not ideal for momentum trading.
- ADX 20-25: Trend is emerging - potentially starting a directional move.
- ADX 25-40: Strong trend - clear directional movement. Good for momentum plays.
- ADX > 40: Very strong trend - powerful move in progress, but may be extended.
The direction indicator (+/-) tells you which way:
- "25+" means ADX of 25 with bullish direction (uptrend)
- "25-" means ADX of 25 with bearish direction (downtrend)
For post-earnings plays, ideal setups show ADX rising above 25 with positive direction, confirming the earnings reaction is developing into a sustained trend rather than a one-day spike.
─────────────────────────────────────────
7. Institutional Buying PASS
─────────────────────────────────────────
WHAT IT IS:
This proprietary composite indicator detects patterns consistent with institutional accumulation at three stages after earnings:
EARLY (Days 0-4): Looks for "large block" buying on the earnings reaction day (exceptionally high volume with a close in the upper half of the day's range) combined with follow-through buying on the next day.
MID (Days 5-9): Checks for sustained elevated volume (averaging 1.5x the 20-day average) combined with positive drift and consistent upward price movement (more up days than down days).
LATE (Days 10+): Detects either visible accumulation (positive drift with high volume) OR stealth accumulation (positive drift with unusually LOW volume - suggesting smart money is quietly building positions without attracting attention).
HOW TO INTERPRET:
- Check mark/value of '1': Institutional buying pattern detected. The stock shows characteristics consistent with large players accumulating shares.
- X mark/value of '0': No institutional buying pattern detected. This doesn't mean institutions aren't buying - just that the typical footprints aren't visible.
A passing grade here adds conviction to other bullish signals. Institutions have research teams, information advantages, and long time horizons. When their footprints appear in the data, it often precedes sustained moves.
Important: This is a pattern detection tool, not a guarantee. Always combine with other analysis.
─────────────────────────────────────────
8. Strong ATR Drift PASS
─────────────────────────────────────────
WHAT IT IS:
This measures whether the stock has drifted significantly relative to its own volatility. Instead of asking "did it move 10%?", it asks "did it move more than 1.5 ATRs?"
ATR (Average True Range) measures a stock's typical daily movement. A volatile stock might move 5% daily, while a stable stock might move 0.5%. Using ATR normalizes for this difference.
Calculation:
ATR Drift = (Current Close - D0 Close) / D0 ATR in dollars
The indicator passes when ATR Drift exceeds 1.5 AND at least 5 days have passed since earnings.
HOW TO INTERPRET:
- Check mark/value of '1': The stock has drifted more than 1.5 times its average daily range since earnings - a statistically significant move that suggests genuine momentum, not just noise.
- X mark/value of '0': The drift (if any) is within normal volatility bounds - could just be random fluctuation.
Why wait 5 days? The immediate post-earnings reaction (days 0-2) often includes gap fills and noise. By day 5, if the stock is still extended beyond 1.5 ATRs from the earnings close, it suggests real buying pressure, not just a reflexive gap.
A passing grade here helps filter out stocks that "beat earnings" but haven't actually moved meaningfully. It focuses attention on stocks where the market is voting with real capital.
─────────────────────────────────────────
9. Days Since D0
─────────────────────────────────────────
WHAT IT IS:
Simply counts the number of trading days since the earnings reaction day (D0).
HOW TO INTERPRET:
- Days 0-5 (Green): Fresh earnings - the information is new, institutional repositioning is active, and momentum trades are most potent. This is the "sweet spot" for PEAD strategies.
- Days 6-10 (Neutral): Mid-period - some edge remains but diminishing. Good for adding to winning positions, less ideal for new entries.
- Days 11+ (Red): Extended period - most of the post-earnings drift has typically played out. Higher risk that momentum fades or reverses.
Research shows PEAD effects are strongest in the first 5-10 days after earnings, then decay. Beyond 20-30 days, the informational advantage of the earnings surprise is largely priced in.
Use this to prioritize: focus on stocks with strong signals that are still in the early window, and be more selective about entries as days accumulate.
═══════════════════════════════════════════════════════════════
PUTTING IT ALL TOGETHER
═══════════════════════════════════════════════════════════════
You can use this screener in the chart view or in the Screener.
One combination of the above filters to develop a shortlist of positive drift candidates may be:
- SUE > 2.0 (significant earnings beat)
- SURGE > 1.5 (significant revenue beat)
- Positive % From D0 Close (price confirming the good news)
- Institutional Buying PASS (big players accumulating)
- Strong ATR Drift PASS (statistically significant movement)
- Days Since D0 < 10 (still in the active drift window)
No single indicator is sufficient. The power comes from convergence - when multiple independent measures all point the same direction.
═══════════════════════════════════════════════════════════════
SETTINGS
═══════════════════════════════════════════════════════════════
Key adjustable parameters:
- SUE Method: "Analyst-based" uses consensus estimates; "Time-series" uses year-over-year comparison
- Window Size: Number of quarters used for standardization (default: 8)
- ATR Drift Threshold: Minimum ATR multiple for "strong" classification (default: 1.5)
- Institutional Buying thresholds: Adjustable volume and CLV parameters
═══════════════════════════════════════════════════════════════
DISCLAIMER
═══════════════════════════════════════════════════════════════
This screener is a research tool, not financial advice. Past patterns do not guarantee future results. Always conduct your own due diligence and manage risk appropriately. Post-earnings trading involves significant uncertainty and volatility. The 'SUE' in this indicator does not represent a real person; any similarity to actual Sue's (or Susans for that matter) living or dead is quite frankly ridiculous, not to mention coincidental.
EMA Color Buy/Sell
indicator("EMA Color & Buy/Sell Signals", overlay=true, max_lines_count=500, max_labels_count=500)
EMA
emaShortLen = input.int(9, "Kısa EMA")
emaLongLen = input.int(21, "Uzun EMA")
EMA
emaShort = ta.ema(close, emaShortLen)
emaLong = ta.ema(close, emaLongLen)
EMA renkleri (trend yönüne göre)
emaShortColor = emaShort > emaShort ? color.green : color.red
emaLongColor = emaLong > emaLong ? color.green : color.red
EMA
plot(emaShort, color=emaShortColor, linewidth=3, title="EMA Short")
plot(emaLong, color=emaLongColor, linewidth=3, title="EMA Long")
buySignal = ta.crossover(emaShort, emaLong)
sellSignal = ta.crossunder(emaShort, emaLong)
plotshape(buySignal, title="Buy", location=location.belowbar, color=color.lime, style=shape.triangleup, size=size.large)
plotshape(sellSignal, title="Sell", location=location.abovebar, color=color.red, style=shape.triangledown, size=size.large)
barcolor(close > open ? color.new(color.green, 0) : color.new(color.red, 0))
var line buyLine = na
var line sellLine = na
if buySignal
buyLine := line.new(bar_index, low, bar_index, high, color=color.lime, width=2)
if sellSignal
sellLine := line.new(bar_index, high, bar_index, low, color=color.red, width=2)
RMA Trend
indicator("RMA Trend İndikatörü", overlay=true, timeframe="", timeframe_gaps=true)
length = input.int(14, "RMA Periyodu", minval=1)
src = input(close, "Kapanış Kaynağı")
rma_val = ta.rma(src, length)
rma_color = rma_val > rma_val ? color.new(color.lime, 0) : color.new(color.red, 0)
plot(rma_val, title="RMA", color=rma_color, linewidth=3
longSignal = ta.crossover(src, rma_val)
shortSignal = ta.crossunder(src, rma_val)
plotshape(longSignal, title="AL Sinyali", style=shape.triangleup, location=location.belowbar, color=color.new(color.lime, 0), size=size.large, text="AL")
plotshape(shortSignal, title="SAT Sinyali", style=shape.triangledown, location=location.abovebar, color=color.new(color.red, 0), size=size.large, text="SAT")
bgcolor(rma_val > rma_val ? color.new(color.lime, 90) : color.new(color.red, 90))
ICT Premium/Discount Zones [Exponential-X]Premium/Discount Zones - Visual Market Structure Tool
Overview
This indicator helps traders visualize premium and discount price zones based on recent market structure. It automatically identifies swing highs and lows within a specified lookback period and divides the price range into three key areas: Premium Zone, Equilibrium, and Discount Zone.
What This Indicator Does
The script continuously monitors price action and calculates:
Highest High and Lowest Low within the lookback period
Equilibrium Level - the midpoint between the swing high and low
Premium Zone - the area from equilibrium to the swing high (typically viewed as relatively expensive price levels)
Discount Zone - the area from the swing low to equilibrium (typically viewed as relatively cheap price levels)
Core Calculation Method
The indicator uses pivot point logic to identify significant swing highs and lows based on the pivot strength parameter. It then calculates the highest high and lowest low over the specified lookback period. The equilibrium is computed as the arithmetic mean of these two extremes, creating a fair value reference point.
The zones are dynamically updated as new price data becomes available, ensuring the visualization remains relevant to current market conditions.
Key Features
Dynamic Zone Detection
Automatically adjusts zones based on recent price action
Uses customizable lookback period for flexibility across different timeframes
Employs pivot strength parameter to filter out minor price fluctuations
Visual Clarity
Color-coded zones for easy identification (red for premium, green for discount)
Optional equilibrium line display
Adjustable zone label placement
Customizable color schemes to match your charting preferences
Alert Capabilities
Alerts when price enters the premium zone
Alerts when price enters the discount zone
Alerts when price returns to equilibrium
Helps traders monitor key zone interactions without constant chart watching
Customization Options
Adjustable lookback period (5-500 bars)
Configurable pivot strength for swing detection (1-20 bars)
Control over box extension into the future
Toggle labels and equilibrium line on/off
Full color customization for all visual elements
How to Use This Indicator
Setup
Add the indicator to your chart
Adjust the lookback period to match your trading timeframe (shorter for intraday, longer for swing trading)
Set pivot strength to filter out noise (higher values for major swings, lower for more frequent updates)
Customize colors and labels to your preference
Interpretation
Premium Zone: Price trading here may indicate potential resistance or selling opportunities when aligned with other technical factors
Discount Zone: Price trading here may indicate potential support or buying opportunities when aligned with other technical factors
Equilibrium: Acts as a fair value reference point where price often consolidates or reacts
Trading Applications
This tool works well when combined with other forms of analysis such as:
Trend identification indicators
Volume analysis
Support and resistance levels
Price action patterns
Market structure analysis
Important Considerations
This indicator identifies zones based purely on historical price data
Premium and discount zones are relative to the recent lookback period
The effectiveness varies across different market conditions and timeframes
Should be used as part of a comprehensive trading strategy, not in isolation
Past price structure does not guarantee future price behavior
Technical Details
Calculation Method
Uses Pine Script's ta.pivothigh() and ta.pivotlow() functions for swing detection
Employs ta.highest() and ta.lowest() for range calculation
Updates dynamically with each new bar
Draws zones using box objects for clear visual representation
Performance Optimization
Efficiently manages box and line objects to minimize resource usage
Uses conditional plotting to reduce unnecessary calculations
Limited to essential visual elements for chart clarity
Timeframe Compatibility
This indicator works on all timeframes but the recommended settings vary:
1-5 minute charts: Lookback period 10-20, Pivot strength 3-5
15-60 minute charts: Lookback period 20-50, Pivot strength 5-10
Daily charts: Lookback period 50-100, Pivot strength 10-15
Weekly charts: Lookback period 20-50, Pivot strength 5-10
Adjust these values based on the volatility of your specific instrument.
Limitations and Considerations
What This Indicator Does NOT Do
Does not provide buy or sell signals on its own
Does not predict future price movements
Does not account for fundamental factors or market events
Does not guarantee profitability or accuracy
Market Condition Awareness
In strong trending markets, price may remain in premium or discount zones for extended periods
During ranging conditions, price typically oscillates between zones more predictably
High volatility can cause frequent zone recalculations
Low volatility may result in narrow zones with limited practical use
Risk Considerations
Premium and discount are relative concepts, not absolute values
What appears as a discount zone may continue lower in a downtrend
What appears as a premium zone may continue higher in an uptrend
Always use proper risk management and position sizing
Consider multiple timeframe analysis for context
Version Information
This indicator is written in Pine Script v6, ensuring compatibility with the latest TradingView features and optimal performance.
Final Notes
This tool is designed to enhance your market analysis by providing a clear visual representation of premium and discount price zones. It should be used as one component of a well-rounded trading approach that includes proper risk management, multiple forms of analysis, and realistic expectations about market behavior.
The concept of premium and discount zones is rooted in auction market theory and the idea that price oscillates around fair value. However, traders should understand that these zones are interpretive tools based on historical data and do not constitute trading advice or predictions about future price action.
Remember to backtest any strategy using this indicator on historical data before applying it to live trading, and always trade responsibly within your risk tolerance.
Disclaimer: The information provided by this indicator is for educational and informational purposes only. It does not constitute financial advice, investment advice, trading advice, or any other sort of advice. Always conduct your own research and consult with qualified financial professionals before making trading decisions.
Index & Stock Options Reference Tool-(ISORT) [Arjo]The Index & Stock Options Reference Tool-(ISORT) is an indicator that helps users observe price trend direction together with commonly used option strike levels for selected indices and stocks in Indian market .
The indicator integrates a smoothed trend framework with structured option-related data to help users observe how price direction aligns with commonly referenced option strike levels .
It does not generate trading signals, does not provide buy or sell recommendations, and does not evaluate profitability .
Key Features
1. Trend Context Engine
Uses a Super-Smoother filter combined with EMA smoothing
Highlights directional context through color-based trend states
Designed to reduce short-term noise
2. Dynamic ATM & Strike Reference
Automatically computes ATM strike and offset strike levels to select OTM strike
Strike intervals adapt to the selected index or stock
Supports both NSE and BSE instruments, including SENSEX
3. Expiry Awareness
User-selectable expiry date inputs
Displays a visual warning if the selected expiry has already passed
Helps avoid referencing outdated option contracts
4. Option Price Reference Panel
Displays last observed CALL and PUT prices (when available)
Allows optional manual entry values for analytical comparison
All price values are shown strictly as references
5. Informational Table Overlay
Customizable on-chart table layout
Displays strike, timestamp, price reference, and arithmetic P&L values
Table values are informational only, not predictive or advisory
How to Use
1. Select the Underlying Instrument
Choose whether to reference the current chart symbol or a custom index/stock from the input settings
Supported instruments include major NSE indices, selected stocks, and SENSEX
2. Configure Expiry Parameters
Enter the option expiry date using the Day, Month, and Year inputs
If an expired date is selected, the indicator will display a visual warning
This helps ensure option references remain time-relevant
3. Observe Trend Context
The smoothed trend line provides directional context only
Color changes reflect shifts in price structure, not trade instructions
This trend is intended for contextual analysis, not timing entries
4. Review Strike References
The indicator automatically calculates ATM and offset strike levels
Strike spacing adjusts based on the selected index or stock
These values serve as reference levels commonly observed in options markets
5. Interpret the Information Table
The on-chart table displays:
Strike level
Timestamp of the most recent context change
Last observed option price (when available)
Arithmetic price difference values
All values are informational references only and do not represent performance or outcomes
6. Optional Manual Inputs
Manual price fields can be used to compare external reference values
These inputs do not trigger signals or automated calculations
Important Notes
This indicator is not a trading system
It does not generate buy or sell signals
It does not provide financial or trading advice
It is intended for learning, observation, and market study
Disclaimer
This script is provided for educational and analytical purposes only. It does not constitute investment advice, trading advice. The author assumes no responsibility for decisions made using this indicator.
Happy Trading (Arjo)
Al Brooks - EMA20Instead of simply fetching data from the 60-minute or 15-minute charts, this script mathematically simulates the internal logic of those EMAs directly on your current timeframe.
Just for fun.
Adaptive 2-Pole Trend Bands [supfabio]Adaptive 2-Pole Trend Bands is a volatility-aware trend filtering indicator designed to identify the dominant market direction while providing dynamic reference zones around price.
Instead of relying on traditional moving averages, this indicator uses a two-pole digital filter to smooth price action while maintaining responsiveness. Around this central trend line, a multi-band structure based on ATR is applied to help traders evaluate pullbacks, extensions, and potential exhaustion areas within a trend.
Core Concept
The indicator is built around three key ideas:
Digital Trend Filtering
Volatility-Adjusted Bands
Trend Persistence Measurement
These components work together to separate meaningful price movement from noise and to provide context for how far price has moved relative to recent volatility.
Two-Pole Trend Filter
At its core, the indicator uses a two-pole smoothing filter, which produces a cleaner trend curve than common moving averages.
Compared to standard averages, this approach:
Reduces market noise
Produces smoother transitions
Responds faster to genuine trend changes
Avoids excessive lag in trending markets
The result is a trend line that represents the structural direction of price, rather than short-term fluctuations.
Adaptive Multi-Band System
Around the central trend filter, the indicator plots four independent volatility-based bands, each derived from the Average True Range (ATR).
Each band represents a different degree of price extension:
Band 1: Shallow pullbacks and minor reactions
Band 2: Moderate extensions within a trend
Band 3: Strong directional moves
Band 4: Extreme extensions relative to recent volatility
Because the bands are ATR-based, they automatically adapt to changing market conditions, expanding during high volatility and contracting during calmer periods.
This makes the indicator suitable for both slow and fast markets without manual recalibration.
Trend State Detection
The color of the central filter dynamically reflects trend persistence, not just direction:
Sustained upward movement highlights bullish conditions
Sustained downward movement highlights bearish conditions
Transitional phases are visually distinct, helping identify regime changes
This logic is based on how long price has maintained directional behavior, reducing sensitivity to isolated candles or short-lived spikes.
Practical Applications
This indicator can be used as:
A trend filter for discretionary or systematic strategies
A context tool to evaluate pullbacks versus overextension
A risk reference to avoid entries in extreme price zones
A confirmation layer when combined with price action or momentum tools
It performs consistently across different asset classes, including futures, cryptocurrencies, forex, indices, and equities.
Configuration
Key parameters such as filter length, damping factor, and band multipliers are fully configurable, allowing traders to adapt the indicator to different timeframes and trading styles.
Important Notes
This indicator does not predict future price movement
It does not generate guaranteed buy or sell signals
Best results are achieved when used in combination with sound risk management and additional confirmation tools
Past behavior does not imply future performance
Disclaimer
This indicator is provided for educational and analytical purposes only and should not be considered financial advice.
Se quiser, posso:
Criar uma versão resumida para a primeira linha da publicação
Ajustar o texto para um tom mais técnico ou mais comercial
Traduzir para português mantendo o inglês como idioma principal
Revisar o título para SEO dentro da Biblioteca Pública
Opening Range Breakout with VWAP & RSI ConfirmationThis indicator identifies breakout trading opportunities based on the Opening Range Breakout (ORB) strategy combined with intraday VWAP and higher timeframe RSI confirmation.
Opening Range: Calculates the high, low, and midpoint of the first 15 or 30 minutes (configurable) after your specified market open time.
Intraday VWAP: A volume-weighted average price calculated manually and reset daily, tracking price action throughout the trading day.
RSI Confirmation: Uses RSI from a user-selected higher timeframe (1H, 4H, or Daily) to confirm signals.
Buy Signal: Triggered when VWAP breaks above the Opening Range High AND the RSI is below or equal to the buy threshold (default 30).
Sell Signal: Triggered when VWAP breaks below the Opening Range Low AND the RSI is above or equal to the sell threshold (default 70).
Visuals: Plots Opening Range levels and VWAP on the chart with clear buy/sell markers and optional labels showing RSI values.
Alerts: Provides alert conditions for buy and sell signals to facilitate timely trading decisions.
This tool helps traders capture momentum breakouts while filtering trades based on momentum strength indicated by RSI.
POI Zones with Imbalance- Ahmed AwadHighlights Point of Interest (POI) zones on the chart where a significant price imbalance occurs between the candle’s open and close. The indicator draws semi-transparent orange zones to mark potential buy or sell areas, helping traders spot strong price moves and key levels. Adjustable imbalance threshold and transparency for flexibility.
Liquidity Entry Triggers (4-Model System) | WarRoomXYZLiquidity Entry Triggers is an open-source, price-action-based analytical framework designed to highlight recurring institutional liquidity behaviors that appear across all liquid markets.
The script focuses on how and where liquidity is taken, rather than attempting to predict direction using oscillators or lagging indicators.
It is optimized for XAUUSD, FX pairs, indices, and crypto , particularly on 1m–15m timeframes where session behavior and liquidity reactions are most visible.
This tool is not a buy/sell signal generator .
It provides contextual entry zones based on structural liquidity logic, allowing traders to apply their own execution rules.
Core Philosophy
Markets move because of:
•Trapped traders
•Forced liquidations
•Session-based liquidity cycles
•Reactions at prior institutional participation zones
This script visualizes four repeatable entry triggers that emerge from those mechanisms.
🔹 1. Failed Breakout / Trapped Trader Model
When price breaks a clearly defined range high or low, breakout traders often enter expecting continuation.
If price fails to hold outside the range and closes back inside, those traders become trapped.
The script detects:
•Breaks beyond recent highs/lows
•Immediate rejection back into the range
•Structural failure of momentum
These conditions frequently lead to mean reversion or reversal moves as trapped traders exit and fuel movement in the opposite direction.
Markers are plotted at the point of failure to highlight potential trap zones.
🔹 2. Liquidation Flush Detection
Sharp impulsive candles with abnormally large wicks often represent liquidation cascades rather than healthy trend continuation.
The script identifies liquidation behavior by measuring:
•Wick-to-body imbalance
•Sudden expansion followed by rejection
•Temporary price inefficiencies
These flushes commonly occur near:
•Session highs/lows
•Range extremes
•Trend exhaustion points
Such events often lead to rebalance moves , where price partially or fully fills the wick.
🔹 3. Orderblock Reaction Zones
Orderblocks represent areas where heavy participation occurred before a strong displacement move.
The script highlights:
•Clean bullish and bearish orderblock structures
•Zones formed during consolidation prior to expansion
•Areas likely to be defended when revisited
Orderblocks with minimal noise and clean departure are prioritized, as they often reflect institutional positioning rather than retail activity.
These zones are intended as reaction areas , not automatic entry signals.
🔹 4. London Session Liquidity Sweep Model
The London session frequently establishes the initial daily high or low.
Later in the session or during New York, price often:
•Sweeps internal liquidity around that level
•Rejects after the sweep
•Continues with the higher-timeframe bias
The script monitors London session behavior and marks:
•Liquidity runs above/below London highs and lows
•Rejections back inside the prior structure
This model is especially effective when combined with broader daily context.
🔹4. How the Components Work Together
The framework is designed as a context stack , not a checklist of signals:
Liquidity Event → Location → Timing → Trader Execution
Each model reinforces the others:
•Failed breakouts often occur after liquidity sweeps
•Liquidation wicks frequently form near orderblocks
•London sweeps often trigger failed momentum moves
•Confluence increases probability, not certainty
🔹 Practical Usage Guide
✔ Identify context
Determine whether price is approaching a range extreme, session level, or prior participation zone.
✔ Wait for a liquidity event
Look for a sweep, failed breakout, or liquidation wick.
✔ Observe reaction
Rejection, displacement, or reclaim behavior provides confirmation.
✔ Execute manually
Stops are commonly placed beyond the liquidity extreme.
Targets are typically internal liquidity, prior highs/lows, or imbalance zones.
The indicator does not manage trades or enforce rules.
Execution and risk management remain the trader’s responsibility.
🔹 5. Originality & Design Notes
This script does not replicate or bundle existing indicators.
It introduces:
•A multi-model liquidity entry framework
•Structural failed breakout detection
•Wick-based liquidation imbalance logic
•Session-aware liquidity sweep visualization
•A unified, minimal, non-lagging design
All concepts are based on observable market behavior and integrated into a single analytical tool.
🔹 6. Suitable Markets & Timeframes
Works best on:
•XAUUSD
•Major FX pairs
•Indices
•Liquid crypto markets
Recommended timeframes:
•1m
•5m
•15m
•30m
🔹7. Limitations & Notes
•This is an analytical framework , not a trading system
•All markings are confirmed at candle close (non-repainting)
•No open interest or order flow data is used
•Results depend on user interpretation and execution
•Best used alongside session bias and higher-timeframe structure
Disclaimer
This script is provided for educational and informational purposes only.
It does not constitute financial advice, investment advice, or a recommendation to buy or sell any instrument.
Trading involves risk, and losses can exceed initial deposits.
The author assumes no responsibility for trading decisions made using this tool.
Users are strongly encouraged to test this script in demo or simulation environments and to apply proper risk management, position sizing, and personal discretion at all times.
By using this script, you acknowledge and accept all associated risks.
Index ScalpingIndex Scalping Indicator will help to reduced the noise and provide clear call/put options. Use it in 5 min timeframe
FxAST Trend Force [ALLDYN]Attribution
This indicator is based on the original Trend Speed Analyzer created by Zeiierman .
FxAST Trend Force is a modified and simplified derivative that preserves the core methodology while focusing on clarity, usability, and practical trend interpretation .
This indicator is intended for educational and analytical use. Derivative works must retain attribution and license terms.
__________________________________________________________________________________
FxAST Trend Force
Overview
FxAST Trend Force is a directional pressure indicator designed to show who is in control of the market and how strong that control is, in real time.
Instead of measuring raw price speed or traditional momentum, this tool focuses on trend force — the sustained push of price relative to a dynamic trend baseline. The result is a clean, intuitive view of trend direction, strength, and condition without complex math or hard-to-interpret ratios.
This indicator is best used as a trend confirmation and trade management tool , not a standalone signal generator.
_________________________________________________________________________________
How It Works
FxAST Trend Force uses a Dynamic Moving Average (DMA) that adapts to changing market conditions. Price behavior relative to this adaptive trend line determines the current trend regime.
While price remains on one side of the trend:
Directional pressure accumulates
Strength builds or weakens
The regime resets only when price decisively crosses the trend
This creates a clear visual representation of trend persistence vs exhaustion , rather than short-term noise.
__________________________________________________________________________________
Core Concepts (Plain English)
Trend
Shows the current directional bias:
Bull → price above the dynamic trend
Bear → price below the dynamic trend
This answers: “Which side is currently in control?”
__________________________________________________________________________________
Strength
Displays how strong the current trend pressure is on a 0–100 scale , normalized to recent market conditions.
Strength is shown both as:
A simple label: Weak / Normal / Strong
A visual meter for quick interpretation
This answers: “Is this move weak, average, or meaningful?”
__________________________________________________________________________________
State
Indicates whether trend force is:
Building → pressure increasing
Fading → pressure weakening
This answers: “Is the trend gaining energy or losing it?”
__________________________________________________________________________________
Visual Meter
A compact bar at the bottom of the table represents trend force intensity at a glance.
Longer bar → stronger sustained pressure
Shorter bar → weaker or stalling trend
No ratios. No multipliers. Just visual clarity.
__________________________________________________________________________________
How to Use
Trend Confirmation
Favor longs when Trend = Bull and Strength = Normal/Strong
Favor shorts when Trend = Bear and Strength = Normal/Strong
__________________________________________________________________________________
Trade Management
Building state supports continuation
Fading state warns of exhaustion, consolidation, or potential reversal
__________________________________________________________________________________
Filtering Noise
Weak strength often signals chop or low-quality conditions
Strong force helps filter false breakouts
__________________________________________________________________________________
Settings (Simplified)
Maximum Length
Controls how smooth or responsive the dynamic trend is.
Accelerator Multiplier
Adjusts how quickly the trend adapts to price changes.
Lookback Period
Defines the window used to normalize trend force.
Enable Candles
Colors price candles by trend force for visual clarity.
Show Simple Table
Toggles the Trend / Strength / State display.
__________________________________________________________________________________
Philosophy
FxAST Trend Force is intentionally not a signal-spamming indicator.
It is designed to reduce cognitive load , not increase it.
If you need:
exact entries → use price action
exact exits → use structure
context and confirmation → use Trend Force
__________________________________________________________________________________
Disclaimer
This indicator is provided for educational purposes only and does not constitute financial advice. Trading involves risk, and users are responsible for their own decisions.
NeoChartLabs POCOne of our Favorite Indicators - the High Time Frame Point of Control with a Volume Profile.
Shout out to p2pasta for the original script, we updated to v6.
Currently included: Monthly, 3 months and 6 months.
/* DEFINITION */
Point Of Control (= POC) is a price level at which the heaviest volumes were traded.
Value Area High/Low (=VAH/VAL) is a range of prices where the majority of trading volume took place. Naturally, Value Area High being the top price level and Value Area Low being the lowest. POC always is between the two.
/* HOW TO TRADE WITH THIS INDICATOR */
The basis for POC is determining bias on whichever timeframe you choose.
1. Identify a POC on the timeframe of your choosing.
/* If you choose a "low" timeframe (monthly here) then make sure to look at the higher timeframes to see how it is playing against a higher timeframe POC.
2. When the price is moving away from the POC (either to the upside or downside) this will confirm or invalidate the trade.
3. You can now enter the trade on bias or wait for a retest of the same POC.
VixTrixVixTrix - Because markets move in both directions.
VixTrix was born from a fundamental limitation in traditional volatility indicators: they only measure downside panic, completely missing the greed-driven extremes that form market tops.
How It Works:
Dual-Component Analysis:
vixBear = Panic selling intensity (distance from recent highs)
vixBull = FOMO buying intensity (distance from recent lows)
Oscillator = vixBear - vixBull = Net fear/greed imbalance
When the oscillator is positive, fear dominates (potential bottom forming). When negative, greed dominates (potential top forming).
Professional-Grade Filtering:
The magic happens with the symmetric RMS (Root Mean Square) bands. Unlike fixed percentage bands or standard deviation, RMS:
Creates mathematically symmetric positive/negative thresholds
Naturally adapts to changing volatility regimes
Provides statistical significance to extremes
VixTrix also adds selectable MA smoothing for the RMS calculation:
WMA (default): Balanced – middle-ground approach
VWMA: Volume-weighted – filters low-volume noise
EMA: Responsive – catches quick reversals
SMA: Stable – for swing trading
HMA: Fast and smooth – ideal for day trading
Signals require triple confirmation:
Statistical Extreme: Oscillator beyond RMS band
Price Action Confirmation: Correct candle color (bullish for bottoms, bearish for tops)
Momentum Continuation: Oscillator still moving toward extreme (exhaustion)
This multi-filter approach reduces premature entries and false signals while maintaining early positioning at potential reversal points.
Why This Matters for Your Trading:
In bull markets, traditional fear indicators sit near zero, giving no warning of impending tops.
VixTrix identifies when greed becomes excessive – when FOMO buying reaches statistical extremes that often precede corrections.
In range-bound markets, VixTrix excels at identifying overreactions in both directions, providing high-probability mean reversion opportunities.
During crashes, it captures the panic selling with the same precision as VixFix, but with better timing through its momentum confirmation.
VixTrix spots continuations through:
"No Signal" = Healthy Trend – Oscillator stays between RMS bands (no exhaustion)
Failed Extremes – Touches band but no triple confirmation = trend likely continues
Hidden Divergence – Price makes higher low while oscillator makes shallower low = uptrend continues
Controlled Emotions – Oscillator negative but not extreme in uptrends (greed present but not excessive)
Key Insight: When VixTrix doesn't give a signal during a pullback, institutions aren't panicking – they're just pausing before resuming the trend.
Green columns = Bullish exhaustion (potential bottoms)
Red columns = Bearish exhaustion (potential tops)
Golden RMS bands = Dynamic thresholds adapting to current volatility
Background highlights = Active signal conditions
The Result: A professional-grade oscillator that works in all market conditions – trending up, trending down, or ranging – by measuring the complete emotional spectrum driving price action.
RS vs Indexes By Shashi MishraRS vs Indexes giving details about strength of the sripts against the TIDE which is indexes that you can follow , for example small cap index 100 / 250
NYSE Open Close Session Map by o0psiNYSE Open Close Session Map by o0psi
This indicator highlights the regular US cash session window (default 09:30–16:00 New York time) and makes the key session bars obvious on the chart.
What it shows
A marker on the session OPEN bar
A marker on the session CLOSE bar (last in-session candle)
Optional background highlight for the full session window
Optional labels for the session high and session low bars (based on intraday price during the session)
How it works
The script detects bars inside the selected session window (New York timezone). It anchors OPEN on the first in-session bar, updates the session high/low while the session is active, then anchors CLOSE on the final in-session bar and labels the high/low bars where they occurred.
Notes
Session range precision depends on chart timeframe (lower timeframes capture extremes more precisely).
This is a charting/visualization tool and does not provide trading advice.
Ultimate Reversion BandsURB – The Smart Reversion Tool
URB Final filters out false breakouts using a real retest mechanism that most indicators miss. Instead of chasing wicks that fail immediately, it waits for price to confirm rejection by retesting the inner band—proving sellers/buyers are truly exhausted.
Eliminates fakeouts – The retest filter catches only genuine reversions
Triple confirmation – Wick + retest + optional volume/RSI filters
Clear visuals – Outer bands show extremes, inner bands show retest zones
Works on any timeframe – From scalping to swing trading
Perfect for traders tired of getting stopped out by false breakouts.
Core Construction:
Smart Dynamic Bands:
Basis = Weighted hybrid EMA of HLC3, SMA, and WMA
Outer Bands = Basis ± (ATR × Multiplier)
Inner Bands = Basis ± (ATR × Multiplier × 0.5) → The "retest zone"
The Unique Filter: The Real Retest
Step 1: Identify an extreme wick touching the outer band
Step 2: Wait 1-3 bars for price to return and touch the inner band
Why it works: Most false breakouts never retest. A genuine reversal shows seller/buyer exhaustion by allowing price to come back to the "halfway" level.
Optional Confirmations:
Volume surge filter (default ON)
RSI extremes filter (optional)
Each can be toggled ON/OFF
How to Use:
Watch for extreme wicks touching the red/lime outer bands
Wait for the retest – price must return to touch the inner band (dotted line) within 3 bars
Enter on confirmation with built-in volume/RSI filters
Set stops beyond the extreme wick
AMT Structure: 80% Traverse, PD Levels & nPOCsHere is a clean, professional description formatted for the TradingView description box. It highlights the methodology (AMT/80% Rule), the specific features, and the credits.
Title: AMT Structure: 80% Traverse, PD Levels & nPOCs
Description:
This indicator is a comprehensive toolkit designed for futures traders utilizing Auction Market Theory (AMT) and Volume Profile strategies. It consolidates multiple scripts into a single, unified overlay to declutter your chart while providing essential structural references for the 80% Traverse setup, intraday context, and longer-term auction targets.
Key Features:
1. 80% Rule / Traverse Setup (Chart Champions Logic)
Automated RTH Open Detection: Hardcoded to the 08:30 AM CT Open to ensure accuracy for US Futures (ES/NQ) regardless of your chart's timezone settings.
Value Area Logic: Automatically calculates the Previous Day's Value Area High (VAH), Value Area Low (VAL), and Point of Control (POC).
Setup Detection: If the market opens outside of the previous day's value, the script highlights the Value Area in color (default: Purple), signaling that an 80% traverse (filling the value area) is structurally possible if price re-enters value.
Background Fill: Optional shading between VAH and VAL to clearly visualize the "playing field" for the traverse.
2. Auction Market Theory (AMT) Premarket Levels
Overnight High/Low: Automatically captures the highest and lowest prices traded during the overnight session (17:00 - 08:30 CT).
Breakout Alerts: Includes logic to detect and alert when these overnight levels are broken during the RTH session.
Auto-Cleanup: Lines can be set to auto-delete after a specified time (default: 60 mins into the session) to keep the chart clean after the Initial Balance (IB) period.
3. Structural Reference Levels
Previous Day Levels: Plots Previous Day High, Low, and Equilibrium (Midpoint) as standard reference lines.
Initial Balance (IB): Option to display the First Hour High and Low (08:30 - 09:30 CT) to assess day type (Neutral, Trend, Normal Variation, etc.).
RTH VWAP: An anchored VWAP that resets specifically at the RTH Open (08:30 CT), distinct from the standard 24-hour VWAP.
4. Naked Points of Control (nPOCs)
Multi-Timeframe Tracking: Tracks and plots Naked POCs for Daily, Weekly, and Monthly profiles.
Auto-Cleanup: Lines automatically delete themselves the moment price touches them, ensuring you only see untested levels.
Customization: Toggle each timeframe on/off individually.
Settings & Customization:
Global Offset: Move all text labels to the right with a single setting to prevent price action from obscuring text.
8:30 Open Offset: Independent offset for the Open label to distinguish it from other opening references.
Smart Coloring: Text labels automatically match their corresponding line colors for easy identification.
Modular Toggles: Every section (AMT, VWAP, PD Levels, CCV, nPOCs) can be turned on or off individually to suit your specific trading plan.
Usage: This tool is specifically tuned for ES and NQ futures trading but can be adapted for other instruments. It replaces the need for separate indicators for Overnight Highs/Lows, Previous Day Levels, and Volume Profile targeting.
EMA Color Cross + Trend Arrows V6//@version=5
indicator("EMA Color Cross + Trend Arrows V6", overlay=true, max_bars_back=500)
// === Inputs ===
fastLen = input.int(9, "Hızlı EMA")
slowLen = input.int(21, "Yavaş EMA")
// === EMA Hesapları ===
emaFast = ta.ema(close, fastLen)
emaSlow = ta.ema(close, slowLen)
// Trend Yönü
trendUp = emaFast > emaSlow
trendDown = emaFast < emaSlow
// === Çizgi Renkleri ===
lineColor = trendUp ? color.new(color.green, 0) : color.new(color.red, 0)
// === EMA Çizgileri (agresif kalın) ===
plot(emaFast, "Hızlı EMA", lineColor, 4)
plot(emaSlow, "Yavaş EMA", color.new(color.gray, 70), 2)
// === Ok Sinyalleri ===
buySignal = ta.crossover(emaFast, emaSlow)
sellSignal = ta.crossunder(emaFast, emaSlow)
// Büyük Oklar
plotshape(buySignal, title="AL", style=shape.triangleup, color=color.green, size=size.large, location=location.belowbar)
plotshape(sellSignal, title="SAT", style=shape.triangledown, color=color.red, size=size.large, location=location.abovebar)
// === Trend Bar Color ===
barcolor(trendUp ? color.green : color.red)
T3 MA Basit ve Stabil//@version=5
indicator("T3 MA Basit ve Stabil", overlay=true)
length = input.int(14, "T3 Length")
vFactor = input.float(0.7, "vFactor")
lineWidth = input.int(3, "Çizgi Kalınlığı")
ema1 = ta.ema(close, length)
ema2 = ta.ema(ema1, length)
ema3 = ta.ema(ema2, length)
ema4 = ta.ema(ema3, length)
ema5 = ta.ema(ema4, length)
ema6 = ta.ema(ema5, length)
c1 = -vFactor * vFactor * vFactor
c2 = 3 * vFactor * vFactor + 3 * vFactor * vFactor * vFactor
c3 = -6 * vFactor * vFactor - 3 * vFactor - 3 * vFactor * vFactor * vFactor
c4 = 1 + 3 * vFactor + vFactor * vFactor * vFactor + 3 * vFactor * vFactor
t3 = c1*ema6 + c2*ema5 + c3*ema4 + c4*ema3
colorUp = color.green
colorDown = color.red
col = t3 > t3 ? colorUp : colorDown
plot(t3, color=col, linewidth=lineWidth)
barcolor(col)
plotshape(t3 > t3 and t3 <= t3 , location=location.belowbar, color=colorUp, style=shape.triangleup, size=size.small)
plotshape(t3 < t3 and t3 >= t3 , location=location.abovebar, color=colorDown, style=shape.triangledown, size=size.small)
RSI Divergence bsTzdThis indicator automatically detects bullish and bearish RSI divergences by comparing swing highs and lows in price against momentum shifts on the Relative Strength Index. It identifies both regular divergences, which signal potential trend reversals, and hidden divergences, which often confirm trend continuation.
All divergences are plotted directly on the chart using clean, non-repainting swing-point logic so signals only appear after pivots are confirmed.
The goal of the tool is to help traders quickly spot early momentum shifts that are otherwise difficult to see in real-time—especially during fast intraday moves. By combining price structure with RSI behavior, the indicator offers high-quality signals designed to improve entry timing, stop placement, and overall trend analysis.
Key Features
Automatic bullish & bearish regular divergences
Automatic bullish & bearish hidden divergences
Uses confirmed swing pivots to avoid repainting
Works on all assets and all timeframes
Clean visual markers for fast decision-making
Helps identify momentum exhaustion, trend continuation, and potential reversals
Useful for scalping, day trading, and swing trading setups
Pro trade by Amit// This work is licensed under Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License (CC BY-NC-SA 4.0) creativecommons.org
//@version=5
import HeWhoMustNotBeNamed/utils/1 as ut
import Trendoscope/ohlc/1 as o
import Trendoscope/LineWrapper/1 as wr
import Trendoscope/ZigzagLite/2 as zg
import Trendoscope/abstractchartpatterns/5 as p
import Trendoscope/basechartpatterns/6 as bp
indicator("Installing Wait....", "Automatic Chart Pattern", overlay = true, max_lines_count=500, max_labels_count=500, max_polylines_count = 100)
openSource = input.source(open, '', inline='cs', group='Source', display = display.none)
highSource = input.source(high, '', inline='cs', group='Source', display = display.none)
lowSource = input.source(low, '', inline='cs', group='Source', display = display.none)
closeSource = input.source(close, '', inline='cs', group='Source', display = display.none, tooltip = 'Source on which the zigzag and pattern calculation is done')
useZigzag1 = input.bool(true, '', group = 'Zigzag', inline='z1', display = display.none)
zigzagLength1 = input.int(8, step=5, minval=1, title='', group='Zigzag', inline='z1', display=display.none)
depth1 = input.int(55, "", step=25, maxval=500, group='Zigzag', inline='z1', display=display.none, tooltip = 'Enable and set Length and Dept of Zigzag 1')
useZigzag2 = input.bool(false, '', group = 'Zigzag', inline='z2', display = display.none)
zigzagLength2 = input.int(13, step=5, minval=1, title='', group='Zigzag', inline='z2', display=display.none)
depth2 = input.int(34, "", step=25, maxval=500, group='Zigzag', inline='z2', display=display.none, tooltip = 'Enable and set Length and Dept of Zigzag 2')
useZigzag3 = input.bool(false, '', group = 'Zigzag', inline='z3', display = display.none)
zigzagLength3 = input.int(21, step=5, minval=1, title='', group='Zigzag', inline='z3', display=display.none)
depth3 = input.int(21, "", step=25, maxval=500, group='Zigzag', inline='z3', display=display.none, tooltip = 'Enable and set Length and Dept of Zigzag 3')
useZigzag4 = input.bool(false, '', group = 'Zigzag', inline='z4', display = display.none)
zigzagLength4 = input.int(34, step=5, minval=1, title='', group='Zigzag', inline='z4', display=display.none)
depth4 = input.int(13, "", step=25, maxval=500, group='Zigzag', inline='z4', display=display.none, tooltip = 'Enable and set Length and Dept of Zigzag 4')
numberOfPivots = input.int(5, "Number of Pivots", , 'Number of pivots used for pattern identification.', group='Scanning', display = display.none)
errorThresold = input.float(20.0, 'Error Threshold', 0.0, 100, 5, 'Error Threshold for trend line validation', group='Scanning', display = display.none)
flatThreshold = input.float(20.0, 'Flat Threshold', 0.0, 30, 5, 'Ratio threshold to identify the slope of trend lines', group='Scanning', display = display.none)
lastPivotDirection = input.string('both', 'Last Pivot Direction', , 'Filter pattern based on the last pivot direction. '+
'This option is useful while backtesting individual patterns. When custom is selected, then the individual pattern last pivot direction setting is used',
group='Scanning', display=display.none)
checkBarRatio = input.bool(true, 'Verify Bar Ratio ', 'Along with checking the price, also verify if the bars are proportionately placed.', group='Scanning', inline = 'br', display = display.none)
barRatioLimit = input.float(0.382, '', group='Scanning', display = display.none, inline='br')
avoidOverlap = input.bool(true, 'Avoid Overlap', group='Scanning', inline='a', display = display.none)
repaint = input.bool(false, 'Repaint', 'Avoid Overlap - Will not consider the pattern if it starts before the end of an existing pattern '+
'Repaint - Uses real time bars to search for patterns. If unselected, then only use confirmed bars.',
group='Scanning', inline='a', display = display.none)
allowChannels = input.bool(true, 'Channels', group='Pattern Groups - Geometric Shapes', display = display.none, inline='g')
allowWedges = input.bool(true, 'Wedge', group='Pattern Groups - Geometric Shapes', display = display.none, inline='g')
allowTriangles = input.bool(true, 'Triangle', group='Pattern Groups - Geometric Shapes', display = display.none, inline='g',
tooltip = 'Channels - Trend Lines are parralel to each other creating equidistance price channels'+
' \t- Ascending Channel \t- Descending Channel \t- Ranging Channel'+
' Wedges - Trend lines are either converging or diverging from each other and both the trend lines are moving in the same direction'+
' \t- Rising Wedge (Expanding) \t- Rising Wedge (Contracting) \t- Falling Wedge (Expanding) \t- Falling Wedge (Contracting)'+
' Triangles - Trend lines are either converging or diverging from each other and both trend lines are moving in different directions'+
' \t- Converging Triangle \t- Diverging Triangle \t- Ascending Triangle (Contracting) \t- Ascending Triangle (Expanding) \t- Descending Triangle(Contracting) \t- Descending Triangle(Expanding)')
allowRisingPatterns = input.bool(true, 'Rising', group='Pattern Groups - Direction', display = display.none, inline = 'd')
allowFallingPatterns = input.bool(true, 'Falling', group='Pattern Groups - Direction', display = display.none, inline = 'd')
allowNonDirectionalPatterns = input.bool(true, 'Flat/Bi-Directional', group='Pattern Groups - Direction', display = display.none, inline = 'd',
tooltip = 'Rising - Either both trend lines are moving up or one trend line is flat and the other one is moving up.'+
' \t- Ascending Channel \t- Rising Wedge (Expanding) \t- Rising Wedge (Contracting) \t- Ascending Triangle (Expanding) \t- Ascending Triangle (Contracting)'+
' Falling - Either both trend lines are moving down or one trend line is flat and the other one is moving down.'+
' \t- Descending Channel \t- Falling Wedge (Expanding) \t- Falling Wedge (Contracting) \t- Descending Triangle (Expanding) \t- Descending Triangle (Contracting)'+
' Flat/Bi-Directional - Trend Lines move in different directions or both flat.'+
' \t- Ranging Channel \t- Converging Triangle \t- Diverging Triangle')
allowExpandingPatterns = input.bool(true, 'Expanding', group='Pattern Groups - Formation Dynamics', display = display.none, inline = 'f')
allowContractingPatterns = input.bool(true, 'Contracting', group='Pattern Groups - Formation Dynamics', display = display.none, inline='f')
allowParallelChannels = input.bool(true, 'Parallel', group = 'Pattern Groups - Formation Dynamics', display = display.none, inline = 'f',
tooltip = 'Expanding - Trend Lines are diverging from each other.'+
' \t- Rising Wedge (Expanding) \t- Falling Wedge (Expanding) \t- Ascending Triangle (Expanding) \t- Descending Triangle (Expanding) \t- Diverging Triangle'+
' Contracting - Trend Lines are converging towards each other.'+
' \t- Rising Wedge (Contracting) \t- Falling Wedge (Contracting) \t- Ascending Triangle (Contracting) \t- Descending Triangle (Contracting) \t- Converging Triangle'+
' Parallel - Trend Lines are almost parallel to each other.'+
' \t- Ascending Channel \t- Descending Channel \t- Ranging Channel')
allowUptrendChannel = input.bool(true, 'Ascending ', group = 'Price Channels', inline='uc', display = display.none)
upTrendChannelLastPivotDirection = input.string('both', '', , inline='uc', group='Price Channels', display = display.none,
tooltip='Enable Ascending Channel and select the last pivot direction filter. Last pivot direction will only be used if the Generic Last Pivot Direction parameter is set to Custom')
allowDowntrendChannel = input.bool(true, 'Descending', group = 'Price Channels', inline='dc', display = display.none)
downTrendChannelLastPivotDirection = input.string('both', '', , inline='dc', group='Price Channels', display = display.none,
tooltip='Enable Descending Channel and select the last pivot direction filter. Last pivot direction will only be used if the Generic Last Pivot Direction parameter is set to Custom')
allowRangingChannel = input.bool(true, 'Ranging ', group = 'Price Channels', inline='rc', display = display.none)
rangingChannelLastPivotDirection = input.string('both', '', , inline='rc', group='Price Channels', display = display.none,
tooltip='Enable Ranging Channel and select the last pivot direction filter. Last pivot direction will only be used if the Generic Last Pivot Direction parameter is set to Custom')
allowRisingWedgeExpanding = input.bool(true, 'Rising ', inline='rwe', group = 'Expanding Wedges', display = display.none)
risingWedgeExpandingLastPivotDirection = input.string('down', '', , inline='rwe', group='Expanding Wedges', display = display.none,
tooltip='Enable Rising Wedge (Expanding) and select the last pivot direction filter. Last pivot direction will only be used if the Generic Last Pivot Direction parameter is set to Custom')
allowFallingWedgeExpanding = input.bool(true, 'Falling ', inline='fwe', group = 'Expanding Wedges', display = display.none)
fallingWedgeExpandingLastPivotDirection = input.string('up', '', , inline='fwe', group='Expanding Wedges', display = display.none,
tooltip='Enable Falling Wedge (Expanding) and select the last pivot direction filter. Last pivot direction will only be used if the Generic Last Pivot Direction parameter is set to Custom')
allowRisingWedgeContracting = input.bool(true, 'Rising ', inline='rwc', group = 'Contracting Wedges', display = display.none)
risingWedgeContractingLastPivotDirection = input.string('down', '', , inline='rwc', group='Contracting Wedges', display = display.none,
tooltip='Enable Rising Wedge (Contracting) and select the last pivot direction filter. Last pivot direction will only be used if the Generic Last Pivot Direction parameter is set to Custom')
allowFallingWedgeContracting = input.bool(true, 'Falling ', inline='fwc', group = 'Contracting Wedges', display = display.none)
fallingWedgeContractingLastPivotDirection = input.string('up', '', , inline='fwc', group='Contracting Wedges', display = display.none,
tooltip='Enable Falling Wedge (Contracting) and select the last pivot direction filter. Last pivot direction will only be used if the Generic Last Pivot Direction parameter is set to Custom')
allowRisingTriangleExpanding = input.bool(true, 'Ascending ', inline='rte', group = 'Expanding Triangles', display = display.none)
risingTriangleExpandingLastPivotDirection = input.string('up', '', , inline='rte', group='Expanding Triangles', display = display.none,
tooltip='Enable Ascending Triangle (Expanding) and select the last pivot direction filter. Last pivot direction will only be used if the Generic Last Pivot Direction parameter is set to Custom')
allowFallingTriangleExpanding = input.bool(true, 'Descending', inline='fte', group = 'Expanding Triangles', display = display.none)
fallingTriangleExpandingLastPivotDirection = input.string('down', '', , inline='fte', group='Expanding Triangles', display = display.none,
tooltip='Enable Descending Triangle (Expanding) and select the last pivot direction filter. Last pivot direction will only be used if the Generic Last Pivot Direction parameter is set to Custom')
allowExpandingTriangle = input.bool(true, 'Diverging ', inline='dt', group = 'Expanding Triangles', display = display.none)
divergineTriangleLastPivotDirection = input.string('both', '', , inline='dt', group='Expanding Triangles', display = display.none,
tooltip='Enable Diverging Triangle and select the last pivot direction filter. Last pivot direction will only be used if the Generic Last Pivot Direction parameter is set to Custom')
allowRisingTriangleConverging= input.bool(true, 'Ascending ', inline='rtc', group = 'Contracting Triangles', display = display.none)
risingTriangleContractingLastPivotDirection = input.string('up', '', , inline='rtc', group='Contracting Triangles', display = display.none,
tooltip='Enable Ascending Triangle (Contracting) and select the last pivot direction filter. Last pivot direction will only be used if the Generic Last Pivot Direction parameter is set to Custom')
allowFallingTriangleConverging = input.bool(true, 'Descending', inline='ftc', group = 'Contracting Triangles', display = display.none)
fallingTriangleContractingLastPivotDirection = input.string('down', '', , inline='ftc', group='Contracting Triangles', display = display.none,
tooltip='Enable Descending Triangle (Contracting) and select the last pivot direction filter. Last pivot direction will only be used if the Generic Last Pivot Direction parameter is set to Custom')
allowConvergingTriangle = input.bool(true, 'Converging ', inline='ct', group = 'Contracting Triangles', display = display.none)
convergingTriangleLastPivotDirection = input.string('both', '', , inline='ct', group='Contracting Triangles', display = display.none,
tooltip='Enable Converging Triangle and select the last pivot direction filter. Last pivot direction will only be used if the Generic Last Pivot Direction parameter is set to Custom')
allowedPatterns = array.from(
false,
allowUptrendChannel and allowRisingPatterns and allowParallelChannels and allowChannels,
allowDowntrendChannel and allowFallingPatterns and allowParallelChannels and allowChannels,
allowRangingChannel and allowNonDirectionalPatterns and allowParallelChannels and allowChannels,
allowRisingWedgeExpanding and allowRisingPatterns and allowExpandingPatterns and allowWedges,
allowFallingWedgeExpanding and allowFallingPatterns and allowExpandingPatterns and allowWedges,
allowExpandingTriangle and allowNonDirectionalPatterns and allowExpandingPatterns and allowTriangles,
allowRisingTriangleExpanding and allowRisingPatterns and allowExpandingPatterns and allowTriangles,
allowFallingTriangleExpanding and allowFallingPatterns and allowExpandingPatterns and allowTriangles,
allowRisingWedgeContracting and allowRisingPatterns and allowContractingPatterns and allowWedges,
allowFallingWedgeContracting and allowFallingPatterns and allowContractingPatterns and allowWedges,
allowConvergingTriangle and allowNonDirectionalPatterns and allowContractingPatterns and allowTriangles,
allowFallingTriangleConverging and allowFallingPatterns and allowContractingPatterns and allowTriangles,
allowRisingTriangleConverging and allowRisingPatterns and allowContractingPatterns and allowTriangles
)
getLastPivotDirectionInt(lastPivotDirection)=>lastPivotDirection == 'up'? 1 : lastPivotDirection == 'down'? -1 : 0
allowedLastPivotDirections = array.from(
0,
lastPivotDirection == 'custom'? getLastPivotDirectionInt(upTrendChannelLastPivotDirection) : getLastPivotDirectionInt(lastPivotDirection),
lastPivotDirection == 'custom'? getLastPivotDirectionInt(downTrendChannelLastPivotDirection) : getLastPivotDirectionInt(lastPivotDirection),
lastPivotDirection == 'custom'? getLastPivotDirectionInt(rangingChannelLastPivotDirection) : getLastPivotDirectionInt(lastPivotDirection),
lastPivotDirection == 'custom'? getLastPivotDirectionInt(risingWedgeExpandingLastPivotDirection) : getLastPivotDirectionInt(lastPivotDirection),
lastPivotDirection == 'custom'? getLastPivotDirectionInt(fallingWedgeExpandingLastPivotDirection) : getLastPivotDirectionInt(lastPivotDirection),
lastPivotDirection == 'custom'? getLastPivotDirectionInt(divergineTriangleLastPivotDirection) : getLastPivotDirectionInt(lastPivotDirection),
lastPivotDirection == 'custom'? getLastPivotDirectionInt(risingTriangleExpandingLastPivotDirection) : getLastPivotDirectionInt(lastPivotDirection),
lastPivotDirection == 'custom'? getLastPivotDirectionInt(fallingTriangleExpandingLastPivotDirection) : getLastPivotDirectionInt(lastPivotDirection),
lastPivotDirection == 'custom'? getLastPivotDirectionInt(risingWedgeContractingLastPivotDirection) : getLastPivotDirectionInt(lastPivotDirection),
lastPivotDirection == 'custom'? getLastPivotDirectionInt(fallingWedgeContractingLastPivotDirection) : getLastPivotDirectionInt(lastPivotDirection),
lastPivotDirection == 'custom'? getLastPivotDirectionInt(convergingTriangleLastPivotDirection) : getLastPivotDirectionInt(lastPivotDirection),
lastPivotDirection == 'custom'? getLastPivotDirectionInt(fallingTriangleContractingLastPivotDirection) : getLastPivotDirectionInt(lastPivotDirection),
lastPivotDirection == 'custom'? getLastPivotDirectionInt(risingTriangleContractingLastPivotDirection) : getLastPivotDirectionInt(lastPivotDirection)
)
theme = input.string('Dark', title='Theme', options= , group='Display', inline='pc',
tooltip='Chart theme settings. Line and label colors are generted based on the theme settings. If dark theme is selected, '+
'lighter colors are used and if light theme is selected, darker colors are used. '+
'Pattern Line width - to be used for drawing pattern lines', display=display.none)
patternLineWidth = input.int(2, '', minval=1, inline='pc', group = 'Display', display = display.none)
showPatternLabel = input.bool(true, 'Pattern Label', inline='pl1', group = 'Display', display = display.none)
patternLabelSize = input.string(size.normal, '', , inline='pl1', group = 'Display', display = display.none,
tooltip = 'Option to display Pattern Label and select the size')
showPivotLabels = input.bool(true, 'Pivot Labels ', inline='pl2', group = 'Display', display = display.none, tooltip = 'Option to display pivot labels and select the size')
pivotLabelSize = input.string(size.normal, '', , inline='pl2', group = 'Display', display = display.none)
showZigzag = input.bool(true, 'Zigzag', inline='z', group = 'Display', display = display.none)
zigzagColor = input.color(color.blue, '', inline='z', group = 'Display', display = display.none, tooltip = 'Option to display zigzag within pattern and the default zigzag line color')
deleteOldPatterns = input.bool(true, 'Max Patterns', inline='do', group = 'Display', display = display.none)
maxPatterns = input.int(20, '', minval=1, step=5, inline = 'do', group = 'Display', display = display.none, tooltip = 'If selected, only last N patterns will be preserved on the chart.')
errorRatio = errorThresold/100
flatRatio = flatThreshold/100
showLabel = true
offset = 0
type Scanner
bool enabled
string ticker
string timeframe
p.ScanProperties sProperties
p.DrawingProperties dProperties
array patterns
array zigzags
method getZigzagAndPattern(Scanner this, int length, int depth, array ohlcArray, int offset=0)=>
var zg.Zigzag zigzag = zg.Zigzag.new(length, depth, 0)
var map lastDBar = map.new()
zigzag.calculate(array.from(highSource, lowSource))
var validPatterns = 0
mlzigzag = zigzag
if(zigzag.flags.newPivot)
while(mlzigzag.zigzagPivots.size() >= 6+offset)
lastBar = mlzigzag.zigzagPivots.first().point.index
lastDir = int(math.sign(mlzigzag.zigzagPivots.first().dir))
if(lastDBar.contains(mlzigzag.level)? lastDBar.get(mlzigzag.level) < lastBar : true)
lastDBar.put(mlzigzag.level, lastBar)
= mlzigzag.find(this.sProperties, this.dProperties, this.patterns, ohlcArray)
if(valid)
validPatterns+=1
currentPattern.draw()
this.patterns.push(currentPattern, maxPatterns)
alert('New Pattern Alert')
else
break
mlzigzag := mlzigzag.nextlevel()
true
method scan(Scanner this)=>
var array ohlcArray = array.new()
var array patterns = array.new()
ohlcArray.push(o.OHLC.new(openSource, highSource, lowSource, closeSource))
if(useZigzag1)
this.getZigzagAndPattern(zigzagLength1, depth1, ohlcArray)
if(useZigzag2)
this.getZigzagAndPattern(zigzagLength2, depth2, ohlcArray)
if(useZigzag3)
this.getZigzagAndPattern(zigzagLength3, depth3, ohlcArray)
if(useZigzag4)
this.getZigzagAndPattern(zigzagLength4, depth4, ohlcArray)
var scanner = Scanner.new(true, "", "",
p.ScanProperties.new(offset, numberOfPivots, errorRatio, flatRatio, checkBarRatio, barRatioLimit, avoidOverlap, allowedPatterns=allowedPatterns, allowedLastPivotDirections= allowedLastPivotDirections, themeColors = ut.getColors(theme)),
p.DrawingProperties.new(patternLineWidth, showZigzag, 1, zigzagColor, showPatternLabel, patternLabelSize, showPivotLabels, pivotLabelSize, deleteOnPop = deleteOldPatterns),
array.new())
if(barstate.isconfirmed or repaint)
scanner.scan()






















