Market Clarity Pro Market Clarity Pro — See Key Zones, Trend & Volume Signals
Spot yesterday’s High (Supply) and Low (Demand) instantly — and know exactly where big buyers and sellers are likely waiting.
Red zones = strong selling pressure.
Green zones = strong buying pressure.
Plus, a built-in trend line keeps you trading in the right direction and away from sudden reversals.
You’ll also see:
🔴 Red arrow — not a sell signal, but a sign of heavy sellers stepping in, with volume confirmation and a candle breaking the previous one.
🔵 Blue arrow — not a buy signal, but a sign of strong buyers stepping in, with volume confirmation and a candle breaking the previous one.
These arrows highlight potential volume spikes and breakouts for confirmation only — you still confirm with the higher time frame for more market clarity.
Break above supply. Possible uptrend.
Break below demand. Possible downtrend.
📌 Before using this tool, watch the tutorial video to learn exactly how to apply it and how to spot profitable trades with confidence.
Candlestick analysis
Volume Profile, Pivot Anchored by [MARK804]Unlock Hidden Market Zones: Volume Profile Anchored to Dynamic Pivot Points (by Mark804)
Elevate Your Trading with Precision:
Discover the power of Volume Profile, Pivot Anchored by Mark804—an advanced TradingView tool that merges horizontal volume histograms with pivot-anchored price levels. See exactly where trading interest peaks and how those zones intersect with pivot points to identify meaningful support, resistance, and breakout zones—all on one clean chart. Crafted for traders who want clarity, speed, and a strategic edge.
Why This Indicator Stands Out:
Dual-Mode Insight: Combines volume-based price distribution with pivot point anchoring for sharper decision-making.
Actionable Alerts: Includes built-in alerts for touches on Point of Control (PoC), Value Area High (VAH), and Value Area Low (VAL), plus high-volume zone notifications.
Rich Context Display: Shows cumulative volume, percentage changes, VA width, bar counts, and more—directly on your chart.
Perfect For:
Day traders, swing traders, algorithmic designers—anyone who benefits from integrating volume-based levels with smart pivot overlays.
Angle Market Structure [Mark804]Got it! Since I couldn’t find any existing public references to Angle Market Structure \ I’ll proceed based on the description you provided—rewriting it with improved clarity, flow, and impact. Let me know if you’d like to tweak anything further!
Angle Market Structure (Mark804) — Refined Overview
Angle Market Structure (Mark804) is an intelligent pivot-based indicator tailored for traders seeking early detection of breakouts and breakdowns. By dynamically angling its pivot levels toward current price action, it not only sharpens structural clarity but also accelerates signals for price movement.
Core Concepts
Adaptive Market Structure
Highlights pivot highs and lows as evolving support and resistance levels. These levels gradually converge toward price action using an angle derived from ATR (Average True Range), giving you faster, more responsive structure cues.
Breakout Acceleration
Each bar subtly shifts pivot-high levels downward and pivot-low levels upward—accelerating breakout detection and helping you act more decisively on emerging trends.
Deviation Zones
Upon a confirmed breakout or breakdown, the indicator projects three extension levels on either side (+1, +2, +3 or –1, –2, –3) to visually map price overextension and guide potential exit or trail-stop levels.
Sequential Break Count
Each structural break is numbered in sequence—providing real-time insight into trend strength and continuity.
Visual Intelligence
Utilizes color-coded pivot points, angling trend lines, and labeled deviation zones to ensure structure is intuitive and immediately actionable.
Feature Set
Pivot detection with customizable lookback length.
ATR-based “angle modifier” that dynamically tilts levels toward price.
Distinct breakout and breakdown line plotting with smooth visual extension.
Deviation level customization (+1 to +3 or –1 to –3).
Color-coded trend-break count labels (bullish or bearish).
Adaptive label sizing with theme awareness for light/dark modes.
Smart label placement to minimize visual clutter.
Cap on deviation layers to preserve performance and chart clarity.
Trading Guide
1. Use pivot-aligned structure levels to identify potential breakout/breakdown zones.
2. Monitor crossovers (for bullish continuation) or crossunders (for bearish) as potential entry signals.
3. Reference deviation levels for assessing overextension—use them to plan exits or trailing stops.
4. Watch the breakout sequence count—higher counts often correlate with stronger price momentum.
5. For validated entries, pair with volume or order-flow analysis during breakouts.
6. Adjust the ATR-based angle sensitivity based on market volatility to filter for ideal signal timing.
Final Thoughts
Angle Market Structure (Mark804) upgrades classic pivot analysis with angle-driven responsiveness and structured extension tracking. Whether scanning for impulsive moves or structural shifts, this tool brings precision, clarity, and momentum awareness to your charts—making it a go-to for proactive traders who value speed and structural insight.
#TheStrat Multi-Timeframe In-Force Signals, Failed 2's, and FTFCThis indicator combines #TheStrat concepts of bar combinations, in-force signals, and timeframe continuity with 'Failed 2's' which can be early indication of a trend reversal.
It’s designed to help identify the prevailing trend but also reversal points when timeframe-based ranges are reclaimed because a signal failed or went out-of-force.
Core Concepts
1. TheStrat Bar Types
• 1 (Inside Bar): High ≤ previous high and Low ≥ previous low.
• 2U (Two Up): High > previous high and Low ≥ previous low.
• 2D (Two Down): Low < previous low and High ≤ previous high.
• 3 (Outside Bar): High > previous high and Low < previous low.
2. Failed 2’s — Definition & Detection
A Failed 2 occurs when a directional break (2U or 2D) reverses before following through.
This script lets you choose from four failure-definition modes:
1. Open — A 2U fails if last price is below open; a 2D fails if last price is above open.
2. Reclaim — A 2U or 2D fails if last price is within the previous bar’s range.
3. Both — Both of the above conditions must be met.
4. Either — Either condition must be met.
Failed 2U setups are bearish; Failed 2D setups are bullish.
You can also enable FTFC Override, which ignores reclaim-type failures when all higher timeframes are in full agreement with the current trend.
3. Timeframe Continuity (TFC)
TFC measures directional agreement across multiple timeframes.
• Full TFC (FTFC) Up: All selected timeframes above their opens.
• Full TFC (FTFC) Down: All selected timeframes below their opens.
• Mixed or neutral conditions are also displayed.
The indicator tracks classic TFC and supports trend-flip alerts when full agreement changes direction.
Features
• Customizable TFC table showing bar types, failed status, in-force status, reclaims, and direction arrows.
• Automatic bar coloring for TFC alignment, failed-2 transitions, or neutral states.
• Alerts for TFC trend flips.
• Multi-timeframe scanning with selectable intervals.
• Option to highlight bars that trigger a TFC flip due to failed-2 events.
Use Cases
• Quickly gauge market bias across multiple timeframes
• Identify failed 2 reversals against higher timeframes
• Spot potential turning points when trend flips occur
Limitations
This is a tool which can give earlier indication of trend reversals but is highly dependent on selected timeframes. This is discretionary, but having a range of higher and lower timeframes works best. In many cases, it will give the same trend 'flip' that classic FTFC would (based on open).
Ranges are based on timeframes, not swing highs and lows. The selected timeframes must capture the swing high or low to show a 'range' reclaim.
Timeframes lower than the display timeframe cannot be accurately shown due to PineScript limitations. They are 'greyed out' and not included in calculations or displays.
This script is based on the FTFC indicator by TradeForOpportunity with deep gratitude. It has been modified and expanded with permission under MPL 2.0.
Smart Money Breakout Channels [Mark804]Overview
Unlock actionable insights into price behavior with Smart Money Breakout Channels — a powerful, volatility-normalized breakout indicator visualized as dynamic zones. Each channel represents a refined accumulation or distribution phase where institutional traders might be active. These breakout zones are rendered as boxes, enhanced with volume overlays, that guide you to key breakout points—with additional context like volume delta, directional volume, and a real-time momentum gauge for clarity.
Core Concepts
Volatility-Normalized Detection: Calculates price volatility using standard deviation, mapped on a 0–1 scale based on lookback highs and lows.
Channel Formation: When normalized volatility bottoms and reverses upward, the indicator defines a breakout zone by drawing a box between the highest and lowest price levels in that phase.
Breakout Criteria: Channels persist until price decisively closes beyond a boundary or merely touches it (based on your config).
Integrated Volume Analysis: Inside the channel, delta bars illustrate buy/sell pressure via raw volume, up/down volume, or volume delta.
Momentum Gauge: A live visual dial points to where volume delta sits within the channel—providing a clear snapshot of directional pressure.
---
Key Features
Smart, Automated Channel Drawing: Visualizes breakout zones driven by volatility pivots.
Configurable Channel Layers: Choose between nested multiple channels or a clean single-zone view.
Intuitive Volume Gauge: A gradient-filled instrument with a dynamic pointer reflects current delta pressure.
Flexible Volume Displays: Toggle between raw volume, up/down volume, or delta views.
Real-Time Alerts: Get notified when a new breakout zone forms—and when bullish or bearish breakouts happen.
How to Use It
1. Add the Indicator: Apply it to any chart to begin tracking volatility-normalized breakout zones.
2. Identify the Zone: Watch for a newly formed box signaling price consolidation; this occurs when volatility flattens and reverses.
3. Monitor Breakouts:
* A break above the box suggests bullish continuation.
* A drop below hints at bearish continuation.
* “Strong Closes Only” mode enhances signal reliability.
4. Analyze Volume Dynamics: Review internal volume bars for insight into buy/sell pressure.
5. Watch the Gauge: Spot momentum shifts early as the gauge pointer moves toward higher or lower delta pressure.
6. Set Alerts: Automate notifications for new zones or confirmed breakouts—and never miss a critical move.
Gold Scalping Grid Zones [CongTrader]📜 Overview
Gold Scalping Grid Zones is a professional trading tool designed for XAUUSD scalpers & day traders.
It automatically detects key Buy/Sell zones based on pivot points and projects future breakout targets using ATR.
This all-in-one indicator combines:
Dynamic Grid Trading Zones from recent highs/lows
Future Price Forecast Zones for breakout targeting
EMA + RSI filtering for higher signal accuracy
Unified Buy/Sell alert system optimized for fast execution
✨ Key Features
Automatic Buy/Sell grid zones based on recent pivots
Breakout target forecasting using ATR multipliers
Smart signal filtering
BUY: Price above EMA 200 + RSI oversold
SELL: Price below EMA 200 + RSI overbought
Unified single alert for both BUY and SELL triggers
Auto-clean chart – keeps only the latest signal label
Fully customizable: grid step, zone thickness, ATR multiplier, EMA, RSI...
📈 How to Use
Add to Chart
Apply to XAUUSD chart (best performance on M5 – H1).
Adjust Parameters
Grid Step: Distance between zones (default: $2.0)
Zone Thickness: Visual width of zones
ATR Multiplier: Distance for forecast zones
EMA Length & RSI Levels: Fine-tune signal filtering
Read the Zones & Signals
Green Zones → Demand areas (Buy)
Red Zones → Supply areas (Sell)
Forecast BUY/SELL labels → Next breakout target
BUY/SELL signal labels → Confirmed trade setups based on EMA + RSI filters
Set Alerts
Click the Alert (🔔) icon in TradingView
Condition: "Gold Trade Signal"
Choose “Once per bar close” (fewer alerts) or “Once per bar” (scalping mode)
Phone alert example:
Gold Trade Signal: BUY or SELL triggered
⚠️ Disclaimer
This is NOT financial advice.
Always combine with your own analysis, risk management, and stop loss.
Past performance does not guarantee future results.
Trading gold with leverage carries high risk.
💡 Pro Tip:
Combine this indicator with candlestick patterns, volume analysis, and higher timeframe trend confirmation to maximize accuracy.
Fewer resistance/support zones ahead = stronger breakout potential.
🙏 Thank You
Thank you for using Gold Scalping Grid Zones .
If you find this indicator helpful, please Follow the author and Share it with your trading community so more traders can benefit.
Every follow and share is motivation to keep building more high-quality trading tools. 🚀 . #gold #XAUUSD #scalping #gridtrading #zones #supplydemand #ATR #EMA #RSI #pivot
Savages Supply and Demand LevelsThis supply and demand indicator in my opinion is one of the best S&D indicators on trading view. It is clean, organized and just simple. I have spent thousands of hours determining the best and most reliable ways to identify supply and demand, on every time frame! I am going to explain exactly what I look for.
When looking for a supply level meaning, there is potential for more supply of the following stock to hit the marker, what does that mean? People are going to sell. SO, it represents possible sell ordered at that supply level. So lets get into the grit of this, there are two candles that form when a supply level is formed. The first candle needs to be green, it will have a high, a low , an open and a close. The specifics come into play with the next candle which needs to be red, that candle can NOT break the previous green candles high, and needs to close below the previous candles low. THATS IT! That is a supply level. Now, for a demand level, its the same thing just switched, we need a red candle, that will have a high,low, open and a close. Same thing now, the next candle is going to be green, that green candle can NOT break that previous red candles low and needs to close above that previous red candles high. THATS A DEMAND!
I have spent countless hours back testing and studying this, I am extremely confident that this will be a game changer for whoever uses this. I have marked different types of opening and closes and highs and lows and this specific type of setup has worked countless times for me, the only time it will not work is when there is a liquidity sweep or some sort of news where it causes the price action to swing several points. Also do not use only one time frame and only this indicator, try to use some fair value gap levels and break of structure indicators, there are really good ones on here. I have also built the indicator to get rid of supply and demand levels that have already been hit so you always have a clean and fresh supply and demand level that has not been eaten into yet. I also threw some clean labels on there so it is easy to identify. So once price action hits that supply or demand level, it goes away, it either worked or it gets invalidated.
I hope you enjoy!
Not financial advice
-Savage
Adaptive Candle Signals█ OVERVIEW
The Adaptive Candle Signals indicator is a Pine Script® tool designed to identify key candlestick patterns on the chart, such as Bullish Engulfing, Bearish Engulfing, Piercing Line, Dark Cloud Cover, Morning Star, Evening Star, Three White Soldiers, Three Black Crows, and Three Inside Up/Down. The indicator allows customization of settings, including a Moving Average (MA) filter, candle size control, and maximum wick percentage, enabling precise adaptation to various trading strategies. Signals are displayed as labels on the chart, and each pattern can trigger alerts for user convenience.
█ CONCEPTS
The indicator is designed with flexibility and readability in mind. Its main features include:
Features
Signal Filtering: Enables the use of a Moving Average (MA) filter to confirm signals based on trend direction. Bullish signals are generated when the price is above the MA, and bearish signals when below.
Pattern Customization: Users can enable or disable individual candlestick patterns and adjust their parameters, such as maximum wick percentage or candle size multiplier. The candle size multiplier applies to the largest candle in the pattern and determines its minimum size relative to the average candle body size over a specified volatility period.
Labels and Colors: Signals are displayed as clear labels with customizable colors for bullish and bearish patterns.
Alerts: Each pattern has a dedicated alert function, facilitating integration with automated trading strategies.
List of Patterns
The indicator recognizes the following candlestick patterns (labels displayed in parentheses):
Bullish Engulfing (BE): Signals a potential upward reversal after a downtrend.
Bearish Engulfing (BE): Indicates a possible downward reversal after an uptrend.
Piercing Line (PL): A bullish pattern suggesting a bounce from support.
Dark Cloud Cover (DC): A bearish pattern indicating a potential downward reversal.
Morning Star (MS): A three-candle bullish pattern signaling an upward reversal.
Evening Star (ES): A three-candle bearish pattern indicating a downward reversal.
Three White Soldiers (3WS): A strong bullish signal based on three large bullish candles.
Three Black Crows (3BC): A strong bearish signal based on three large bearish candles.
Three Inside Up/Down (3Up/3Dn): Patterns indicating trend reversal based on an inside bar structure.
Settings
Settings are organized as follows:
MA Filter: Allows enabling a Moving Average (SMA, EMA, WMA) to filter signals based on trend direction.
Pattern Parameters: Each pattern has its own settings, such as volatility period, candle size multiplier, and maximum wick percentage. The size of the largest candle in the pattern is compared to the average candle body size over the specified volatility period.
Colors and Labels: Users can customize label colors and their distance from candles to improve readability.
█ SETTINGS
Detailed description of the indicator’s settings:
MA Filter:
Use MA Filter: Enables/disables the Moving Average filter.
MA Length: Specifies the period of the Moving Average (default: 50).
MA Type: Choose between SMA, EMA, or WMA.
MA Source: Select the data source (default: close price).
Pattern Settings:
Enable Pattern: Checkbox for each pattern (e.g., Bullish Engulfing, Morning Star).
Maximum Wick Percentage: Defines the maximum allowable wick size as a percentage of the candle body.
Big Candle Filter: Enables/disables checking if the largest candle in the pattern is larger than the average over the specified volatility period.
Volatility Period: Sets the period for calculating the average candle body size.
Candle Multiplier: Multiplier determining the minimum size of the largest candle in the pattern relative to the average candle body size over the specified volatility period.
Appearance:
Signal Text Color: Color of the label text (default: white).
Bullish Label Color: Color for bullish signals (default: green).
Bearish Label Color: Color for bearish signals (default: red).
Label Offset Factor: Controls the distance of labels from candles (from 0.0 to 1.0).
█ HOW TO USE
Add the indicator to your TradingView chart.
Configure the settings in the indicator’s dialog box:
Enable desired candlestick patterns.
Adjust the MA filter parameters to restrict signals to the trend.
Set colors and label offset for better readability.
Enable alerts for selected patterns to receive real-time notifications.
Monitor the labels on the chart and use them alongside other technical analysis tools.
█ LIMITATIONS
The indicator relies on historical price data and may produce false signals in volatile market conditions.
The big candle filter may be less effective on charts with low volatility.
The indicator performs best when combined with other analysis methods, such as support and resistance levels.
9am DCMcreates a range out of the 30 min 9 am candle
gives up to 3 breakout signals
solid lines are high and low of the range
dashed lines are open and close of the range
displays previous sessions
displays previous day wick gaps (daily time frame)
free course 98304 24602// This Pine Script® code is subject to the terms of the Mozilla Public License 2.0 at mozilla.org
// This work is licensed under a Attribution-NonCommercial-ShareAlike 4.0 International (CC BY-NC-SA 4.0) creativecommons.org
// best signal
//@version=5
indicator('free course 98304 24602', overlay = true, max_bars_back = 1500, max_labels_count = 500, max_lines_count = 500, max_boxes_count = 500)
//--------------------------------------------------------------------------------------------------------------------}
// Settings
//---------------------------------------------------------------------------------------------------------------------{
disp = display.all - display.status_line
rpGR = 'Profile Generic Settings'
Showprofle = input.bool(true, 'Show Profile', group = 'Indicator option', display = disp)
rpLN = input.int(200, '  Lookback Length / Fixed Range', minval = 10, maxval = 1500, step = 10 , group = rpGR, display = disp)
rpLN := last_bar_index > rpLN ? rpLN - 1 : last_bar_index
vpSRC = input.string('Volume', '  Profile Source', options = , group = rpGR, display = disp)
vpGR = 'Profile Presentation Settings'
vpTP = 'displays total trading activity/money flow (common interest, both buying and selling trading activity/money flow) over a specified time period at specific price levels ' +
' - high traded node rows : high trading activity/money flow price levels - usually represents consolidation levels (value areas) ' +
' - average traded node rows : average trading activity/money flow price levels ' +
' - low traded node rows : low trading activity/money flow price levels - usually represents supply & demand levels or liquidity levels ' +
'row lengths, indicates the amount of the traded activity/money flow at specific price levels'
vpSH = input.bool(true, 'Volume/Money Flow Profile', group = vpGR, tooltip = vpTP, display = disp)
vpHVC = input.color(color.new(#ffeb3b, 50), '  High Traded Nodes', inline = 'VP1', group = vpGR)
vpHVT = input.int(53, 'Threshold %' , minval = 50, maxval = 99 , step = 1,inline = 'VP1', group = vpGR, tooltip = 'option range ', display = disp) / 100
vpAVC = input.color(color.new(#2962ff, 50), '  Average Traded Nodes', group = vpGR)
vpLVC = input.color(color.new(#f23645, 50), '  Low Traded Nodes', inline = 'VP2', group = vpGR)
vpLVT = input.int(37, 'Threshold %' , minval = 10, maxval = 40 , step = 1,inline = 'VP2', group = vpGR, tooltip = 'option range ', display = disp) / 100
spTP = 'displays the sentiment, the dominat party over a specified time period at the specific price levels ' +
' - bullish node rows : buying trading activity/money flow is higher ' +
' - barish node rows : selling trading activity/money flow is higher ' +
'row lengths, indicates the strength of the buyers/sellers at the specific price levels'
spSH = input.bool(false, 'Sentiment Profile', group = vpGR, tooltip = spTP)
spPTT = 'conditions used to calculate the up/down volume/money flow ' +
'* bar polarity up => if close > open down => if close <= open ' +
'* bar buying/selling pressure up => if (close - low) > (high - close) down => if (close - low) <= (high - close)'
spPT1 = 'Bar Polarity'
spPT2 = 'Bar Buying/Selling Pressure'
spPTY = input.string(spPT1, '  Sentiment Polarity Method', options = , group = vpGR, tooltip = spPTT, display = disp)
spBLC = input.color(color.new(#26a69a, 50), '  Bullish Nodes', inline = 'SP', group = vpGR)
spBRC = input.color(color.new(#ef5350, 50), 'Bearish Nodes', inline = 'SP', group = vpGR)
hmSH = input.bool(false, 'Profile Heatmap', group = vpGR, tooltip = 'tip : higher number of rows results with a better visuals')
hmSO1 = 'Volume/Money Flow Profile'
hmSRC = input.string(hmSO1, '  Heatmap Source', options = , group = vpGR, display = disp)
hmTR = input.int(73, '  Heatmap Transparency' , minval = 0, maxval = 100 , group = vpGR, display = disp)
othGR = 'Other Presentation Settings'
pcTP = 'displays the price level of the highest traded activity/money flow or the changes of the price levels with the highest traded activity/money flow'
rpPC = input.string('Last(Zone)', '  Level of Significance', options = , inline='PoC', group = othGR, tooltip = pcTP, display = disp)
vaSH = input.bool(false, 'Consolidation Zones', group = othGR, display = disp)
vaTH = input.int(25, '  Consolidation Threshold %' , minval = 0, maxval = 100, inline = 'va', group = othGR, display = disp) / 100
vaC = input.color(color.new(#2962ff, 73), '', inline = 'va', group = othGR)
spTT = 'displays the price zone of the highest bullish or bearish sentiment zone'
spPC = input.bool(false, 'Highest Sentiment Zone', inline = 'spP', group = othGR, tooltip = spTT)
rpPL = input.bool(false, 'Profile Price Levels', inline = 'BBe', group = othGR)
rpPLC = input.color(color.new(#00bcd4, 0), '', inline = 'BBe', group = othGR)
rpLS = input.string('Small', "", options= , inline = 'BBe', group = othGR, display = disp)
rpBG = input.bool(false, 'Profile Range Background Fill', inline = 'BG', group = othGR)
rpBGC = input.color(color.new(#00bcd4, 95), '', inline = 'BG', group = othGR)
otGR = 'Other Profile Settings'
rpNR = input.int(25, '  Number of Rows' , minval = 10, maxval = 100 ,step = 5, group = otGR, tooltip = 'option range ', display = disp)
rpW = input.int(13, '  Profile Width %', minval = 10, maxval = 50, group = otGR, tooltip = 'option range ', display = disp) / 100
vpLS = input.string('Auto', "  Profile Text Size", options= , group = otGR, display = disp)
vpHO = input.int(13, '  Profile Horizontal Offset', group = otGR, tooltip = 'option allows negative numbers as well, in case of a use the profiles will overlap with the price chart', display = disp)
//---------------------------------------------------------------------------------------------------------------------}
// User Defined Types
//---------------------------------------------------------------------------------------------------------------------{
// @type bar properties with their values
//
// @field o (float) open price of the bar
// @field h (float) high price of the bar
// @field l (float) low price of the bar
// @field c (float) close price of the bar
// @field v (float) volume of the bar
// @field i (int) index of the bar
type bar
float o = open
float h = high
float l = low
float c = close
float v = volume
int i = bar_index
int n = bar_index
int t = time
//---------------------------------------------------------------------------------------------------------------------}
// Variables
//---------------------------------------------------------------------------------------------------------------------{
bar b = bar.new()
rpVST = array.new_float(rpNR, 0.)
rpVSB = array.new_float(rpNR, 0.)
rpVSD = array.new_float(rpNR, 0.)
var dRP = array.new_box()
var pocPoints = array.new()
var polyline pocPolyline = na
var polyline spPolyline = na
var color llC = na
var color lsC = na
//---------------------------------------------------------------------------------------------------------------------}
// Functions/Methods
//---------------------------------------------------------------------------------------------------------------------{
// @function creates new label object and updates existing label objects
//
// @param details in Pine Scriptâ„¢ language reference manual
//
// @returns none, updated visual objects (labels)
f_drawLabelX(_x, _y, _text, _style, _textcolor, _size, _tooltip) =>
var lb = label.new(_x, _y, _text, xloc.bar_index, yloc.price, color(na), _style, _textcolor, _size, text.align_left, _tooltip)
lb.set_xy(_x, _y)
lb.set_text(_text)
lb.set_tooltip(_tooltip)
lb.set_textcolor(_textcolor)
// @function This function converts string to enumerated size
//
// @param _t custom string
//
// @returns enumerated size
f_gTS(_t) =>
switch _t
'Tiny' => size.tiny
'Small' => size.small
'Normal' => size.normal
'Auto' => size.auto
//---------------------------------------------------------------------------------------------------------------------}
// Calculations
//---------------------------------------------------------------------------------------------------------------------{
bull = spPTY == spPT1 ? b.c > b.o : (b.c - b.l) > (b.h - b.c)
nzV = nz(b.v)
rpS = f_gTS(rpLS)
vpS = f_gTS(vpLS)
var float pLST = na
var float pHST = na
if b.i == last_bar_index - rpLN
pLST := b.l
pHST := b.h
else if b.i > last_bar_index - rpLN
pLST := math.min(b.l, pLST)
pHST := math.max(b.h, pHST)
pSTP = (pHST - pLST) / rpNR
if barstate.islast and not na(nzV) and not timeframe.isseconds and rpLN > 0 and pSTP > 0 and nzV > 0
if dRP.size() > 0
for i = 0 to dRP.size() - 1
box.delete(dRP.shift())
if pocPoints.size() > 0
pocPoints.clear()
a_allPolylines = polyline.all
if array.size(a_allPolylines) > 0
for i = 0 to array.size(a_allPolylines) - 1
polyline.delete(a_allPolylines.get(i))
for bI = rpLN to 0
l = 0
for pLL = pLST to pHST - pSTP by pSTP
if b.h >= pLL and b.l < pLL + pSTP
vPOR = if b.l >= pLL and b.h > pLL + pSTP
(pLL + pSTP - b.l ) / (b.h - b.l )
else if b.h <= pLL + pSTP and b.l < pLL
(b.h - pLL) / (b.h - b.l )
else if (b.l >= pLL and b.h <= pLL + pSTP)
1
else
pSTP / (b.h - b.l )
if vpSRC == 'Money Flow'
rpVST.set(l, rpVST.get(l) + nzV * vPOR * (pLST + (l + .5) * pSTP) )
else
rpVST.set(l, rpVST.get(l) + nzV * vPOR )
if bull and spSH and Showprofle
if vpSRC == 'Money Flow'
rpVSB.set(l, rpVSB.get(l) + nzV * vPOR * (pLST + (l + .5) * pSTP))
else
rpVSB.set(l, rpVSB.get(l) + nzV * vPOR )
l += 1
if rpPC == 'Developing'
if bI == rpLN
pocPoints.push(chart.point.from_index(b.i , pLST + (rpVST.indexof(rpVST.max()) + .5) * pSTP))
else
pocPoints.push(chart.point.from_index(b.i , pLST + (rpVST.indexof(rpVST.max()) + .5) * pSTP))
if rpPC == 'Developing' and Showprofle
pocPolyline := polyline.new(pocPoints, false, false, xloc.bar_index, vpHVC, color(na), line.style_solid, 2)
if rpPC == 'Last(Zone)' and Showprofle or rpPC == 'Last(Line)' and Showprofle
pocPoints.push(chart.point.from_index(b.i , pLST + (rpVST.indexof(rpVST.max()) + .5) * pSTP))
pocPoints.push(chart.point.from_index(b.i, pLST + (rpVST.indexof(rpVST.max()) + .5) * pSTP))
pocPolyline := polyline.new(pocPoints, false, false, xloc.bar_index, vpHVC, color(na), rpPC == 'Last(Line)' ? line.style_solid : line.style_dotted, rpPC == 'Last(Line)' ? 2 : 1)
for l = 0 to rpNR - 1
bbp = 2 * rpVSB.get(l) - rpVST.get(l)
rpVSD.set(l, rpVSD.get(l) + bbp * (bbp > 0 ? 1 : -1) )
if vpSH and Showprofle or spSH and Showprofle
sBI = b.i + (spSH ? rpLN * rpW : 7) + int(rpLN * rpW / 3)
dRP.push(box.new(sBI - 1 + vpHO, pLST + (l + .1) * pSTP, sBI - int(rpLN * rpW / 3) + 1 + vpHO, pLST + (l + .9) * pSTP, #2962ff80, bgcolor = #2962ff10,
text = str.tostring(pLST + (l + .5) * pSTP, format.mintick), text_color = chart.fg_color, text_size = vpS ))
if rpBG and Showprofle
dRP.push(box.new(b.i - rpLN, pLST, b.i, pHST, rpBGC, bgcolor = rpBGC ))
if rpPL and Showprofle
f_drawLabelX(b.i, pHST, str.tostring(pHST, format.mintick), label.style_label_down, rpPLC, rpS,
'Profile High - ' + str.tostring(pHST, format.mintick) + ' %' + str.tostring((pHST - pLST) / pLST * 100, '#.##') + ' higher than the Profile Low ' +
'Total ' + (vpSRC == 'Volume' ? 'Volume : ' : 'Money Flow (' + syminfo.currency + ') : ') + str.tostring(rpVST.sum(), format.volume) +
' Number of bars : ' + str.tostring(rpLN + 1))
f_drawLabelX(b.i, pLST, str.tostring(pLST, format.mintick), label.style_label_up , rpPLC, rpS,
'Profile Low - ' + str.tostring(pLST, format.mintick) + ' %' + str.tostring((pHST - pLST) / pHST * 100, '#.##') + ' lower than the Profile High ' +
'Total ' + (vpSRC == 'Volume' ? 'Volume : ' : 'Money Flow (' + syminfo.currency + ') : ') + str.tostring(rpVST.sum(), format.volume) +
' Number of bars : ' + str.tostring(rpLN + 1))
for l = 0 to rpNR - 1
if dRP.size() < 500
vtLV = rpVST.get(l)
vtMX = rpVST.max()
LpM = vtLV / vtMX
vdMX = rpVSD.max()
DpM = rpVSD.get(l) / vdMX
llC := LpM > vpHVT ? color.from_gradient(LpM, vpHVT, 1, vpAVC, vpHVC) : color.from_gradient(LpM, 0, vpLVT, vpLVC, vpAVC)
bbp = 2 * rpVSB.get(l) - vtLV
lsC := bbp > 0 ? color.from_gradient(DpM, 0, .7, color.new(spBLC, 70 + int(hmTR / 4)), color.new(spBLC, 30 + int(hmTR / 4))) :
color.from_gradient(DpM, 0, .7, color.new(spBRC, 70 + int(hmTR / 4)), color.new(spBRC, 30 + int(hmTR / 4)))
if rpPC == 'Last(Zone)' and LpM == 1 and Showprofle
dRP.push(box.new(b.i , pLST + (rpVST.indexof(vtMX) + .0) * pSTP, b.i, pLST + (rpVST.indexof(vtMX) + 1.) * pSTP, vpHVC, bgcolor = color.new(vpHVC, 73) ))
if vaSH and LpM > vaTH and LpM < 1 and Showprofle
dRP.push(box.new(b.i , pLST + (l + .0) * pSTP, b.i, pLST + (l + 1.) * pSTP, color(na), bgcolor = vaC ))
if vaSH and rpPC != 'Last(Zone)' and LpM == 1 and Showprofle
dRP.push(box.new(b.i , pLST + (l + .0) * pSTP, b.i, pLST + (l + 1.) * pSTP, color(na), bgcolor = vaC ))
if spPC and DpM == 1 and Showprofle
spPolyline := polyline.new(array.from(chart.point.from_index(b.i , pLST + (rpVSD.indexof(vdMX) + .5) * pSTP), chart.point.from_index(b.i, pLST + (rpVSD.indexof(vdMX) + .5) * pSTP)), false, false, xloc.bar_index, lsC, color(na), line.style_dotted, 1)
dRP.push(box.new(b.i , pLST + (rpVSD.indexof(vdMX) + .0) * pSTP, b.i, pLST + (rpVSD.indexof(vdMX) + 1.) * pSTP, lsC, bgcolor = color.new(lsC, 73) ))
if vpSH and Showprofle
sBI = b.i + (spSH ? rpLN * rpW : 7) + int(rpLN * rpW / 3)
eBI = sBI + int(LpM * rpLN * rpW)
dRP.push(box.new(sBI + vpHO, pLST + (l + .1) * pSTP, eBI + vpHO, pLST + (l + .9) * pSTP, llC, bgcolor = llC,
text = str.tostring(vpSRC == 'Money Flow' ? array.get(rpVST, l) : array.get(rpVST, l) * (pLST + (l + .5) * pSTP), format.volume) + ' ' +
syminfo.currency + ' (' + str.tostring(math.abs(vtLV / rpVST.sum() * 100), '#.##') + '%)',
text_halign = text.align_left, text_color = chart.fg_color, text_size = vpS ))
if spSH and Showprofle
sBI = b.i + rpLN * rpW
eBI = sBI - int(DpM * rpLN * rpW)
dRP.push(box.new(sBI + vpHO, pLST + (l + .1) * pSTP, eBI + vpHO, pLST + (l + .9) * pSTP, lsC, bgcolor = lsC,
text = str.tostring(bbp, format.volume ) + (vpSRC == 'Money Flow' ? ' ' + syminfo.currency : '') +
' (' + str.tostring(math.abs(bbp / vtLV * 100), '#.##') + '%)',
text_halign = text.align_right, text_color = chart.fg_color, text_size = vpS ))
if hmSH and Showprofle
dRP.push(box.new(b.i , pLST + (l + .0) * pSTP, b.i, pLST + (l + 1.) * pSTP, hmSRC == hmSO1 ? color.new(llC, hmTR) : lsC, bgcolor = hmSRC == hmSO1 ? color.new(llC, hmTR) : lsC))
//---------------------------------------------------------------------------------------------------------------------}
//---------------------------------------------------------------------------------------------------------------------}
//---------------------------------------------------------------------------------------------------------------------}
//---------------------------------------------------------------------------------------------------------------------}
//---------------------------------------------------------------------------------------------------------------------}
//---------------------------------------------------------------------------------------------------------------------}
showRevBands = input.bool(true, "Show Reversal Bands", group='Indicator option')
lenRevBands = input.int(30, "Length", group="REVERSAL BANDS")
f_kc(src, len, sensitivity) =>
basis = ta.sma(src, len)
span = ta.atr(len)
= f_kc(close, lenRevBands, 3)
= f_kc(close, lenRevBands, 4)
= f_kc(close, lenRevBands, 5)
= f_kc(close, lenRevBands, 6)
cyan = #00DBFF, cyan30 = color.new(cyan, 100)
pink = #b2b5be, pink30 = color.new(pink, 100)
red = #b2b5be, red30 = color.new(red , 100)
up1 = plot(showRevBands ? upperKC1 : na, "Rev.Zone Upper 1", red30, display = display.none)
up2 = plot(showRevBands ? upperKC2 : na, "Rev.Zone Upper 2", red30, display = display.none)
up3 = plot(showRevBands ? upperKC3 : na, "Rev.Zone Upper 3", red30, display = display.none)
//plot(showRevBands ? upperKC4 : na, "Rev.Zone Upper 4", red30)
//plot(showRevBands ? lowerKC4 : na, "Rev.Zone Lower 4", cyan30)
dn1 = plot(showRevBands ? lowerKC3 : na, "Rev.Zone Lower 3", cyan30, display = display.none)
dn2 = plot(showRevBands ? lowerKC2 : na, "Rev.Zone Lower 2", cyan30, display = display.none)
dn3 = plot(showRevBands ? lowerKC1 : na, "Rev.Zone Lower 1", cyan30, display = display.none)
fill(up1, up2, color = color.new(#f23645, 80))
fill(up2, up3, color = color.new(#f23645, 50))
fill(dn1, dn2, color = color.new(#089981, 50))
fill(dn2, dn3, color = color.new(#089981, 80))
//---------------------------------------------------------------------------------------------------------------------}
//CONSTANTS & STRINGS & INPUTS
//---------------------------------------------------------------------------------------------------------------------{
BULLISH_LEG = 1
BEARISH_LEG = 0
BULLISH = +1
BEARISH = -1
GREEN = #089981
RED = #F23645
BLUE = #2157f3
GRAY = #878b94
MONO_BULLISH = #b2b5be
MONO_BEARISH = #5d606b
HISTORICAL = 'Historical'
PRESENT = 'Present'
COLORED = 'Colored'
MONOCHROME = 'Monochrome'
ALL = 'All'
BOS = 'BOS'
CHOCH = 'CHoCH'
TINY = size.tiny
SMALL = size.small
NORMAL = size.normal
ATR = 'Atr'
RANGE = 'Cumulative Mean Range'
CLOSE = 'Close'
HIGHLOW = 'High/Low'
SOLID = '⎯⎯⎯'
DASHED = '----'
DOTTED = '····'
SMART_GROUP = 'Smart Money Concepts'
INTERNAL_GROUP = 'Real Time Internal Structure'
SWING_GROUP = 'Real Time Swing Structure'
BLOCKS_GROUP = 'Order Blocks'
EQUAL_GROUP = 'EQH/EQL'
GAPS_GROUP = 'Fair Value Gaps'
LEVELS_GROUP = 'Highs & Lows MTF'
ZONES_GROUP = 'Premium & Discount Zones'
modeTooltip = 'Allows to display historical Structure or only the recent ones'
styleTooltip = 'Indicator color theme'
showTrendTooltip = 'Display additional candles with a color reflecting the current trend detected by structure'
showInternalsTooltip = 'Display internal market structure'
internalFilterConfluenceTooltip = 'Filter non significant internal structure breakouts'
showStructureTooltip = 'Display swing market Structure'
showSwingsTooltip = 'Display swing point as labels on the chart'
showHighLowSwingsTooltip = 'Highlight most recent strong and weak high/low points on the chart'
showInternalOrderBlocksTooltip = 'Display internal order blocks on the chart Number of internal order blocks to display on the chart'
showSwingOrderBlocksTooltip = 'Display swing order blocks on the chart Number of internal swing blocks to display on the chart'
orderBlockFilterTooltip = 'Method used to filter out volatile order blocks It is recommended to use the cumulative mean range method when a low amount of data is available'
orderBlockMitigationTooltip = 'Select what values to use for order block mitigation'
showEqualHighsLowsTooltip = 'Display equal highs and equal lows on the chart'
equalHighsLowsLengthTooltip = 'Number of bars used to confirm equal highs and equal lows'
equalHighsLowsThresholdTooltip = 'Sensitivity threshold in a range (0, 1) used for the detection of equal highs & lows Lower values will return fewer but more pertinent results'
showPremiumDiscountZonesTooltip = 'Display premium, discount, and equilibrium zones on chart'
modeInput = input.string( HISTORICAL, 'Mode', group = SMART_GROUP, tooltip = modeTooltip, options = )
styleInput = input.string( COLORED, 'Style', group = SMART_GROUP, tooltip = styleTooltip,options = )
showTrendInput = input( false, 'Color Candles', group = SMART_GROUP, tooltip = showTrendTooltip)
showInternalsInput = input( true, 'Show Internal Structure', group = INTERNAL_GROUP, tooltip = showInternalsTooltip)
showInternalBullInput = input.string( ALL, 'Bullish Structure', group = INTERNAL_GROUP, inline = 'ibull', options = )
internalBullColorInput = input( GREEN, '', group = INTERNAL_GROUP, inline = 'ibull')
showInternalBearInput = input.string( ALL, 'Bearish Structure' , group = INTERNAL_GROUP, inline = 'ibear', options = )
internalBearColorInput = input( RED, '', group = INTERNAL_GROUP, inline = 'ibear')
internalFilterConfluenceInput = input( false, 'Confluence Filter', group = INTERNAL_GROUP, tooltip = internalFilterConfluenceTooltip)
internalStructureSize = input.string( TINY, 'Internal Label Size', group = INTERNAL_GROUP, options = )
showStructureInput = input( true, 'Show Swing Structure', group = SWING_GROUP, tooltip = showStructureTooltip)
showSwingBullInput = input.string( ALL, 'Bullish Structure', group = SWING_GROUP, inline = 'bull', options = )
swingBullColorInput = input( GREEN, '', group = SWING_GROUP, inline = 'bull')
showSwingBearInput = input.string( ALL, 'Bearish Structure', group = SWING_GROUP, inline = 'bear', options = )
swingBearColorInput = input( RED, '', group = SWING_GROUP, inline = 'bear')
swingStructureSize = input.string( SMALL, 'Swing Label Size', group = SWING_GROUP, options = )
showSwingsInput = input( false, 'Show Swings Points', group = SWING_GROUP, tooltip = showSwingsTooltip,inline = 'swings')
swingsLengthInput = input.int( 50, '', group = SWING_GROUP, minval = 10, inline = 'swings')
showHighLowSwingsInput = input( false, 'Show Strong/Weak High/Low',group = SWING_GROUP, tooltip = showHighLowSwingsTooltip)
orderBlockFilterInput = input.string( 'Atr', 'Order Block Filter', group = BLOCKS_GROUP, tooltip = orderBlockFilterTooltip, options = )
showEqualHighsLowsInput = input( false, 'Equal High/Low', group = EQUAL_GROUP, tooltip = showEqualHighsLowsTooltip)
equalHighsLowsLengthInput = input.int( 3, 'Bars Confirmation', group = EQUAL_GROUP, tooltip = equalHighsLowsLengthTooltip, minval = 1)
equalHighsLowsThresholdInput = input.float( 0.1, 'Threshold', group = EQUAL_GROUP, tooltip = equalHighsLowsThresholdTooltip, minval = 0, maxval = 0.5, step = 0.1)
equalHighsLowsSizeInput = input.string( TINY, 'Label Size', group = EQUAL_GROUP, options = )
showDailyLevelsInput = input( false, 'Daily', group = LEVELS_GROUP, inline = 'daily')
dailyLevelsStyleInput = input.string( SOLID, '', group = LEVELS_GROUP, inline = 'daily', options = )
dailyLevelsColorInput = input( BLUE, '', group = LEVELS_GROUP, inline = 'daily')
showWeeklyLevelsInput = input( false, 'Weekly', group = LEVELS_GROUP, inline = 'weekly')
weeklyLevelsStyleInput = input.string( SOLID, '', group = LEVELS_GROUP, inline = 'weekly', options = )
weeklyLevelsColorInput = input( BLUE, '', group = LEVELS_GROUP, inline = 'weekly')
showMonthlyLevelsInput = input( false, 'Monthly', group = LEVELS_GROUP, inline = 'monthly')
monthlyLevelsStyleInput = input.string( SOLID, '', group = LEVELS_GROUP, inline = 'monthly', options = )
monthlyLevelsColorInput = input( BLUE, '', group = LEVELS_GROUP, inline = 'monthly')
showPremiumDiscountZonesInput = input( false, 'Premium/Discount Zones', group = ZONES_GROUP , tooltip = showPremiumDiscountZonesTooltip)
premiumZoneColorInput = input.color( RED, 'Premium Zone', group = ZONES_GROUP)
equilibriumZoneColorInput = input.color( GRAY, 'Equilibrium Zone', group = ZONES_GROUP)
discountZoneColorInput = input.color( GREEN, 'Discount Zone', group = ZONES_GROUP)
//---------------------------------------------------------------------------------------------------------------------}
//DATA STRUCTURES & VARIABLES
//---------------------------------------------------------------------------------------------------------------------{
// @type UDT representing alerts as bool fields
// @field internalBullishBOS internal structure custom alert
// @field internalBearishBOS internal structure custom alert
// @field internalBullishCHoCH internal structure custom alert
// @field internalBearishCHoCH internal structure custom alert
// @field swingBullishBOS swing structure custom alert
// @field swingBearishBOS swing structure custom alert
// @field swingBullishCHoCH swing structure custom alert
// @field swingBearishCHoCH swing structure custom alert
// @field internalBullishOrderBlock internal order block custom alert
// @field internalBearishOrderBlock internal order block custom alert
// @field swingBullishOrderBlock swing order block custom alert
// @field swingBearishOrderBlock swing order block custom alert
// @field equalHighs equal high low custom alert
// @field equalLows equal high low custom alert
// @field bullishFairValueGap fair value gap custom alert
// @field bearishFairValueGap fair value gap custom alert
type alerts
bool internalBullishBOS = false
bool internalBearishBOS = false
bool internalBullishCHoCH = false
bool internalBearishCHoCH = false
bool swingBullishBOS = false
bool swingBearishBOS = false
bool swingBullishCHoCH = false
bool swingBearishCHoCH = false
bool internalBullishOrderBlock = false
bool internalBearishOrderBlock = false
bool swingBullishOrderBlock = false
bool swingBearishOrderBlock = false
bool equalHighs = false
bool equalLows = false
bool bullishFairValueGap = false
bool bearishFairValueGap = false
bool chochswing = false
bool chochplusswing = false
bool swingbos = false
bool chochplus = false
bool choch = false
bool bos = false
bool ob = false
bool swingob = false
bool obtouch = false
// @type UDT representing last swing extremes (top & bottom)
// @field top last top swing price
// @field bottom last bottom swing price
// @field barTime last swing bar time
// @field barIndex last swing bar index
// @field lastTopTime last top swing time
// @field lastBottomTime last bottom swing time
type trailingExtremes
float top
float bottom
int barTime
int barIndex
int lastTopTime
int lastBottomTime
// @type UDT representing trend bias
// @field bias BULLISH or BEARISH
type trend
int bias
// @type UDT representing Equal Highs Lows display
// @field l_ine displayed line
// @field l_abel displayed label
type equalDisplay
line l_ine = na
label l_abel = na
// @type UDT representing a pivot point (swing point)
// @field currentLevel current price level
// @field lastLevel last price level
// @field crossed true if price level is crossed
// @field barTime bar time
// @field barIndex bar index
type pivot
float currentLevel
float lastLevel
bool crossed
int barTime = time
int barIndex = bar_index
// @type UDT representing an order block
// @field barHigh bar high
// @field barLow bar low
// @field barTime bar time
// @field bias BULLISH or BEARISH
type orderBlock
float barHigh
float barLow
int barTime
int bias
// @variable current swing pivot high
var pivot swingHigh = pivot.new(na,na,false)
// @variable current swing pivot low
var pivot swingLow = pivot.new(na,na,false)
// @variable current internal pivot high
var pivot internalHigh = pivot.new(na,na,false)
// @variable current internal pivot low
var pivot internalLow = pivot.new(na,na,false)
// @variable current equal high pivot
var pivot equalHigh = pivot.new(na,na,false)
// @variable current equal low pivot
var pivot equalLow = pivot.new(na,na,false)
// @variable swing trend bias
var trend swingTrend = trend.new(0)
// @variable internal trend bias
var trend internalTrend = trend.new(0)
// @variable equal high display
var equalDisplay equalHighDisplay = equalDisplay.new()
// @variable equal low display
var equalDisplay equalLowDisplay = equalDisplay.new()
// @variable storage for parsed highs
var array parsedHighs = array.new()
// @variable storage for parsed lows
var array parsedLows = array.new()
// @variable storage for raw highs
var array highs = array.new()
// @variable storage for raw lows
var array lows = array.new()
// @variable storage for bar time values
var array times = array.new()
// @variable last trailing swing high and low
var trailingExtremes trailing = trailingExtremes.new()
// @variable color for swing bullish structures
var swingBullishColor = styleInput == MONOCHROME ? MONO_BULLISH : swingBullColorInput
// @variable color for swing bearish structures
var swingBearishColor = styleInput == MONOCHROME ? MONO_BEARISH : swingBearColorInput
// @variable color for premium zone
var premiumZoneColor = styleInput == MONOCHROME ? MONO_BEARISH : premiumZoneColorInput
// @variable color for discount zone
var discountZoneColor = styleInput == MONOCHROME ? MONO_BULLISH : discountZoneColorInput
// @variable bar index on current script iteration
varip int currentBarIndex = bar_index
// @variable bar index on last script iteration
varip int lastBarIndex = bar_index
// @variable alerts in current bar
alerts currentAlerts = alerts.new()
// @variable time at start of chart
var initialTime = time
// @variable default volatility measure
atrMeasure = ta.atr(200)
// @variable parsed volatility measure by user settings
volatilityMeasure = orderBlockFilterInput == ATR ? atrMeasure : ta.cum(ta.tr)/bar_index
// @variable true if current bar is a high volatility bar
highVolatilityBar = (high - low) >= (2 * volatilityMeasure)
// @variable parsed high
parsedHigh = highVolatilityBar ? low : high
// @variable parsed low
parsedLow = highVolatilityBar ? high : low
// we store current values into the arrays at each bar
parsedHighs.push(parsedHigh)
parsedLows.push(parsedLow)
highs.push(high)
lows.push(low)
times.push(time)
//---------------------------------------------------------------------------------------------------------------------}
//USER-DEFINED FUNCTIONS
//---------------------------------------------------------------------------------------------------------------------{
// @function Get the value of the current leg, it can be 0 (bearish) or 1 (bullish)
// @returns int
leg(int size) =>
var leg = 0
newLegHigh = high > ta.highest( size)
newLegLow = low < ta.lowest( size)
if newLegHigh
leg := BEARISH_LEG
else if newLegLow
leg := BULLISH_LEG
leg
// @function Identify whether the current value is the start of a new leg (swing)
// @param leg (int) Current leg value
// @returns bool
startOfNewLeg(int leg) => ta.change(leg) != 0
// @function Identify whether the current level is the start of a new bearish leg (swing)
// @param leg (int) Current leg value
// @returns bool
startOfBearishLeg(int leg) => ta.change(leg) == -1
// @function Identify whether the current level is the start of a new bullish leg (swing)
// @param leg (int) Current leg value
// @returns bool
startOfBullishLeg(int leg) => ta.change(leg) == +1
// @function create a new label
// @param labelTime bar time coordinate
// @param labelPrice price coordinate
// @param tag text to display
// @param labelColor text color
// @param labelStyle label style
// @returns label ID
drawLabel(int labelTime, float labelPrice, string tag, color labelColor, string labelStyle) =>
var label l_abel = na
if modeInput == PRESENT
l_abel.delete()
l_abel := label.new(chart.point.new(labelTime,na,labelPrice),tag,xloc.bar_time,color=color(na),textcolor=labelColor,style = labelStyle,size = size.small)
// @function create a new line and label representing an EQH or EQL
// @param p_ivot starting pivot
// @param level price level of current pivot
// @param size how many bars ago was the current pivot detected
// @param equalHigh true for EQH, false for EQL
// @returns label ID
drawEqualHighLow(pivot p_ivot, float level, int size, bool equalHigh) =>
equalDisplay e_qualDisplay = equalHigh ? equalHighDisplay : equalLowDisplay
string tag = 'EQL'
color equalColor = swingBullishColor
string labelStyle = label.style_label_up
if equalHigh
tag := 'EQH'
equalColor := swingBearishColor
labelStyle := label.style_label_down
if modeInput == PRESENT
line.delete( e_qualDisplay.l_ine)
label.delete( e_qualDisplay.l_abel)
e_qualDisplay.l_ine := line.new(chart.point.new(p_ivot.barTime,na,p_ivot.currentLevel), chart.point.new(time ,na,level), xloc = xloc.bar_time, color = equalColor, style = line.style_dotted)
labelPosition = math.round(0.5*(p_ivot.barIndex + bar_index - size))
e_qualDisplay.l_abel := label.new(chart.point.new(na,labelPosition,level), tag, xloc.bar_index, color = color(na), textcolor = equalColor, style = labelStyle, size = equalHighsLowsSizeInput)
// @function store current structure and trailing swing points, and also display swing points and equal highs/lows
// @param size (int) structure size
// @param equalHighLow (bool) true for displaying current highs/lows
// @param internal (bool) true for getting internal structures
// @returns label ID
getCurrentStructure(int size,bool equalHighLow = false, bool internal = false) =>
currentLeg = leg(size)
newPivot = startOfNewLeg(currentLeg)
pivotLow = startOfBullishLeg(currentLeg)
pivotHigh = startOfBearishLeg(currentLeg)
if newPivot
if pivotLow
pivot p_ivot = equalHighLow ? equalLow : internal ? internalLow : swingLow
if equalHighLow and math.abs(p_ivot.currentLevel - low ) < equalHighsLowsThresholdInput * atrMeasure
drawEqualHighLow(p_ivot, low , size, false)
p_ivot.lastLevel := p_ivot.currentLevel
p_ivot.currentLevel := low
p_ivot.crossed := false
p_ivot.barTime := time
p_ivot.barIndex := bar_index
if not equalHighLow and not internal
trailing.bottom := p_ivot.currentLevel
trailing.barTime := p_ivot.barTime
trailing.barIndex := p_ivot.barIndex
trailing.lastBottomTime := p_ivot.barTime
if showSwingsInput and not internal and not equalHighLow
drawLabel(time , p_ivot.currentLevel, p_ivot.currentLevel < p_ivot.lastLevel ? 'LL' : 'HL', swingBullishColor, label.style_label_up)
else
pivot p_ivot = equalHighLow ? equalHigh : internal ? internalHigh : swingHigh
if equalHighLow and math.abs(p_ivot.currentLevel - high ) < equalHighsLowsThresholdInput * atrMeasure
drawEqualHighLow(p_ivot,high ,size,true)
p_ivot.lastLevel := p_ivot.currentLevel
p_ivot.currentLevel := high
p_ivot.crossed := false
p_ivot.barTime := time
p_ivot.barIndex := bar_index
if not equalHighLow and not internal
trailing.top := p_ivot.currentLevel
trailing.barTime := p_ivot.barTime
trailing.barIndex := p_ivot.barIndex
trailing.lastTopTime := p_ivot.barTime
if showSwingsInput and not internal and not equalHighLow
drawLabel(time , p_ivot.currentLevel, p_ivot.currentLevel > p_ivot.lastLevel ? 'HH' : 'LH', swingBearishColor, label.style_label_down)
// @function draw line and label representing a structure
// @param p_ivot base pivot point
// @param tag test to display
// @param structureColor base color
// @param lineStyle line style
// @param labelStyle label style
// @param labelSize text size
// @returns label ID
drawStructure(pivot p_ivot, string tag, color structureColor, string lineStyle, string labelStyle, string labelSize) =>
var line l_ine = line.new(na,na,na,na,xloc = xloc.bar_time)
var label l_abel = label.new(na,na)
if modeInput == PRESENT
l_ine.delete()
l_abel.delete()
l_ine := line.new(chart.point.new(p_ivot.barTime,na,p_ivot.currentLevel), chart.point.new(time,na,p_ivot.currentLevel), xloc.bar_time, color=structureColor, style=lineStyle)
l_abel := label.new(chart.point.new(na,math.round(0.5*(p_ivot.barIndex+bar_index)),p_ivot.currentLevel), tag, xloc.bar_index, color=color(na), textcolor=structureColor, style=labelStyle, size = labelSize)
// @function delete order blocks
// @param internal true for internal order blocks
// @returns orderBlock ID
// @function fetch and store order blocks
// @param p_ivot base pivot point
// @param internal true for internal order blocks
// @param bias BULLISH or BEARISH
// @returns void
// @function draw order blocks as boxes
// @param internal true for internal order blocks
// @returns void
// @function detect and draw structures, also detect and store order blocks
// @param internal true for internal structures or order blocks
// @returns void
displayStructure(bool internal = false) =>
var bullishBar = true
var bearishBar = true
if internalFilterConfluenceInput
bullishBar := high - math.max(close, open) > math.min(close, open - low)
bearishBar := high - math.max(close, open) < math.min(close, open - low)
pivot p_ivot = internal ? internalHigh : swingHigh
trend t_rend = internal ? internalTrend : swingTrend
lineStyle = internal ? line.style_dashed : line.style_solid
labelSize = internal ? internalStructureSize : swingStructureSize
extraCondition = internal ? internalHigh.currentLevel != swingHigh.currentLevel and bullishBar : true
bullishColor = styleInput == MONOCHROME ? MONO_BULLISH : internal ? internalBullColorInput : swingBullColorInput
if ta.crossover(close,p_ivot.currentLevel) and not p_ivot.crossed and extraCondition
string tag = t_rend.bias == BEARISH ? CHOCH : BOS
if internal
currentAlerts.internalBullishCHoCH := tag == CHOCH
currentAlerts.internalBullishBOS := tag == BOS
else
currentAlerts.swingBullishCHoCH := tag == CHOCH
currentAlerts.swingBullishBOS := tag == BOS
p_ivot.crossed := true
t_rend.bias := BULLISH
displayCondition = internal ? showInternalsInput and (showInternalBullInput == ALL or (showInternalBullInput == BOS and tag != CHOCH) or (showInternalBullInput == CHOCH and tag == CHOCH)) : showStructureInput and (showSwingBullInput == ALL or (showSwingBullInput == BOS and tag != CHOCH) or (showSwingBullInput == CHOCH and tag == CHOCH))
if displayCondition
drawStructure(p_ivot,tag,bullishColor,lineStyle,label.style_label_down,labelSize)
p_ivot := internal ? internalLow : swingLow
extraCondition := internal ? internalLow.currentLevel != swingLow.currentLevel and bearishBar : true
bearishColor = styleInput == MONOCHROME ? MONO_BEARISH : internal ? internalBearColorInput : swingBearColorInput
if ta.crossunder(close,p_ivot.currentLevel) and not p_ivot.crossed and extraCondition
string tag = t_rend.bias == BULLISH ? CHOCH : BOS
if internal
currentAlerts.internalBearishCHoCH := tag == CHOCH
currentAlerts.internalBearishBOS := tag == BOS
else
currentAlerts.swingBearishCHoCH := tag == CHOCH
currentAlerts.swingBearishBOS := tag == BOS
p_ivot.crossed := true
t_rend.bias := BEARISH
displayCondition = internal ? showInternalsInput and (showInternalBearInput == ALL or (showInternalBearInput == BOS and tag != CHOCH) or (showInternalBearInput == CHOCH and tag == CHOCH)) : showStructureInput and (showSwingBearInput == ALL or (showSwingBearInput == BOS and tag != CHOCH) or (showSwingBearInput == CHOCH and tag == CHOCH))
if displayCondition
drawStructure(p_ivot,tag,bearishColor,lineStyle,label.style_label_up,labelSize)
// @function get line style from string
// @param style line style
// @returns string
getStyle(string style) =>
switch style
SOLID => line.style_solid
DASHED => line.style_dashed
DOTTED => line.style_dotted
// @function draw MultiTimeFrame levels
// @param timeframe base timeframe
// @param sameTimeframe true if chart timeframe is same as base timeframe
// @param style line style
// @param levelColor line and text color
// @returns void
drawLevels(string timeframe, bool sameTimeframe, string style, color levelColor) =>
= request.security(syminfo.tickerid, timeframe, [high , low , time , time],lookahead = barmerge.lookahead_on)
float parsedTop = sameTimeframe ? high : topLevel
float parsedBottom = sameTimeframe ? low : bottomLevel
int parsedLeftTime = sameTimeframe ? time : leftTime
int parsedRightTime = sameTimeframe ? time : rightTime
int parsedTopTime = time
int parsedBottomTime = time
if not sameTimeframe
int leftIndex = times.binary_search_rightmost(parsedLeftTime)
int rightIndex = times.binary_search_rightmost(parsedRightTime)
array timeArray = times.slice(leftIndex,rightIndex)
array topArray = highs.slice(leftIndex,rightIndex)
array bottomArray = lows.slice(leftIndex,rightIndex)
parsedTopTime := timeArray.size() > 0 ? timeArray.get(topArray.indexof(topArray.max())) : initialTime
parsedBottomTime := timeArray.size() > 0 ? timeArray.get(bottomArray.indexof(bottomArray.min())) : initialTime
var line topLine = line.new(na, na, na, na, xloc = xloc.bar_time, color = levelColor, style = getStyle(style))
var line bottomLine = line.new(na, na, na, na, xloc = xloc.bar_time, color = levelColor, style = getStyle(style))
var label topLabel = label.new(na, na, xloc = xloc.bar_time, text = str.format('P{0}H',timeframe), color=color(na), textcolor = levelColor, size = size.small, style = label.style_label_left)
var label bottomLabel = label.new(na, na, xloc = xloc.bar_time, text = str.format('P{0}L',timeframe), color=color(na), textcolor = levelColor, size = size.small, style = label.style_label_left)
topLine.set_first_point( chart.point.new(parsedTopTime,na,parsedTop))
topLine.set_second_point( chart.point.new(last_bar_time + 20 * (time-time ),na,parsedTop))
topLabel.set_point( chart.point.new(last_bar_time + 20 * (time-time ),na,parsedTop))
bottomLine.set_first_point( chart.point.new(parsedBottomTime,na,parsedBottom))
bottomLine.set_second_point(chart.point.new(last_bar_time + 20 * (time-time ),na,parsedBottom))
bottomLabel.set_point( chart.point.new(last_bar_time + 20 * (time-time ),na,parsedBottom))
// @function true if chart timeframe is higher than provided timeframe
// @param timeframe timeframe to check
// @returns bool
higherTimeframe(string timeframe) => timeframe.in_seconds() > timeframe.in_seconds(timeframe)
// @function update trailing swing points
// @returns int
updateTrailingExtremes() =>
trailing.top := math.max(high,trailing.top)
trailing.lastTopTime := trailing.top == high ? time : trailing.lastTopTime
trailing.bottom := math.min(low,trailing.bottom)
trailing.lastBottomTime := trailing.bottom == low ? time : trailing.lastBottomTime
// @function draw trailing swing points
// @returns void
drawHighLowSwings() =>
var line topLine = line.new(na, na, na, na, color = swingBearishColor, xloc = xloc.bar_time)
var line bottomLine = line.new(na, na, na, na, color = swingBullishColor, xloc = xloc.bar_time)
var label topLabel = label.new(na, na, color=color(na), textcolor = swingBearishColor, xloc = xloc.bar_time, style = label.style_label_down, size = size.tiny)
var label bottomLabel = label.new(na, na, color=color(na), textcolor = swingBullishColor, xloc = xloc.bar_time, style = label.style_label_up, size = size.tiny)
rightTimeBar = last_bar_time + 20 * (time - time )
topLine.set_first_point( chart.point.new(trailing.lastTopTime, na, trailing.top))
topLine.set_second_point( chart.point.new(rightTimeBar, na, trailing.top))
topLabel.set_point( chart.point.new(rightTimeBar, na, trailing.top))
topLabel.set_text( swingTrend.bias == BEARISH ? 'Strong High' : 'Weak High')
bottomLine.set_first_point( chart.point.new(trailing.lastBottomTime, na, trailing.bottom))
bottomLine.set_second_point(chart.point.new(rightTimeBar, na, trailing.bottom))
bottomLabel.set_point( chart.point.new(rightTimeBar, na, trailing.bottom))
bottomLabel.set_text( swingTrend.bias == BULLISH ? 'Strong Low' : 'Weak Low')
// @function draw a zone with a label and a box
// @param labelLevel price level for label
// @param labelIndex bar index for label
// @param top top price level for box
// @param bottom bottom price level for box
// @param tag text to display
// @param zoneColor base color
// @param style label style
// @returns void
drawZone(float labelLevel, int labelIndex, float top, float bottom, string tag, color zoneColor, string style) =>
var label l_abel = label.new(na,na,text = tag, color=color(na),textcolor = zoneColor, style = style, size = size.small)
var box b_ox = box.new(na,na,na,na,bgcolor = color.new(zoneColor,80),border_color = color(na), xloc = xloc.bar_time)
b_ox.set_top_left_point( chart.point.new(trailing.barTime,na,top))
b_ox.set_bottom_right_point(chart.point.new(last_bar_time,na,bottom))
l_abel.set_point( chart.point.new(na,labelIndex,labelLevel))
// @function draw premium/discount zones
// @returns void
drawPremiumDiscountZones() =>
drawZone(trailing.top, math.round(0.5*(trailing.barIndex + last_bar_index)), trailing.top, 0.95*trailing.top + 0.05*trailing.bottom, 'Premium', premiumZoneColor, label.style_label_down)
equilibriumLevel = math.avg(trailing.top, trailing.bottom)
drawZone(equilibriumLevel, last_bar_index, 0.525*trailing.top + 0.475*trailing.bottom, 0.525*trailing.bottom + 0.475*trailing.top, 'Equilibrium', equilibriumZoneColorInput, label.style_label_left)
drawZone(trailing.bottom, math.round(0.5*(trailing.barIndex + last_bar_index)), 0.95*trailing.bottom + 0.05*trailing.top, trailing.bottom, 'Discount', discountZoneColor, label.style_label_up)
//---------------------------------------------------------------------------------------------------------------------}
//MUTABLE VARIABLES & EXECUTION
//---------------------------------------------------------------------------------------------------------------------{
parsedOpen = showTrendInput ? open : na
candleColor = internalTrend.bias == BULLISH ? swingBullishColor : swingBearishColor
plotcandle(parsedOpen,high,low,close,color = candleColor, wickcolor = candleColor, bordercolor = candleColor)
if showHighLowSwingsInput or showPremiumDiscountZonesInput
updateTrailingExtremes()
if showHighLowSwingsInput
drawHighLowSwings()
if showPremiumDiscountZonesInput
drawPremiumDiscountZones()
getCurrentStructure(swingsLengthInput,false)
getCurrentStructure(5,false,true)
if showEqualHighsLowsInput
getCurrentStructure(equalHighsLowsLengthInput,true)
if showInternalsInput or showTrendInput
displayStructure(true)
if showStructureInput or showHighLowSwingsInput
displayStructure()
lastBarIndex := currentBarIndex
currentBarIndex := bar_index
newBar = currentBarIndex != lastBarIndex
if barstate.islastconfirmedhistory or (barstate.isrealtime and newBar)
if showDailyLevelsInput and not higherTimeframe('D')
drawLevels('D',timeframe.isdaily,dailyLevelsStyleInput,dailyLevelsColorInput)
if showWeeklyLevelsInput and not higherTimeframe('W')
drawLevels('W',timeframe.isweekly,weeklyLevelsStyleInput,weeklyLevelsColorInput)
if showMonthlyLevelsInput and not higherTimeframe('M')
drawLevels('M',timeframe.ismonthly,monthlyLevelsStyleInput,monthlyLevelsColorInput)
//---------------------------------------------------------------------------------------------------------------------}
//ALERTS
//---------------------------------------------------------------------------------------------------------------------{
alertcondition(currentAlerts.internalBullishBOS, 'Internal Bullish BOS', 'Internal Bullish BOS formed')
alertcondition(currentAlerts.internalBullishCHoCH, 'Internal Bullish CHoCH', 'Internal Bullish CHoCH formed')
alertcondition(currentAlerts.internalBearishBOS, 'Internal Bearish BOS', 'Internal Bearish BOS formed')
alertcondition(currentAlerts.internalBearishCHoCH, 'Internal Bearish CHoCH', 'Internal Bearish CHoCH formed')
alertcondition(currentAlerts.swingBullishBOS, 'Bullish BOS', 'Internal Bullish BOS formed')
alertcondition(currentAlerts.swingBullishCHoCH, 'Bullish CHoCH', 'Internal Bullish CHoCH formed')
alertcondition(currentAlerts.swingBearishBOS, 'Bearish BOS', 'Bearish BOS formed')
alertcondition(currentAlerts.swingBearishCHoCH, 'Bearish CHoCH', 'Bearish CHoCH formed')
alertcondition(currentAlerts.equalHighs, 'Equal Highs', 'Equal highs detected')
alertcondition(currentAlerts.equalLows, 'Equal Lows', 'Equal lows detected')
//---------------------------------------------------------------------------------------------------------------------}
//-----------------------------------------------------------------------------
// Input Settings
//-----------------------------------------------------------------------------
i_3 = "FVGs represent price areas where a significant gap occurred between two trading sessions, indicating a potential continuation or reversal point."
//----------------------------------------
// Order Blocks
//----------------------------------------
var_ob_13 = (time - time ) / 100
//----------------------------------------
// Constants
color CLEAR = color.rgb(0, 0, 0, 100)
//----------------------------------------
// Fair Value Gaps (FVG)
//----------------------------------------
in_fvg_1 = input(true, "Fair Value Gaps (FVG)", group="Fair Value Gaps", inline="fvg_css", tooltip = i_3)
in_fvg_2 = input.timeframe("", "Timeframe", group="Fair Value Gaps", inline="tf")
in_fvg_op = input.int(defval=12, title="Opacity %", minval=0, maxval=100, group="Fair Value Gaps", inline="tf")
in_fvg_3 = input.float(2, "Max Width", minval=0, maxval=5.0, step=0.1, group="Fair Value Gaps", inline="width")
in_fvg_4 = input.bool(false, "Filter FVG", group="Fair Value Gaps", inline="width")
in_fvg_5 = input.string("Close", "Mitigation Method", options= , group="Fair Value Gaps", inline="mt")
in_fvg_6 = input.bool(true, "Fill", group="Fair Value Gaps", inline="mt")
in_fvg_7 = input.bool(false, "Shade", group="Fair Value Gaps", inline="mt")
in_fvg_8 = input.int(defval=8, title="Max FVG", minval=0, maxval=50, group="Fair Value Gaps", inline="OS")
in_fvg_9 = input.int(defval=17, title="Length", minval=0, maxval=100, group="Fair Value Gaps", inline="OS")
in_fvg_10 = input.bool(false, "Extend", group="Fair Value Gaps", inline="OS")
in_fvg_11 = input.color(color.new(#089981, 88), "", group="Fair Value Gaps", inline="fvg_css")
in_fvg_12 = input.color(color.new(#f23645, 88), "", group="Fair Value Gaps", inline="fvg_css")
mid_line_show = input.string("On", " Mid Line", , group="Fair Value Gaps", inline="mid")
in_fvg_13 = input.string("Solid", " Style", , group="Fair Value Gaps", inline="mid")
in_fvg_14 = input.color(#089981, "", group="Fair Value Gaps", inline="mid")
in_fvg_14_2 = input.color(#f23645, "", group="Fair Value Gaps", inline="mid")
in_fvg_16 = input.int(defval=1, title="Line Width", minval=1, maxval=5, group="Fair Value Gaps", inline="mid_w")
in_fvg_15 = input.bool(false, "Extend (Current)", group="Fair Value Gaps", inline="mid_w")
var_fvg_1 = color.new(color.green, 100)
var_fvg_2 = color.new(color.green, 90)
var_fvg_3 = true
var_fvg_4 = true
var_fvg_5 = color.white
var_fvg_6 = "HTF"
var_fvg_7 = 10
var_fvg_8 = 50
in_fvg_op := 100 - in_fvg_op
//-----------------------------------------------------------------------------
// Global Variables
//-----------------------------------------------------------------------------
color transparent = #ffffff00
custom_func_1(res) =>
t = time(res)
not na(t) and (na(t ) or t > t )
custom_func_2(x, y, txt, css, dashed, down, lbl_size) =>
label.new(int(math.avg(x, bar_index)), y, txt, color=transparent, textcolor=css, style=down ? label.style_label_down : label.style_label_up, size=lbl_size)
line.new(x, y, bar_index, y, color=css, style=dashed ? line.style_dotted : line.style_solid)
custom_func_3(_cond, _count) =>
_barssince = bar_index - ta.valuewhen(_cond, bar_index, _count)
_barssince
// Swing Detection/Measurements
custom_func_4(length) =>
var prev = 0
prev := high > ta.highest(length) ? 0 : low < ta.lowest(length) ? 1 : prev
t = prev == 0 and prev != 0 ? high : 0
b = prev == 1 and prev != 1 ? low : 0
var variable_ms_1 = 0, var variable_ms_2 = 0
var variable_ms_3 = 0., var variable_ms_4 = 0, var variable_ms_5 = 0., var variable_ms_6 = 0
var variable_ms_7 = 0., var variable_ms_8 = 0, var variable_ms_9 = 0., var variable_ms_10 = 0
var variable_ms_11 = true, var variable_ms_12 = true
var variable_ms_13 = true, var variable_ms_14 = true
var variable_ms_15 = high, var variable_ms_16 = low
var up_trailing_x = 0, var down_trailing_x = 0
var high_text = "", var low_text = ""
variable_ms_17 = false
variable_ms_18 = false
// Functions
lineStyle(x) =>
switch x
"Solid" => line.style_solid
"Dashed" => line.style_dashed
"Dotted" => line.style_dotted
variable_ms_20 = ta.pivothigh(high, 10, 10)
variable_ms_21 = ta.pivotlow(low, 10, 10)
//-----------------------------------------------------------------------------
// Fair Value Gaps
//-----------------------------------------------------------------------------
// Global Data
var htfH = open
var htfL = open
if close > htfH
htfH := close
if close < htfL
htfL := close
// Security Data, used for HTF Bar Data reference
sClose = request.security(ticker.standard(syminfo.tickerid), in_fvg_2, close , barmerge.gaps_off, barmerge.lookahead_on)
sHighP2 = request.security(ticker.standard(syminfo.tickerid), in_fvg_2, high , barmerge.gaps_off, barmerge.lookahead_on)
sLowP2 = request.security(ticker.standard(syminfo.tickerid), in_fvg_2, low , barmerge.gaps_off, barmerge.lookahead_on)
sOpen = request.security(ticker.standard(syminfo.tickerid), in_fvg_2, open , barmerge.gaps_off, barmerge.lookahead_on)
sBar = request.security(ticker.standard(syminfo.tickerid), in_fvg_2, bar_index, barmerge.gaps_off, barmerge.lookahead_on)
// Array variables to hold data in memory
var variable_fvg_1 = array.new_box(0)
var variable_fvg_2 = array.new_box(0)
var variable_fvg_3 = array.new_box(0)
var variable_fvg_4 = array.new_box(0)
var variable_fvg_5 = array.new_line(0)
var variable_fvg_6 = array.new_line(0)
var variable_fvg_7 = array.new_line(0)
var variable_fvg_8 = array.new_line(0)
var variable_fvg_9 = array.new_line(0)
var variable_fvg_10 = array.new_line(0)
var variable_fvg_11 = array.new_label(0)
var variable_fvg_12 = array.new_label(0)
var variable_fvg_13 = color.new(color.white, 100)
var variable_fvg_14 = false
var variable_fvg_15 = false
variable_fvg_14 := false
variable_fvg_15 := false
// Functions
custom_func_5(_upperlimit, _lowerlimit, _midlimit, _bar, _boxholder, _boxholder_fill, _midholder, _highholder, _lowholder, _labelholder, _boxcolor, _mtfboxcolor, _htf, line_color_mid) =>
variable_fvg_16 = str.tostring(in_fvg_2)
offset = var_fvg_8
variable_fvg_17 = _mtfboxcolor
bg_color = color.new(_mtfboxcolor, in_fvg_op)
if _htf == false
variable_fvg_16 := str.tostring(timeframe.period)
offset := var_fvg_7
variable_fvg_17 := _boxcolor
array.push(_boxholder, box.new(_bar, _upperlimit, _bar + (var_ob_13) * in_fvg_9, _lowerlimit, border_color= na, bgcolor=in_fvg_6 ? bg_color : na, extend=in_fvg_10 ? extend.right : extend.none, xloc=xloc.bar_time, text="", text_color=#787b86, text_halign=text.align_right, text_size=size.small))
array.push(_boxholder_fill, box.new(_bar, _upperlimit, _bar + (var_ob_13) * in_fvg_9, _lowerlimit, border_color= na, bgcolor=in_fvg_6 ? bg_color : na, extend=in_fvg_10 ? extend.right : extend.none, xloc=xloc.bar_time))
array.push(_midholder, line.new(_bar, (_lowerlimit + _upperlimit) / 2.0, _bar + (var_ob_13) * in_fvg_9, _midlimit, color=mid_line_show == "On" ? line_color_mid : #363a4500, extend=in_fvg_10 ? extend.right : extend.none, style=lineStyle(in_fvg_13), width=in_fvg_16, xloc=xloc.bar_time))
array.push(_lowholder, line.new(_bar, _lowerlimit, _bar + (var_ob_13) * in_fvg_9, _lowerlimit, color=var_fvg_3 ? variable_fvg_17 : na, extend=in_fvg_10 ? extend.right : extend.none, width=1, xloc=xloc.bar_time))
array.push(_highholder, line.new(_bar, _upperlimit, _bar + (var_ob_13) * in_fvg_9, _upperlimit, color=var_fvg_3 ? variable_fvg_17 : na, extend=in_fvg_10 ? extend.right : extend.none, width=1, xloc=xloc.bar_time))
// Checks for gap between current candle and 2 previous candle (Fair Value Gap)
custom_func_6(_close, _high, _highp2, _low, _lowp2, _open, _bar, _htf) =>
gap = 0
thold_ = (ta.highest(_high, 300) - ta.lowest(_low, 300)) * math.max(in_fvg_3, 0.1) / 100.
if _open > _close // Red candle
if _lowp2 > _high
if not (in_fvg_4) or math.abs(_lowp2 - _high) > thold_
upperlimit = _high
lowerlimit = _lowp2
midlimit = lowerlimit + ((upperlimit - lowerlimit) / 2.)
gap := 1
if in_fvg_1
custom_func_5(upperlimit, lowerlimit, midlimit, _bar, variable_fvg_1, variable_fvg_3, variable_fvg_9, variable_fvg_5, variable_fvg_7, variable_fvg_11, var_fvg_1, in_fvg_12, _htf,in_fvg_14_2)
else
if _low > _highp2
if not (in_fvg_4) or math.abs(_low - _highp2) > thold_
upperlimit = _low
lowerlimit = _highp2
midlimit = lowerlimit + ((upperlimit - lowerlimit) / 2.)
gap := -1
if in_fvg_1
custom_func_5(upperlimit, lowerlimit, midlimit, _bar, variable_fvg_2, variable_fvg_4, variable_fvg_10, variable_fvg_6, variable_fvg_8, variable_fvg_12, var_fvg_2, in_fvg_11, _htf,in_fvg_14)
gap
// Removes the gap from its relevant array if it has been filled
custom_func_7(_currentgap, _currentgap_fill, _i, _boxholder, _boxholder_fill, _midholder, _highholder, _lowholder, _labelholder) =>
array.remove(_boxholder, _i)
array.remove(_boxholder_fill, _i)
currentmid = array.get(_midholder, _i)
currenthigh = array.get(_highholder, _i)
currentlow = array.get(_lowholder, _i)
array.remove(_midholder, _i)
array.remove(_highholder, _i)
array.remove(_lowholder, _i)
if var_fvg_4
line.delete(currentmid)
line.delete(currenthigh)
line.delete(currentlow)
else
line.set_extend(currentmid, extend.none)
line.set_x2(currentmid, time)
line.set_extend(currenthigh, extend.none)
line.set_x2(currenthigh, time)
line.set_extend(currentlow, extend.none)
line.set_x2(currentlow, time)
if var_fvg_4
box.delete(_currentgap)
box.delete(_currentgap_fill)
else
box.set_extend(_currentgap, extend.none)
box.set_right(_currentgap, time)
// Checks if gap has been filled either by 0.5 fill (var_fvg_3) or SHRINKS the gap to reflect the true value gap left
custom_func_8(_high, _low) =>
variable_fvg_19 = 0
if array.size(variable_fvg_1) > 0
for i = array.size(variable_fvg_1) - 1 to 0
if in_fvg_15
currentgap_fill = array.get(variable_fvg_3, i)
currentgap = array.get(variable_fvg_1, i)
cmid = array.get(variable_fvg_9, i)
chigh = array.get(variable_fvg_5, i)
clow = array.get(variable_fvg_7, i)
line.set_x2(cmid, timenow + (var_ob_13) * in_fvg_9)
line.set_x2(chigh, timenow + (var_ob_13) * in_fvg_9)
line.set_x2(clow, timenow + (var_ob_13) * in_fvg_9)
box.set_right(currentgap_fill, timenow + (var_ob_13) * in_fvg_9)
box.set_right(currentgap, timenow + (var_ob_13) * in_fvg_9)
if in_fvg_5 == "Touch"
currentgap_fill = array.get(variable_fvg_3, i)
currentgap = array.get(variable_fvg_1, i)
currentmid = array.get(variable_fvg_9, i)
currenthigh = array.get(variable_fvg_5, i)
currentlow = array.get(variable_fvg_7, i)
currenttop = box.get_top(currentgap)
if high > currenttop
variable_fvg_19 := 1
custom_func_7(currentgap, currentgap_fill, i, variable_fvg_1, variable_fvg_3, variable_fvg_9, variable_fvg_5, variable_fvg_7, variable_fvg_11)
if in_fvg_5 == "Wicks"
currentgap_fill = array.get(variable_fvg_3, i)
currentgap = array.get(variable_fvg_1, i)
currentmid = array.get(variable_fvg_9, i)
currenthigh = array.get(variable_fvg_5, i)
currentlow = array.get(variable_fvg_7, i)
currenttop = box.get_bottom(currentgap)
currentbottom = box.get_top(currentgap_fill)
if high > currentbottom and in_fvg_7
currentgap_f = array.get(variable_fvg_3, i)
cur_bottom = box.get_bottom(currentgap_f)
_bottom = box.get_bottom(currentgap)
if _bottom == cur_bottom
box.set_bottom(currentgap_f, high)
else
box.set_bottom(currentgap_f, math.max(cur_bottom, high))
box.set_bgcolor(currentgap_f, #787b865e)
if high > currenttop
variable_fvg_19 := 1
custom_func_7(currentgap, currentgap_fill, i, variable_fvg_1, variable_fvg_3, variable_fvg_9, variable_fvg_5, variable_fvg_7, variable_fvg_11)
if in_fvg_5 == "Close"
currentgap_fill = array.get(variable_fvg_3, i)
currentgap = array.get(variable_fvg_1, i
DTLLC Time & PriceDTLLC Time and Price with Signals
This indicator is built for traders who understand ICT concepts and want a structured, visual way to align time-based price action with key market levels. By combining customizable trading windows, breakout logic, and daily reference points, it helps you identify high-probability trade opportunities while filtering out market noise.
Key Features
1. Dual Custom Time Ranges (Kill Zones)
Set two independent time ranges per day (start/end hour and minute).
Each range identifies the highest high and lowest low within its window.
Built-in breakout detection generates buy/sell signals when price moves beyond these levels.
2. Volatility Filtering
Adjustable volatility threshold based on True Range relative to ATR.
Filters out low-quality signals during choppy, low-volatility conditions.
3. ATR-Based Stop Loss
Custom ATR length and stop-loss multiplier settings.
Automatically plots ATR-based stop levels for triggered trades.
4. Daily Key Levels
Plots Previous Day High, Previous Day Low, and Midnight Open continuously on the chart.
Useful for spotting breakout and reversal opportunities in line with ICT market structure concepts.
5. Liquidity & Engulfing Candle Highlights
Highlights potential liquidity grab zones (yellow candles) when significant highs/lows are set within your lookback period.
Detects bullish (green) and bearish (red) engulfing patterns for added confluence.
6. Visual & Signal Tools
Buy/Sell signals plotted directly on chart (separate colors for Range 1 and Range 2). Continuous plotting of reference levels to maintain market context throughout the session.
Example Use Case:
A common ICT-inspired reversal setup:
Wait for price to sweep the Previous Day’s High or Low during your chosen time range.
Look for a buy or sell signal with volatility confirmation.
Manage risk using the ATR-based stop-loss plot.
Disclaimer: This script is for educational purposes only and is not financial advice. Trade responsibly and always test strategies before applying them in live markets.
LANZ Strategy 6.0🔷 LANZ Strategy 6.0 — NY Session Entry Tool & Multi-Account Risk Manager
LANZ Strategy 6.0 - Is a trading tool designed to help traders plan, execute, and manage operations with a focus on risk management, multi-account handling, and visual clarity.
It works exclusively on the 1-hour timeframe ⏳ and is optimized for the New York market opening dynamics.
🧠 Core Concept
The strategy identifies bullish trading opportunities based on the 09:00 NY candle. Once detected, it automatically calculates and draws:
EP (Entry Price) — The exact level where the trade setup triggers.
SL (Stop Loss) — Based on a customizable percentage of the candle's high–low range or wick extremes.
TP (Take Profit) — Calculated using your chosen Risk–Reward Ratio (e.g., 1:5, 1:3, etc.).
⚙️ Main Features
⏳ Time-Specific Execution
Operates only when the 09:00 NY candle closes bullish.
Ideal for traders who align with the New York Session market structure.
💰 Multi-Account Lot Size Management
Up to 5 independent accounts can be configured with their own capital and risk %, showing the exact lot size to use for each.
📏 Adaptive Risk Control
Supports both Forex and non-Forex assets (indices, gold, oil).
For non-Forex, you can manually define the pip value according to your broker’s specs.
🎨 Visual Trade Map
Automatically plots clean and easy-to-read EP, SL, and TP lines with customizable colors, styles, and thickness.
A floating information panel displays levels, pip distances, and lot sizes.
🔔 Real-Time Alerts
Alerts for:
Entry signal detection.
Stop Loss hit.
Take Profit hit.
Manual close at the defined session end.
📊 Example
If you trade GBPUSD with Account #1 set to $10,000 and 2% risk,
and the 09:00 NY candle closes bullish with SL = 30 pips and RR = 5:1:
EP, SL, and TP levels are drawn instantly.
Risk = $200 (2% of $10,000).
Lot size is calculated automatically.
All details are shown in the on-chart panel.
🛠️ How to Use
Load the indicator on a 1-hour chart.
Configure risk settings and account data.
Wait for the 09:00 NY candle to close bullish.
Use the displayed lot size and levels to execute your trade.
Let the tool alert you for SL, TP, or manual close.
⚠️ Disclaimer:
This script is for educational purposes only. It does not guarantee profits and past performance does not represent future results. Always manage your risk responsibly.
👨💻 Credits:
💡 Developed by: LANZ
🧠 Execution Model & Logic Design: LANZ
📅 Designed for: 1H timeframe and NY-based entries
Session HL + Candles + AMD (Nephew_Sam_) copyi want to test and see if i can apply this script to topstepx if i publish it. all credits to Nephem_Sam_) Great indicator!
QuadRes Pro - Advanced Multi-Indicator Resonance Trading System🚀 Multi-Indicator Resonance Trading Strategy - Professional English Introduction
Strategy Overview
Elite 3-Minute High-Frequency Quantitative Trading System
This proprietary algorithmic trading strategy leverages advanced multi-indicator resonance technology, specifically designed for short-term high-frequency trading in the 3-minute timeframe. Our system achieves superior performance through sophisticated signal confluence analysis, combining four premium technical indicators with intelligent risk management protocols.
🎯 Core Technical Framework
Multi-Indicator Confluence Engine
MACD Momentum Analysis (6,13,5): Optimized parameters for ultra-short-term trend detection
KDJ Stochastic Oscillator (25,3,3): Enhanced momentum confirmation with custom smoothing
EMA Crossover System (20/50): Dynamic trend filter with real-time directional bias
ADX Trend Strength Filter (14): Eliminates low-volatility, choppy market conditions
Advanced Signal Processing
Resonance Threshold: Minimum 3 out of 4 indicators must align for trade execution
Smart Volume Confirmation: Volume must exceed 80% of 20-period moving average
Time-Based Filtering: Active during high-liquidity sessions (9:00-15:00, 21:00-23:00)
Daily Trade Limits: Maximum 8 trades per day to prevent overtrading
🛡️ Professional Risk Management
Dynamic Position Sizing
ATR-Based Stop Loss: 2.5x Average True Range for optimal risk-reward ratio
Target Profit Ratio: 0.8:1 risk-reward optimization
Equity-Based Sizing: Adaptive position size based on account equity (1.5% risk per trade)
Maximum Drawdown Control: Automatic position reduction at 15% drawdown threshold
Optional Martingale Protocol (High-Risk Feature)
Conservative Multiplier: 1.5x position increase after consecutive losses
Safety Cap: Maximum 3x base position size to prevent catastrophic losses
Recommendation: Disabled for conservative institutional accounts
📊 Performance Metrics & Expectations
Backtested Performance Statistics
Metric Target Range Optimized Results
Win Rate 65-78% 78.3% (+9.5% improvement)
Maximum Drawdown <12% 6.7% (-8.6% reduction)
Sharpe Ratio >1.5 2.95 (+1.17 improvement)
Total Return >60% 96.8% (+28.6% enhancement)
Daily Trade Frequency 3-6 trades 3.8 trades (-27% noise reduction)
Slippage Impact <10% 6.2% (-64% cost optimization)
Risk Characteristics
Strategy Type: Mean-reversion with trend-following confirmation
Market Suitability: Best performance in trending markets with moderate volatility
Time Sensitivity: Optimal for 3-minute charts, adaptable to 1-5 minute timeframes
Currency Compatibility: Forex majors, crypto, and high-volume equities
🚀 Competitive Advantages
Technological Superiority
Pine Script v6 Optimization: Latest TradingView infrastructure for maximum execution speed
Real-Time Dashboard: Live 4-indicator status monitoring with visual confirmation signals
Smart Alerts: Automated notifications with signal strength and position size recommendations
Dynamic Adaptation: Self-adjusting parameters based on market volatility regimes
Institutional-Grade Features
Equity Curve Protection: Advanced drawdown detection with automatic risk reduction
Volume-Weighted Execution: Ensures optimal entry timing during high-liquidity periods
Multi-Session Compatibility: Seamless operation across global trading sessions
Professional Monitoring: Comprehensive performance tracking with win rate analytics
💼 Target Client Profile
Ideal for:
Proprietary Trading Firms: Seeking consistent alpha generation in short-term strategies
Hedge Funds: Requiring diversified high-frequency trading approaches
Professional Traders: Managing $50K+ accounts with risk management discipline
Algorithmic Trading Platforms: Implementing systematic trading protocols
Capital Requirements
Minimum Account Size: $25,000 (recommended $50,000+)
Leverage Capability: 1:100 maximum for forex, 1:4 for equities
Infrastructure: High-speed internet, VPS hosting recommended for optimal execution
🎖️ Implementation Support
Professional Services Included
Strategy Optimization: Custom parameter tuning for specific market conditions
Risk Assessment: Comprehensive backtesting across multiple market cycles
Performance Monitoring: Monthly performance reports with optimization recommendations
Technical Support: 24/7 assistance for strategy implementation and troubleshooting
Getting Started
Initial Consultation: Strategy suitability assessment and risk profiling
Paper Trading Phase: 30-day simulation with real market conditions
Live Implementation: Gradual capital allocation with continuous monitoring
Performance Review: Quarterly optimization and strategy refinement
⚠️ Important Disclaimer: Past performance does not guarantee future results. This strategy involves substantial risk of loss and is not suitable for all investors. Professional consultation recommended before implementation.
🏆 Proven Excellence: Developed by quantitative trading specialists with 10+ years in algorithmic strategy development and institutional trading experience.
Contact us for personalized strategy consultation and implementation support.
Adan Confirmed Bullish Divergence (v1.1) — No RepaintAdan Confirmed Bullish Divergence (v1.1) — No Repaint
糖哥专属MA均线Custom MA 30-60-90-120-180-250 is a versatile Moving Average (MA) indicator designed for TradingView, supporting the simultaneous display of six moving averages (default periods: 30, 60, 90, 120, 180, 250). This indicator is ideal for trend analysis, support and resistance identification, and generating trading signals. Optimized for free plan users, it bypasses the 3-indicator limit by combining multiple MAs into a single script.Key FeaturesMultiple Moving Averages: Displays six MAs by default (MA30, MA60, MA90, MA120, MA180, MA250) with fully adjustable periods.
Flexible MA Types: Supports Simple Moving Average (SMA), Exponential Moving Average (EMA), and Weighted Moving Average (WMA), switchable via the settings panel.
Custom Price Source: Allows selection of price data such as close, open, high, low, and more for MA calculations.
Display Control: Each MA can be individually enabled or disabled to reduce chart clutter.
Customizable Styles: Supports custom colors and line thickness for each MA, enhancing visual clarity.
Free Plan Friendly: Combines all MAs into a single indicator, perfect for TradingView’s free plan users.
Use CasesTrend Analysis: Identify potential buy/sell signals through MA crossovers (e.g., MA30 crossing above MA60).
Support and Resistance: MAs serve as dynamic support or resistance levels to aid price analysis.
Multi-Timeframe: Suitable for daily, hourly, or other timeframes, with adjustable periods to match your strategy.
SettingsMA Periods: Customize the period for each MA (default: 30, 60, 90, 120, 180, 250).
MA Type: Choose between SMA, EMA, or WMA to suit different trading styles.
Price Source: Select the price data for MA calculations (e.g., close, open, etc.).
Display Toggle: Enable or disable specific MAs to optimize chart clarity.
Color Settings: Customize the color and thickness of each MA line.
How to UseAdd the indicator to your chart.
Adjust periods, MA type, price source, and colors in the settings panel.
Develop trading strategies based on MA crossovers, trends, or support/resistance levels.
Save your chart layout to retain personalized settings.
NotesAdjust MA periods based on your timeframe (e.g., shorter periods for intraday trading, longer periods for long-term trends).
Too many MAs may clutter the chart; use the display toggle to streamline the view.
Test different MA types (SMA, EMA, WMA) to find the best fit for your strategy.
Release NotesVersion: Pine Script v5
Target Audience: Suitable for technical analysts in stocks, forex, cryptocurrencies, and other markets.
Feedback: Share your experience or suggestions in the comments to help improve the indicator!
Renko Price TrackerRenko Sequential Signal – qLine + Moneyball Confirmation
This indicator is designed for Renko chart traders who want to combine price action relative to a key line (qLine) with Moneyball buy/sell signals as a confirmation. It helps filter trades so you only get signals when both conditions align within a chosen time window.
How It Works
First Event – Price Trigger
Detects when the Renko close crosses above/below your selected qLine plot from the qPro indicator.
You can choose between:
Cross – only triggers on an actual crossover/crossunder.
State (Close) – triggers whenever price closes above/below qLine.
Second Event – Moneyball Confirmation
Waits for Moneyball’s Buy Signal (for long) or Bear/Sell Signal (for short) plot to fire.
You select the exact Moneyball plot from the source menu.
You can specify how the Moneyball signal is interpreted (== 1, >= 1, or any nonzero value).
Sequential Logic
The Moneyball signal must occur within N Renko bricks after the price event.
The final buy/sell signal is printed on the Moneyball bar.
Key Features
Works natively on Renko charts.
Adjustable confirmation window (0–5 bricks).
Flexible detection for both qLine and Moneyball signals.
Customizable label sizes, arrow display, and alerts.
Alerts fire for both buy and sell conditions:
BUY: qLine ➜ Moneyball Buy
SELL: qLine ➜ Moneyball Sell
Inputs
qLine Source – Pick the qPro qLine plot.
Price Event Type – Cross or State.
Moneyball Buy/Sell Signal Plots – Select the correct plots from your Moneyball indicator.
Confirmation Window – Bars allowed between events.
Visual Settings – Label size, arrow visibility, etc.
Use Case
Ideal for traders who:
Want a double-confirmation entry system.
Use Renko charts for cleaner trend detection.
Already have qPro and Moneyball loaded, but want an automated, rule-based confluence check.
P.A.P Penjejak Awan Pelangi//@version=5
indicator("P.A.P Penjejak Awan Pelangi", overlay=true, max_labels_count=500, max_lines_count=500)
//------------------- INPUTS -------------------//
tfHigher = input.timeframe("60", "Higher TF for SMC")
atrLength = input.int(14, "ATR Length")
atrMultSL = input.float(1.5, "ATR Multiplier SL")
atrMultTP = input.float(2.0, "ATR Multiplier TP")
showOB = input.bool(true, "Show Order Blocks")
showRyg = input.bool(true, "Show R.Y.G Levels")
showVWAP = input.bool(true, "Show VWAP")
showSignalTable = input.bool(true, "Show Signal Table")
//------------------- ATR SMART RISK -------------------//
atr = ta.atr(atrLength)
sl = close - atr * atrMultSL
tp = close + atr * atrMultTP
plot(sl, "Stop Loss", color=color.red, style=plot.style_linebr, linewidth=1)
plot(tp, "Take Profit", color=color.green, style=plot.style_linebr, linewidth=1)
//------------------- VWAP -------------------//
vwap = ta.vwap(close)
plot(showVWAP ? vwap : na, "VWAP", color=color.orange, linewidth=2)
//------------------- R.Y.G Model -------------------//
// Idea: Green = bullish bias, Yellow = caution, Red = bearish bias
emaFast = ta.ema(close, 20)
emaSlow = ta.ema(close, 50)
biasColor = emaFast > emaSlow ? color.green : emaFast < emaSlow ? color.red : color.yellow
bgcolor(showRyg ? biasColor : na, transp=85)
//------------------- SIMPLE ORDER BLOCK -------------------//
var float obHigh = na
var float obLow = na
if showOB
// Bullish OB: last down candle before a big move up
if close > high and close < open
obHigh := high
obLow := low
// Bearish OB: last up candle before a big move down
if close < low and close > open
obHigh := high
obLow := low
if not na(obHigh) and not na(obLow)
box.new(left=bar_index-1, top=obHigh, right=bar_index, bottom=obLow, bgcolor=color.new(color.purple, 85))
//------------------- SIGNAL TABLE -------------------//
var table sigTable = table.new(position.top_right, 3, 3, border_width=1)
signalBias = emaFast > emaSlow ? "Bullish" : emaFast < emaSlow ? "Bearish" : "Neutral"
signalATR = str.tostring(atr, format.mintick)
signalVWAP = close > vwap ? "Above" : "Below"
if showSignalTable
table.cell(sigTable, 0, 0, "Bias", text_color=color.white, bgcolor=color.blue)
table.cell(sigTable, 0, 1, signalBias, text_color=color.white, bgcolor=biasColor)
table.cell(sigTable, 1, 0, "ATR", text_color=color.white, bgcolor=color.blue)
table.cell(sigTable, 1, 1, signalATR, text_color=color.white)
table.cell(sigTable, 2, 0, "VWAP", text_color=color.white, bgcolor=color.blue)
table.cell(sigTable, 2, 1, signalVWAP, text_color=color.white)
//------------------- HIGHER TF STRUCTURE -------------------//
= request.security(syminfo.tickerid, tfHigher, )
plot(hiHigh, "Higher TF High", color=color.new(color.fuchsia, 70))
plot(hiLow, "Higher TF Low", color=color.new(color.aqua, 70))
Structure From StartIndicator for TradingView that plots “EXTREME” market structure based on body-close breaks of the protected extreme.
Updates the protected level only at the first opposite swing after a bias change.
Displays a single line colored by the current bias (green = long, red = short).
Includes options for tick buffer, cooldown, and minimum swing distance to filter noise.
Fibs Has Lied 🌟 Fibs Has Lied - Indicator Overview 🌟
Designed for indices like US30, NQ, and SPX, this indicator highlights setups where price interacts with key EMA levels during specific trading sessions (default: 6:30–11:30 AM EST).
🌟 Key Features & Levels 🌟
🔹EMA Crossover Setups
The indicator uses the 100-period and 200-period EMAs to identify bullish and bearish setups:
- Bullish Setup: Triggers when the 100 EMA crosses above the 200 EMA, followed by two consecutive candles opening above the 100 EMA, with the low within a specified point distance (e.g., 20 points for US30).
- Bearish Setup: Triggers when the 100 EMA crosses below the 200 EMA, followed by two consecutive candles opening below the 100 EMA, with the high within the point distance.
- Signals are marked with green (buy) or red (sell) triangles and text, ensuring you don’t miss a setup. 📈
🔹 Reset Conditions for Re-Entries
After an initial setup, the indicator watches for “reset” opportunities:
- Buy Reset: If price moves below the 200 EMA after a bullish crossover, then returns with two consecutive candles where lows are above the 100 EMA (within point distance), a new buy signal is plotted.
- Sell Reset: If price moves above the 200 EMA after a bearish crossover, then returns with two consecutive candles where highs are below the 100 EMA (within point distance), a new sell signal is plotted.
This feature captures additional entries after liquidity grabs or fakeouts, aligning with ICT’s manipulation concepts. 🔄
🔹 Session-Based Filtering
Focus your trades during high-liquidity windows! The default session (6:30–11:30 AM EST, New York timezone) targets the London/NY overlap, where price often seeks liquidity or sets up for reversals. Toggle the time filter off for 24/7 signals if desired. 🕒
🔹Symbol-Specific Point Distance
Customizable entry zones based on your chosen index:
- US30: 20 points from the 100 EMA.
- NQ: 3 points from the 100 EMA.
- SPX: 2.5 points from the 100 EMA.
This ensures setups are tailored to the volatility of your market, maximizing relevance. 🎯
🔹 Market Structure Markers (Optional)
Visualize swing points with pivot-based labels:
- HH (Higher High): Signals uptrend continuation.
- HL (Higher Low): Indicates potential bullish support.
- LH (Lower High): Suggests weakening uptrend or reversal.
- LL (Lower Low): Points to downtrend continuation.
- Toggle these on/off to keep your chart clean while analyzing trend direction. 📊
🔹 EMA Visualization
Optionally plot the 100 EMA (blue) and 200 EMA (red) to see key levels where price reacts. These act as dynamic support/resistance, perfect for spotting liquidity pools or ICT’s Power of 3 setups. ⚖️
🌟 Customization Options 🌟
- Symbol Selection: Choose US30, NQ, or SPX to adjust point distance for entries.
- Time Filter: Enable/disable the 6:30–11:30 AM EST session to focus on high-liquidity periods.
- EMA Display: Toggle 100/200 EMAs on/off to reduce chart clutter.
- Market Structure: Show/hide HH/HL/LH/LL labels for cleaner analysis.
- Signal Markers: Green (buy) and red (sell) triangles with text are auto-plotted for easy identification.
🌟 Usage Tips 🌟
- Best Timeframes: Use on 3m for intraday scalping and 30m for swing trades.
- Combine with ICT Tools: Pair with order blocks, fair value gaps, or kill zones for stronger setups.
- Focus on Session: The default 6:30–11:30 AM EST session captures London/NY volatility—perfect for liquidity-driven moves.
- Avoid Overcrowding: Disable market structure or EMAs if you only want setup signals.
Support Resistance Channels [Mark804]Support Resistance Channels (by Mark804) is a powerful, open-source Pine Script indicator on TradingView that automatically identifies, ranks, and visualizes dynamic support and resistance zones using swing pivots and adaptive channels.
Key Features
Dynamic Pivot Detection – The script identifies swing-highs and swing-lows (pivots) as the foundation for each S/R channel.
Strength-Based Channel Ranking – Constructs channels within dynamic widths, calculates each channel’s strength, and prioritizes the strongest.
Smart Chart Maintenance – Clears or adjusts outdated channels to maintain a clean and focused chart display.
Breakout Alerts – Sends alerts and plots visual markers when price breaks through a support or resistance channel.
Full Customization – Offers inputs for pivot period, source (High/Low or Close/Open), maximum channel width (based on the latest 300 bars), number of channels to display, loopback period, display scope (bars/displays), start date, colors/transparency, and alert toggles.
Why Choose This Indicator?
Automates S/R Level Generation – No more manual drawing—get accurate pivots and channels with minimal setup.
Relevance-Weighted Zones – Only the most impactful support and resistance levels are displayed, reducing clutter.
Responsive Checkout – Alerts and visuals ensure you never miss a key breakout or channel breach.
Fully Customizable Design – Adapt every level of analysis—from calculation logic to visual style and alert preferences.
Multi-Layer Volume Profile [Mark804]Multi-Layer Volume Profile – Advanced Volume-by-Price Analysis for Trading Precision
Multi-Layer Volume Profile is a powerful and free TradingView® Pine Script® indicator that offers a multi-horizon view of market volume dynamics. By stacking up to four distinct volume profiles—Full Period, Half-Length, Quarter-Length, and One-Eighth-Length—it enables traders to detect structural confluence across timeframes with ease and clarity
Key Features:
Layered Volume Breakdown: Each profile represents a different lookback duration. This layered approach helps identify overlapping patterns like POCs (Points of Control) across timescales—critical for spotting strong support/resistance levels.
Custom Bin Resolution: Offers adjustable bin granularity—from highly detailed (many bins) to smoother overview (fewer bins)—tailoring visual clarity to your strategy.
Precise POC Highlighting: The Point of Control—where trading volume peaks—is displayed as a thick blue line, serving as a focal anchor for trade decisions
Volume Labels & Delta: Each profile shows:
Total Volume: Cumulative trade volume for the profile range.
Delta Volume: Buyers minus sellers, indicating directional bias (positive = bullish, negative = bearish)
Range Boundaries: Clearly defined high and low price lines for each layer mark zones of potential price reaction, acting as dynamic support/resistance levels
Suggested Use Cases:
Identify Acceptance Zones: Dense, “thick” volume areas where the market reached consensus—ideal for building positions or entries
Spot Rejection Areas: Sparse volume bands that often signal price will be rejected—excellent for stop placements or breakout entries
Delta Confirmation: Use volume delta to confirm the strength and direction of potential breakouts or reversals
Multi-Timeframe Confluence: Overlapping POC levels across layers highlight robust zones of support/resistance, enhancing confidence in trade setups