Indicatori e strategie
SPY-ES & QQQ-NQ Live Ratiothis shows the live ratios of SPY and QQQs o you can easily convert them into ES and NQ levels
شموع انعكاسيةReversal Candlestick Patterns Indicator
This custom TradingView indicator identifies key reversal candlestick patterns on the chart, including Bullish Engulfing, Bearish Engulfing, Hammer, and Shooting Star. It highlights these patterns with distinct chart symbols, helping traders spot potential trend reversal points quickly and visually. Suitable for all timeframes and markets.
Volumetric Compressed MAVCMA uses the compressor and weighted stdev functions originally translated to pine by @gorx1. Compressor is usually used in audio to avoid clipping of certain frequencies. The original idea is actually pretty simple:
ma(simple string smt, float src, simple int len) =>
switch smt
'RMA' => ta.rma(src, len)
'SMA' => ta.sma(src, len)
'EMA' => ta.ema(src, len)
'WMA' => ta.wma(src, len)
'HMA' => ta.hma(src, len)
'LSMA' => ta.linreg(src, len, 0)
=> na
compressor(float in_1, simple int len, simple int thresh_dn_m, simple int thresh_up_m) =>
data = math.log(math.abs(in_1))
loc = ta.wma(data, len)
dev = wstdev(data, len)
thresh_dn = loc + dev * thresh_dn_m
thresh_up = loc + dev * thresh_up_m
math.exp(math.min(math.max(data, thresh_up), thresh_dn)) - math.exp(thresh_up)
compressed_out = compressor(volume, len_window, up_thresh, down_thresh)
comp_ma = ma(ma_type, close * compressed_out, len_ml) / ma(ma_type, compressed_out, len_ml)
vwma = ma(ma_type, close, len_window)
We get the ratio of the compressed volume calculation and plot it with the base MA. Base MA's length is determined by window size input compared to ML length that is used for compressed version.
This provides us another possible confirmation indicator that can be used to take advantage of volume ranges. Autmated crossover alerts are also added. A reminder is that this kind of indicators should not be used on it's own for trading but rather should be used as a confirmation along with your trend detection and main entry indicators to provide additional confluence.
Range Breakout [sgbpulse]Range Breakout
1. Overview
The "Range Breakout " indicator is a powerful tool designed to identify and visually display price ranges on your chart using pivot points. It dynamically draws two distinct boxes – an External Range and an Internal Range – helping traders pinpoint potential support and resistance zones. Beyond its visual representation, the indicator offers a comprehensive set of 12 unique breakout alerts, providing real-time notifications for significant price movements outside these defined ranges. Additionally, it integrates RSI and MFI metrics for momentum confirmation.
2. How It Works
The indicator operates by identifying pivot points based on user-defined "left" and "right" bar lengths. A high pivot is a bar with a specified number of lower highs both to its left and right, and similarly for a low pivot.
External Range: Calculated using longer pivot lengths (default: 15 bars left, 6 bars right). This range represents broader, more significant price consolidation areas.
Internal Range: Calculated using shorter pivot lengths (default: 4 bars left, 3 bars right). This range captures tighter, more immediate price consolidations within the broader trend.
The External Range will always be greater than or equal to the Internal Range, as it's based on a wider historical context. Both ranges are displayed as transparent boxes on your chart, dynamically adjusting as new pivots are formed.
3. Key Features and Settings
Customizable Pivot Lengths:
External Range (Left/Right Bars): Adjust sensitivity for identifying the broader price range. Longer lengths lead to more stable, but less frequent, range updates.
Internal Range (Left/Right Bars): Adjust sensitivity for the tighter, more immediate price range.
Tool Tips: Minimum 6 bars for the External Range, and minimum 2 bars for the Internal Range.
Customizable Range Colors: Easily change the background colors of the External and Internal Range boxes to match your chart's aesthetic.
Dynamic Range Display: The indicator automatically updates the range boxes as new pivot highs and lows are formed, always presenting the most current valid ranges.
RSI / MFI Settings:
Timeframe Source: Select the timeframe for RSI and MFI calculation.
- Chart: Calculation based on the current chart timeframe.
- Daily: Always calculated based on the daily ("D") timeframe, even if the chart is on a lower timeframe.
RSI Length: Period length for RSI calculation (default: 14).
RSI Overbought Level: Overbought level for RSI (default: 70.0).
RSI Oversold Level: Oversold level for RSI (default: 30.0).
MFI Length: Period length for MFI calculation (default: 14).
MFI Overbought Level: Overbought level for MFI (default: 80.0).
MFI Oversold Level: Oversold level for MFI (default: 20.0).
4. Synergy of Ranges & Breakout Strength
The interaction between the External and Internal Ranges provides deep insights into price movement and breakout strength:
Immediate Direction: The movement of the Internal Range (up or down) indicates the short-term directional bias within the broader framework of the External Range.
Strength Confirmation: A breakout of the External Range, followed by a breakout of the Internal Range, confirms the strength of the move and increases confidence in the breakout.
Strong Momentum ("Leaving" Ranges Behind): When price breaks out with exceptionally strong momentum, it continues to move aggressively and does not immediately form new pivots. In such situations, the existing ranges (External and Internal) remain in place while the candles "leave them behind." A "Full Candle" breakout, where the entire candle moves past both ranges, indicates a particularly powerful and decisive move.
Momentum (RSI / MFI) as Confirmation:
- RSI (Relative Strength Index): Measures the speed and change of price movements. Extreme values (above 70 or below 30) indicate overbought/oversold conditions respectively, confirming strong momentum in a breakout.
- MFI (Money Flow Index): Similar to RSI but incorporates volume. Extreme values (above 80 or below 20) indicate strong money flow in/out, reinforcing breakout confirmation.
- Importance of Confirmation: If a breakout occurs but momentum indicators do not confirm it (for example, an upside breakout while RSI is declining), this could signal weakness in the move and the risk of a false breakout (Fakeout).
5. Visuals
The indicator provides clear visual representations on the chart:
Range Boxes:
Two dynamic boxes are drawn on the chart: one for the External Range and one for the Internal Range.
These boxes update continuously, displaying the current range boundaries based on the latest pivots. They provide an immediate visual indication of support and resistance levels.
RSI/MFI Status Labels:
Small text labels appear to the right of the current bar, vertically centered.
They display the status of RSI and MFI: RSI OB (Overbought), RSI OS (Oversold), MFI OB, MFI OS, along with the exact value.
Important: The labels remain on the chart as long as the condition holds (indicator is above/below the level), unlike alerts which mark a singular crossover event.
Plotting of Key Values:
The indicator plots six invisible series on the chart, primarily to allow the user to view the exact numerical values of:
- The upper and lower bounds of the External Range (External High, External Low).
- The upper and lower bounds of the Internal Range (Internal High, Internal Low).
- The calculated RSI and MFI values (RSI, MFI).
These values are accessible for viewing through TradingView's Data Window and also via the Status Line when hovering over the relevant candle. This enables more precise quantitative analysis of range levels and momentum.
6. Comprehensive Breakout Alerts
The "Range Breakout " indicator provides 12 distinct alert conditions for breakouts, allowing you to select the required level of confirmation for each alert. All alerts are triggered only upon a fully confirmed bar close (barstate.isconfirmed) to minimize false signals and ensure reliability.
All breakout alerts are configured to detect a Crossover/Crossunder of the levels, meaning a specific event where the price moves from one side of the range to the other.
External Range Breakout UP
- Close: Price closes above the External Range.
- Real Body: The entire "real body" of the candle (min of open/close prices) closes above the External Range.
- Full Candle: The entire candle (the lowest point of the candle) closes above the External Range.
External Range Breakout DOWN
- Close: Price closes below the External Range.
- Real Body: The entire "real body" of the candle (max of open/close prices) closes below the External Range.
- Full Candle: The entire candle (the highest point of the candle) closes below the External Range.
Internal Range Breakout UP
- Close: Price closes above the Internal Range.
- Real Body: The "real body" of the candle closes above the Internal Range.
- Full Candle: The entire candle closes above the Internal Range.
Internal Range Breakout DOWN
- Close: Price closes below the Internal Range.
- Real Body: The "real body" of the candle closes below the Internal Range.
- Full Candle: The entire candle closes below the Internal Range.
7. Ideal Use Cases
This indicator is ideal for traders who:
Want to clearly identify and monitor price consolidation zones.
Seek confirmation for breakout strategies across various timeframes.
Require reliable and automated alerts for potential entry or exit points based on range expansion.
8. Complementary Indicator
For even more comprehensive market analysis, we highly recommend using this indicator in conjunction with Market Structure Support & Resistance External/Internal & BoS .
This powerful complementary indicator automatically and accurately identifies significant support and resistance levels by locating high and low pivot points, as well as key Pre-Market High/Low levels. Its strength lies in its dynamic adaptability to any timeframe and asset, providing precise and relevant real-time levels while maintaining a clean chart. It also identifies Break of Structure (BoS) to signal potential trend changes or continuations.
Using both indicators together provides a robust framework for identifying defined ranges and potential trend shifts, enabling more informed trading decisions.
View Market Structure Support & Resistance External/Internal & BoS Indicator
9. Important Note: Trading Risk
This indicator is intended for educational and informational purposes only and does not constitute investment advice or a recommendation for trading in any form whatsoever.
Trading in financial markets involves significant risk of capital loss. It is important to remember that past performance is not indicative of future results. All trading decisions are your sole responsibility. Never trade with money you cannot afford to lose.
Vùng đỉnh đáy chính + Bob Volman (Dữ liệu H1)This indicator combines two powerful components into one tool designed for traders who rely on multi-timeframe structure and price action:
🔹 1. H1 Break-Based Swing Zone Detection
Identifies key swing highs and lows based on H1 "break candle" logic — where a candle closes beyond the wick of the previous candle.
When a previous high or low is broken, a new range is drawn and trend context is updated:
🟢 Uptrend = price breaks above key high → green range
🔴 Downtrend = price breaks below key low → red range
⚪ Neutral = no new break → white range
Key swing points are marked with minimal dot labels on the chart for quick structure recognition.
🔹 2. Bob Volman-Style EMAs & Engulfing Signals (from H1)
Applies EMA 15, 21, and 35 from the H1 timeframe to reflect market bias and volatility.
Highlights the area between EMA 15 and EMA 35 with a colored fill to visualize momentum:
Green = bullish bias
Red = bearish bias
Detects classic Bullish and Bearish Engulfing Candles on H1 and marks them with arrows:
🔽 Red arrow = bearish engulfing
🔼 Green arrow = bullish engulfing
Fibonacci 61.8 BUY or SELL (EMA-Filtered)This indicator helps identify Fibonacci-based Buy or Sell zones based on recent pivot highs/lows, but only when filtered by the EMA trend.
✅ Buy Zones: Only when price is above EMA
✅ Sell Zones: Only when price is below EMA
🟩 Draws a 61.8% Fibonacci retracement line
🟥 Adds a label with price value: BUY @ or SELL @
📏 All drawing is based on pivot structure (LL → LH for buy; HH → HL for sell)
📊 EMA Trend Filter
Only draws buy setups when price > EMA
Only draws sell setups when price < EMA
You can change the EMA length:
📈 How It Works – Step by Step
✅ BUY SETUP (LL → LH, only if price > EMA):
Detects pivot low → stores as prevLow
Detects pivot high after that → stores as prevHigh
Calculates Fib Level:
fibLevel = prevLow + (prevHigh - prevLow) * 0.618
Draws a green dashed line at that fib level
Adds a label to the right:
"BUY @ price"
🚫 SELL SETUP (HH → HL, only if price < EMA):
Detects pivot high → stores as prevHigh
Detects pivot low after that → stores as prevLow
Calculates Fib Level:
fibLevel = prevHigh - (prevHigh - prevLow) * 0.618
Draws a red dashed line at that fib level
Adds a label to the right:
"SELL @ price"
✅ Strengths
Simple yet powerful EMA + Fibonacci strategy
Visually clean: only one signal shown at a time
Customizable: style, color, width, offset, precision
Works well for trend continuation trades
⚠️ Limitations
Only shows latest setup, not historical signals
Does not show price breaking fib level or reacting to it
Assumes fixed 61.8% retracement—no multi-level analysis
Doesn't differentiate between minor and major pivots
📌 How to Trade It
🟢 BUY Example:
Price above EMA
Pivot Low → Pivot High → 61.8% level plotted
Wait for price to react at that level to go long
🔴 SELL Example:
Price below EMA
Pivot High → Pivot Low → 61.8% level plotted
Wait for price to react at that level to go short
PRO-ZLMA RSI MACD [XAUUSD]Effective Scalping Strategy for XAUUSDStrategy LogicZLMA to catch reversals early but smoothlyEMA 200 as a trend filter (confirms Long/Short more accurately)RSI filters overbought/oversold price areasMACD confirms momentumoptimize and analyze your indicator strategy — aiming for the highest profits across various time frames (1M, 5M, 30M, 1H, 4H, 1D) when trading XAU/USD:
High-Low Range % – poslední 2 periodyHere’s a ready-to-use **English description** for publishing your script on TradingView:
---
## 📈 **High-Low Range % – Last 2 Periods**
This indicator calculates and visualizes the **percentage range** between the **High and Low** of the last **two closed periods** (daily, weekly, or monthly – user selectable).
### 🔍 Features:
* Displays the **High–Low range in %** for each of the **two most recent completed candles**.
* **Highlights** the range label if it exceeds a user-defined threshold (e.g., 10%).
* Allows switching between **daily, weekly, or monthly** timeframe bases.
* User controls for:
* Range threshold
* Label color (normal and highlighted)
* Label text size
* Vertical label offset above the High
### ⚙️ Inputs:
* **Timeframe**: Select between `"D"`, `"W"`, or `"M"` to define the range period.
* **Threshold (%)**: If the range exceeds this value, the label changes color.
* **Highlight Color**: Color for ranges above the threshold.
* **Normal Color**: Color for ranges below the threshold.
* **Text Size**: Tiny → Huge label size.
* **Offset**: Distance in ticks to place the label above the period's High.
### 🖼 Visual Output:
* A label placed **just above the High** of the respective candle.
* High and Low levels of the selected period are plotted as horizontal lines.
* Only the **two most recent closed periods** are displayed to keep the chart clean.
---
Let me know if you'd also like a **screenshot description** or **tags** for publication (e.g., `volatility`, `range`, `BTC`, `weekly`, etc.).
Divergences HeatmapWhen the price is around a support or resistance zone, look for any divergences. Ignore any signals if the price is ranging.
Smart Price Divergence (MACD Filter) + EMA
Smart MACD Price Divergence + EMA
This indicator automatically spots price divergences filtered by MACD momentum and trend direction with EMA:
🔹 Finds regular bullish & bearish divergences
🔹 Filters signals using a simple EMA trend filter
🔹 Clear triangle labels on the chart
🔹 Ready-to-use alerts for your strategy
Use it to catch potential reversal points when the trend may be losing strength.
How it works
Bearish Divergence: Price makes a higher high above the EMA while MACD makes a lower high → possible reversal down.
Bullish Divergence: Price makes a lower low below the EMA while MACD makes a higher low → possible reversal up.
The EMA filter helps spot extreme areas where the trend may be overextended.
Signal colors
🔻 Red triangle — Bearish Price Divergence (potential short)
🔺 Green triangle — Bullish Price Divergence (potential long)
Works on any timeframe and market (crypto, forex, indices, stocks).
✅ Subscribe to my profile to get new useful Pine Script tools soon!
💡 Want a custom version?
I can build private Pine Script indicators & strategies tailored exactly for you — scalping signals, trend or reversal strategies, custom filters for crypto, forex, stocks, or any pairs you trade.
I can also improve or fix your existing scripts.
If you want a unique, high-quality and profitable tool — contact me anytime!
📩 Telegram 👉 t.me
VIX-Price Covariance MonitorThe VIX-Price Covariance Monitor is a statistical tool that measures the evolving relationship between a security's price and volatility indices such as the VIX (or VVIX).
It can give indication of potential market reversal, as typically, volatility and the VIX increase before markets turn red,
This indicator calculates the Pearson correlation coefficient using the formula:
ρ(X,Y) = cov(X,Y) / (σₓ × σᵧ)
Where:
ρ is the correlation coefficient
cov(X,Y) is the covariance between price and the volatility index
σₓ and σᵧ are the standard deviations of price and the volatility index
Enjoy!
Features
Dual Correlation Periods: Analyze both short-term and long-term correlation trends simultaneously
Adaptive Color Coding: Correlation strength is visually represented through color intensity
Market Condition Assessment: Automatic interpretation of correlation values into actionable market insights
Leading/Lagging Analysis: Optional time-shift analysis to detect predictive relationships
Detailed Information Panel: Real-time statistics including current correlation values, historical averages, and trading implications
Interpretation
Positive Correlation (Red): Typically bearish for price, as rising VIX correlates with falling markets. This is what traders should be looking for.
Negative Correlation (Green): Typically bullish for price, as falling VIX correlates with rising markets
How to use it
Apply the indicator to any chart to see its correlation with the default VIX index
Adjust the correlation length to match your trading timeframe (shorter for day trading, longer for swing trading)
Enable the secondary correlation period to compare different timeframes simultaneously
For advanced analysis, enable the Leading/Lagging feature to detect if VIX changes precede or follow price movements
Use the information panel to quickly assess the current market condition and potential trading implications
Asia Session Range Checker//@version=5
indicator("Asia Session Range Checker", overlay=true)
// Define session times in London timezone
asiaStart = timestamp("Europe/London", year(timenow), month(timenow), dayofmonth(timenow), 00, 00)
asiaEnd = timestamp("Europe/London", year(timenow), month(timenow), dayofmonth(timenow), 08, 00)
inAsiaSession = (time >= asiaStart and time <= asiaEnd)
// Variables to track high/low of Asia session
var float asiaHigh = na
var float asiaLow = na
var float asiaRangePercent = na
var bool newDay = false
// Reset daily at the start of a new session
if (not inAsiaSession)
newDay := true
else
if (newDay)
asiaHigh := high
asiaLow := low
newDay := false
else
asiaHigh := math.max(asiaHigh, high)
asiaLow := math.min(asiaLow, low)
// Calculate % range after session ends
if (not inAsiaSession and not na(asiaHigh) and not na(asiaLow))
asiaRangePercent := (asiaHigh - asiaLow) / asiaLow * 100
// Show background for Asian session
bgcolor(inAsiaSession ? color.new(color.blue, 85) : na)
// Plot session high/low
plot(inAsiaSession ? asiaHigh : na, "Asia High", color=color.green, linewidth=1)
plot(inAsiaSession ? asiaLow : na, "Asia Low", color=color.red, linewidth=1)
// Show label with % range when session ends
if (not inAsiaSession and not na(asiaRangePercent) and bar_index % 50 == 0)
label.new(x=bar_index, y=high,
text="Asia Range: " + str.tostring(asiaRangePercent, "#.##") + "%",
style=label.style_label_down,
color=asiaRangePercent > 2 ? color.red : color.green,
textcolor=color.white,
size=size.small)
Simple ## User Guide for the Simple
I. Indicator Philosophy
This indicator is not a simple system that provides only one type of signal. It is an advanced tool that analyzes the market using three independent "engines," each specializing in detecting a different type of trading opportunity. Its goal is to identify high-probability setups by filtering out market noise.
II. Legend – What You See on the Chart
Before we proceed to the signals, you need to understand what each visual element represents:
Orange Line (200 EMA): This is the main, long-term trend indicator. It acts like a river – if the price flows above it, we look for buying opportunities (LONG). If it's below, we look for selling opportunities (SHORT).
The Ribbon (green/red): Represents short-term momentum and acts as a dynamic support/resistance zone. A green ribbon suggests buying strength, while a red one suggests selling pressure.
Kijun-sen Line (blue/red): This is the medium-term "center of gravity" of the market. It shows the price equilibrium. Its position relative to the price and the ribbon is crucial for many signals.
Gray Background: This is a "NO-TRADE ZONE." It appears when the ADX indicator shows that the market is in consolidation and lacks a clear trend. Most signals are ignored in these areas.
## III. The Three Signal Engines – When to Consider a Position
The indicator generates three different types of signals, each with its own characteristics and risk profile.
1. LONG / SHORT Labels (The Pullback Engine - Conservative)
Character: Safe, conservative, trend-following. Appears the least frequently.
How it works: It looks for ideal, "textbook" conditions. For a LONG signal, all indicators must be in full alignment (price > ribbon > Kijun > orange line), the trend must be strong (high ADX), AND the price must make a pullback to the ribbon and then bounce off it.
When to consider a position: When you see this signal, you are entering a well-developed, healthy trend. It's a high-probability entry, but often not at the very beginning of the move. Ideal for traders who value safety.
2. 🔵 / 🟣 Circles (The Squeeze Engine - Moderate)
Character: Moderately aggressive, looks for the beginning of a new, dynamic move.
How it works: It searches for periods of consolidation and low volatility (when the market is "gathering energy"). The signal (a circle) appears at the moment the price breaks out of this consolidation, and the direction of the breakout is confirmed by the Kijun-sen line.
When to consider a position: When you see the price has been moving sideways for a while, and then a circle appears. This is a sign that the consolidation phase has likely ended and a new impulse is beginning. Ideal for catching "fresh" moves.
3. ⚡ Lightning Bolt (The Reversal Engine - Aggressive)
Character: Aggressive, contrarian, attempts to catch sharp reversals. This is the riskiest signal.
How it works: It ignores most of the trend filters. Its sole purpose is to find a moment where the price, after a sharp and overextended move in one direction, suddenly reverses on a strong candle with high volume.
When to consider a position: When you want to take a risk to catch the very bottom (V-bottom) or top (V-top). This signal requires the most experience. It is recommended to only take it when it appears near a significant, horizontal support or resistance level. Never take it "in a vacuum."
IV. Summary and Practical Strategy
Signal
Signal Type
Character
Ideal Market Conditions
LONG/SHORT
Pullback Entry
Conservative
A strong, developed, and healthy trend.
🔵/🟣
Squeeze Breakout
Moderate
The end of a sideways move, the beginning of a new impulse.
⚡
Sharp Reversal
Aggressive
Market panic, oversold/overbought conditions at a key S/R level.
Eksportuj do Arkuszy
Price Action Concepts [StratifyTrade]// This work is licensed under a Attribution-NonCommercial-ShareAlike 4.0 International (CC BY-NC-SA 4.0) creativecommons.org
// © StratifyTrade - formerly know as HunterAlgos
//@version=5
indicator("Price Action Concepts ", shorttitle = "Price Action Concepts ", overlay = true, max_lines_count = 500, max_labels_count = 500, max_boxes_count = 500, max_bars_back = 500, max_polylines_count = 100)
//-----------------------------------------------------------------------------{
//Boolean set
//-----------------------------------------------------------------------------{
s_BOS = 0
s_CHoCH = 1
i_BOS = 2
i_CHoCH = 3
i_pp_CHoCH = 4
green_candle = 5
red_candle = 6
s_CHoCHP = 7
i_CHoCHP = 8
boolean =
array.from(
false
, false
, false
, false
, false
, false
, false
, false
, false
)
//-----------------------------------------------------------------------------{
// User inputs
//-----------------------------------------------------------------------------{
show_swing_ms = input.string ("All" , "Swing " , inline = "1", group = "MARKET STRUCTURE" , options = )
show_internal_ms = input.string ("All" , "Internal " , inline = "2", group = "MARKET STRUCTURE" , options = )
internal_r_lookback = input.int (5 , "" , inline = "2", group = "MARKET STRUCTURE" , minval = 2)
swing_r_lookback = input.int (50 , "" , inline = "1", group = "MARKET STRUCTURE" , minval = 2)
ms_mode = input.string ("Manual" , "Market Structure Mode" , inline = "a", group = "MARKET STRUCTURE" , tooltip = " Use selected lenght Use automatic lenght" ,options = )
show_mtf_str = input.bool (true , "MTF Scanner" , inline = "9", group = "MARKET STRUCTURE" , tooltip = "Display Multi-Timeframe Market Structure Trend Directions. Green = Bullish. Red = Bearish")
show_eql = input.bool (false , "Show EQH/EQL" , inline = "6", group = "MARKET STRUCTURE")
plotcandle_bool = input.bool (false , "Plotcandle" , inline = "3", group = "MARKET STRUCTURE" , tooltip = "Displays a cleaner colored candlestick chart in place of the default candles. (requires hiding the current ticker candles)")
barcolor_bool = input.bool (false , "Bar Color" , inline = "4", group = "MARKET STRUCTURE" , tooltip = "Color the candle bodies according to market strucutre trend")
i_ms_up_BOS = input.color (#089981 , "" , inline = "2", group = "MARKET STRUCTURE")
i_ms_dn_BOS = input.color (#f23645 , "" , inline = "2", group = "MARKET STRUCTURE")
s_ms_up_BOS = input.color (#089981 , "" , inline = "1", group = "MARKET STRUCTURE")
s_ms_dn_BOS = input.color (#f23645 , "" , inline = "1", group = "MARKET STRUCTURE")
lvl_daily = input.bool (false , "Day " , inline = "1", group = "HIGHS & LOWS MTF")
lvl_weekly = input.bool (false , "Week " , inline = "2", group = "HIGHS & LOWS MTF")
lvl_monthly = input.bool (false , "Month" , inline = "3", group = "HIGHS & LOWS MTF")
lvl_yearly = input.bool (false , "Year " , inline = "4", group = "HIGHS & LOWS MTF")
css_d = input.color (color.blue , "" , inline = "1", group = "HIGHS & LOWS MTF")
css_w = input.color (color.blue , "" , inline = "2", group = "HIGHS & LOWS MTF")
css_m = input.color (color.blue , "" , inline = "3", group = "HIGHS & LOWS MTF")
css_y = input.color (color.blue , "" , inline = "4", group = "HIGHS & LOWS MTF")
s_d = input.string ('⎯⎯⎯' , '' , inline = '1', group = 'HIGHS & LOWS MTF' , options = )
s_w = input.string ('⎯⎯⎯' , '' , inline = '2', group = 'HIGHS & LOWS MTF' , options = )
s_m = input.string ('⎯⎯⎯' , '' , inline = '3', group = 'HIGHS & LOWS MTF' , options = )
s_y = input.string ('⎯⎯⎯' , '' , inline = '4', group = 'HIGHS & LOWS MTF' , options = )
ob_show = input.bool (true , "Show Last " , inline = "1", group = "VOLUMETRIC ORDER BLOCKS" , tooltip = "Display volumetric order blocks on the chart Ammount of volumetric order blocks to show")
ob_num = input.int (5 , "" , inline = "1", group = "VOLUMETRIC ORDER BLOCKS" , tooltip = "Orderblocks number", minval = 1, maxval = 10)
ob_metrics_show = input.bool (true , "Internal Buy/Sell Activity" , inline = "2", group = "VOLUMETRIC ORDER BLOCKS" , tooltip = "Display volume metrics that have formed the orderblock")
css_metric_up = input.color (color.new(#089981, 50) , " " , inline = "2", group = "VOLUMETRIC ORDER BLOCKS")
css_metric_dn = input.color (color.new(#f23645 , 50) , "" , inline = "2", group = "VOLUMETRIC ORDER BLOCKS")
ob_swings = input.bool (false , "Swing Order Blocks" , inline = "a", group = "VOLUMETRIC ORDER BLOCKS" , tooltip = "Display swing volumetric order blocks")
css_swing_up = input.color (color.new(color.gray , 90) , " " , inline = "a", group = "VOLUMETRIC ORDER BLOCKS")
css_swing_dn = input.color (color.new(color.silver, 90) , "" , inline = "a", group = "VOLUMETRIC ORDER BLOCKS")
ob_filter = input.string ("None" , "Filtering " , inline = "d", group = "VOLUMETRIC ORDER BLOCKS" , tooltip = "Filter out volumetric order blocks by BOS/CHoCH/CHoCH+", options = )
ob_mitigation = input.string ("Absolute" , "Mitigation " , inline = "4", group = "VOLUMETRIC ORDER BLOCKS" , tooltip = "Trigger to remove volumetric order blocks", options = )
ob_pos = input.string ("Precise" , "Positioning " , inline = "k", group = "VOLUMETRIC ORDER BLOCKS" , tooltip = "Position of the Order Block Cover the whole candle Cover half candle Adjust to volatility Same as Accurate but more precise", options = )
use_grayscale = input.bool (false , "Grayscale" , inline = "6", group = "VOLUMETRIC ORDER BLOCKS" , tooltip = "Use gray as basic order blocks color")
use_show_metric = input.bool (true , "Show Metrics" , inline = "7", group = "VOLUMETRIC ORDER BLOCKS" , tooltip = "Show volume associated with the orderblock and his relevance")
use_middle_line = input.bool (true , "Show Middle-Line" , inline = "8", group = "VOLUMETRIC ORDER BLOCKS" , tooltip = "Show mid-line order blocks")
use_overlap = input.bool (true , "Hide Overlap" , inline = "9", group = "VOLUMETRIC ORDER BLOCKS" , tooltip = "Hide overlapping order blocks")
use_overlap_method = input.string ("Previous" , "Overlap Method " , inline = "Z", group = "VOLUMETRIC ORDER BLOCKS" , tooltip = " Preserve the most recent volumetric order blocks Preserve the previous volumetric order blocks", options = )
ob_bull_css = input.color (color.new(#089981 , 90) , "" , inline = "1", group = "VOLUMETRIC ORDER BLOCKS")
ob_bear_css = input.color (color.new(#f23645 , 90) , "" , inline = "1", group = "VOLUMETRIC ORDER BLOCKS")
show_acc_dist_zone = input.bool (false , "" , inline = "1", group = "Accumulation And Distribution")
zone_mode = input.string ("Fast" , "" , inline = "1", group = "Accumulation And Distribution" , tooltip = " Find small zone pattern formation Find bigger zone pattern formation" ,options = )
acc_css = input.color (color.new(#089981 , 60) , "" , inline = "1", group = "Accumulation And Distribution")
dist_css = input.color (color.new(#f23645 , 60) , "" , inline = "1", group = "Accumulation And Distribution")
show_lbl = input.bool (false , "Show swing point" , inline = "1", group = "High and Low" , tooltip = "Display swing point")
show_mtb = input.bool (false , "Show High/Low/Equilibrium" , inline = "2", group = "High and Low" , tooltip = "Display Strong/Weak High And Low and Equilibrium")
toplvl = input.color (color.red , "Premium Zone " , inline = "3", group = "High and Low")
midlvl = input.color (color.white , "Equilibrium Zone" , inline = "4", group = "High and Low")
btmlvl = input.color (#089981 , "Discount Zone " , inline = "5", group = "High and Low")
fvg_enable = input.bool (false , " " , inline = "1", group = "FAIR VALUE GAP" , tooltip = "Display fair value gap")
what_fvg = input.string ("FVG" , "" , inline = "1", group = "FAIR VALUE GAP" , tooltip = "Display fair value gap", options = )
fvg_num = input.int (5 , "Show Last " , inline = "1a", group = "FAIR VALUE GAP" , tooltip = "Number of fvg to show")
fvg_upcss = input.color (color.new(#089981, 80) , "" , inline = "1", group = "FAIR VALUE GAP")
fvg_dncss = input.color (color.new(color.red , 80) , "" , inline = "1", group = "FAIR VALUE GAP")
fvg_extend = input.int (10 , "Extend FVG" , inline = "2", group = "FAIR VALUE GAP" , tooltip = "Extend the display of the FVG.")
fvg_src = input.string ("Close" , "Mitigation " , inline = "3", group = "FAIR VALUE GAP" , tooltip = " Use the close of the body as trigger Use the extreme point of the body as trigger", options = )
fvg_tf = input.timeframe ("" , "Timeframe " , inline = "4", group = "FAIR VALUE GAP" , tooltip = "Timeframe of the fair value gap")
t = color.t (ob_bull_css)
invcol = color.new (color.white , 100)
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{ - UDT }
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{----------------------------------------------------------------------------------------------------------------------------------------------}
type bar
float o = open
float c = close
float h = high
float l = low
float v = volume
int n = bar_index
int t = time
type Zphl
line top
line bottom
label top_label
label bottom_label
bool stopcross
bool sbottomcross
bool itopcross
bool ibottomcross
string txtup
string txtdn
float topy
float bottomy
float topx
float bottomx
float tup
float tdn
int tupx
int tdnx
float itopy
float itopx
float ibottomy
float ibottomx
float uV
float dV
type FVG
box box
line ln
bool bull
float top
float btm
int left
int right
type ms
float p
int n
float l
type msDraw
int n
float p
color css
string txt
bool bull
type obC
float top
float btm
int left
float avg
float dV
float cV
int wM
int blVP
int brVP
int dir
float h
float l
int n
type obD
box ob
box eOB
box blB
box brB
line mL
type zone
chart.point points
float p
int c
int t
type hqlzone
box pbx
box ebx
box lbx
label plb
label elb
label lbl
type ehl
float pt
int t
float pb
int b
type pattern
string found = "None"
bool isfound = false
int period = 0
bool bull = false
type alerts
bool chochswing = false
bool chochplusswing = false
bool swingbos = false
bool chochplus = false
bool choch = false
bool bos = false
bool equal = false
bool ob = false
bool swingob = false
bool zone = false
bool fvg = false
bool obtouch = false
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{ - End }
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{ - General Setup }
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{----------------------------------------------------------------------------------------------------------------------------------------------}
bar b = bar.new()
var pattern p = pattern.new()
alerts blalert = alerts.new()
alerts bralert = alerts.new()
if p.isfound
p.period += 1
if p.period == 50
p.period := 0
p.found := "None"
p.isfound := false
p.bull := na
switch
b.c > b.o => boolean.set(green_candle, true)
b.c < b.o => boolean.set(red_candle , true)
f_zscore(src, lookback) =>
(src - ta.sma(src, lookback)) / ta.stdev(src, lookback)
var int iLen = internal_r_lookback
var int sLen = swing_r_lookback
vv = f_zscore(((close - close ) / close ) * 100,iLen)
if ms_mode == "Dynamic"
switch
vv >= 1.5 or vv <= -1.5 => iLen := 10
vv >= 1.6 or vv <= -1.6 => iLen := 9
vv >= 1.7 or vv <= -1.7 => iLen := 8
vv >= 1.8 or vv <= -1.8 => iLen := 7
vv >= 1.9 or vv <= -1.9 => iLen := 6
vv >= 2.0 or vv <= -2.0 => iLen := 5
=> iLen
var msline = array.new(0)
iH = ta.pivothigh(high, iLen, iLen)
sH = ta.pivothigh(high, sLen, sLen)
iL = ta.pivotlow (low , iLen, iLen)
sL = ta.pivotlow (low , sLen, sLen)
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{ - End }
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{ - ARRAYS }
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{----------------------------------------------------------------------------------------------------------------------------------------------}
hl () =>
= request.security(syminfo.tickerid , 'D' , hl() , lookahead = barmerge.lookahead_on)
= request.security(syminfo.tickerid , 'W' , hl() , lookahead = barmerge.lookahead_on)
= request.security(syminfo.tickerid , 'M' , hl() , lookahead = barmerge.lookahead_on)
= request.security(syminfo.tickerid , '12M', hl() , lookahead = barmerge.lookahead_on)
lstyle(style) =>
out = switch style
'⎯⎯⎯' => line.style_solid
'----' => line.style_dashed
'····' => line.style_dotted
mtfphl(h, l ,tf ,css, pdhl_style) =>
var line hl = line.new(
na
, na
, na
, na
, xloc = xloc.bar_time
, color = css
, style = lstyle(pdhl_style)
)
var line ll = line.new(
na
, na
, na
, na
, xloc = xloc.bar_time
, color = css
, style = lstyle(pdhl_style)
)
var label lbl = label.new(
na
, na
, xloc = xloc.bar_time
, text = str.format('P{0}L', tf)
, color = invcol
, textcolor = css
, size = size.small
, style = label.style_label_left
)
var label hlb = label.new(
na
, na
, xloc = xloc.bar_time
, text = str.format('P{0}H', tf)
, color = invcol
, textcolor = css
, size = size.small
, style = label.style_label_left
)
hy = ta.valuewhen(h != h , h , 1)
hx = ta.valuewhen(h == high , time , 1)
ly = ta.valuewhen(l != l , l , 1)
lx = ta.valuewhen(l == low , time , 1)
if barstate.islast
extension = time + (time - time ) * 50
line.set_xy1(hl , hx , hy)
line.set_xy2(hl , extension , hy)
label.set_xy(hlb, extension , hy)
line.set_xy1(ll , lx , ly)
line.set_xy2(ll , extension , ly)
label.set_xy(lbl, extension , ly)
if lvl_daily
mtfphl(pdh , pdl , 'D' , css_d, s_d)
if lvl_weekly
mtfphl(pwh , pwl , 'W' , css_w, s_w)
if lvl_monthly
mtfphl(pmh , pml, 'M' , css_m, s_m)
if lvl_yearly
mtfphl(pyh , pyl , '12M', css_y, s_y)
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{ - End }
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{ - Market Structure }
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{----------------------------------------------------------------------------------------------------------------------------------------------}
method darkcss(color css, float factor, bool bull) =>
blue = color.b(css) * (1 - factor)
red = color.r(css) * (1 - factor)
green = color.g(css) * (1 - factor)
color.rgb(red, green, blue, 0)
method f_line(msDraw d, size, style) =>
var line id = na
var label lbl = na
id := line.new(
d.n
, d.p
, b.n
, d.p
, color = d.css
, width = 1
, style = style
)
if msline.size() >= 250
line.delete(msline.shift())
msline.push(id)
lbl := label.new(
int(math.avg(d.n, b.n))
, d.p
, d.txt
, color = invcol
, textcolor = d.css
, style = d.bull ? label.style_label_down : label.style_label_up
, size = size
, text_font_family = font.family_monospace
)
structure(bool mtf) =>
msDraw drw = na
bool isdrw = false
bool isdrwS = false
var color css = na
var color icss = na
var int itrend = 0
var int trend = 0
bool bull_ob = false
bool bear_ob = false
bool s_bull_ob = false
bool s_bear_ob = false
n = bar_index
var ms up = ms.new(
array.new()
, array.new< int >()
, array.new()
)
var ms dn = ms.new(
array.new()
, array.new< int >()
, array.new()
)
var ms sup = ms.new(
array.new()
, array.new< int >()
, array.new()
)
var ms sdn = ms.new(
array.new()
, array.new< int >()
, array.new()
)
switch show_swing_ms
"All" => boolean.set(s_BOS , true ), boolean.set(s_CHoCH, true ) , boolean.set(s_CHoCHP, true )
"CHoCH" => boolean.set(s_BOS , false), boolean.set(s_CHoCH, true ) , boolean.set(s_CHoCHP, false )
"CHoCH+" => boolean.set(s_BOS , false), boolean.set(s_CHoCH, false) , boolean.set(s_CHoCHP, true )
"BOS" => boolean.set(s_BOS , true ), boolean.set(s_CHoCH, false) , boolean.set(s_CHoCHP, false )
"None" => boolean.set(s_BOS , false), boolean.set(s_CHoCH, false) , boolean.set(s_CHoCHP, false )
=> na
switch show_internal_ms
"All" => boolean.set(i_BOS, true ), boolean.set(i_CHoCH, true ), boolean.set(i_CHoCHP, true )
"CHoCH" => boolean.set(i_BOS, false), boolean.set(i_CHoCH, true ), boolean.set(i_CHoCHP, false)
"CHoCH+" => boolean.set(i_BOS, false), boolean.set(i_CHoCH, false ), boolean.set(i_CHoCHP, true )
"BOS" => boolean.set(i_BOS, true ), boolean.set(i_CHoCH, false ), boolean.set(i_CHoCHP, false)
"None" => boolean.set(i_BOS, false), boolean.set(i_CHoCH, false ), boolean.set(i_CHoCHP, false)
=> na
switch
iH =>
up.p.unshift(b.h )
up.l.unshift(b.h )
up.n.unshift(n )
iL =>
dn.p.unshift(b.l )
dn.l.unshift(b.l )
dn.n.unshift(n )
sL =>
sdn.p.unshift(b.l )
sdn.l.unshift(b.l )
sdn.n.unshift(n )
sH =>
sup.p.unshift(b.h )
sup.l.unshift(b.h )
sup.n.unshift(n )
// INTERNAL BULLISH STRUCTURE
if up.p.size() > 0 and dn.l.size() > 1
if ta.crossover(b.c, up.p.first())
bool CHoCH = na
string txt = na
if itrend < 0
CHoCH := true
switch
not CHoCH =>
txt := "BOS"
css := i_ms_up_BOS
blalert.bos := true
if boolean.get(i_BOS) and mtf == false and na(drw)
isdrw := true
drw := msDraw.new(
up.n.first()
, up.p.first()
, i_ms_up_BOS
, txt
, true
)
CHoCH =>
dn.l.first() > dn.l.get(1) ? blalert.chochplus : blalert.choch
txt := dn.l.first() > dn.l.get(1) ? "CHoCH+" : "CHoCH"
css := i_ms_up_BOS.darkcss(0.25, true)
if (dn.l.first() > dn.l.get(1) ? boolean.get(i_CHoCHP) : boolean.get(i_CHoCH)) and mtf == false and na(drw)
isdrw := true
drw := msDraw.new(
up.n.first()
, up.p.first()
, i_ms_up_BOS.darkcss(0.25, true)
, txt
, true
)
if mtf == false
switch
ob_filter == "None" => bull_ob := true
ob_filter == "BOS" and txt == "BOS" => bull_ob := true
ob_filter == "CHoCH" and txt == "CHoCH" => bull_ob := true
ob_filter == "CHoCH+" and txt == "CHoCH+" => bull_ob := true
itrend := 1
up.n.clear()
up.p.clear()
// INTERNAL BEARISH STRUCTURE
if dn.p.size() > 0 and up.l.size() > 1
if ta.crossunder(b.c, dn.p.first())
bool CHoCH = na
string txt = na
if itrend > 0
CHoCH := true
switch
not CHoCH =>
bralert.bos := true
txt := "BOS"
css := i_ms_dn_BOS
if boolean.get(i_BOS) and mtf == false and na(drw)
isdrw := true
drw := msDraw.new(
dn.n.first()
, dn.p.first()
, i_ms_dn_BOS
, txt
, false
)
CHoCH =>
if up.l.first() < up.l.get(1)
bralert.chochplus := true
else
bralert.choch := true
txt := up.l.first() < up.l.get(1) ? "CHoCH+" : "CHoCH"
css := i_ms_dn_BOS.darkcss(0.25, false)
if (up.l.first() < up.l.get(1) ? boolean.get(i_CHoCHP) : boolean.get(i_CHoCH)) and mtf == false and na(drw)
isdrw := true
drw := msDraw.new(
dn.n.first()
, dn.p.first()
, i_ms_dn_BOS.darkcss(0.25, false)
, txt
, false
)
if mtf == false
switch
ob_filter == "None" => bear_ob := true
ob_filter == "BOS" and txt == "BOS" => bear_ob := true
ob_filter == "CHoCH" and txt == "CHoCH" => bear_ob := true
ob_filter == "CHoCH+" and txt == "CHoCH+" => bear_ob := true
itrend := -1
dn.n.clear()
dn.p.clear()
// SWING BULLISH STRUCTURE
if sup.p.size() > 0 and sdn.l.size() > 1
if ta.crossover(b.c, sup.p.first())
bool CHoCH = na
string txt = na
if trend < 0
CHoCH := true
switch
not CHoCH =>
blalert.swingbos := true
txt := "BOS"
icss := s_ms_up_BOS
if boolean.get(s_BOS) and mtf == false and na(drw)
isdrwS := true
drw := msDraw.new(
sup.n.first()
, sup.p.first()
, s_ms_up_BOS
, txt
, true
)
CHoCH =>
if sdn.l.first() > sdn.l.get(1)
blalert.chochplusswing := true
else
blalert.chochswing := true
txt := sdn.l.first() > sdn.l.get(1) ? "CHoCH+" : "CHoCH"
icss := s_ms_up_BOS.darkcss(0.25, true)
if (sdn.l.first() > sdn.l.get(1) ? boolean.get(s_CHoCHP) : boolean.get(s_CHoCH)) and mtf == false and na(drw)
isdrwS := true
drw := msDraw.new(
sup.n.first()
, sup.p.first()
, s_ms_up_BOS.darkcss(0.25, true)
, txt
, true
)
if mtf == false
switch
ob_filter == "None" => s_bull_ob := true
ob_filter == "BOS" and txt == "BOS" => s_bull_ob := true
ob_filter == "CHoCH" and txt == "CHoCH" => s_bull_ob := true
ob_filter == "CHoCH+" and txt == "CHoCH+" => s_bull_ob := true
trend := 1
sup.n.clear()
sup.p.clear()
// SWING BEARISH STRUCTURE
if sdn.p.size() > 0 and sup.l.size() > 1
if ta.crossunder(b.c, sdn.p.first())
bool CHoCH = na
string txt = na
if trend > 0
CHoCH := true
switch
not CHoCH =>
bralert.swingbos := true
txt := "BOS"
icss := s_ms_dn_BOS
if boolean.get(s_BOS) and mtf == false and na(drw)
isdrwS := true
drw := msDraw.new(
sdn.n.first()
, sdn.p.first()
, s_ms_dn_BOS
, txt
, false
)
CHoCH =>
if sup.l.first() < sup.l.get(1)
bralert.chochplusswing := true
else
bralert.chochswing := true
txt := sup.l.first() < sup.l.get(1) ? "CHoCH+" : "CHoCH"
icss := s_ms_dn_BOS.darkcss(0.25, false)
if (sup.l.first() < sup.l.get(1) ? boolean.get(s_CHoCHP) : boolean.get(s_CHoCH)) and mtf == false and na(drw)
isdrwS := true
drw := msDraw.new(
sdn.n.first()
, sdn.p.first()
, s_ms_dn_BOS.darkcss(0.25, false)
, txt
, false
)
if mtf == false
switch
ob_filter == "None" => s_bear_ob := true
ob_filter == "BOS" and txt == "BOS" => s_bear_ob := true
ob_filter == "CHoCH" and txt == "CHoCH" => s_bear_ob := true
ob_filter == "CHoCH+" and txt == "CHoCH+" => s_bear_ob := true
trend := -1
sdn.n.clear()
sdn.p.clear()
= structure(false)
if isdrw
f_line(drw, size.small, line.style_dashed)
if isdrwS
f_line(drw, size.small, line.style_solid)
= request.security("", "15" , structure(true))
= request.security("", "60" , structure(true))
= request.security("", "240" , structure(true))
= request.security("", "1440" , structure(true))
if show_mtf_str
var tab = table.new(position = position.top_right, columns = 10, rows = 10, bgcolor = na, frame_color = color.rgb(54, 58, 69, 0), frame_width = 1, border_color = color.rgb(54, 58, 69, 100), border_width = 1)
table.cell(tab, 0, 1, text = "15" , text_color = color.silver, text_halign = text.align_center, text_size = size.normal, bgcolor = chart.bg_color, text_font_family = font.family_monospace, width = 2)
table.cell(tab, 0, 2, text = "1H" , text_color = color.silver, text_halign = text.align_center, text_size = size.normal, bgcolor = chart.bg_color, text_font_family = font.family_monospace, width = 2)
table.cell(tab, 0, 3, text = "4H" , text_color = color.silver, text_halign = text.align_center, text_size = size.normal, bgcolor = chart.bg_color, text_font_family = font.family_monospace, width = 2)
table.cell(tab, 0, 4, text = "1D" , text_color = color.silver, text_halign = text.align_center, text_size = size.normal, bgcolor = chart.bg_color, text_font_family = font.family_monospace, width = 2)
table.cell(tab, 1, 1, text = itrend15 == 1 ? "BULLISH" : itrend15 == -1 ? "BEARISH" : na , text_halign = text.align_center, text_size = size.normal, text_color = itrend15 == 1 ? i_ms_up_BOS.darkcss(-0.25, true) : itrend15 == -1 ? i_ms_dn_BOS.darkcss(0.25, false) : color.gray, bgcolor = chart.bg_color, text_font_family = font.family_monospace)
table.cell(tab, 1, 2, text = itrend1H == 1 ? "BULLISH" : itrend1H == -1 ? "BEARISH" : na , text_halign = text.align_center, text_size = size.normal, text_color = itrend1H == 1 ? i_ms_up_BOS.darkcss(-0.25, true) : itrend1H == -1 ? i_ms_dn_BOS.darkcss(0.25, false) : color.gray, bgcolor = chart.bg_color, text_font_family = font.family_monospace)
table.cell(tab, 1, 3, text = itrend4H == 1 ? "BULLISH" : itrend4H == -1 ? "BEARISH" : na , text_halign = text.align_center, text_size = size.normal, text_color = itrend4H == 1 ? i_ms_up_BOS.darkcss(-0.25, true) : itrend4H == -1 ? i_ms_dn_BOS.darkcss(0.25, false) : color.gray, bgcolor = chart.bg_color, text_font_family = font.family_monospace)
table.cell(tab, 1, 4, text = itrend1D == 1 ? "BULLISH" : itrend1D == -1 ? "BEARISH" : na , text_halign = text.align_center, text_size = size.normal, text_color = itrend1D == 1 ? i_ms_up_BOS.darkcss(-0.25, true) : itrend1D == -1 ? i_ms_dn_BOS.darkcss(0.25, false) : color.gray, bgcolor = chart.bg_color, text_font_family = font.family_monospace)
table.cell(tab, 0, 5, text = "Detected Pattern", text_halign = text.align_center, text_size = size.normal, text_color = color.silver, bgcolor = chart.bg_color, text_font_family = font.family_monospace)
table.cell(tab, 0, 6, text = p.found, text_halign = text.align_center, text_size = size.normal, text_color = na(p.bull) ? color.white : p.bull ? i_ms_up_BOS.darkcss(-0.25, true) : p.bull == false ? i_ms_dn_BOS.darkcss(0.25, false) : na, bgcolor = chart.bg_color, text_font_family = font.family_monospace)
table.merge_cells(tab, 0, 5, 1, 5)
table.merge_cells(tab, 0, 6, 1, 6)
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{ - End }
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{ - Strong/Weak High/Low And Equilibrium }
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{----------------------------------------------------------------------------------------------------------------------------------------------}
var phl = Zphl.new(
na
, na
, label.new(na , na , color = invcol , textcolor = i_ms_dn_BOS , style = label.style_label_down , size = size.tiny , text = "")
, label.new(na , na , color = invcol , textcolor = i_ms_up_BOS , style = label.style_label_up , size = size.tiny , text = "")
, true
, true
, true
, true
, ""
, ""
, 0
, 0
, 0
, 0
, high
, low
, 0
, 0
, 0
, 0
, 0
, 0
, na
, na
)
zhl(len)=>
upper = ta.highest(len)
lower = ta.lowest(len)
var float out = 0
out := b.h > upper ? 0 : b.l < lower ? 1 : out
top = out == 0 and out != 0 ? b.h : 0
btm = out == 1 and out != 1 ? b.l : 0
= zhl(sLen)
= zhl(iLen)
upphl(trend) =>
var label lbl = label.new(
na
, na
, color = invcol
, textcolor = toplvl
, style = label.style_label_down
, size = size.small
)
if top
phl.stopcross := true
phl.txtup := top > phl.topy ? "HH" : "HL"
if show_lbl
topl = label.new(
b.n - swing_r_lookback
, top
, phl.txtup
, color = invcol
, textcolor = toplvl
, style = label.style_label_down
, size = size.small
)
line.delete(phl.top )
phl.top := line.new(
b.n - sLen
, top
, b.n
, top
, color = toplvl)
phl.topy := top
phl.topx := b.n - sLen
phl.tup := top
phl.tupx := b.n - sLen
if itop
phl.itopcross := true
phl.itopy := itop
phl.itopx := b.n - iLen
phl.tup := math.max(high, phl.tup)
phl.tupx := phl.tup == high ? b.n : phl.tupx
phl.uV := phl.tup != phl.tup ? b.v : phl.uV
if barstate.islast
line.set_xy1(
phl.top
, phl.tupx
, phl.tup
)
line.set_xy2(
phl.top
, b.n + 50
, phl.tup
)
label.set_x(
lbl
, b.n + 50
)
label.set_y(
lbl
, phl.tup
)
dist = math.abs(phl.uV / (phl.uV + phl.dV)) * 100
label.set_text (lbl, trend < 0
? "Strong High | " + str.tostring(phl.uV, format.volume) + " (" + str.tostring(math.round(dist,0)) + "%)"
: "Weak High | " + str.tostring(phl.uV, format.volume) + " (" + str.tostring(math.round(dist,0)) + "%)")
dnphl(trend) =>
var label lbl = label.new(
na
, na
, color = invcol
, textcolor = btmlvl
, style = label.style_label_up
, size = size.small
)
if btm
phl.sbottomcross := true
phl.txtdn := btm > phl.bottomy ? "LH" : "LL"
if show_lbl
btml = label.new(
b.n - swing_r_lookback
, btm, phl.txtdn
, color = invcol
, textcolor = btmlvl
, style = label.style_label_up
, size = size.small
)
line.delete(phl.bottom )
phl.bottom := line.new(
b.n - sLen
, btm
, b.n
, btm
, color = btmlvl
)
phl.bottomy := btm
phl.bottomx := b.n - sLen
phl.tdn := btm
phl.tdnx := b.n - sLen
if ibtm
phl.ibottomcross := true
phl.ibottomy := ibtm
phl.ibottomx := b.n - iLen
phl.tdn := math.min(low, phl.tdn)
phl.tdnx := phl.tdn == low ? b.n : phl.tdnx
phl.dV := phl.tdn != phl.tdn ? b.v : phl.dV
if barstate.islast
line.set_xy1(
phl.bottom
, phl.tdnx
, phl.tdn
)
line.set_xy2(
phl.bottom
, b.n + 50
, phl.tdn
)
label.set_x(
lbl
, b.n + 50
)
label.set_y(
lbl
, phl.tdn
)
dist = math.abs(phl.dV / (phl.uV + phl.dV)) * 100
label.set_text (lbl, trend > 0
? "Strong Low | " + str.tostring(phl.dV, format.volume) + " (" + str.tostring(math.round(dist,0)) + "%)"
: "Weak Low | " + str.tostring(phl.uV, format.volume) + " (" + str.tostring(math.round(dist,0)) + "%)")
midphl() =>
avg = math.avg(phl.bottom.get_y2(), phl.top.get_y2())
var line l = line.new(
y1 = avg
, y2 = avg
, x1 = b.n - sLen
, x2 = b.n + 50
, color = midlvl
, style = line.style_solid
)
var label lbl = label.new(
x = b.n + 50
, y = avg
, text = "Equilibrium"
, style = label.style_label_left
, color = invcol
, textcolor = midlvl
, size = size.small
)
if barstate.islast
more = (phl.bottom.get_x1() + phl.bottom.get_x2()) > (phl.top.get_x1() + phl.top.get_x2()) ? phl.top.get_x1() : phl.bottom.get_x1()
line.set_xy1(l , more , avg)
line.set_xy2(l , b.n + 50, avg)
label.set_x (lbl , b.n + 50 )
label.set_y (lbl , avg )
dist = math.abs((l.get_y2() - close) / close) * 100
label.set_text (lbl, "Equilibrium (" + str.tostring(math.round(dist,0)) + "%)")
hqlzone() =>
if barstate.islast
var hqlzone dZone = hqlzone.new(
box.new(
na
, na
, na
, na
, bgcolor = color.new(toplvl, 70)
, border_color = na
)
, box.new(
na
, na
, na
, na
, bgcolor = color.new(midlvl, 70)
, border_color = na
)
, box.new(
na
, na
, na
, na
, bgcolor = color.new(btmlvl, 70)
, border_color = na
)
, label.new(na, na, text = "Premium" , color = invcol, textcolor = toplvl, style = label.style_label_down, size = size.small)
, label.new(na, na, text = "Equilibrium", color = invcol, textcolor = midlvl, style = label.style_label_left, size = size.small)
, label.new(na, na, text = "Discount" , color = invcol, textcolor = btmlvl, style = label.style_label_up , size = size.small)
)
dZone.pbx.set_lefttop(int(math.max(phl.topx, phl.bottomx)) , phl.tup)
dZone.pbx.set_rightbottom(b.n + 50 , 0.95 * phl.tup + 0.05 * phl.tdn)
dZone.ebx.set_lefttop(int(math.max(phl.topx, phl.bottomx)), 0.525 * phl.tup + 0.475 * phl.tdn)
dZone.ebx.set_rightbottom(b.n + 50 , 0.525 * phl.tdn + 0.475 * phl.tup)
dZone.lbx.set_lefttop(int(math.max(phl.topx, phl.bottomx)), 0.95 * phl.tdn + 0.05 * phl.tup)
dZone.lbx.set_rightbottom(b.n + 50 , phl.tdn)
dZone.plb.set_xy( int(math.avg(math.max(phl.topx, phl.bottomx), int(b.n + 50))) , phl.tup)
dZone.elb.set_xy( int(b.n + 50) , math.avg(phl.tup, phl.tdn))
dZone.lbl.set_xy( int(math.avg(math.max(phl.topx, phl.bottomx), int(b.n + 50))) , phl.tdn)
if show_mtb
upphl (trend)
dnphl (trend)
hqlzone()
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{ - End }
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{ - Volumetric Order Block }
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{----------------------------------------------------------------------------------------------------------------------------------------------}
method eB(box b, bool ext, color css, bool swing) =>
b.unshift(
box.new(
na
, na
, na
, na
, xloc = xloc.bar_time
, text_font_family = font.family_monospace
, extend = ext ? extend.right : extend.none
, border_color = swing ? color.new(css, 0) : color.new(color.white,100)
, bgcolor = css
, border_width = 1
)
)
method eL(line l, bool ext, bool solid, color css) =>
l.unshift(
line.new(
na
, na
, na
, na
, width = 1
, color = css
, xloc = xloc.bar_time
, extend = ext ? extend.right : extend.none
, style = solid ? line.style_solid : line.style_dashed
)
)
method drawVOB(bool cdn, bool bull, color css, int loc, bool swing) =>
= request.security(
syminfo.tickerid
, ""
,
, lookahead = barmerge.lookahead_off
)
var obC obj = obC.new(
array.new()
, array.new()
, array.new< int >()
, array.new()
, array.new()
, array.new()
, array.new< int >()
, array.new< int >()
, array.new< int >()
, array.new< int >()
, array.new()
, array.new()
, array.new< int >()
)
var obD draw = obD.new(
array.new()
, array.new()
, array.new()
, array.new()
, array.new()
)
if barstate.isfirst
for i = 0 to ob_num - 1
draw.mL .eL(false, false, use_grayscale ? color.new(color.gray, 0) : color.new(css,0))
draw.ob .eB(false, use_grayscale ? color.new(color.gray, 90) : css, swing)
draw.blB.eB(false, css_metric_up , swing)
draw.brB.eB(false, css_metric_dn , swing)
draw.eOB.eB(true , use_grayscale ? color.new(color.gray, 90) : css, swing)
float pos = ob_pos == "Full"
? (bull ? high : low)
: ob_pos == "Middle"
? ohlc4
: ob_pos == "Accurate"
? hl2
: hl2
if cdn
obj.h.clear()
obj.l.clear()
obj.n.clear()
for i = 1 to math.abs((loc - b.n)) - 1
obj.h.push(hH )
obj.l.push(lL )
obj.n.push(b.t )
// obj.h.reverse()
// obj.l.reverse()
int iU = obj.l.indexof(obj.l.min()) + 1
int iD = obj.h.indexof(obj.h.max()) + 1
obj.dir.unshift(
bull
? (b.c > b.o ? 1 : -1)
: (b.c > b.o ? 1 : -1)
)
obj.top.unshift(
bull
? pos
: obj.h.max()
)
obj.btm.unshift(
bull
? obj.l.min()
: pos
)
obj.left.unshift(
bull
? obj.n.get(obj.l.indexof(obj.l.min()))
: obj.n.get(obj.h.indexof(obj.h.max()))
)
obj.avg.unshift(
math.avg(obj.top.first(), obj.btm.first())
)
obj.cV.unshift(
bull
? b.v
: b.v
)
if ob_pos == "Precise"
switch bull
true =>
if obj.avg.get(0) < (b.c < b.o ? b.c : b.o ) and obj.top.get(0) > hlcc4
obj.top.set(0, obj.avg.get(0))
obj.avg.set(0, math.avg(obj.top.first(), obj.btm.first()))
false =>
if obj.avg.get(0) > (b.c < b.o ? b.o : b.c ) and obj.btm.get(0) < hlcc4
obj.btm.set(0, obj.avg.get(0))
obj.avg.set(0, math.avg(obj.top.first(), obj.btm.first()))
obj.blVP.unshift ( 0 )
obj.brVP.unshift ( 0 )
obj.wM .unshift ( 1 )
if use_overlap
int rmP = use_overlap_method == "Recent" ? 1 : 0
if obj.avg.size() > 1
if bull
? obj.btm.first() < obj.top.get(1)
: obj.top.first() > obj.btm.get(1)
obj.wM .remove(rmP)
obj.cV .remove(rmP)
obj.dir .remove(rmP)
obj.top .remove(rmP)
obj.avg .remove(rmP)
obj.btm .remove(rmP)
obj.left .remove(rmP)
obj.blVP .remove(rmP)
obj.brVP .remove(rmP)
if barstate.isconfirmed
for x = 0 to ob_num - 1
tg = switch ob_mitigation
"Middle" => obj.avg
"Absolute" => bull ? obj.btm : obj.top
for in tg
if (bull ? cC < pt : cC > pt)
obj.wM .remove(idx)
obj.cV .remove(idx)
obj.dir .remove(idx)
obj.top .remove(idx)
obj.avg .remove(idx)
obj.btm .remove(idx)
obj.left .remove(idx)
obj.blVP .remove(idx)
obj.brVP .remove(idx)
if barstate.islast
if obj.avg.size() > 0
// Alert
if bull
? ta.crossunder(low , obj.top.get(0))
: ta.crossover (high, obj.btm.get(0))
switch bull
true => blalert.obtouch := true
false => bralert.obtouch := true
float tV = 0
obj.dV.clear()
seq = math.min(ob_num - 1, obj.avg.size() - 1)
for j = 0 to seq
tV += obj.cV.get(j)
if j == seq
for y = 0 to seq
obj.dV.unshift(
math.floor(
(obj.cV.get(y) / tV) * 100)
)
obj.dV.reverse()
for i = 0 to math.min(ob_num - 1, obj.avg.size() - 1)
dmL = draw.mL .get(i)
dOB = draw.ob .get(i)
dblB = draw.blB.get(i)
dbrB = draw.brB.get(i)
deOB = draw.eOB.get(i)
dOB.set_lefttop (obj.left .get(i) , obj.top.get(i))
deOB.set_lefttop (b.t , obj.top.get(i))
dOB.set_rightbottom (b.t , obj.btm.get(i))
deOB.set_rightbottom(b.t + (b.t - b.t ) * 100 , obj.btm.get(i))
if use_middle_line
dmL.set_xy1(obj.left.get(i), obj.avg.get(i))
dmL.set_xy2(b.t , obj.avg.get(i))
if ob_metrics_show
dblB.set_lefttop (obj.left.get(i), obj.top.get(i))
dbrB.set_lefttop (obj.left.get(i), obj.avg.get(i))
dblB.set_rightbottom(obj.left.get(i), obj.avg.get(i))
dbrB.set_rightbottom(obj.left.get(i), obj.btm.get(i))
rpBL = dblB.get_right()
rpBR = dbrB.get_right()
dbrB.set_right(rpBR + (b.t - b.t ) * obj.brVP.get(i))
dblB.set_right(rpBL + (b.t - b.t ) * obj.blVP.get(i))
if use_show_metric
txt = switch
obj.cV.get(i) >= 1000000000 => str.tostring(math.round(obj.cV.get(i) / 1000000000,3)) + "B"
obj.cV.get(i) >= 1000000 => str.tostring(math.round(obj.cV.get(i) / 1000000,3)) + "M"
obj.cV.get(i) >= 1000 => str.tostring(math.round(obj.cV.get(i) / 1000,3)) + "K"
obj.cV.get(i) < 1000 => str.tostring(math.round(obj.cV.get(i)))
deOB.set_text(
str.tostring(
txt + " (" + str.tostring(obj.dV.get(i)) + "%)")
)
deOB.set_text_size (size.auto)
deOB.set_text_halign(text.align_left)
deOB.set_text_color (use_grayscale ? color.silver : color.new(css, 0))
if ob_metrics_show and barstate.isconfirmed
if obj.wM.size() > 0
for i = 0 to obj.avg.size() - 1
switch obj.dir.get(i)
1 =>
switch obj.wM.get(i)
1 => obj.blVP.set(i, obj.blVP.get(i) + 1), obj.wM.set(i, 2)
2 => obj.blVP.set(i, obj.blVP.get(i) + 1), obj.wM.set(i, 3)
3 => obj.brVP.set(i, obj.brVP.get(i) + 1), obj.wM.set(i, 1)
-1 =>
switch obj.wM.get(i)
1 => obj.brVP.set(i, obj.brVP.get(i) + 1), obj.wM.set(i, 2)
2 => obj.brVP.set(i, obj.brVP.get(i) + 1), obj.wM.set(i, 3)
3 => obj.blVP.set(i, obj.blVP.get(i) + 1), obj.wM.set(i, 1)
var hN = array.new(1, b.n)
var lN = array.new(1, b.n)
var hS = array.new(1, b.n)
var lS = array.new(1, b.n)
if iH
hN.pop()
hN.unshift(int(b.n ))
if iL
lN.pop()
lN.unshift(int(b.n ))
if sH
hS.pop()
hS.unshift(int(b.n ))
if sL
lS.pop()
lS.unshift(int(b.n ))
if ob_show
bull_ob.drawVOB(true , ob_bull_css, hN.first(), false)
bear_ob.drawVOB(false, ob_bear_css, lN.first(), false)
if ob_swings
s_bull_ob.drawVOB(true , css_swing_up, hS.first(), true)
s_bear_ob.drawVOB(false, css_swing_dn, lS.first(), true)
if bull_ob
blalert.ob := true
if bear_ob
bralert.ob := true
if s_bull_ob
blalert.swingob := true
if s_bear_ob
blalert.swingob := true
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{ - End }
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{ - FVG | VI | OG }
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{----------------------------------------------------------------------------------------------------------------------------------------------}
ghl() => request.security(syminfo.tickerid, fvg_tf, [high , low , close , open ])
tfG() => request.security(syminfo.tickerid, fvg_tf, )
cG(bool bull) =>
= ghl()
= tfG()
var FVG draw = FVG.new(
array.new()
, array.new()
)
var FVG cords = array.new()
float pup = na
float pdn = na
bool cdn = na
int pos = 2
cc = timeframe.change(fvg_tf)
if barstate.isfirst
for i = 0 to fvg_num - 1
draw.box.unshift(box.new (na, na, na, na, border_color = color.new(color.white, 100), xloc = xloc.bar_time))
draw.ln.unshift (line.new(na, na, na, na, xloc = xloc.bar_time, width = 1, style = line.style_solid))
switch what_fvg
"FVG" =>
pup := bull ? gl : l
pdn := bull ? h : gh
cdn := bull ? gl > h and cc : gh < l and cc
pos := 2
"VI" =>
pup := bull
? (gc > go
? go
: gc)
: (gc > go
? go
: gc )
pdn := bull
? (gc > go
? gc
: go )
: (gc > go
? gc
: go)
cdn := bull
? go > gc and gh > gl and gc > gc and go > go and gh < math.min(gc, go) and cc
: go < gc and gl < gh and gc < gc and go < go and gl > math.max(gc, go) and cc
pos := 1
"OG" =>
pup := bull ? b.l : gl
pdn := bull ? gh : gh
cdn := bull ? gl > gh and cc : gh < gl and cc
pos := 1
if not na(cdn) and cdn
cords.unshift(
FVG.new(
na
, na
, bull
? true
: false
, pup
, pdn
, b.t - (b.t - b.t ) * pos
, b.t + (b.t - b.t ) * fvg_extend)
)
if bull
blalert.fvg := tru
Last xHL📈 Last xHL – Visualize Key Highs and Lows
This script highlights the most recent significant highs and lows over a user-defined period, helping traders quickly identify key support and resistance zones.
🔍 Features:
Highest High (HH) and Highest Close/Open (HC) lines
Lowest Low (LL) and Lowest Close/Open (LC) lines
Dynamic updates with each new bar
Gradient-filled zones between HH–HC and LL–LC for visual clarity
⚙️ Customization:
Adjustable lookback period (_length) to suit your trading style
Color-coded lines and fills for quick interpretation
🧠 Use Case:
This tool is ideal for traders who want to:
Spot potential breakout or reversal zones
Identify price compression or expansion areas
Enhance their technical analysis with visual cues
This script is for educational and informational purposes only. It does not constitute financial advice. Always do your own research before making trading decisions.
5 Min >2% Move with High Volume//@version=5
indicator("5 Min >2% Move with High Volume", overlay=true)
// Inputs
volumeMultiplier = input.float(1.5, "Volume Multiplier")
percentChangeTrigger = input.float(2.0, "Min % Move", step=0.1)
// Get today's open price
dayOpen = request.security(syminfo.tickerid, "D", open )
// Calculate % change from open
percentChange = 100 * (close - dayOpen) / dayOpen
// Volume vs average volume
avgVol = ta.sma(volume, 5)
volCondition = volume > avgVol * volumeMultiplier
// 5-minute time window: first candle after 9:15 AM (Indian markets)
inSession = (hour == 9 and minute == 20) // candle from 9:15 to 9:20
// Final condition: price move > 2% and high volume in first 5 min
screenerCondition = inSession and volCondition and math.abs(percentChange) > percentChangeTrigger
plotshape(screenerCondition, location=location.abovebar, style=shape.labelup, color=color.green, size=size.small, text=">2% + Vol")
alertcondition(screenerCondition, title="Screener Trigger", message="Stock moved >2% in first 5 mins with high volume")
Multi SMA AnalyzerMulti SMA Analyzer with Custom SMA Table & Advanced Session Logic
A feature-rich SMA analysis suite for traders, offering up to 7 configurable SMAs, in-depth trend detection, real-time table, and true session-aware calculations.
Ideal for those who want to combine intraday, swing, and higher-timeframe trend analysis with maximum chart flexibility.
Key Features
📊 Multi-SMA Overlay
- 7 SMAs (default: 5, 20, 50, 100, 200, 21, 34)—individually configurable (period, source, color, line style)
- Show/hide each SMA, custom line style (solid, stepline, circles), and color logic
- Dynamic color: full opacity above SMA, reduced when below
⏰ Session-Aware SMAs
- Each SMA can be calculated using only user-defined session hours/days/timezone
- “Ignore extended hours” option for accurate intraday trend
📋 Smart Data Table
- Live SMA values, % distance from price, and directional arrows (↑/↓/→)
- Bull/Bear/Sideways trend classification
- Custom table position, size, colors, transparency
- Table can run on chart or custom (higher) timeframe for multi-TF analysis
🎯 Golden/Death Cross Detection
- Flexible crossover engine: select any two from (5, 10, 20, 50, 100, 200) for fast/slow SMA cross signals
- Plots icons (★ Golden, 💀 Death), optional crossover labels with custom size/colors
🏷️ SMA Labels
- Optional on-chart SMA period labels
- Custom placement (above/below/on line), size, color, offset
🚨 Signal & Trend Engine
- Bull/Bear/Sideways logic: price vs. multiple SMAs (not just one pair)
- Volume spike detection (2x 20-period SMA)
- Bullish engulfing candlestick detection
- All signals can use chart or custom table timeframe
🎨 Visual Customization
- Dynamic background color (Bull: green, Bear: red, Neutral: gray)
- Every visual aspect is customizable: label/table colors, transparency, size, position
🔔 Built-in Alerts
- Crossovers (SMA20/50, Golden/Death)
- Bull trend, volume spikes, engulfing pattern—all alert-ready
How It Works
- Session Filtering:
- SMAs can be set to count only bars from your chosen market session, for true intraday/trading-hour signals
Dynamic Table & Signals:
- Table and all signal logic run on your selected chart or custom timeframe
Flexible Crossover:
- Choose any pair (5, 10, 20, 50, 100, 200) for cross detection—SMA 10 is available for crossover even if not shown as an SMA line
Everything is modular:
- Toggle features, set visuals, and alerts to your workflow
🚨 How to Use Alerts
- All key signals (crossovers, trend shifts, volume spikes, engulfing patterns) are available as alert conditions.
To enable:
- Click the “Alerts” (clock) icon at the top of TradingView.
- Select your desired signal (e.g., “Golden Cross”) from the condition dropdown.
- Set your alert preferences and create the alert.
- Now, you’ll get notified automatically whenever a signal occurs!
Perfect For
- Multi-timeframe and swing traders seeking higher timeframe SMA confirmation
- Intraday traders who want to ignore pre/post-market data
- Anyone wanting a modern, powerful, fully customizable multi-SMA overlay
// P.S: Experiment with Golden Cross where Fast SMA is 5 and Slow SMA is 20.
// Set custom timeframe for 4 hr while monitoring your chart on 15 min time frame.
// Enable Background Color and Use Table Timeframe for Background.
// Uncheck Pine labels in Style tab.
Clean, open-source, and loaded with pro features—enjoy!
Like, share, and let me know if you'd like any new features added.
MA Respect IndicatorThis indicator tells you how much a moving average is being respected.
Green = highly respected
Blue = watch out, transitioning
Red = not respected at all.
If you trade moving averages, you may find this very helpful with determining when and when not to trust a MA. This can be changed to look at a VWAP, and many other different MA calculation types.
FVG + RSI Sweep M15FVG + RSI Sweep M15 – Smart Liquidity Trading Indicator
This indicator is designed for high-probability intraday trading, optimized for the 15-minute timeframe (M15). It combines:
Fair Value Gap (FVG) detection – reveals price imbalance zones
RSI reversal signals – identifies overbought/oversold exhaustion
Liquidity sweep logic – confirms fakeouts beyond recent highs/lows
Time filter – focuses only on high-volume London & New York sessions
When all conditions align, it generates clean Buy/Sell signals, with automatic TP and SL levels based on risk–reward logic. Ideal for traders seeking 1–2 precise trades per day with minimal noise.
4 diffs (CB & IBIT Premium)📊 Script Name: 4 diffs (CB & IBIT Premium)
Version: Pine Script® v6
Overlay: Yes (table displayed on chart)
🧠 What it Does:
This script tracks four important Bitcoin price differentials to monitor spot/perpetual/futures price inefficiencies and ETF premium/discounts, and displays them in a live table on the chart. It helps traders identify arbitrage opportunities or institutional pricing signals.
📈 Displayed Metrics:
Coinbase Premium
→ Difference between Coinbase spot and Binance spot prices.
→ Use case: US vs. offshore spot market divergence.
Coinbase Spot vs Binance Perpetual
→ Difference between Coinbase spot and Binance perpetual price.
→ Use case: Spot-perp basis, often used for funding rate insights or market stress.
Bybit vs Binance Perpetual
→ Difference between Bybit perp and Binance perp price.
→ Use case: Compare derivative pricing across major offshore exchanges.
IBIT Premium (CME vs ETF-implied)
→ Compares CME futures price vs. IBIT’s implied spot BTC value
→ IBIT implied BTC = IBIT ETF price ÷ (BTC held / shares outstanding)
→ Use case: Gauge institutional premium/discount and ETF arbitrage clues.
🛠️ Customization:
Text color of the table is adjustable via the input setting.
📌 Visual Output:
A fixed 2×4 table appears in the top-right corner of the chart.
Each row shows a label and the live price difference in USD.