OPEN-SOURCE SCRIPT
Aktualisiert

Enhanced Gap Up/Down Analysis

731
This Pine Script indicator, titled "Enhanced Gap Up/Down Analysis", is designed to visually analyze the percentage gaps between the current day's opening price and the previous day's closing price. It provides valuable insights into market behavior by categorizing gaps and coloring them based on specific conditions.

Key Features:

Bar Coloring Based on Conditions:

Gap-Up Days:
Green if the day closes higher than it opens.
Red if the day closes lower than it opens.

Gap-Down Days:
Red if the day closes lower than it opens.
Green if the day closes higher than it opens.
The bar's position reflects the gap percentage (positive values for gap-ups above the X-axis, negative values for gap-downs below the X-axis).
Gap Size Thresholds:

Users can define small and moderate gap thresholds to categorize gaps:
Small Gaps: Transparent color.
Moderate Gaps: Opaque color.
Large Gaps: Fully visible color.
Ensures small gaps are less than moderate gaps with validation logic.
Filter Gaps by Percentage:

Includes filters to show gaps only within a user-defined range (minFilterGap to maxFilterGap).
Histogram Visualization:

Plots the gap percentages as a histogram for easy visual analysis:
Positive bars for gap-ups.
Negative bars for gap-downs.
Alerts for Large Gaps:

Alerts notify when a gap exceeds the moderate threshold in either direction.
Use Cases:
Identify Market Sentiment:

Quickly assess whether gap-ups or gap-downs dominate.
Analyze whether gaps tend to follow through or reverse by observing bar colors.
Filter Relevant Gaps:

Focus on significant gaps (e.g., only gaps greater than 2%).
Visual Aid for Trading:

Helps traders detect patterns in market gaps and price movement relationships (e.g., gaps and reversals).

Customizable Inputs:

Small and Moderate Gap Thresholds: Define gap categories.
Gap Filter Range: Control which gaps to display.
Alerts: Get notified of significant gaps.
This tool is particularly useful for traders analyzing price gaps and their implications for market trends or reversals.
Versionshinweise
What it does
This script tracks every opening gap-percent on the active symbol, groups the gaps into 10 size buckets, and gives you an at-a-glance dashboard:


Bucket Count Avg Gap %
Gap Up < 1 % # bars avg size
… … …
Gap Dn > 4 % # bars avg size
Optional: overlay a colour-coded histogram so you can see each day’s gap magnitude in the sub-pane without hiding price.

📊 Why it’s useful
Quick volatility gauge – instantly see how big recent gaps really are.

Playbook filter – e.g. “I only fade gap-ups between 1 % and 3 %.” Set the min/max filters and the table tells you how common that setup is.

No visual clutter – pick any corner of the pane for the table and turn the histogram on/off with one click.

⚙️ Inputs

Setting Default What it controls
Show gap-% histogram? ✅ Toggle the coloured bars.
Table position Top-Right Corner where the stats table is drawn.
Small gap threshold (%) 1 % Light-shade cut-off in the histogram.
Moderate gap threshold (%) 2 % Medium-shade cut-off.
Min gap shown (%) 0 % Filter out tiny gaps.
Max gap shown (%) 100 % Filter out extreme events.
🖥️ How to read it
Green bars = session closed higher than it opened; red bars = closed lower.

“Gap Up 1-2 % Count = 27” → there were 27 sessions whose open was 1-2 % above the prior close.

“Avg % = 1.46 %” in that bucket means the average gap size of those 27 sessions was +1.46 %.

🚀 Quick start
Add the indicator to any chart.

Open ⚙️ Settings → adjust min/max gap filters for your strategy.

Move the table if it overlaps something.

Hide the histogram if you only want the numeric cheat-sheet.

Haftungsausschluss

Die Informationen und Veröffentlichungen sind nicht als Finanz-, Anlage-, Handels- oder andere Arten von Ratschlägen oder Empfehlungen gedacht, die von TradingView bereitgestellt oder gebilligt werden, und stellen diese nicht dar. Lesen Sie mehr in den Nutzungsbedingungen.