Market Structure & Bias [H4/H1]# Market Structure & Bias
## Overview
A **deterministic market structure indicator** that identifies valid swing points (Highs/Lows) and Break of Structure (BOS) events using strict, rule-based logic. No discretionary interpretation, no lagging indicators, no moving averages — just pure price action structure.
This indicator calculates structure independently across **multiple timeframes (H4 & H1)** and displays the current bias for each, helping traders align their entries with higher timeframe direction.
---
## 🔍 How It Works
### Defining Valid Swing Points
**Valid LOW:**
- A bearish candle (close < open) is immediately followed by a bullish candle (close > open)
- The LOW is the lowest price (including wick) of the bearish candle
**Valid HIGH:**
- A bullish candle (close > open) is immediately followed by a bearish candle (close < open)
- The HIGH is the highest price (including wick) of the bullish candle
### Break of Structure (BOS)
**BOS Up (Bullish):**
- Occurs when a candle **closes completely above** the last valid HIGH (close > HIGH wick)
- Sets bias to **Bullish**
**BOS Down (Bearish):**
- Occurs when a candle **closes completely below** the last valid LOW (close < LOW wick)
- Sets bias to **Bearish**
⚠️ **Important:** Wicks that exceed HIGH/LOW levels without a complete close beyond them do NOT qualify as BOS.
---
## 📊 Multi-Timeframe Bias
The indicator calculates structure **independently** for:
- **H4 (4-Hour)**
- **H1 (1-Hour)**
- **Current Chart Timeframe**
Each timeframe maintains its own bias based on the last confirmed BOS:
- Last BOS Up → **Bullish Bias**
- Last BOS Down → **Bearish Bias**
When H4 and H1 are in **confluence** (both bullish or both bearish), the chart background subtly highlights this alignment.
---
## ⚙️ Features
✅ **Strict Rule-Based Logic** — No subjective interpretation
✅ **Multi-Timeframe Analysis** — H4, H1, and current TF structure
✅ **Bias Dashboard** — Clean table showing bias for all timeframes
✅ **Visual Markers** — Labels for swing points (H/L) and BOS events
✅ **Level Lines** — Plots last valid HIGH and LOW levels
✅ **Confluence Detection** — Background color when HTF bias aligns
✅ **Built-in Alerts** — Configurable alerts for all BOS events
---
## 🎨 Settings
| Setting | Description |
|---------|-------------|
| Show Current TF Structure | Toggle current timeframe markers |
| Show H4 Structure | Toggle H4 BOS labels and levels |
| Show H1 Structure | Toggle H1 BOS labels and levels |
| Show Bias Table | Toggle the bias dashboard |
| Show Swing Points | Toggle H/L labels |
| Colors | Customize bullish, bearish, H4, and H1 colors |
| Table Position | Choose corner for bias table |
---
## 📈 How to Use
1. **Identify HTF Bias** — Check the H4 and H1 bias in the table
2. **Wait for Confluence** — Best setups occur when H4 and H1 bias align
3. **Trade with Structure** — Look for entries on your execution timeframe in the direction of HTF bias
4. **Set Alerts** — Use the built-in alerts to get notified of BOS events
### Example Workflow:
- H4 Bias: **Bullish** ✅
- H1 Bias: **Bullish** ✅
- → Look for **long entries** on lower timeframes when structure confirms
---
## 🔔 Alerts
- `Current TF BOS Up` — Bullish BOS on chart timeframe
- `Current TF BOS Down` — Bearish BOS on chart timeframe
- `H4 BOS Up` — Bullish BOS on H4
- `H4 BOS Down` — Bearish BOS on H4
- `H1 BOS Up` — Bullish BOS on H1
- `H1 BOS Down` — Bearish BOS on H1
---
## ⚠️ Disclaimer
This indicator is a tool for **technical analysis** and does not constitute financial advice. Always use proper risk management and combine with your own analysis. Past performance does not guarantee future results.
---
## 📝 Notes
- Works on any instrument (Forex, Crypto, Stocks, Indices)
- Best used on timeframes ≤ H1 for optimal HTF reference
- Structure resets after each BOS — always uses the most recent valid levels
- No repainting — signals are confirmed on candle close
---
**If you find this indicator useful, please leave a like and follow for more tools!** 🚀
指標和策略
SWING STRATEGY (YALGOS ENGINE)System Overview: SWING STRATEGY (YALGOS ENGINE)
1. What does the system do? This is a smart Trend Following system designed for Swing Trading (medium-term) or Day Trading (intraday). Its unique feature is that it functions as an Independent Simulator: Although it is technically an "Indicator" (and not an official TradingView "Strategy"), it manages an internal trading log, calculates Profit/Loss, and displays a real-time performance table directly on your screen.
2. How does the "Engine" work? (The Logic) The heart of the system is an Adaptive SuperTrend algorithm. Unlike a standard SuperTrend that uses fixed settings, this system "senses" the market and adjusts dynamically:
Volatility Detection: It constantly monitors how volatile the market is (using ATR relative to price).
Automatic Adjustment:
High Volatility ("Stormy Market"): The system widens the Stop Loss line (the trend line) to avoid being stopped out by random market noise.
Low Volatility ("Calm Market"): The system tightens the Stop Loss line to catch the trend early and maximize profit.
3. How are decisions made?
Long Entry (Buy): When the price crosses the trend line upward (the line turns Green).
Short Entry (Sell): When the price crosses the trend line downward (the line turns Red) — only if Short is enabled in the settings.
Exit: When the trend reverses, or when the price touches the trend line (which acts as a Trailing Stop).
4. Visual Features (What you see)
Performance Dashboard: A table displayed on the chart showing the number of trades, the Win Rate, and the Net Profit for the selected time range (e.g., "Last 3 Months").
Result Lines: The system draws a line connecting the entry point to the exit point.
Green/Blue Dotted Line: The trade ended in profit.
Orange Dotted Line: The trade ended in a loss.
Chart Labels: Clear BUY and SELL labels, and a small X marker if the trade was closed due to a Stop Loss hit.
Summary This system essentially "dances" with the market: it gives the price room to breathe when the market is wild, and keeps a tight leash when the market is calm, all while providing you with a transparent snapshot of its historical performance.
LakyFx Delta Divergence Bands V2.24LakyFx Delta Bands (Multi-Source Delta Aggregator)
What this indicator is
LakyFx Delta Bands is a volume-delta analytics tool designed to estimate buy vs sell pressure by decomposing volume into “buy volume” and “sell volume” per candle, then computing Delta = Buy − Sell. It can aggregate data from multiple exchanges/venues (for crypto) or switch to a single-source mode (for stocks/indices) using the chart symbol or a manual proxy symbol.
This indicator does not generate guaranteed trade signals. It is built to help you:
Understand whether participation is dominated by buying or selling pressure,
Spot momentum shifts when delta trends change,
Detect regular and hidden divergences between price action and delta flow,
Smooth delta with configurable moving averages to reduce noise,
Use lower-timeframe aggregation to approximate intra-bar delta (when enabled).
Key concepts explained
1) Delta (estimated)
TradingView typically provides OHLCV (Open/High/Low/Close/Volume) per candle, not true order-by-order “aggressive buy/sell” tape for most symbols.
So this indicator estimates buy/sell volume from candle structure using one of these methods:
Simple method (directional volume):
If Close > Open: treat most volume as buying.
If Close < Open: treat most volume as selling.
If Close == Open: treat volume as neutral/0 split (or minimal split depending on implementation).
Candle Anatomy method (body + wicks weighting):
Attempts to distribute volume based on candle body size and wick structure.
Intuition: stronger directional bodies imply stronger directional participation; wicks represent rejection.
Result: Delta = BuyVolume − SellVolume
Positive delta suggests net buying pressure; negative delta suggests net selling pressure.
Important: This is an estimation model, not true executed market delta.
2) Aggregation (crypto multi-exchange)
In crypto mode, delta can be computed from multiple data sources and summed into a single composite delta:
Spot venues (e.g., Binance Spot)
Perpetual venues (e.g., Binance Perp)
If a venue does not list the symbol, the script ignores it (treats as 0 contribution) instead of erroring.
3) Single-source mode (stocks/indices)
When Stocks/Indices mode is enabled, the indicator ignores the crypto exchange list and uses one data source:
Either the chart’s symbol (syminfo.tickerid)
Or a Proxy Symbol you provide (example: use SPY or ES1! as a proxy for SPX).
This is crucial because many indices (like SPX) do not have real trade volume in the same way an ETF or futures contract does.
4) LTF Delta aggregation (intra-bar approximation)
Instead of computing delta only from the chart timeframe candle, the indicator can compute delta from lower timeframe candles and sum them to approximate the delta inside each higher-timeframe candle.
To mitigate limited 1-minute history, the LTF timeframe is chosen dynamically:
Chart TF ≤ 1H → use 1m
1H < Chart TF ≤ 4H → use 15m
Chart TF > 4H → use 1H
This increases stability and reduces the “not enough 1m history” problem.
Note: LTF aggregation is still an approximation and depends heavily on available historical data and session structure (especially for stocks).
What you see on the chart
A) Zero line (baseline)
A horizontal centerline represents Delta = 0:
Above 0 = net buying pressure
Below 0 = net selling pressure
B) Delta histogram
A histogram shows current candle delta (aggregated):
Positive bars above zero = net buying
Negative bars below zero = net selling
The histogram may be visually scaled (shortened) to improve readability if the raw delta is extremely spiky.
C) Delta Moving Averages (3 lines)
Three delta moving averages (MA1 / MA2 / MA3) are plotted on top of the histogram:
They smooth delta to highlight trend and momentum.
MA types and lengths are fully configurable.
Color/thickness settings help you visually detect:
MA crossing above/below 0,
MA slope changes (momentum shift),
MA separation (trend strength).
D) Divergences (regular + hidden)
The script detects divergences between:
Price pivots (swing highs/lows)
Delta signal pivots (delta or chosen MA / cumulative delta)
It can display:
Regular bullish divergence: price makes a lower low, delta makes a higher low
Regular bearish divergence: price makes a higher high, delta makes a lower high
And also:
Hidden bullish divergence: price makes a higher low, delta makes a lower low
Hidden bearish divergence: price makes a lower high, delta makes a higher high
Hidden divergences are typically shown with lighter / more transparent colors because they are usually treated as lower priority than regular divergences.
E) Value Box (top right)
A small table shows current values (minimal, readable):
MA2 (in millions if configured that way)
Delta (human formatted)
Optionally also shows debug information:
SYM: the active symbol used for computation (auto symbol or manual)
Sources: how many sources are enabled vs how many are actually active (valid data)
Δ TF: what timeframe is currently used for delta calculation (chart TF if not LTF, otherwise 1m/15m/1H)
Settings & what they do (explained)
1) Sources / Venues (Crypto list)
Enable 1..10: toggles each exchange feed on/off.
Symbol input per source: defines the venue ticker (e.g., BINANCE:BTCUSDT, BYBIT:ETHUSDT.P).
If Auto Symbols from Chart is enabled, the script derives tickers from the chart’s base currency and constructs venue tickers internally.
Why you still see BTCUSDT in settings:
TradingView does not allow scripts to programmatically rewrite the UI input fields. Auto symbols work internally, not by changing what you see in input boxes.
2) Auto Symbols from Chart
When enabled:
The script reads the chart’s base currency (e.g., BTC, ETH, SOL)
Builds venue tickers for each configured exchange (spot/perp format)
Uses those computed tickers (“used symbols”) for requests
When disabled:
Uses the manually typed sym1..sym10 values exactly as they appear.
3) Stocks/Indices Mode (Single source)
When enabled:
Crypto exchange list is ignored.
The script uses:
Proxy symbol if provided
Otherwise the chart symbol
Use cases:
Stocks: AAPL, TSLA, MSFT, etc. (chart symbol is enough)
Indices: SPX → set proxy to SPY or ES1! for meaningful volume
ETFs: SPY/QQQ (chart symbol is enough)
4) Proxy Symbol (optional)
Only used in Stocks/Indices mode:
If empty: uses chart symbol
If set: uses the proxy symbol for all delta calculations
Examples:
SPX proxy: AMEX:SPY or CME:ES1!
NDX proxy: NASDAQ:QQQ or CME:NQ1!
5) Delta Mode (calculation method)
You typically have:
Simple (directional candle)
Candle Anatomy
LTF Delta — Simple
LTF Delta — Anatomy
(Names may vary slightly, but the behavior matches.)
When to use what:
Simple: robust, easy to interpret, less “model risk”
Anatomy: potentially more nuanced, but more sensitive to candle structure
LTF versions: more granular delta estimate, but depends on data availability
6) Normalize Volume to Quote Currency (if present)
Some scripts multiply volume by price to approximate “quote volume”:
If ON: uses volume * close
If OFF: uses raw volume
For crypto, quote volume can sometimes give a more comparable magnitude across price regimes.
For stocks, raw share volume may be fine; quote volume can help compare capital flow.
7) Moving Averages (MA1/MA2/MA3)
Each MA usually includes:
Length: number of bars
Type: SMA / EMA / RMA / WMA / VWMA (depending on what you enabled)
Line width: thickness for readability
Color style: optionally dynamic by slope (e.g., bright when rising, muted when falling)
How to interpret:
MA above 0 = persistent net buying pressure
MA below 0 = persistent net selling pressure
MA slope turning = flow shift
MA compression (lines converging) = reduced directional dominance
MA expansion = strengthening trend
8) Divergence settings
Typical controls include:
Pivot length (left/right): how “swing points” are detected
Max lookback / range: divergence search window
Signal source for divergence: Raw Delta, MA2, or Cumulative Delta
Regular divergence ON/OFF
Hidden divergence ON/OFF
Hidden divergence sensitivity: often separate pivot length or confirmation conditions
Why pivots matter:
Divergence logic needs “confirmed” swing highs/lows, so it inherently lags by the pivot confirmation amount.
9) Visual controls
Histogram visibility
Histogram transparency
Histogram scaling (shortening) to reduce extreme spikes visually
Zero line color/opacity
Value Box on/off
Debug lines on/off
Practical usage tips
Crypto (multi-exchange)
Use a balanced set of spot + perp venues for broad participation.
If the token is small/mid cap and listed only on a few venues, the “Sources active” debug line will tell you why delta looks weak or flat.
Stocks
Use Stocks/Indices mode ON.
Prefer HTF Simple/Anatomy first.
Use LTF only on intraday charts where 1m/15m history is sufficiently available.
Indices
Use a proxy (SPY/ES1!) because index volume can be non-representative or missing.
Known limitations (important)
Delta is estimated, not true traded delta.
LTF data availability can be limited, especially for stocks.
Session gaps can make LTF aggregation less smooth on stocks.
If most venues do not list a token, multi-exchange delta will naturally be small/flat (sources ignored).
Summary
LakyFx Delta Bands gives you a clean, highly configurable way to visualize:
multi-source aggregated delta,
smoothed delta flow via configurable MAs,
divergence signals (regular + hidden),
and debugging feedback about what symbol and how many sources are actually driving the calculation.
If you want, I can also rewrite this documentation into a shorter “TradingView script description” format (less technical, more marketing style) or a “README” format with sections and examples.
Order Flow IndicatorThe Order Flow Indicator is an advanced order flow analysis tool that processes lower timeframe (LTF) tick-level data to reveal the underlying buying and selling dynamics behind price movement. Using custom scoring formulas and proprietary weighting algorithms, this indicator transforms raw tick data into actionable visualizations that help traders understand market microstructure, detect potential institutional activity, and identify shifts in buying and selling pressure.
Unlike standard volume indicators that only show total volume per bar, this indicator analyzes every individual tick within each chart bar—potentially hundreds or thousands of data points—to calculate directional pressure, volume absorption, and large order detection with far greater precision.
-------------------------------------------------------------------
Core Features
1. Institutional Buyer Histogram
The institutional buyer histogram identifies and displays large orders that likely represent institutional or professional trading activity. The indicator uses a proprietary classification system with an adaptive algorithm to detect which orders are the most important, automatically calibrating to different instruments and market conditions without manual adjustment.
Large orders are classified by direction:
Buy Orders (green, above zero) : Large orders where price moved up
Sell Orders (red, below zero) : Large orders where price moved down
Neutral Orders (white, split across zero) : Large orders with no directional impact
The tiered filtering system allows you to adjust sensitivity:
Tier 1 Only : Shows only the absolute largest, most significant orders
Tier 1 & 2 Only : Shows very large orders (default setting)
Tier 1, 2 & 3 Only : Shows large orders with more frequency
All Tiers : Shows all significant orders above normal retail size
Use Order Size Filter Only : Bypass the adaptive tier system and filter purely by a specific order size threshold
An optional Size Filter can be enabled to set an absolute minimum order size in addition to tier filtering, allowing for precise control over which orders are displayed.
2. Buy & Sell Pressure Histogram
Visualizes the total directional pressure within each bar using a proprietary scoring system that weights volume by price impact. The histogram height represents total pressure intensity, while the color gradient—ranging from neutral gray to green (buying) or red (selling)—indicates how one-sided the activity was. Bars with strong directional conviction display more saturated colors, while mixed or balanced activity remains closer to neutral.
The color intensity is determined by custom adaptive algorithms that compare current activity against recent historical context, providing meaningful visual feedback about the strength and conviction of each bar's order flow.
3. Absorption Histogram
Detects when significant volume occurs without proportional price movement. High absorption readings suggest that large orders may be getting filled without moving the market, potentially indicating institutional activity, strong support/resistance levels, or an active battle between buyers and sellers. This can mean a reversal is coming or that the move is exhausted.
The indicator uses proprietary efficiency calculations and adaptive normalization to compare current absorption against recent historical context, automatically adjusting to different market conditions and volatility.
4. Neutral Volume Histogram
Displays cumulative volume where price remained unchanged between ticks. Elevated neutral volume may indicate consolidation, indecision, or large orders being executed at a single price level without directional impact. These are typically limit orders where institutional buyers were trying to get their orders filled without moving the markets.
5. Order Flow Trend Line & Moving Averages
Tracks cumulative directional order flow over time, resetting at user-defined intervals (hourly, daily, weekly, etc.). Two calculation methods are available:
Basic : Raw cumulative volume delta (up volume minus down volume)
Advanced : Uses the proprietary scoring system for volume-weighted directional measurement
Three time-based moving averages (default: 15min, 1H, 4H) provide trend context. Unlike traditional bar-based MAs, these automatically calculate the appropriate length based on your chart timeframe, ensuring consistent time periods across different charts. Optional color-filled areas show when the trend line is above or below each MA for quick visual reference.
-------------------------------------------------------------------
How To Read The Indicator
Institutional Histogram Interpretation:
Green spikes above zero = Large buying orders detected
Red spikes below zero = Large selling orders detected
White spikes above and below zero = Large neutral orders detected
Simultaneous buy and sell spikes = Two-sided institutional activity (potential reversal zone or high-interest price level)
The identification table on your chart shows which tier filter is active and any size filter threshold
Pressure Histogram Interpretation:
Tall bars with saturated green = Strong, mostly one-sided buying pressure
Tall bars with saturated red = Strong, mostly one-sided selling pressure
Shorter or gray-tinted bars = Lower conviction or balanced activity from buyers and sellers
Absorption Histogram Interpretation:
Tall bright bars = High volume absorbed without moving price (potential reversal or exhaustion of the move)
Low/absent bars = Volume efficiently moving price as expected
Neutral Volume Histogram Interpretation:
Large neutral volume signals clusters of limit orders from large buyers and sellers looking to fill their orders without moving the market. This can signal a potential reversal, or intention to support price from that area.
Trend Line Interpretation:
Rising trend line (green) = Cumulative buying pressure increasing
Falling trend line (red) = Cumulative selling pressure increasing
Trend crossing above/below MAs = Potential shift in order flow momentum
-------------------------------------------------------------------
Trading Applications
Scalping & Intraday Trading : Use the Institutional Histogram to identify when large players are entering the market. Imbalances between institutional buying and selling often precede short-term price movements. Watch for a strong directional bias from large orders and then look for pullbacks to enter positions in the same direction of the large order bias.
Watch for high spikes in absorption after an extended move up or down. This typically represents a reversal is coming or that the move is exhausted and a pullback to fair price areas is likely so trail your stop tightly if you are already in a position or use the absorption spike as a signal to watch for a potential entry near that spike candle.
Support & Resistance Confirmation : High Absorption readings at key price levels may confirm that orders are being absorbed, strengthening the case for support or resistance. Clusters of absorption can help identify accumulation and distribution zones. These often have price reactions that can be scalped for quick profits by trading back towards where price approached the support/resistance level from.
Trend Confirmation : The Order Flow Trend Line can confirm or diverge from price trends. Strong price moves accompanied by aligned order flow provide higher conviction. Divergences between price and cumulative delta may signal weak conviction from traders and indicate a potential reversal is coming.
Institutional Order Detection : Filter for only the largest orders (Tier 1) to see when potential institutional players are most active. These rare, significant orders often precede meaningful price moves. When you see a clear bias in direction from the institutional traders, look for pullbacks and then enter a position in the same direction as the large trader bias.
Volume Analysis : Compare Pressure and Neutral Volume histograms together. High pressure with low neutral volume suggests conviction moves, while high neutral volume with low pressure may indicate consolidation or absorption.
-------------------------------------------------------------------
Settings Overview
Global Settings:
Data Source : Analyze order flow from a different symbol (e.g., ES1! while viewing SPY). Leave empty to use the current chart symbol.
Lower Timeframe : The granularity of tick data analysis (default: 1T for 1-tick). Lower timeframes provide more accurate data but have limited historical depth.
Only Show Data For Confirmed Bars : When enabled, only displays data after bars close to prevent values from updating on open bars.
Institutional Buyer Histogram Settings:
Order Size Tier Filter : Adjust sensitivity from Tier 1 (largest orders only) through All Tiers (broader detection), or use Size Filter Only mode
Only Show Orders Above Filter Threshold : Enable an additional absolute minimum order size filter
Order Size Filter Threshold : Set a specific minimum volume when the size filter is enabled
Color Settings : Customize buy, sell, and neutral order colors
Buy & Sell Pressure Histogram Settings:
Enable/disable and invert the histogram
Customize buy pressure, sell pressure, and base colors for the gradient system
Absorption Histogram Settings:
Enable/disable and invert the histogram
Customize absorption and base colors
Neutral Volume Histogram Settings:
Enable/disable and invert the histogram
Customize the neutral volume color
Order Flow Trend Settings:
Calculation Method : Basic (raw delta) or Advanced (proprietary scoring)
Smoothing Length : Apply SMA smoothing to the trend line (1 = no smoothing)
Reset Period : When cumulative values reset (5min through 1 Year)
MA 1/2/3 Timeframes : Time-based moving average periods (each can be independently enabled)
MA Fill : Optional color fill between trend line and MAs
Identification Table:
Enable/disable the on-chart table showing active features
Customize position, background color, and text color
-------------------------------------------------------------------
Important Notes & Limitations
Lower Timeframe Data Requirements : This indicator is designed to work with tick-level data (1T timeframe) for maximum accuracy. The quality of analysis depends directly on the granularity of data available:
Tick-based intervals require a paid TradingView subscription (Ultimate plan)
Historical tick data is very limited — even on the Ultimate plan, only 40,000 bars of historical tick data is available which can be days worth of data on some charts and only hours worth of data on charts like NQ where there are a large amount of traders constantly buying and selling.
Second-based data requires Premium or Ultimate plans. This will give you more history to work with, but multiple transactions can happen within a single second bar, so the data, especially directional data will not be as accurate as tick level data.
Using higher LTF settings (such as 1-minute) will still work but provides less granular order flow analysis
For complete information on data availability by subscription tier, see the TradingView pricing page.
Volume Data Required : This indicator requires volume data to function. Instruments without volume data (such as some forex pairs from certain brokers) cannot be analyzed with this tool.
Real-Time Updates : Without "Only Show Data For Confirmed Bars" enabled, the current bar's values will update in real-time as new ticks arrive. Enable this setting if you prefer to act only on finalized data that will not change upon bar confirmation.
Instrument Compatibility : While designed primarily for futures trading analysis, this indicator works on any instrument with volume data including stocks, forex, ETFs, and cryptocurrencies.
Using Multiple Instances Of The Indicator : There are multiple different options for you to use on this indicator, but having them on the same pane can be confusing and not obvious when the data overlaps. To fix this, just add a second or third instance of the indicator to your chart and then switch on the specific tool you want to use for that indicator pane. My personal favorite is the absorption on one pane and the institutional buyer histogram on another pane for easy analysis of both.
If you want to combine two histograms onto one indicator pane such as absorption and neutral volume, just enable the inversion setting on one of the tools so you get data on the positive side and negative side of the zero line and reduce how much space your indicator setup consumes of your chart.
Fix Indicator Loading Error: If the indicator fails to load or displays incorrectly, toggle the "Fix Indicator Loading Error" checkbox in settings. This forces TradingView to restart the indicator and typically resolves loading issues. Tradingview charts have issues with parsing tick data sometimes too, so if you see gaps between readings, try refreshing your browser. Most of the time that fixes the issue with gaps in data. If that does not resolve the issue, there may not be any tick data available from the exchange during that time period.
-------------------------------------------------------------------
Default Configuration
Out of the box, the indicator displays:
Institutional Buyer Histogram : Enabled with Tier 1 & 2 filter
Identification Table : Enabled (shows active features and current tier selection)
All other features : Disabled
This provides immediate value by showing large order detection without overwhelming the chart. Enable additional features as needed for your trading style.
A.I. Megatron [RubiXalgo]A.I. Megatron – 2025 EditionAdvanced Kalman + k-NN + Machine Learning hybrid indicator that visualizes market structure as a rotating Rubik’s Cube metaphor — fast vs slow trend “sides”, momentum “colors”, volume imbalance “faces”.Core Visual LanguageGreen Red gradient = Bullish Bearish conviction
Teal/Purple accents = Crypto mode alternative
Trend Strength Bar (bottom-right) → ❖ Kalman % (how committed is the trend?)
Momentum Power Bar (middle-right) → ◆ Stochastic Money Flow % (are we oversold < ~31% or overbought > ~69%?)
Fast Rubik line = quick Kalman trend
Slow Rubik line = deeper / institutional trend
Vector Recovery Zones = volume imbalance magnets (green = potential support reclaim, red = resistance reclaim)
Bounce Boxes = wick-pressure support/resistance zones
Sharkwave TTM Squares = squeeze intensity markers (stronger color = higher compression → bigger expected expansion)
Gann-style Vxt3 dots = high-probability volume + momentum alignment pings
Most reliable context combinations (2025 observed edge)
Long bias
• Trend bar dark green (>65–75%)
• Momentum bar green / deep green (<38%)
• Price near or inside green recovery or bounce zone
• Green Gann dot(s) printing
• TTM bottom squares lighting upShort bias
• Trend bar deep red/purple (>65–75%)
• Momentum bar red/deep red (>62–69%)
• Price near or inside red recovery or bounce zone
• Red Gann dot(s) printing
• TTM top squares lighting upTagline style one-liners (pick your favourite)“Solve the market like a speed-cuber solves a Rubik’s Cube — one face (trend / momentum / volume) at a time.”
“Kalman eyes + k-NN brain + Sharkwave heartbeat = Megatron.”
“Not another oscillator. A visual machine-learning market Rubik’s Cube.”
“See what institutions see — before they move.”
“Colors don’t lie. Trends rotate. Volume screams.”
BreakPoint Pro - Market Structure Shifts BreakPoint Pro - Market Structure Shifts
BreakPoint Pro identifies meaningful structural breaks in price action by tracking swing highs and lows, detecting directional shifts, and optionally requiring a break-and-retest confirmation before signaling.
To reduce noise and overtrading, BreakPoint Pro integrates:
- Trend and momentum filters
- Signal cooldown logic
- Adaptive ATR-based risk visualization
- Multi-timeframe structural context
The result is a clean, structured framework that helps traders align entries with both local structure and higher-timeframe bias, while maintaining consistent risk parameters.
NQ 1m Chart Short Signal & TP Hit
This indicator is not a strategy and does not auto-execute trades. It is intended as a decision-support tool for discretionary traders who understand structure, trend alignment, and risk management.
BreakPoint Pro identifies meaningful structural breaks in price action by tracking swing highs and lows, detecting directional shifts, and optionally requiring a break-and-retest confirmation before signaling.
BTC 4h Chart Short Signal Close to TP
✨ Key Features (At a Glance)
- Market Structure Shift (MSS) detection
- Optional break + retest confirmation
- EMA trend filter
- RSI momentum filter
- Cooldown system to prevent signal clustering
- ATR-based Stop Loss & Take Profit visualization
- Dynamic Risk/Reward calculation
- Higher-Timeframe (HTF) structure dashboard
- Fully customizable visuals (SL/TP lines, opacity, styles)
ETH 1h Chart - Showing current potential short trade in play, but also older potential trades as well with background color grading and structure high/low levels
🔍 In-Depth Feature Overview
1. Market Structure Detection
BreakPoint continuously tracks recent swing highs and swing lows to determine when price breaks previous structure.
A structure shift is only confirmed when price closes beyond a prior swing, helping filter out wicks and false breaks.
The indicator maintains a structure state:
- Bullish
- Bearish
- Neutral
This state governs signal eligibility and background context.
2. Break + Retest Logic (Optional)
When enabled, BreakPoint requires:
- A confirmed break of structure
- A controlled retest within an ATR-based tolerance
- A continuation close in the break direction
This helps avoid chasing impulsive moves and favors acceptance over reaction.
Retest sensitivity can be fine-tuned using the ATR tolerance multiplier.
3. Trend & Momentum Filters
To improve signal quality, BreakPoint supports optional filters:
EMA Filter
- Long signals only above the EMA
- Short signals only below the EMA
RSI Filter
- Longs require RSI above a configurable midline
- Shorts require RSI below it
Filters can be used independently or combined for stricter confirmation.
4. Cooldown Protection
After a signal triggers, BreakPoint enforces a cooldown period before allowing another signal.
This prevents rapid flip-flopping in choppy conditions and encourages patience and structure clarity.
5. ATR-Based Risk Visualization
Upon a valid signal, BreakPoint automatically plots:
- Stop Loss (SL)
- Take Profit (TP)
Using:
- ATR-based distance
- Configurable Risk/Reward ratio
- Direction-aware placement
All SL/TP lines and labels are purely visual aids and can be customized or disabled depending on your workflow.
6. Higher-Timeframe Structure Dashboard
BreakPoint dynamically evaluates structure on three higher timeframes relative to your current chart.
A compact table displays:
- Timeframe
- Bullish / Bearish / Neutral structure
- Current trade direction
- SL, TP, and live R:R values
This helps traders quickly assess top-down alignment without switching charts.
DXY- USD Index 1h Chart Short with TP hit
🛠️ Settings Review:
Core Structure
- Swing Length – Controls sensitivity of swing detection
- Require Break + Retest – Enables retest confirmation logic
- Retest ATR Tolerance – Defines acceptable retest range
Filters
- Use EMA Filter / EMA Length
- Use RSI Filter / RSI Length / RSI Midline
Signal Management
- Cooldown Bars After Signal – Minimum bars between signals
Risk Visualization
- Use ATR-based Stop Loss
- ATR Stop Loss Multiplier
- Use ATR-based Take Profit
- Risk/Reward Ratio
Visual Customization
- SL/TP colors
- Line styles (solid, dashed, dotted)
- Line widths
- Opacity levels
HTF Display
- Show/Hide HTF structure box
- Table position on chart
DASH - Weekly Timeframe Long Trade hit TP
Best Practices & Tips
- Works best on liquid markets (indices, FX, majors, liquid crypto)
- Use HTF structure alignment for higher-confidence trades
Combine with:
Key levels
Session highs/lows
Supply & demand zones
- Increase swing length and enable filters on higher timeframes
- Avoid treating signals as standalone trade commands
BreakPoint excels as a structure confirmation tool, not a prediction engine.
SOL - 4hr Short
⚠️ Disclaimer:
BreakPoint Pro – Market Structure Shifts is a technical analysis tool designed to highlight potential market structure shifts. It provides visual signals and trade bias suggestions based on swing highs/lows, optional EMA/RSI filters, and break/retest logic. It does not guarantee profits and should not be considered financial advice.
Users are responsible for their own trades. Always perform your own analysis and manage risk appropriately. Use proper stop-losses and position sizing. Trading involves significant risk of loss, and past performance is not indicative of future results.
By using this indicator, you acknowledge that the author cannot be held liable for any trading losses or financial outcomes resulting from its use.
💳 If you'd like access or have any questions, visit our website or feel free to reach out to me directly via DM.
Nagative RR - Pivots Indicator - Old versionIntroduction
This indicator is a comprehensive scalping tool designed to identify high-probability reversals around key Pivot Point levels. It combines classical Support/Resistance theory with modern Market Structure concepts. It is optimized for the 1-minute timeframe, utilizing granular price action to identify precise entries.
Core Methodology
The strategy operates on a logic specifically designed to target a high win rate (historically testing in the 90-92% range) by utilizing a Negative Risk-to-Reward ratio (taking small profits frequently while allowing room for the trade to breathe).
Daily Pivots Reversals:
The core logic anchors to Daily Pivot Points. It treats these levels as critical Support and Resistance zones, waiting for price to interact and reverse off these levels rather than trading breakouts.
Market Structure Shifts (MSS):
The script visualizes and identifies Market Structure Shifts. These are used not just for visual aid but as a hard filter—trades are only taken when the immediate market structure aligns with the reversal direction.
Profitability Filters:
To improve performance and reduce noise, several filters have been added:
EMA Filter: Ensures trades align with the macro trend.
Time Filter: Avoids low-volume trading hours.
S/R Flip Logic: requires a confirmed "flip" of a level before entering.
Features & Functionality
"Pick My Trade" Integration: This script features a built-in JSON generator. It automatically creates the specific JSON payloads required for "Pick My Trade" automation (including Token, Account ID, and Quantity), making it ready for automated trading out of the box.
Visual Backtesting: The script draws Entry, Take Profit, and Stop Loss boxes on the chart for visual verification.
Statistics Panel: A custom dashboard tracks performance in real-time.
How to Use
Timeframe: Set your chart to 1 minute for the best results, as the logic is tuned for this granularity.
Automation: Go to settings -> "Webhook / Automation" and check "Use Pick My Trade JSON". Create an alert on "Any function call" to send fully formatted orders.
Risk Warning: This strategy utilizes a Negative RR approach (typically 1:2 or 1:4 Risk:Reward). This is intentional to achieve a high win rate, but requires discipline and proper risk management.
Disclaimer This script is for educational purposes. Past performance is not indicative of future results. Trading involves risk. Credits to Lois#0290 for the original strategy concept.
Sessions Moving Fib + ES SMT Divergence This indicator automatically tracks the high and low of the Asia, London, and New York trading sessions and draws a dynamic (moving) Fibonacci range for each session.
The Fibonacci levels update in real time as the session develops and then extend forward once the session ends, giving clear intraday reaction zones.
In addition, the indicator detects SMT-style divergences on ES (S&P 500 futures) by comparing price structure against another correlated market (default NQ).
This helps identify institutional divergence, where one market makes a higher high or lower low while the other fails — often signaling potential reversals or continuation traps.
This tool is designed for intraday futures traders, especially those trading ICT / SMT concepts, session-based liquidity, and market structure.
Ingenuity Crazy Strategy Advance CloseThis indicator is designed to keep your trading simple and repeatable. By default, it is optimized for XAUUSD, during Tokyo session, on the 5-minute chart. The indicator automatically marks a tradable range and waits for price to break and confirm a direction. Once the signal appears, it’s as straightforward as buy or sell—no extra analysis or overthinking required.
After the first entry is taken, the indicator continues to monitor price. When price reaches a specific pip distance, it will automatically signal a second trade using the same risk, allowing you to scale into momentum without increasing complexity. The goal is to remove hesitation and reduce emotional decision-making, while still giving you structured trade opportunities.
This system is not meant to be over-tweaked. The logic is built to give clean entries as long as you’re using the correct session, pair, and settings.
🔧 Default Setup:
• Pair: XAUUSD
• Session: Tokyo
• Timeframe: M5 (5-minute)
⚠️ Important:
The default settings are only optimized for XAUUSD. To trade other pairs or timeframes and get the most consistent results, you must use the correct settings.
Axiom Flow: LiteAxiom Flow Lite is a specialized TradingView indicator designed for professional market bias analysis and real-time visualization of institutional order flow. It primarily serves as a decision-support dashboard, providing traders with an immediate read on trend alignment and market volatility.
📊 Core Features & Functionality
Axiom Multi-Timeframe Dashboard: Displays trend direction across four key timeframes (typically 15m, 1H, 4H, and Daily) to identify confluence and overall market bias.
Mentor Panel & Advice: Features a dedicated panel that provides real-time trade advice based on current market conditions, such as "Strong Bull," "Squeeze," or "Chop Detected".
Squeeze & Volatility Detection: Uses proprietary logic to identify "energy build-up" phases (squeezes) and cautions users to stay cash during periods of low volatility or "dead" market conditions.
Crash Protection (Circuit Breaker): Built-in filters monitor fast-timeframe momentum to detect aggressive counter-trend moves and warn users to pause trading during high-risk reversals.
🚀 Lite vs. PRO Version
While the Lite version provides essential market analysis and bias detection, it is a visual-only roadmap. Key differences include:
Lite Version: Focused on dashboard analysis, trend alignment, and visual identifying zones without automated execution markers.
PRO Version: Unlocks advanced execution tools including automated entry points, stop-loss lines, dynamic take-profit targets (Levels 1–4), and real-time bounce confirmation alerts.
Axiom Flow: PRO SuiteAxiom Flow PRO is an advanced institutional-grade toolkit designed for traders who prioritize precision, clarity, and systematic execution. This premium suite automates the detection of high-probability Fair Value Gaps (FVG) and combines them with a comprehensive Multi-Timeframe Trend Analysis dashboard, transforming complex price action into a streamlined professional workflow.
Whether you trade Indices (NQ, ES), Crypto, Forex, or Metals, Axiom Flow PRO provides the structural roadmap needed to identify where institutional money is moving and where the highest-confluence entries reside.
📊 Key Institutional Features
1. Smart 3-Candle FVG Scanner
Stop manually hunting for imbalances. Our proprietary scanner uses a strict 3-candle confirmation rule to identify high-momentum displacement zones.
Automatic Zone Detection: Draws real-time Bullish and Bearish FVG boxes with integrated mid-line (Equilibrium) markers.
Momentum Filtering: Only identifies gaps backed by three consecutive candles of the same color, ensuring you only see gaps formed by genuine trend strength.
2. Automated Execution Levels & Targets
Take the guesswork out of risk management. For every confirmed setup, the script automatically calculates and plots:
Precision Entry & Stop Loss: Hardcoded lines calculated based on the displacement range.
Dynamic Fibonacci Targets: Automatically projects four Take-Profit levels, allowing you to scale out of positions scientifically as the trend develops.
3. The Axiom Multi-Timeframe Dashboard
Your command center for market bias. Instantly view the trend alignment across four critical timeframes: 15m, 1H, 4H, and Daily.
Unified Trend Verdict: Quickly identify "Strong Bull/Bear" conditions or "Scalp Only" environments based on timeframe confluence.
Squeeze Detection: Built-in RSI volatility filters alert you when the market is in a "Squeeze" (low volatility), helping you stay cash during chop.
4. Integrated Crash Protection (Circuit Breaker)
Protect your capital during aggressive reversals. The suite includes a hidden Trend Filter that monitors fast-timeframe momentum. If price breaks key structural EMAs, the dashboard engages "Protection Mode," warning you to pause new signals until the trend stabilizes.
🛠️ Professional Overlays & Killzones
Declutter your chart by toggling essential institutional tools directly within the Axiom suite:
Session Killzones: Visual boxes for Asia, London, and New York sessions.
Institutional Pivots: Auto-plots Previous Daily, Weekly, and Monthly Highs/Lows (PDH/L).
Session VWAP: Track the volume-weighted average price for the current session.
🚀 Why Choose the PRO Suite?
While the Lite version offers basic analysis, the PRO Suite is a complete execution engine. It doesn't just show you where the market might go—it provides the exact mathematical framework for how to trade it, from entry to final target.
Master the flow. Trade with Axiom.
VaCs MLL V2Quick User Guide
S/R Levels: These are dynamic Support and Resistance lines. They represent "unmitigated" price levels. As soon as the price hits a line, it disappears to keep your chart clean.
BSL/SSL Zones: The red and green boxes represent Buy-Side Liquidity (Previous Day High) and Sell-Side Liquidity (Previous Day Low). These are magnet zones where the price often heads to hunt stop losses.
Leverage Calculator: The dashboard calculates the exact leverage you should use. If you set your "Risk Per Trade" to 5%, and the price hits the "Stop Loss Price," you will lose exactly 5% of your total capital.
Trend Status: Based on the Daily 30 EMA. If the background is Green (Bullish), look for long entries at S/R levels. If Red (Bearish), look for short entries.
TrendSchool V7 Pro 🚀 TrendSchool V7 Pro: المنظومة المتكاملة للتداول المؤسسي
يعد مؤشر TrendSchool V7 Pro القفزة النوعية في عالم أدوات التحليل الفني، حيث يدمج بين تحليل الاتجاه، الزخم، السيولة الذكية، ومفاهيم Smart Money Concepts (SMC) في نظام واحد فائق الدقة. تم تصميم هذه النسخة لتكون "النسخة الاحترافية النظيفة"، حيث تم تحسين الأداء البرمجي لضمان شارت نقي مع ثبات كامل للأهداف والوقف.
💎 الميزات الحصرية والدقيقة لنسخة V7 Pro
1️⃣ رادار اقتناص السيولة (Liquidity Sweep Radar)
خوارزمية متطورة تتبع بصمات صناع السوق من خلال مراقبة مستويات السيولة التاريخية:
صاعد ↗️ (Bullish Sweep): رصد عملية سحب السيولة من الأسفل (Sweep Down) بكسر قاع سابق والارتداد السريع، مما يعطي إشارة دخول شرائية قوية مع "الأموال الذكية".
هابط ↘️ (Bearish Sweep): رصد عملية سحب السيولة من الأعلى (Sweep Up) باختراق قمة سابقة والعودة أسفلها، مما يعطي إشارة بيعية استباقية قبل الهبوط.
مستقر ⚪: مراقبة لحظية لاستقرار السوق وتجنب الدخول في مناطق التذبذب العشوائي.
2️⃣ محرك الإشارات الذكي (Signal Intelligence Engine)
نظام فلترة متعدد الطبقات يضمن جودة الصفقات:
Signal Score (0-100%): تقييم رقمي دقيق يعتمد على توافق (EMA 9/20/50/200، MACD، RSI، ADX، MFI، CMF).
تأكيد الفريم الأكبر (HTF): ربط آلي يمنع الدخول عكس اتجاه الفريمات الكبرى لضمان التداول مع الاتجاه العام.
فلترة المناطق المؤسسية: نظام ذكي يمنع إشارات الشراء عند مناطق العرض (Supply) وإشارات البيع عند مناطق الطلب (Demand).
3️⃣ إدارة المخاطر الديناميكية (Smart Risk Management)
نظام "اضبط وانسى" لإدارة الصفقات باحترافية:
أهداف ذكية (TP1, TP2, TP3): أهداف متغيرة تُحسب آلياً بناءً على تقلبات السوق (ATR) ونوع الفريم، مما يضمن واقعية الأهداف.
وقف خسارة مرن: خيارات تشمل (ATR Dynamic، Fixed %، أو Candle High/Low) لحماية رأس المال بدقة.
الوقف المتحرك (Trailing Stop): خوارزمية تلاحق السعر لتأمين الأرباح بمجرد انطلاق الصفقة.
4️⃣ الهندسة السعرية والمناطق المؤسسية
S&D & Order Blocks: تحديد آلي لمناطق دخول المؤسسات الكبرى مع ميزة "تلاشي المناطق" عند استهلاكها.
Fair Value Gaps (FVG): رصد الفجوات السعرية التي يسعى السعر دائماً لتغطيتها كمناطق جذب.
مستويات السيولة الزمنية: رسم تلقائي لقمم وقيعان اليوم الحالي والأمس كمستويات دعم ومقاومة نفسية قوية.
5️⃣ أدوات التحليل المتقدمة (Alpha Tools)
SMT Divergence: اكتشاف التباعد بين (QQQ vs SPY) لاكتشاف ضعف الاتجاه مبكراً.
رادار الانفجار (Squeeze Radar): تنبيه "انفجار وشيك ⚡" عند تداخل بولينجر باند مع كيلتنر شانل.
هدف الساعة الثابت: خوارزمية تتوقع هدف السعر خلال الساعة الحالية وتثبته لضمان التركيز.
نظام Hero Zero: إشارات خاصة لاقتناص فرص نهاية الجلسة الأمريكية (15:45 EST) مع اقتراح عقود الأوبشن المناسبة.
📋 لوحة البيانات الاحترافية (The Dashboard)
مركز قيادة شامل يعرض:
حالة الاتجاه والسيولة: (صاعد/هابط) مع قوة الاتجاه (ADX).
تمركز صانع السوق: تقدير لموقع كبار اللاعبين في السوق.
عقد Options مقترح: تحديد آلي لأفضل Strike Price بناءً على المعطيات اللحظية.
توافق المؤشرات: نظام Triple Convergence لضمان دخول آمن ومؤكد.
⚙️ قابلية التخصيص والفلترة
Asset Type: وضع خاص للأسهم (مع ربط بـ ETF القطاع) ووضع خاص للمؤشرات والعملات الرقمية.
تحكم كامل: إمكانية إظهار أو إخفاء أي عنصر تقني للوصول إلى أفضل رؤية تناسب استراتيجيتك.
✅ مناسب لـ:
✔️ Options Trading | ✔️ Day Trading | ✔️ Scalping | ✔️ Swing Trading
⚠️ تنويه: هذا المؤشر أداة تحليل فني متطورة تهدف لمساعدتك في اتخاذ القرار، وليس توصية مالية مباشرة. التزم دائماً بإدارة رأس مال صارمة.
✨ TrendSchool V7 Pro – تداول بهيكل السوق، لا بالعواطف.
🚀 TrendSchool V7 Pro: The Complete System for Institutional Trading
The TrendSchool V7 Pro indicator represents a quantum leap in the world of technical analysis tools, integrating trend analysis, momentum, smart liquidity, and Smart Money Concepts (SMC) into a single, highly accurate system. This version is designed as the "clean professional version," with optimized software performance to ensure a pristine chart with unwavering target and stop-loss accuracy.
💎 Exclusive and Precise Features of the V7 Pro Version
1️⃣ Liquidity Sweep Radar
A sophisticated algorithm tracks market makers' fingerprints by monitoring historical liquidity levels:
Bullish Sweep ↗️: Detects a sweep down pattern of liquidity being pulled down by breaking a previous low and rebounding quickly, providing a strong buy entry signal with Smart Money.
Bearish Sweep ↘️: Detects a sweep uptrend, where a break below a previous high triggers a sell signal before a decline.
Stable ⚪: Real-time monitoring of market stability and avoidance of entry into areas of random fluctuations.
2️⃣ Signal Intelligence Engine: A multi-layered filtering system ensures trade quality:
Signal Score (0-100%): Accurate numerical evaluation based on alignment with (9/20/50/200 EMA, MACD, RSI, ADX, MFI, CMF).
Higher Timeframe Confirmation (HTF): Automatic linking prevents entry against the trend of higher timeframes to ensure trading with the overall trend.
Institutional Zone Filtering: An intelligent system that blocks buy signals at supply zones and sell signals at demand zones. 3️⃣ Smart Risk Management
A "Set and Forget" System for Professional Trade Management:
Smart Targets (TP1, TP2, TP3): Dynamic targets calculated automatically based on market volatility (ATR) and timeframe type, ensuring realistic targets.
Flexible Stop Loss: Options include ATR Dynamic, Fixed %, or Candle High/Low for precise capital protection.
Trailing Stop: An algorithm that tracks the price to lock in profits as soon as the trade is triggered.
4️⃣ Price Engineering and Institutional Zones
S&D & Order Blocks: Automatically identifies entry zones for major institutions with a "vanish zone" feature when these zones are consumed.
Fair Value Gaps (FVG): Detects price gaps that the price consistently tries to fill as attraction zones.
Time-Based Liquidity Levels: Automatically plots the current and previous day's highs and lows as strong psychological support and resistance levels.
5️⃣ Advanced Analysis Tools (Alpha Tools)
SMT Divergence: Detects divergence between QQQ and SPY to identify early trend weakness.
Squeeze Radar: "Imminent Breakout ⚡" alert when Bollinger Bands overlap with the Keltner Channel.
Horse Fixed Target: An algorithm predicts and fixes the current hourly price target to ensure focus.
Hero Zero System: Special signals to capitalize on opportunities at the end of the US session (3:45 PM EST) with suggested options contracts.
📋 The Professional Dashboard
A comprehensive command center displaying:
Trend Status and Liquidity: (Up/Down) with trend strength (ADX).
Market Maker Positioning: An assessment of the position of major market players.
Option Recommendation: Automatically identifies the best strike price based on real-time data.
Indicator Convergence: A Triple Convergence system to ensure safe and reliable entry. ⚙️ Customizable and Filterable
Asset Type: Dedicated mode for stocks (with sector ETF integration) and dedicated modes for indices and cryptocurrencies.
Complete Control: Show or hide any technical element to achieve the best view that suits your strategy.
✅ Suitable for:
✔️ Options Trading | ✔️ Day Trading | ✔️ Scalping | ✔️ Swing Trading
⚠️ Disclaimer: This indicator is a sophisticated technical analysis tool designed to assist you in decision-making, not a direct financial recommendation. Always adhere to strict money management.
✨ TrendSchool V7 Pro – Trade with market structure, not emotions.
Order Blocks INDIBOT 3D | INDIBOT ABO SALTAN //@version=6
indicator("Order Blocks INDIBOT 3D | INDIBOT", overlay = true,
max_boxes_count = 500, max_labels_count = 500, max_lines_count = 500, max_polylines_count = 100, max_bars_back = 5000)
//#region CONSTANTS
// Core constants that control stored OB capacity and label size.
const int MAX_STORED_OBS = 50
const int retestSize = 4
//#endregion
//#region INPUTS
// Core user controls for OB behavior, volume delta, 3D style and alerts.
grpOB = "ORDER BLOCKS"
swingLen = input.int(5, "Swing Length", minval = 1, group = grpOB, inline = "sw", display = display.none)
bullObColor = input.color(color.new(color.teal, 55), "", group = grpOB, inline = "sw")
bearObColor = input.color(color.new(color.red, 55), "", group = grpOB, inline = "sw")
invMethod = input.string("Wick", "Invalidation", options = , group = grpOB, display = display.none)
showNearestX = input.int(3, "Show Nearest", minval = 1, maxval = 20, group = grpOB, display = display.none)
extendZones = input.int(10, "Extend Zones", minval = 0, group = grpOB,
tooltip = "This will extend the zones by X candles.", display = display.none)
showRetestLbl = input.bool(true, "Retest Labels", group = grpOB, inline = "tog")
hideInvalid = input.bool(true, "Hide Invalidated Zones", group = grpOB, inline = "tog")
grpVD = "VOLUME DELTA"
vdEnable = input.bool(true, "Enable", group = grpVD, inline = "vd")
vdBullColor = input.color(color.new(color.teal, 65), "", group = grpVD, inline = "vd")
vdBearColor = input.color(color.new(color.red, 65), "", group = grpVD, inline = "vd")
vd3D = input.bool(true, "3D", group = grpVD, inline = "3d", tooltip = "Adds 3D-style depth faces.") and vdEnable
vd3DDepth = input.int(5, "", group = grpVD, inline = "3d", minval = 1, maxval = 5, display = display.none)
displayStyle = input.string("Vertical", "Display Style", options = , group = grpVD,
tooltip = "Horizontal: split shown top/bottom. Vertical: split shown left/right across the zone.", display = display.none)
vdTfIn = input.timeframe("", "Volume Delta Timeframe", group = grpVD,
tooltip = "Lower timeframe used to estimate delta")
showTotalVol = input.bool(true, "Display Total Volume", group = grpVD,
tooltip = "Displays total volume (Bull+Bear) from the active delta source.", inline = "vd2") and vdEnable
showDeltaPct = input.bool(true, "Show Delta %", group = grpVD, inline = "vd2",
tooltip = "Shows bullish vs bearish volume split. If selected TF is lower than chart TF, uses LTF data; otherwise uses chart TF.") and vdEnable
vdTextColor = input.color(color.white, "", group = grpVD, inline = "vd2")
grpAL = "ALERTS"
alBullOB = input.bool(true, "Bullish Order Block", group = grpAL, inline = "oba")
alBearOB = input.bool(true, "Bearish Order Block", group = grpAL, inline = "oba")
alBullRetest = input.bool(true, "Bullish OB Retest", group = grpAL, inline = "obr")
alBearRetest = input.bool(true, "Bearish OB Retest", group = grpAL, inline = "obr")
//#endregion
//#region TYPES
// Custom structs for order blocks and 3D poly drawing.
type PolyParams
array points
color lineColor
color fillColor
int lineWidth
type ObRec
int leftIndex
int leftTime
int createdIndex
int createdTime
float top
float bottom
bool isBull
bool active
bool retested
int retestIndex
int retestTime
int invalidIndex
int invalidTime
float bullVol
float bearVol
float totalVol
float bullPct
float bearPct
bool hasDelta
type RetestRec
int barIndex
bool isBull
int obLeftIndex
int obCreatedIndex
//#endregion
//#region GENERIC HELPERS
// Small utilities: clearing drawings, geometry helpers, nearest-OB picking.
method clearAll(array bx, array pl, array lb) =>
if bx.size() > 0
for i = 0 to bx.size() - 1
bx.get(i).delete()
bx.clear()
if pl.size() > 0
for i = 0 to pl.size() - 1
pl.get(i).delete()
pl.clear()
if lb.size() > 0
for i = 0 to lb.size() - 1
lb.get(i).delete()
lb.clear()
// Builds a simple side face for 3D-style boxes using chart points.
method sideBox(array pts, int x, float btm, float top, float depthY, int widthX) =>
pts.unshift(chart.point.from_index(x, btm))
pts.unshift(chart.point.from_index(x + widthX, btm + depthY))
pts.unshift(chart.point.from_index(x + widthX, top + depthY))
pts.unshift(chart.point.from_index(x, top))
pts.unshift(chart.point.from_index(x, btm))
// Returns true if a candle's high/low intersects the OB zone.
touchesZone(float zTop, float zBot, float cHigh, float cLow) =>
cHigh >= zBot and cLow <= zTop
// Distance from price to zone in price units, used to rank nearest zones.
zoneDistance(float px, float zTop, float zBot) =>
px > zTop ? px - zTop : px < zBot ? zBot - px : 0.0
// Inserts a distance+index pair into a sorted list, capped at kMax.
method insertBest(array dists, array idxs, float dist, int idx, int kMax) =>
if dists.size() == 0
dists.push(dist)
idxs.push(idx)
else
int pos = dists.size()
if dists.size() > 0
for j = 0 to dists.size() - 1
if dist < dists.get(j)
pos := j
break
dists.insert(pos, dist)
idxs.insert(pos, idx)
while dists.size() > kMax
dists.pop()
idxs.pop()
// Picks the k nearest bull/bear OBs to current price (optionally including invalid).
pickNearest(array store, bool wantBull, int kMax, bool includeInvalid) =>
array dists = array.new_float()
array idxs = array.new_int()
if store.size() > 0
for i = 0 to store.size() - 1
ObRec ob = store.get(i)
if ob.isBull == wantBull
bool ok = includeInvalid ? true : ob.active
if ok
float dist = zoneDistance(close, ob.top, ob.bottom)
dists.insertBest(idxs, dist, i, kMax)
idxs
formatVol(float v) =>
str.tostring(v, format.volume)
//#endregion
//#region VOLUME ENGINE (CHART OR LOWER TF)
// Per-bar total / bull / bear volume
tfSec(string tf) =>
timeframe.in_seconds(tf)
int chartSec = tfSec(timeframe.period)
int srcSec = tfSec(vdTfIn)
bool useLtf = not na(chartSec) and not na(srcSec) and srcSec < chartSec
getBarVols() =>
float tot = na
float bull = na
float bear = na
if not useLtf or vdTfIn == ""
float v = volume
bool up = close > open
bool dn = close < open
tot := v
bull := up ? v : 0.0
bear := dn ? v : 0.0
else
array oArr = request.security_lower_tf(syminfo.tickerid, vdTfIn, open)
array cArr = request.security_lower_tf(syminfo.tickerid, vdTfIn, close)
array vArr = request.security_lower_tf(syminfo.tickerid, vdTfIn, volume)
float tSum = 0.0
float bSum = 0.0
float sSum = 0.0
int n = array.size(vArr)
if n > 0
for i = 0 to n - 1
float v2 = array.get(vArr, i)
float o2 = array.get(oArr, i)
float c2 = array.get(cArr, i)
tSum += v2
if c2 > o2
bSum += v2
else if c2 < o2
sSum += v2
tot := tSum
bull := bSum
bear := sSum
= getBarVols()
//#endregion
//#region POC ENGINE (MOST-TOUCHED PRICE + VOLUME)
// Finds a POC between swing and BOS, then aggregates volume.
findMostTouchedPrice(int fromIdx, int toIdx, int nBins) =>
int span = toIdx - fromIdx
if span <= 0 or na(fromIdx) or na(toIdx)
else
float minP = 1e10
float maxP = -1e10
for idx = fromIdx to toIdx
int rel = bar_index - idx
if rel >= 0
float lo = low
float hi = high
if not na(lo) and not na(hi)
if lo < minP
minP := lo
if hi > maxP
maxP := hi
if not (minP < maxP)
else
float step = (maxP - minP) / nBins
step := step <= 0 ? syminfo.mintick : step
array diffCnt = array.new_float(nBins, 0.0)
for idx = fromIdx to toIdx
int rel2 = bar_index - idx
if rel2 >= 0
float lo2 = low
float hi2 = high
if not na(lo2) and not na(hi2)
int sBin = int(math.floor((lo2 - minP) / step))
int eBin = int(math.floor((hi2 - minP) / step))
sBin := sBin < 0 ? 0 : sBin > nBins - 1 ? nBins - 1 : sBin
eBin := eBin < 0 ? 0 : eBin > nBins - 1 ? nBins - 1 : eBin
float cStart = diffCnt.get(sBin)
diffCnt.set(sBin, cStart + 1.0)
if eBin + 1 < nBins
float cEnd = diffCnt.get(eBin + 1)
diffCnt.set(eBin + 1, cEnd - 1.0)
int bestBin = 0
float bestCnt = 0.0
float runCnt = 0.0
for i = 0 to nBins - 1
runCnt += diffCnt.get(i)
if runCnt > bestCnt
bestCnt := runCnt
bestBin := i
float poc = minP + (bestBin + 0.5) * step
// Aggregates total / bull / bear volume at a single price level (POC) for a range.
volumeAtPrice(int fromIdx, int toIdx, float poc) =>
int touches = 0
float totVol = 0.0
float bullVol = 0.0
float bearVol = 0.0
int span = toIdx - fromIdx
if not na(poc) and span >= 0
for step = 0 to span
int idx = toIdx - step
int rel = bar_index - idx
if rel >= 0
float lo = low
float hi = high
if not na(lo) and not na(hi) and lo <= poc and hi >= poc
touches += 1
float vTot = barTotVol
float vBull = barBullVol
float vBear = barBearVol
if not na(vTot)
totVol += vTot
if not na(vBull)
bullVol += vBull
if not na(vBear)
bearVol += vBear
// Wrapper: find POC first, then compute volume at that POC for the BOS range.
calcMostTouchedPriceVol(int fromIdx, int toIdx, int nBins) =>
= findMostTouchedPrice(fromIdx, toIdx, nBins)
= volumeAtPrice(fromIdx, toIdx, poc)
//#endregion
//#region ORDER BLOCK ENGINE (POC-BASED)
// Detects swing highs/lows, confirms BOS, anchors OB at first POC touch.
var array obs = array.new()
var array obRetests = array.new()
var int lastBullRetestBar = na
var int lastBearRetestBar = na
var float shPrice = na
var int shIdx = na
var float slPrice = na
var int slIdx = na
bool evNewBullOB = false
bool evNewBearOB = false
bool evBullRetest = false
bool evBearRetest = false
float ph = ta.pivothigh(high, swingLen, swingLen)
float pl = ta.pivotlow(low, swingLen, swingLen)
if not na(ph)
shPrice := ph
shIdx := bar_index - swingLen
if not na(pl)
slPrice := pl
slIdx := bar_index - swingLen
bool bosBearNow = not na(slPrice) and bar_index > slIdx and close < slPrice and close >= slPrice
bool bosBullNow = not na(shPrice) and bar_index > shIdx and close > shPrice and close <= shPrice
bool bosBear = bosBearNow
bool bosBull = bosBullNow
// Precompute BOS ranges and POC stats in global scope
int bosIdxBear = bar_index - 1
int fromIdxBear = slIdx
int toIdxBear = bosIdxBear
= calcMostTouchedPriceVol(fromIdxBear, toIdxBear, 40)
int bosIdxBull = bar_index - 1
int fromIdxBull = shIdx
int toIdxBull = bosIdxBull
= calcMostTouchedPriceVol(fromIdxBull, toIdxBull, 40)
// Keeps OB array trimmed to recent history and limits max stored OBs.
pruneObs() =>
int minLeft = math.max(0, bar_index - 4999)
if obs.size() > 0
for i = obs.size() - 1 to 0
ObRec ob = obs.get(i)
if ob.leftIndex < minLeft
obs.remove(i)
while obs.size() > MAX_STORED_OBS
bool removed = false
if obs.size() > 0
for j = obs.size() - 1 to 0
ObRec ob2 = obs.get(j)
if not ob2.active
obs.remove(j)
removed := true
break
if not removed and obs.size() > 0
obs.pop()
// Creates and seeds an OB record using a POC-anchored candle and BOS volumes.
addObFromPoc(int baseIdx, float top, float bottom, bool isBull, float totSeed, float bullSeed, float bearSeed, int createdIdx) =>
int offLeft = bar_index - baseIdx
int offCreated = bar_index - createdIdx
int leftTime = time
int createdTm = time
float tot = totSeed
float bVol = bullSeed
float sVol = bearSeed
bool hasDelta = tot > 0.0
float bullPct = hasDelta ? math.round((bVol / tot) * 100.0) : 50.0
float bearPct = hasDelta ? 100.0 - bullPct : 50.0
obs.unshift(ObRec.new(baseIdx, leftTime, createdIdx, createdTm, top, bottom, isBull,
true, false, na, na, na, na, bVol, sVol, tot, bullPct, bearPct, hasDelta))
pruneObs()
// Returns true if a proposed zone overlaps any active OB
obOverlapsActive(float zoneTop, float zoneBottom) =>
float zTop = math.max(zoneTop, zoneBottom)
float zBot = math.min(zoneTop, zoneBottom)
bool overlaps = false
if obs.size() > 0
for i = 0 to obs.size() - 1
ObRec ob = obs.get(i)
if ob.active
float oTop = math.max(ob.top, ob.bottom)
float oBot = math.min(ob.top, ob.bottom)
bool rangeOverlap = zTop >= oBot and zBot <= oTop
if rangeOverlap
overlaps := true
break
overlaps
// Returns true if there is a price gap between anchorIdx and bosIdx.
hasGapBetween(int anchorIdx, int bosIdx, bool isBull) =>
bool gap = false
int fromIdx = math.min(anchorIdx, bosIdx)
int toIdx = math.max(anchorIdx, bosIdx)
if toIdx - fromIdx >= 1
for absIdx = fromIdx + 1 to toIdx
int relNow = bar_index - absIdx
int relPrev = relNow + 1
if relNow >= 0 and relPrev >= 0
float hiPrev = high
float loPrev = low
float hiNow = high
float loNow = low
if not na(hiPrev) and not na(loPrev) and not na(hiNow) and not na(loNow)
if isBull
if loNow > hiPrev
gap := true
break
else
if hiNow < loPrev
gap := true
break
gap
// Bearish BOS → Bearish OB
if bosBear
int bosIdx = bosIdxBear
int fromIdx = fromIdxBear
int toIdx = toIdxBear
if not na(pocB) and touchesB > 0 and not na(fromIdx) and not na(toIdx)
int spanB = toIdx - fromIdx
int bestIdx = na
float runMaxHigh = na
if spanB >= 0
for step = 0 to spanB
int idx = toIdx - step
int rel = bar_index - idx
if rel >= 0
float lo = low
float hi = high
if not na(lo) and not na(hi)
runMaxHigh := na(runMaxHigh) ? hi : math.max(runMaxHigh, hi)
bool touches = lo <= pocB and hi >= pocB
if touches and hi == runMaxHigh
bestIdx := idx
bool gapLeg = not na(bestIdx) ? hasGapBetween(bestIdx, bosIdx, false) : false
if not na(bestIdx) and not gapLeg
int relBest = bar_index - bestIdx
float top = high
float bottom = low
if not obOverlapsActive(top, bottom)
addObFromPoc(bestIdx, top, bottom, false, totVolB, bullVolB, bearVolB, bosIdx)
evNewBearOB := true
slPrice := na
slIdx := na
// Bullish BOS → Bullish OB
if bosBull
int bosIdx2 = bosIdxBull
int fromIdx2 = fromIdxBull
int toIdx2 = toIdxBull
if not na(pocH) and touchesH > 0 and not na(fromIdx2) and not na(toIdx2)
int spanH = toIdx2 - fromIdx2
int bestIdx2 = na
float runMinLow = na
if spanH >= 0
for step = 0 to spanH
int idx2 = toIdx2 - step
int rel2 = bar_index - idx2
if rel2 >= 0
float lo2 = low
float hi2 = high
if not na(lo2) and not na(hi2)
runMinLow := na(runMinLow) ? lo2 : math.min(runMinLow, lo2)
bool touches = lo2 <= pocH and hi2 >= pocH
if touches and lo2 == runMinLow
bestIdx2 := idx2
bool gapLeg2 = not na(bestIdx2) ? hasGapBetween(bestIdx2, bosIdx2, true) : false
if not na(bestIdx2) and not gapLeg2
int relBest2 = bar_index - bestIdx2
float top2 = high
float bottom2 = low
if not obOverlapsActive(top2, bottom2)
addObFromPoc(bestIdx2, top2, bottom2, true, totVolH, bullVolH, bearVolH, bosIdx2)
evNewBullOB := true
shPrice := na
shIdx := na
// Invalidation and retest detection for existing OBs.
if obs.size() > 0
for i = 0 to obs.size() - 1
ObRec ob = obs.get(i)
if ob.active
bool invalid = false
int invIdx = na
int invTime = na
if ob.isBull
if invMethod == "Wick"
invalid := low < ob.bottom
invIdx := bar_index
invTime := time
else
if bar_index > 0
invalid := close < ob.bottom
invIdx := bar_index - 1
invTime := time
else
if invMethod == "Wick"
invalid := high > ob.top
invIdx := bar_index
invTime := time
else
if bar_index > 0
invalid := close > ob.top
invIdx := bar_index - 1
invTime := time
if invalid
ob.active := false
ob.invalidIndex := invIdx
ob.invalidTime := invTime
bool retestPrev = false
int retestBar = na
int retestTm = na
if bar_index > 0
if ob.isBull
bool opensAbovePrev = open > ob.top
bool closesAbovePrev = close > ob.top
bool wickTouchesPrev = low <= ob.top and low >= ob.bottom
retestPrev := opensAbovePrev and closesAbovePrev and wickTouchesPrev
else
bool opensBelowPrev = open < ob.bottom
bool closesBelowPrev = close < ob.bottom
bool wickTouchesPrev = high >= ob.bottom and high <= ob.top
retestPrev := opensBelowPrev and closesBelowPrev and wickTouchesPrev
if retestPrev
retestBar := bar_index - 1
retestTm := time
if retestPrev and not na(retestBar) and retestBar > ob.createdIndex
ob.retested := true
ob.retestIndex := retestBar
ob.retestTime := retestTm
int lastSideBar = ob.isBull ? lastBullRetestBar : lastBearRetestBar
bool canLog = na(lastSideBar) or retestBar - lastSideBar >= 4
if canLog
obRetests.unshift(RetestRec.new(retestBar, ob.isBull, ob.leftIndex, ob.createdIndex))
if ob.isBull
evBullRetest := true
lastBullRetestBar := retestBar
else
evBearRetest := true
lastBearRetestBar := retestBar
obs.set(i, ob)
//#endregion
//#region DRAW ENGINE (ZONES + VOLUME + 3D)
// Handles all boxes, polylines and labels for OBs and 3D faces.
bool showVD = vdEnable
bool isVert = displayStyle == "Vertical"
bool isHorz = not isVert
float dayAtr = ta.atr(14)
var array allBoxes = array.new()
var array allPolys = array.new()
var array allLabels = array.new()
drawPoly(PolyParams pp) =>
if not na(pp) and not na(pp.points) and pp.points.size() > 0
allPolys.unshift(polyline.new(points = pp.points, line_color = pp.lineColor, fill_color = pp.fillColor))
method pushBox(array store, box b) =>
store.unshift(b)
method pushLabel(array store, label l) =>
store.unshift(l)
// Chooses base colors for OB zones depending on vdEnable and bull/bear type.
obColors(ObRec ob) =>
color bullCol = vdEnable ? vdBullColor : bullObColor
color bearCol = vdEnable ? vdBearColor : bearObColor
color baseCol = ob.isBull ? bullCol : bearCol
color faded = ob.active ? baseCol : color.new(baseCol, 85)
// Computes right-most bar index for drawing an OB, considering extension and invalidation.
obRightIndex(ObRec ob) =>
int activeRight = bar_index + extendZones
if ob.active
activeRight
else
na(ob.invalidIndex) ? activeRight : ob.invalidIndex
// Draws the main OB zone box on the chart.
drawObZoneBox(ObRec ob, color faded) =>
int xR = obRightIndex(ob)
int xL = ob.leftIndex
int minBar = bar_index - 4999
if xL < minBar
xL := minBar
xR := math.max(xR, xL)
box bx = box.new(left = xL, right = xR, top = ob.top, bottom = ob.bottom, xloc = xloc.bar_index, bgcolor = faded, border_color = na, border_width = 0)
allBoxes.pushBox(bx)
// Draws a retest marker (triangle) when price revisits an OB.
drawRetestLabels(array bullAct, array bearAct, array bullInv, array bearInv) =>
int ret = 0
if showRetestLbl and obRetests.size() > 0
int minBar = bar_index - 4999
int lastBullLbl = na
int lastBearLbl = na
for i = obRetests.size() - 1 to 0
RetestRec r = obRetests.get(i)
if r.barIndex < minBar or r.barIndex > bar_index
RetestRec _trash = obRetests.remove(i)
else
bool hasDisplayedParent = false
if r.isBull
if bullAct.size() > 0
for j = 0 to bullAct.size() - 1
ObRec ob = obs.get(bullAct.get(j))
if ob.leftIndex == r.obLeftIndex and ob.createdIndex == r.obCreatedIndex
hasDisplayedParent := true
break
if not hasDisplayedParent and not hideInvalid and bullInv.size() > 0
for j = 0 to bullInv.size() - 1
ObRec ob = obs.get(bullInv.get(j))
if ob.leftIndex == r.obLeftIndex and ob.createdIndex == r.obCreatedIndex
hasDisplayedParent := true
break
else
if bearAct.size() > 0
for j = 0 to bearAct.size() - 1
ObRec ob = obs.get(bearAct.get(j))
if ob.leftIndex == r.obLeftIndex and ob.createdIndex == r.obCreatedIndex
hasDisplayedParent := true
break
if not hasDisplayedParent and not hideInvalid and bearInv.size() > 0
for j = 0 to bearInv.size() - 1
ObRec ob = obs.get(bearInv.get(j))
if ob.leftIndex == r.obLeftIndex and ob.createdIndex == r.obCreatedIndex
hasDisplayedParent := true
break
if not hasDisplayedParent
continue
int age = bar_index - r.barIndex
if age >= 0 and age <= 4999
if r.isBull
if not na(lastBullLbl) and r.barIndex - lastBullLbl < 3
continue
lastBullLbl := r.barIndex
else
if not na(lastBearLbl) and r.barIndex - lastBearLbl < 3
continue
lastBearLbl := r.barIndex
float yPrice = close
color baseCol = r.isBull ? bullObColor : bearObColor
st = r.isBull ? label.style_triangleup : label.style_triangledown
yl = r.isBull ? yloc.belowbar : yloc.abovebar
label newLbl = label.new(r.barIndex, yPrice, "", xloc = xloc.bar_index, yloc = yl, style = st,
color = color.new(baseCol, 0), textcolor = color.new(baseCol, 0), size = retestSize, force_overlay = true)
allLabels.pushLabel(newLbl)
ret
// Returns geometry used for volume overlay and 3D top view.
obGeom(ObRec ob) =>
int rawL = ob.leftIndex
int rawR = obRightIndex(ob)
int minBar = bar_index - 4999
int xL = math.max(rawL, minBar)
int xR = math.max(rawR, xL)
int widthX = vd3DDepth
int xR2 = xR + widthX
float yT = ob.top
float yB = ob.bottom
float h = yT - yB
// Converts bull/bear percentages into display strings (if enabled).
deltaTexts(float bullPct, float bearPct) =>
string bullTxt = showDeltaPct ? str.tostring(bullPct) + "%" : ""
string bearTxt = showDeltaPct ? str.tostring(bearPct) + "%" : ""
// Draws a text label with total volume on the right-bottom corner of the OB.
drawTotalVolLabel(int xL, int xR, float yT, float yB, float h, float total) =>
if showTotalVol
int cx = xR - 1
if cx < xL
cx := xL
float cy = yB + h * 0.25
string txt = formatVol(total)
label lb = label.new(cx, cy, txt, xloc = xloc.bar_index, style = label.style_label_right,
textcolor = vdTextColor, color = #ffffff00, size = size.small, force_overlay = true)
allLabels.pushLabel(lb)
// Fills the OB with bull/bear split either vertically or horizontally.
drawDeltaFills(int xL, int xR, float yT, float yB, float h, float bullPct, string bullTxt, string bearTxt) =>
color bullCol = vdEnable ? vdBullColor : bullObColor
color bearCol = vdEnable ? vdBearColor : bearObColor
if isVert
int splitX = xL + int((xR - xL) * (bullPct / 100.0))
splitX := xR - xL >= 2 ? math.max(xL + 1, math.min(xR - 1, splitX)) : xL
box bBull = box.new(xL, yT, splitX, yB, xloc = xloc.bar_index, bgcolor = bullCol, border_width = 0, text = bullTxt, text_color = vdTextColor, text_size = size.small)
box bBear = box.new(splitX, yT, xR, yB, xloc = xloc.bar_index, bgcolor = bearCol, border_width = 0, text = bearTxt, text_color = vdTextColor, text_size = size.small)
allBoxes.pushBox(bBull)
allBoxes.pushBox(bBear)
else
float midY = yB + h * (bullPct / 100.0)
box bBull = box.new(xL, midY, xR, yB, xloc = xloc.bar_index, bgcolor = bullCol, border_width = 0, text = bullTxt, text_color = vdTextColor, text_size = size.small)
box bBear = box.new(xL, yT, xR, midY, xloc = xloc.bar_index, bgcolor = bearCol, border_width = 0, text = bearTxt, text_color = vdTextColor, text_size = size.small)
allBoxes.pushBox(bBull)
allBoxes.pushBox(bBear)
// Track first visible bar index for 3D top face clipping.
var int leftVisIdx = na
if na(leftVisIdx) and time >= chart.left_visible_bar_time
leftVisIdx := bar_index
// Draws the 3D front faces and top faces based on bull/bear split and style.
drawDelta3D(int xL, int xR, int widthX, int xR2, float yT, float yB, float h, float bullPct) =>
color bullCol = vdEnable ? vdBullColor : bullObColor
color bearCol = vdEnable ? vdBearColor : bearObColor
float depthY = dayAtr * (0.1 * vd3DDepth)
int visibleLeft = na(leftVisIdx) ? xL : math.max(xL, leftVisIdx)
int visibleRight = xR
if isHorz
float midY = yB + h * (bullPct / 100.0)
if bullPct > 0
array ptsFrontBull = array.new()
ptsFrontBull.sideBox(xR, yB, midY, depthY, widthX)
drawPoly(PolyParams.new(ptsFrontBull, color.new(chart.fg_color, 90), color.new(bullCol, 70), 1))
if bullPct < 100
array ptsFrontBear = array.new()
ptsFrontBear.sideBox(xR, midY, yT, depthY, widthX)
drawPoly(PolyParams.new(ptsFrontBear, color.new(chart.fg_color, 90), color.new(bearCol, 70), 1))
if visibleRight > visibleLeft
array ptsTop = array.new()
ptsTop.unshift(chart.point.from_index(visibleRight + widthX, yT + depthY))
ptsTop.unshift(chart.point.from_index(visibleLeft + widthX, yT + depthY))
ptsTop.unshift(chart.point.from_index(visibleLeft, yT))
ptsTop.unshift(chart.point.from_index(visibleRight, yT))
ptsTop.unshift(chart.point.from_index(visibleRight + widthX, yT + depthY))
drawPoly(PolyParams.new(ptsTop, color.new(chart.fg_color, 90), color.new(bearCol, 70), 1))
else
array ptsFront = array.new()
ptsFront.sideBox(xR, yB, yT, depthY, widthX)
drawPoly(PolyParams.new(ptsFront, color.new(chart.fg_color, 90), color.new(bearCol, 70), 1))
if visibleRight > visibleLeft
float frac = bullPct / 100.0
int bullRight = visibleLeft + int((visibleRight - visibleLeft) * frac)
bullRight := math.max(visibleLeft, math.min(visibleRight, bullRight))
if bullPct > 0 and bullRight > visibleLeft
array ptsTopBull = array.new()
ptsTopBull.unshift(chart.point.from_index(bullRight + widthX, yT + depthY))
ptsTopBull.unshift(chart.point.from_index(visibleLeft + widthX, yT + depthY))
ptsTopBull.unshift(chart.point.from_index(visibleLeft, yT))
ptsTopBull.unshift(chart.point.from_index(bullRight, yT))
ptsTopBull.unshift(chart.point.from_index(bullRight + widthX, yT + depthY))
drawPoly(PolyParams.new(ptsTopBull, color.new(chart.fg_color, 90), color.new(bullCol, 70), 1))
if bullPct < 100 and visibleRight > bullRight
array ptsTopBear = array.new()
ptsTopBear.unshift(chart.point.from_index(visibleRight + widthX, yT + depthY))
ptsTopBear.unshift(chart.point.from_index(bullRight + widthX, yT + depthY))
ptsTopBear.unshift(chart.point.from_index(bullRight, yT))
ptsTopBear.unshift(chart.point.from_index(visibleRight, yT))
ptsTopBear.unshift(chart.point.from_index(visibleRight + widthX, yT + depthY))
drawPoly(PolyParams.new(ptsTopBear, color.new(chart.fg_color, 90), color.new(bearCol, 70), 1))
// Draws a full OB: zone, retest label, volume fill and 3D faces.
drawZoneAndVolume(ObRec ob) =>
= obColors(ob)
drawObZoneBox(ob, faded)
if showVD and ob.hasDelta
= obGeom(ob)
= deltaTexts(ob.bullPct, ob.bearPct)
drawTotalVolLabel(xL, xR, yT, yB, h, ob.totalVol)
drawDeltaFills(xL, xR, yT, yB, h, ob.bullPct, bullTxt, bearTxt)
if vd3D
drawDelta3D(xL, xR, widthX, xR2, yT, yB, h, ob.bullPct)
true
// Clear all previous drawings each bar before re-rendering current selection.
allBoxes.clearAll(allPolys, allLabels)
// Pick active and invalid OBs based on hideInvalid + showNearestX.
array bullActive = array.new_int()
array bearActive = array.new_int()
array bullInvalid = array.new_int()
array bearInvalid = array.new_int()
if hideInvalid
bullActive := pickNearest(obs, true, showNearestX, false)
bearActive := pickNearest(obs, false, showNearestX, false)
else
bullActive := pickNearest(obs, true, showNearestX, false)
bearActive := pickNearest(obs, false, showNearestX, false)
if obs.size() > 0
for i = 0 to obs.size() - 1
ObRec o = obs.get(i)
if not o.active
if o.isBull
bullInvalid.push(i)
else
bearInvalid.push(i)
if bearInvalid.size() > 0 and not hideInvalid
for i = 0 to bearInvalid.size() - 1
ObRec ob = obs.get(bearInvalid.get(i))
drawZoneAndVolume(ob)
if bearActive.size() > 0
for i = 0 to bearActive.size() - 1
ObRec ob = obs.get(bearActive.get(i))
drawZoneAndVolume(ob)
if bullInvalid.size() > 0 and not hideInvalid
for i = 0 to bullInvalid.size() - 1
ObRec ob = obs.get(bullInvalid.get(i))
drawZoneAndVolume(ob)
if bullActive.size() > 0
for i = 0 to bullActive.size() - 1
ObRec ob = obs.get(bullActive.get(i))
drawZoneAndVolume(ob)
// Draw all stored retest events on top of zones
drawRetestLabels(bullActive, bearActive, bullInvalid, bearInvalid)
//#endregion
//#region ALERTS
alertcondition(alBullOB and evNewBullOB, "Bullish Order Block", "New Bullish Order Block detected.")
alertcondition(alBearOB and evNewBearOB, "Bearish Order Block", "Bearish Order Block detected.")
alertcondition(alBullRetest and evBullRetest, "Bullish OB Retest", "Bullish Order Block retest.")
alertcondition(alBearRetest and evBearRetest, "Bearish OB Retest", "Bearish Order Block retest.")
if alBullOB and evNewBullOB
alert("Bullish Order Block detected.", alert.freq_once_per_bar)
if alBearOB and evNewBearOB
alert("Bearish Order Block detected.", alert.freq_once_per_bar)
if alBullRetest and evBullRetest
alert("Bullish Order Block retest.", alert.freq_once_per_bar)
if alBearRetest and evBearRetest
alert("Bearish Order Block retest.", alert.freq_once_per_bar)
//#endregion
// ╔════════════════════════════════╗
// ║ Download at ║
// ╚════════════════════════════════╝
// STRATEGY INDIBOT
// 2026/2027
// ==========================================================================================
// === Dashboard with Telegram Link ===
var table myTable = table.new(position.top_center, 1, 1, border_width=1, frame_color=color.black, bgcolor=color.white)
// Add Telegram Message to Dashboard
table.cell(myTable, 0, 0, "Join Telegram @STRATEGY INDIBOT", bgcolor=color.blue, text_color=color.white, text_size=size.normal)
lostsol Markets v5lostsol Markets v5 is a high-precision market architecture tool designed for traders who utilize institutional logic, SMC (Smart Money Concepts), and session-based liquidity strategies. Version 5 introduces a refined monochrome aesthetic and an expanded suite of "Market Maker Zones" to help you visualize where institutional orders are being engineered.
Core Architecture: Global Session Tiers
The indicator maps the 24-hour trading cycle into distinct institutional windows. Each session features dynamic range boxes that track real-time highs and lows, providing clear visual targets for liquidity sweeps.
New York (US): High-volatility window mapping the Western institutional open.
London (UK): The core liquidity session for FX and global equity drivers.
Asia: Sets the initial daily bias and overnight liquidity parameters.
Session Fibs: Toggleable Fibonacci levels (0.382, 0.5, 0.618) automatically calculated for every session range to find mean reversion points.
Market Maker Zones (MM Zones)
Version 5 places a heavy focus on the "Gaps" and "Traps" where retail traders often get caught on the wrong side of the trend.
Weekend Trap & Trapped Traders: A proprietary calculation that identifies price ranges where orders are locked over the weekend. It visualizes the "Trapped Traders" zone by comparing the Friday NY close to the weekend price action.
Asia Gap & Dump: Identifies the low-liquidity "dead zones" where institutional re-accumulation typically occurs before a London breakout.
Reversal Windows: Automated boxes for New York and UK "Mid-Gap" reversals, marking the high-probability time-slots for trend exhaustion.
Technical Features
Monochrome UI: Designed for professional dark-mode setups using a sophisticated monochrome base palette to reduce eye fatigue.
Session Bar HUD: A discrete bottom-bar visualization that shows upcoming and active session times without cluttering the price action.
Dynamic Timezone Alignment: Hardcoded for GMT-5 (NY Time) to ensure institutional windows align regardless of your local chart settings.
Wave Trend Dashboard (Beta): Optional dashboard toggle for high-level trend confluence.
How to Use
Liquidity Sweeps: Look for price to exit a session range (e.g., Asia) to "hunt" liquidity before reversing into a Market Maker Reversal Zone.
The Trap Logic: If price is trading within the Trapped Traders box at the New York open, expect a high-velocity breakout once that zone is cleared.
Range Confluence: Use the 50% (Mean Reversion) Fib line within the London or NY boxes to identify institutional "fair value" during a trending day.
Developer Note: This indicator is optimized for intraday timeframes (1m through 1h). For the best experience, ensure your chart is set to a dark theme to take full advantage of the monochrome transparency layers.
INDIBOT - ABO SALTAN //@version=5
indicator("INDIBOT", shorttitle = "INDIBOT", 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 (true , "Show swing point" , inline = "1", group = "High and Low" , tooltip = "Display swing point")
show_mtb = input.bool (true , "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.gray , "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 = 0 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
Regime ScoreRegime Score | Trend vs Chop Market Filter
Regime Score is a market regime detection indicator that tells you when to trade and when to stay out.
It does not predict direction.
It identifies whether the market is trend-friendly or choppy, helping you avoid low-quality trades and whipsaws.
Perfect for breakout traders, trend followers, and system traders.
Regime States
• Green (+1) → Trend-friendly environment (Enable breakout trades)
• Orange (0) → Transition / mixed regime (Reduce size or skip trades)
• Red (-1) → Choppy / hostile market (Stay flat)
Background coloring makes regime shifts easy to spot at a glance.
Designed Philosophy
• Observe-only filter
• No buy/sell signals
• No over-optimization
• Built to improve discipline and consistency
If your system performs well in trends but struggles in ranges, this indicator acts as a trade quality gate.
🚀 Final Thought
Regime Score helps you trade less, but better by aligning your strategy with the right market conditions.
If you believe market context matters more than signals, this tool belongs on your chart.
⭐ If you find it useful, consider liking or sharing to support further development.
Time-Segmented RVOLTime-Segmented RVOL
The Mathematical Flaw in Standard RVOL
Most Relative Volume (RVOL) indicators are built on a "Linear Scaling" hypothesis. They take the daily average and divide it by the number of bars in the day. This fails to account for the "Volume Smile"—the natural tendency for volume to be heavy at the open/close and dry up during mid-day. This leads to "False Highs" every morning and "False Lows" during lunch.
The Solution: Time-Slot Memory
This script uses a high-performance array to create a 20-Day Memory for every specific minute of the trading day.
Contextual Comparison: It compares the current 10:30 AM bar only to the previous twenty 10:30 AM bars.
Pre-Market Precision: Because it compares 4:00 AM volume to historical 4:00 AM volume, it can spot "early-bird" runners hours before the opening bell, identifying unusual interest when total volume is still low.
The Coherent Momentum Tiers
We have organized the color logic into four distinct, logical tiers to assist in rapid decision-making:
Cold (Blue): RVOL < 1.0 . Volume is below the historical average for this specific time slot.
Building (Green): RVOL 1.0 – 3.0. Active participation. The stock is "Awake" and moving with healthy, sustainable interest.
High Intensity (Yellow): RVOL 3.0 – 5.0. Extreme interest. The trade is becoming "crowded"; look for increased volatility.
Parabolic/Super High (Pink): RVOL > 5.0. Massive abnormality (5x+ normal volume). Common in small-cap "pumpers" and major institutional news events.
Trading Strategy: Spotting the "In-Play" Runner
The Awake Signal: Watch for a transition from Blue to Green. This confirms the ticker is "in-play" relative to its own 20-day history.
The Breakout: Look for Yellow or Pink bars accompanied by a price breakout from a consolidation zone. High RVOL confirms the move has real conviction.
Exhaustion (White X): The script includes built-in divergence tracking. If the price makes a new high but the RVOL bars are shrinking, a "White X" will appear. This suggests "Volume Exhaustion"—the fuel is running out.
Settings
Lookback (Days): Default is 20. This acts as a "Truth Filter" to ensure the baseline remains grounded in long-term reality rather than chasing short-term noise.
Custom Thresholds: Fully adjustable levels for the Green, Yellow, and Pink tiers to suit different asset classes (Small-caps vs. Mega-caps).
ELMEHDI VIP (v4.0) ABO SALTAN //@version=5
indicator(title = 'ELMEHDI VIP (v4.0) ABO SALTAN ', shorttitle = 'EL MEHDI KHEYI(v4.0)', overlay = true, max_boxes_count = 500, max_labels_count = 500, max_lines_count = 500, max_bars_back = 500, max_polylines_count = 100)
bullcolor = #339b44
bearcolor = #af3232
ema150 = ta.ema(close, 150)
ema250 = ta.ema(close, 250)
gr_customalert = "Custom Alerts"
gr_signal = "General Configurations"
gr_PullBacksignal = "Trading Assistants"
gr_RiskManage = "Risk Management"
gr_dash = "Dashboard Configurations"
//symbol info
symInfoCheck = false
symInfo = syminfo.ticker + ' | ' + timeframe.period + (timeframe.isminutes ? 'M' : na)
date = str.tostring(dayofmonth(time_close)) + '/' + str.tostring(month(time_close)) + '/' + str.tostring(year(time_close))
//text positioning
textVPosition = 'middle'
textHPosition = 'center'
//symbol info positioning
symVPosition = 'top'
symHPosition = 'left'
//cell size
width = 0
height1 = 0
//title settings
c_title = #b2b5be80
s_title = 'large'
a_title = 'center'
//subtitle settings
c_subtitle = #b2b5be80
s_subtitle = 'normal'
a_subtitle = 'center'
c_bg = color.new(color.blue, 100)
// Get user input
showSignals = input(true, "Show Signal's", group=gr_signal)
//showSignals = true
sensitivity = input.float(2.4, "Sensitivity", 0.1, step=0.1, group=gr_signal)
STuner = input.int(10, "Signal Tuner(1-25)", minval = 1, maxval = 25, group=gr_signal)
Presets = "All Signals"
//Presets = input.string("All Signals", "Presets", , group=gr_signal)
filterstyle = input.string("Trending Signals ", "Signal Mode / Filters", ["Trending Signals ", "Contrarian Signals ", "High Volume ", "Strong ", "Swing ", "Smooth ", "Scalping ", "Scalping+ "], group=gr_signal)
//TextStyle = input.string("Minimal", "Signal Style", , group=gr_signal)
//periodTrendCloud = input.string("Smooth", "Trend Cloud Style", , group=gr_Other_Settings)
TextStyle = "Minimal"
consSignalsFilter = filterstyle == "Trending Signals " ? true : false
StrongSignalsOnly = filterstyle == "Strong " ? true : false
highVolSignals = filterstyle == "High Volume " ? true : false
signalsTrendCloud = (filterstyle == "Smooth ") ? true : (filterstyle == "Scalping ") ? true : (filterstyle == "Scalping+ ") ? true : (filterstyle == "Swing ") ? true : false
ContrarianOnly = filterstyle == "Contrarian Signals " ? true : false
TrendMap = 'Trend Gradient'
momentumCandles = false
assistantenable = input(true,'', group=gr_PullBacksignal, inline = 'sexyshit')
assistantmode = input.string('Trend Assistant', 'Assistant | Mode', , group = gr_PullBacksignal, inline = 'sexyshit')
Show_PR = input.bool(true, title="", group = gr_PullBacksignal , inline = "Features1")
MSTuner = input.int(8, "Reversal Dot | Tuner(2-30)", minval = 2, maxval = 30, group=gr_PullBacksignal, inline = "Features1")
LongTrendAverage = assistantmode == 'Trend Tracker' and assistantenable == true ? true : false
analyscloud = assistantmode == 'Trend Assistant' and assistantenable == true ? true : false
showTrendCloud = (filterstyle == "Smooth ") ? true : (filterstyle == "Scalping ") ? true : (filterstyle == "Scalping+ ") ? true : (filterstyle == "Swing ") ? true : false
periodTrendCloud = (filterstyle == "Smooth ") ? "Smooth" : (filterstyle == "Scalping ") ? "Scalping" : (filterstyle == "Scalping+ ") ? "Scalping+" : (filterstyle == "Swing ") ? "Swing" : na
//ScalpingPlus = input(false, "Fast trend cloud", group=gr_Other_Settings)
//fastTrendCloudLen = input.int(55, "Fast trend cloud", 2, group=gr_Other_Settings)
fill(plot(showTrendCloud and periodTrendCloud == "Smooth" ? na : assistantenable == true and assistantmode == 'Trend Tracker' ? ema150 : na, "", na, editable=false), plot(showTrendCloud and periodTrendCloud == "Smooth" ? na : assistantenable == true and assistantmode == 'Trend Tracker' ? ema250 : na, "", na, editable=false), ema150 > ema250 ? color.new(bullcolor, 70) : ema150 < ema250 ? color.new(bearcolor, 70) : na)
showDashboard = input(true, "Smart Panel", group = gr_dash , inline = "Features1")
locationDashboard = input.string("Bottom Right", "Dashboard Location", , group = gr_dash , tooltip="Smart Panel")
sizeDashboard = input.string("Small", "Dashboard Size", , group = gr_dash , tooltip="Smart Panel")
tpLabels = input(true, "Dynamic Take Profit Lables", group=gr_RiskManage)
ShowTpSlAreas = input(true, "Show take Profit/Stop-loss Area", group=gr_RiskManage)
ShowTrailingSL = input(false, "Show trailing Stop-loss", group=gr_RiskManage)
usePercSL = input(false, "SL/TRAILING", inline="1", group=gr_RiskManage)
percTrailingSL = input.float(1, "", 0, step=0.1, inline="1", group=gr_RiskManage)
useTP1 = input(true, "", inline="1", group=gr_RiskManage)
multTP1 = input.float(1, "TP 1", 0, inline="1", group=gr_RiskManage)
useTP2 = input(true, "", inline="4", group=gr_RiskManage)
multTP2 = input.float(2, "TP 2", 0, inline="4", group=gr_RiskManage)
useTP3 = input(true, "", inline="4", group=gr_RiskManage)
multTP3 = input.float(3, "TP 3", 0, inline="4", group=gr_RiskManage)
ShowSwings = input(false, "Show Market Structure", inline="3", group=gr_RiskManage)
periodSwings = input.int(10, "", 2, inline="3", group=gr_RiskManage)
//showTS = input(title='Show Trend Shifter', defval=false, group='Contrarian SIGNALS')
// showsignals = input(title='Show Signals', defval=false, group='Contrarian SIGNALS')
// Alerts Managemnt
Normalbuy_alert = input.bool(title='Buy Signal', defval=false, inline = "NB", group=gr_customalert)
Strongbuy_alert = input.bool(title='Strong Buy', defval=true, inline = "NB", group=gr_customalert)
Normalsell_alert = input.bool(title='Sell Signal', defval=false , inline = "NS", group=gr_customalert)
Strongsell_alert = input.bool(title='Strong Sell', defval=true , inline = "NS", group=gr_customalert)
slalert = input.bool(title='Stop-Loss', defval=true , inline = "SLTP1", group=gr_customalert)
tp1alert = input.bool(title='Target 1', defval=true , inline = "SLTP1", group=gr_customalert)
tp2alert = input.bool(title='Target 2', defval=true , inline = "TP2TP3", group=gr_customalert)
tp3alert = input.bool(title='Target 3', defval=true , inline = "TP2TP3", group=gr_customalert)
bullcrosscloud_alert = input.bool(title='Bullish Cloud', defval=false, inline = "CD", group=gr_customalert)
bearcrosscloud_alert = input.bool(title='Bearish Cloud', defval=false, inline = "CD", group=gr_customalert)
showCons = false
paintCons = false
// Signal Text
SimpleBuy = "Buy"
StrongB = "Strong Buy"
SimpleSell = "Sell"
StrongS = "Strong Sell"
if TextStyle == "Normal"
SimpleBuy := "Buy"
StrongB := "BUY"
SimpleSell:= "Sell"
StrongS := "Strong Sell"
if TextStyle == "Minimal"
SimpleBuy := "⬆️"
StrongB := "⬆️⬆️"
SimpleSell:= "⬇️"
StrongS := "⬇️⬇️"
// Signal Text Color
// bullsignalcolor = #ffffff
// bearsignalcolor = color.rgb(255, 255, 255)
// if TextStyle == "Normal"
// bullsignalcolor := color.rgb(255, 255, 255)
// bearsignalcolor := color.rgb(255, 255, 255)
// if TextStyle == "Minimal"
// bullsignalcolor := color.rgb(255, 255, 255)
// bearsignalcolor := color.rgb(255, 255, 255)
src = close
RSII = ta.ema(ta.rsi(src, 50), 30)
TR = math.abs(RSII - RSII )
wwalpha = 1 / 50
WWMA = 0.0
WWMA := wwalpha * TR + (1 - wwalpha) * nz(WWMA )
ATRRSI = 0.0
ATRRSI := wwalpha * WWMA + (1 - wwalpha) * nz(ATRRSI )
TsFast = ta.ema(ta.rsi(src, 50), 30)
TsUP = TsFast + ATRRSI * 4.236
TsDN = TsFast - ATRRSI * 4.236
textWatermark = table.new(textVPosition + '_' + textHPosition, 1, 3)
TsSlow = 0.0
TsSlow := TsUP < nz(TsSlow ) ? TsUP : TsFast > nz(TsSlow ) and TsFast < nz(TsSlow ) ? TsDN : TsDN > nz(TsSlow ) ? TsDN : TsDN < nz(TsSlow ) and TsFast > nz(TsSlow ) ? TsUP : nz(TsSlow )
Colorh = TsFast > 55 ? color.rgb(255, 0, 0) : TsFast < 45 ? color.rgb(0, 255, 8) : #ffffff
//QQF = plot(TsFast, 'TS FAST', color=color.new(color.maroon, 100), linewidth=2, display=display.none, editable = false)
//QQS = plot(TsSlow, 'TS SLOW', color=color.new(color.white, 100), linewidth=2, display=display.none , editable = false)
//plot(TsFast, color=Colorh, linewidth=2, style=plot.style_area, histbase=50)
//BearLimit = hline(60, color=color.gray, linestyle=hline.style_dashed)
//BullLimt = hline(40, color=color.gray, linestyle=hline.style_dashed)
bulllim = 45
bearlim = 55
BullSignalr = ta.crossover(TsFast, TsSlow) and TsFast < bulllim
BearSignallr = ta.crossunder(TsFast, TsSlow) and TsFast > bearlim
/////////////////////////////////////////////////////////
// Trap Detector
////////////////////////////////////////////////////////
// Functions
wavetrend(src, chlLen, avgLen) =>
esa = ta.ema(src, chlLen)
d = ta.ema(math.abs(src - esa), chlLen)
ci = (src - esa) / (0.015 * d)
wt1 = ta.ema(ci, avgLen)
wt2 = ta.sma(wt1, 3)
f_top_fractal(src) => src < src and src < src and src > src and src > src
f_bot_fractal(src) => src > src and src > src and src < src and src < src
f_fractalize (src) => f_top_fractal(src) ? 1 : f_bot_fractal(src) ? -1 : 0
f_findDivs(src, topLimit, botLimit) =>
fractalTop = f_fractalize(src) > 0 and src >= topLimit ? src : na
fractalBot = f_fractalize(src) < 0 and src <= botLimit ? src : na
highPrev = ta.valuewhen(fractalTop, src , 0)
highPrice = ta.valuewhen(fractalTop, high , 0)
lowPrev = ta.valuewhen(fractalBot, src , 0)
lowPrice = ta.valuewhen(fractalBot, low , 0)
bearSignal = fractalTop and high > highPrice and src < highPrev
bullSignal = fractalBot and low < lowPrice and src > lowPrev
// Get components
= wavetrend(close, 5*MSTuner, 10*MSTuner)
= f_findDivs(wt2, 10, -35)
= f_findDivs(wt2, 40, -70)
wtDivBull = wtDivBull1 or wtDivBull2
wtDivBear = wtDivBear1 or wtDivBear2
plotshape(ta.crossover(wt1, wt2) and Show_PR and wt2 <= -60)
plotshape(ta.crossunder(wt1, wt2) and Show_PR and wt2 >= 60)
rsi = ta.rsi(close ,14)
// Functions
f_chartTfInMinutes() =>
float _resInMinutes = timeframe.multiplier * (
timeframe.isseconds ? 1. / 60 :
timeframe.isminutes ? 1. :
timeframe.isdaily ? 60. * 24 :
timeframe.isweekly ? 60. * 24 * 7 :
timeframe.ismonthly ? 60. * 24 * 30.4375 : na)
atr(len) =>
tr = ta.tr
atr = 0.0
atr := nz(atr + (tr - atr ) / len, tr)
supertrend(src, factor, len) =>
atr = ta.atr(len)
upperBand = src + factor * atr
lowerBand = src - factor * atr
prevLowerBand = nz(lowerBand )
prevUpperBand = nz(upperBand )
lowerBand := lowerBand > prevLowerBand or close < prevLowerBand ? lowerBand : prevLowerBand
upperBand := upperBand < prevUpperBand or close > prevUpperBand ? upperBand : prevUpperBand
int direction = na
float superTrend = na
prevSuperTrend = superTrend
if prevSuperTrend == prevUpperBand
direction := close > upperBand ? 1 : -1
else
direction := close < lowerBand ? -1 : 1
superTrend := direction == 1 ? lowerBand : direction == -1 ? upperBand : na
dchannel(len)=>
hh = ta.highest(len)
ll = ta.lowest (len)
trend = 0
trend := close > hh ? 1 : close < ll ? -1 : nz(trend )
trendScalper(show, len1, len2, len3, colorBull, colorBear, colorBarBull, colorBarBear) =>
avgOC = math.avg(open, close)
ha_o = 0.0, ha_o := na(ha_o ) ? avgOC : (ha_o + ohlc4 ) / 2
ema1 = ta.ema(ha_o, len1), ema2 = ta.ema(ha_o, len2), ema3 = ta.ema(ha_o, len3)
ris1 = ema1 > ema1 , ris2 = ema2 > ema2 , ris3 = ema3 > ema3
fal1 = ema1 < ema1 , fal2 = ema2 < ema2 , fal3 = ema3 < ema3
colorEma1 = ris1 ? colorBull : fal1 ? colorBear : na, colorEma2 = ris2 ? colorBull : fal2 ? colorBear : na, colorEma3 = ris3 ? colorBull : fal3 ? colorBear : na
fillEma1 = avgOC > ema1 ? colorBull : avgOC < ema1 ? colorBear : na, fillEma2 = ema1 > ema2 ? colorBull : ema1 < ema2 ? colorBear : na, fillEma3 = ema2 > ema3 ? colorBull : ema2 < ema3 ? colorBear : na
colorBar = close < ema1 and close < ema2 ? colorBarBear : colorBarBull
candlesMom() =>
= ta.macd(close, 2, 4, 3)
(macd > 10 and macd > macd ) or (macd < 10 and macd < macd )
trailingSL(buy, sell, factor, len, usePerc, perc) =>
atr = atr(len)
upperBand = high + (usePerc ? high * (perc / 100) : factor * atr)
lowerBand = low - (usePerc ? low * (perc / 100) : factor * atr)
prevLowerBand = nz(lowerBand )
prevUpperBand = nz(upperBand )
lowerBand := lowerBand > prevLowerBand or buy ? lowerBand : prevLowerBand
upperBand := upperBand < prevUpperBand or sell ? upperBand : prevUpperBand
int direction = na
float stop = na
prevSuperTrend = stop
if prevSuperTrend == prevUpperBand
direction := buy ? 1 : -1
else
direction := sell ? -1 : 1
stop := direction == 1 ? lowerBand : direction == -1 ? upperBand : na
add_to_zz(zz, val, bi) =>
array.unshift(zz, bi)
array.unshift(zz, val)
if array.size(zz) > 12
array.pop(zz)
update_zz(zz, val, bi, dir) =>
if array.size(zz) == 0
add_to_zz(zz, val, bi)
else
if dir == 1 and val > array.get(zz, 0) or dir == -1 and val < array.get(zz, 0)
array.set(zz, 0, val)
array.set(zz, 1, bi)
0
// Get components
vosc = ta.obv - ta.ema(ta.obv, 20)
bs = ta.ema(nz(math.abs((open - close) / (high - low) * 100)), 3)
ema = ta.ema(close, 200)
emaBull = close > ema
equal_tf(res) => str.tonumber(res) == f_chartTfInMinutes()
higher_tf(res) => str.tonumber(res) > f_chartTfInMinutes()
too_small_tf(res) => (timeframe.isweekly and res=="1") or (timeframe.ismonthly and str.tonumber(res) < 10)
securityNoRep(sym, res, src) =>
bool bull = na
bull := equal_tf(res) ? src : bull
bull := higher_tf(res) ? request.security(sym, res, src, barmerge.gaps_off, barmerge.lookahead_off) : bull
bull_array = request.security_lower_tf(syminfo.tickerid, higher_tf(res) ? str.tostring(f_chartTfInMinutes()) : too_small_tf(res) ? (timeframe.isweekly ? "3" : "10") : res, src)
if array.size(bull_array) > 1 and not equal_tf(res) and not higher_tf(res)
bull := array.pop(bull_array)
array.clear(bull_array)
bull
//TF1Bull = securityNoRep(syminfo.tickerid, "1" , emaBull)
//TF3Bull = securityNoRep(syminfo.tickerid, "3" , emaBull)
TF5Bull = securityNoRep(syminfo.tickerid, "5" , emaBull)
//TF10Bull = securityNoRep(syminfo.tickerid, "10" , emaBull)
TF15Bull = securityNoRep(syminfo.tickerid, "15" , emaBull)
TF30Bull = securityNoRep(syminfo.tickerid, "30" , emaBull)
TF60Bull = securityNoRep(syminfo.tickerid, "60" , emaBull)
//TF120Bull = securityNoRep(syminfo.tickerid, "120" , emaBull)
TF240Bull = securityNoRep(syminfo.tickerid, "240" , emaBull)
//TF720Bull = securityNoRep(syminfo.tickerid, "720" , emaBull)
//TFDBull = securityNoRep(syminfo.tickerid, "1440", emaBull)
hma55 = ta.hma(close, 55 )
= ta.macd(close, 12, 26, 9)
supertrend = supertrend(close, sensitivity, STuner)
maintrend = dchannel(30)
confBull = (ta.crossover (close, supertrend) or (ta.crossover (close, supertrend) and maintrend < 0)) and macd > 0 and macd > macd and ema150 > ema250 and hma55 > hma55 and maintrend > 0
confBear = (ta.crossunder(close, supertrend) or (ta.crossunder(close, supertrend) and maintrend > 0)) and macd < 0 and macd < macd and ema150 < ema250 and hma55 < hma55 and maintrend < 0
trendcloud = supertrend(ohlc4, periodTrendCloud == "Swing" ? 7 : 4, 10)
hma = periodTrendCloud == "Scalping+" ? ta.hma(close, 55) : na
none = close > 0
= ta.dmi(14, 14)
consFilter = adx > 20
ContBear = TsFast > 65
ContBull = TsFast < 35
StrongFilter = ta.ema(close, 200)
//volFilter = (ta.ema(volume, 25) - ta.ema(volume, 26)) / ta.ema(volume, 26) > 0
volFilter = (ta.ema(volume, 15) - ta.ema(volume, 20)) / ta.ema(volume, 25) > 0
trendFilter = trendcloud
bull = (Presets == "All Signals" ? ta.crossover (close, supertrend) : confBull and not confBull ) and Presets != "Trend Scalper" and (StrongSignalsOnly ? close > StrongFilter : none) and (ContrarianOnly ? ContBull : none) and (consSignalsFilter ? consFilter : none) and (highVolSignals ? volFilter : none) and (signalsTrendCloud ? (periodTrendCloud == "Smooth" ? ema150 > ema250 : close > trendFilter) : none)
bear = (Presets == "All Signals" ? ta.crossunder(close, supertrend) : confBear and not confBear ) and Presets != "Trend Scalper" and (StrongSignalsOnly ? close < StrongFilter : none) and (ContrarianOnly ? ContBear : none) and (consSignalsFilter ? consFilter : none) and (highVolSignals ? volFilter : none) and (signalsTrendCloud ? (periodTrendCloud == "Smooth" ? ema150 < ema250 : close < trendFilter) : none)
countBull = ta.barssince(bull)
countBear = ta.barssince(bear)
trigger = nz(countBull, bar_index) < nz(countBear, bar_index) ? 1 : 0
= trendScalper(Presets == "Trend Scalper" ? true : false, 5, 9, 21, bullcolor, bearcolor, bullcolor, bearcolor)
trailingStop = trailingSL(bull, bear, 2.2, 14, usePercSL, percTrailingSL)
float _ph = ta.highestbars(high, periodSwings) == 0 ? high : na
float _pl = ta.lowestbars (low, periodSwings) == 0 ? low : na
var _dir = 0, dir_ = _pl and na(_ph) ? -1 : _dir, _dir := _ph and na(_pl) ? 1 : dir_, dirChg = ta.change(_dir)
var zz = array.new_float(0), zzOld = array.copy(zz)
float zzLive = _ph or _pl ? (dirChg ? add_to_zz(zz, _dir == 1 ? _ph : _pl, bar_index) : update_zz(zz, _dir == 1 ? _ph : _pl, bar_index, _dir)) : na
float hb_ = ta.highestbars(10) == 0 ? high : na
float lb_ = ta.lowestbars (10) == 0 ? low : na
var int dir = 0
float zz_ = na
float pp = na
var int consCnt = 0
var float condHi = na
var float condLo = na
float H_ = ta.highest(5)
float L_ = ta.lowest (5)
var line lineUp = na
var line lineDn = na
bool breakUp = false
bool breakDn = false
var float pvh1_price = array.new_float(1000, na)
var int pvh1_time = array.new_int (1000, na)
var float pvl1_price = array.new_float(1000, na)
var int pvl1_time = array.new_int (1000, na)
var float pvh2_price = array.new_float(1000, na)
var int pvh2_time = array.new_int (1000, na)
var float pvl2_price = array.new_float(1000, na)
var int pvl2_time = array.new_int (1000, na)
var float htcmrll_price = na
var int htcmrll_time = na
var float ltcmrhh_price = na
var int ltcmrhh_time = na
var box long_boxes = array.new_box()
var box short_boxes = array.new_box()
var float temp_pv_0 = na
var float temp_pv_1 = na
var float temp_pv_2 = na
bool pvh = high < high and high > high
bool pvl = low > low and low < low
int pv1_time = bar_index
float pv1_high = high
float pv1_low = low
var buyBars = array.new_box(365, na)
for i = 0 to 364
box.delete(array.get(buyBars, i))
var sellBars = array.new_box(365, na)
for i = 0 to 364
box.delete(array.get(sellBars, i))
// Colors
green = bullcolor, green50 = color.new(green, 50), green20 = color.new(green, 80)
red = bearcolor, red50 = color.new(red, 50), red20 = color.new(red, 80)
silver = #B2B5BE, silver50 = color.new(silver, 50), silver20 = color.new(silver, 80)
// Plots
atrBand = usePercSL ? (trigger ? low : high) * (percTrailingSL / 100) : ta.atr(14) * 2.2
atrStop = trigger ? low - atrBand : high + atrBand
lastTrade(src) => ta.valuewhen(bull or bear, src, 0)
entry_y = lastTrade(close)
stop_y = lastTrade(atrStop)
tp1_y = (entry_y-lastTrade(atrStop))*multTP1 + entry_y
tp2_y = (entry_y-lastTrade(atrStop))*multTP2 + entry_y
tp3_y = (entry_y-lastTrade(atrStop))*multTP3 + entry_y
labelTpSl(cond, y, txt, color) =>
label labelTpSl = ShowTpSlAreas and cond ? label.new(bar_index + 1, y, txt, xloc.bar_index, yloc.price, color, label.style_label_left, color.white, size.normal) : na
label.delete(labelTpSl )
labelTpSl(none, entry_y, "Entry : " + str.tostring(math.round_to_mintick(entry_y)), #089981)
labelTpSl(none, stop_y , "Stop loss : " + str.tostring(math.round_to_mintick(atrStop)), bearcolor)
labelTpSl(useTP1 and multTP1 != 0, tp1_y, "TP 1 : " + str.tostring(math.round_to_mintick(tp1_y)), #089981)
labelTpSl(useTP2 and multTP2 != 0, tp2_y, "TP 2 : " + str.tostring(math.round_to_mintick(tp2_y)), #089981)
labelTpSl(useTP3 and multTP3 != 0, tp3_y, "TP 3 : " + str.tostring(math.round_to_mintick(tp3_y)), #089981)
lineTpSl(cond, y, color, style) =>
line lineTpSl = ShowTpSlAreas and cond ? line.new(bar_index - (trigger ? countBull : countBear), y, bar_index + 1, y, xloc.bar_index, extend.none, color, style) : na
line.delete(lineTpSl )
lineTpSl(none, entry_y, #089981, line.style_dashed)
lineTpSl(none, stop_y , bearcolor , line.style_solid )
lineTpSl(useTP1 and multTP1 != 0, tp1_y, bullcolor, line.style_dotted)
lineTpSl(useTP2 and multTP2 != 0, tp2_y, bullcolor, line.style_dotted)
lineTpSl(useTP3 and multTP3 != 0, tp3_y, bullcolor, line.style_dotted)
//buy = showSignals and bull ? label.new(bar_index, low , close > StrongFilter ? StrongB : SimpleBuy , xloc.bar_index, yloc.belowbar, bullcolor, label.style_label_up , color.rgb(255, 255, 255), size.normal) : na
//sell = showSignals and bear ? label.new(bar_index, high, close < StrongFilter ? StrongS : SimpleSell , xloc.bar_index, yloc.abovebar, bearcolor , label.style_label_down, color.rgb(255, 255, 255), size.normal) : na
buy = (showSignals and bull ? label.new(bar_index, low , close > StrongFilter ? StrongB : SimpleBuy , xloc.bar_index, yloc.belowbar, bullcolor, label.style_label_up , color.rgb(255, 255, 255), size.normal) : na)
sell = showSignals and bear ? label.new(bar_index, high, close < StrongFilter ? StrongS : SimpleSell , xloc.bar_index, yloc.abovebar, bearcolor , label.style_label_down, color.rgb(255, 255, 255), size.normal) : na
tpLabels(tp) =>
tp1Bull = ta.crossover (rsi, 70), tp2Bull = ta.crossover (rsi, 75), tp3Bull = ta.crossover (rsi, 80)
tp1Bull := tp1Bull and (nz(ta.barssince(tp1Bull) , 9999) > countBull), tp2Bull := tp2Bull and (ta.barssince(tp1Bull) <= countBull), tp2Bull := tp2Bull and (nz(ta.barssince(tp2Bull) , 9999) > countBull), tp3Bull := tp3Bull and (ta.barssince(tp2Bull) <= countBull), tp3Bull := tp3Bull and (nz(ta.barssince(tp3Bull) , 9999) > countBull)
tp1Bear = ta.crossunder(rsi, 30), tp2Bear = ta.crossunder(rsi, 25), tp3Bear = ta.crossunder(rsi, 20)
tp1Bear := tp1Bear and (nz(ta.barssince(tp1Bear) , 9999) > countBear), tp2Bear := tp2Bear and (ta.barssince(tp1Bear) <= countBear), tp2Bear := tp2Bear and (nz(ta.barssince(tp2Bear) , 9999) > countBear), tp3Bear := tp3Bear and (ta.barssince(tp2Bear) <= countBear), tp3Bear := tp3Bear and (nz(ta.barssince(tp3Bear) , 9999) > countBear)
if Presets != "Trend Scalper" and tpLabels
trigger ? (tp == 1 ? tp1Bull : tp == 2 ? tp2Bull : tp3Bull) : (tp == 1 ? tp1Bear : tp == 2 ? tp2Bear : tp3Bear)
plotshape(tpLabels(1), "", shape.xcross, location.abovebar, trigger ? green : na , 0, "TP 1", trigger ? green : na , true)
plotshape(tpLabels(2), "", shape.xcross, location.abovebar, trigger ? green : na , 0, "TP 2", trigger ? green : na , false)
plotshape(tpLabels(3), "", shape.xcross, location.abovebar, trigger ? green : na , 0, "TP 3", trigger ? green : na , false)
plotshape(tpLabels(1), "", shape.xcross, location.belowbar, trigger ? na : red, 0, "TP 1", trigger ? na : red, true)
plotshape(tpLabels(2), "", shape.xcross, location.belowbar, trigger ? na : red, 0, "TP 2", trigger ? na : red, false)
plotshape(tpLabels(3), "", shape.xcross, location.belowbar, trigger ? na : red, 0, "TP 3", trigger ? na : red, false)
var label zzLabel = na
if array.size(zz) > 12 and ShowSwings
if array.get(zz, 0) != array.get(zzOld, 0) or array.get(zz, 1) != array.get(zzOld, 1)
if array.get(zz, 2) == array.get(zzOld, 2) and array.get(zz, 3) == array.get(zzOld, 3)
label.delete(zzLabel)
zzLabel := label.new(math.round(array.get(zz, 1)), array.get(zz, 0), _dir == 1 ? array.get(zz, 0) > array.get(zz, 4) ? ((array.get(zz, 4) < array.get(zz, 8)) ? "High" : "HH") : "LH" : array.get(zz, 0) < array.get(zz, 4) ? ((array.get(zz, 4) > array.get(zz, 8)) ? "Low" : "LL") : "HL", xloc.bar_index, yloc.price, color.new(color.white, 100), _dir == 1 ? label.style_label_down : label.style_label_up, _dir == 1 ? bullcolor : bearcolor)
if showCons and barstate.isconfirmed
dir := hb_ and na(lb_) ? 1 : lb_ and na(hb_) ? -1 : dir
if hb_ and lb_
if dir == 1
zz_ := hb_
else
zz_ := lb_
else
zz_ := hb_ ? hb_ : lb_ ? lb_ : na
for x = 0 to 1000
if na(close) or dir != dir
break
if zz_
if na(pp)
pp := zz_
else
if dir == 1 and zz_ > pp
pp := zz_
if dir == -1 and zz_ < pp
pp := zz_
if pp != pp
if consCnt > 5
if pp > condHi
breakUp := true
if pp < condLo
breakDn := true
if consCnt > 0 and pp <= condHi and pp >= condLo
consCnt += 1
else
consCnt := 0
else
consCnt += 1
if consCnt >= 5
if consCnt == 5
condHi := H_
condLo := L_
else
line.delete(lineUp)
line.delete(lineDn)
condHi := math.max(condHi, high)
condLo := math.min(condLo, low )
lineUp := line.new(bar_index, condHi , bar_index - consCnt, condHi , color=bearcolor , style=line.style_dashed)
lineDn := line.new(bar_index, condLo , bar_index - consCnt, condLo , color=color.lime, style=line.style_dashed)
fill(plot(condHi, "", na, 1, plot.style_stepline, editable=false), plot(condLo, "", na, 1, plot.style_stepline, editable=false), paintCons and consCnt > 5 ? color.white : na, "", false)
//buy_col = color.new(#0ac20a,0)
//sell_col = color.new(#fd1605,0)
//text_col = color.new(#FFFFFF,0)
// -------- Bearish trend (blue) color selection --------
// getSellColor(count) =>
// if count == 1
// color.new(#11e7f2,0)
// else
// if count == 2
// color.new(#11d9f2,0)
// else
// if count == 3
// color.new(#11cbf2,0)
// else
// if count == 4
// color.new(#11aff2,0)
// else
// if count == 5
// color.new(#1193f2,0)
// else
// if count == 6
// color.new(#1176f2,0)
// else
// if count == 7
// color.new(#105df4,0)
// else
// if count == 8
// color.new(#1051f5,0)
// else
// if count == 9
// color.new(#0f44f5,0)
// else
// if count == 10
// color.new(#0c3de0,0)
// else
// if count == 11
// color.new(#0935ca,0)
// else
// if count == 12
// color.new(#062eb4,0)
// else
// if count == 13
// color.new(#02269e,0)
// -------- Bullish trend (blue) color selection --------
// getBuyColor(count) =>
// if count == 1
// color.new(#eef211,0)
// else
// if count == 2
// color.new(#efdc11,0)
// else
// if count == 3
// color.new(#f0c511,0)
// else
// if count == 4
// color.new(#f1af11,0)
// else
// if count == 5
// color.new(#f29811,0)
// else
// if count == 6
// color.new(#f28811,0)
// else
// if count == 7
// color.new(#f27811,0)
// else
// if count == 8
// color.new(#f26811,0)
// else
// if count == 9
// color.new(#f25811,0)
// else
// if count == 10
// color.new(#ea420d,0)
// else
// if count == 11
// color.new(#e12c09,0)
// else
// if count == 12
// color.new(#d81605,0)
// else
// if count == 13
// color.new(#cf0000,0)
// -------- Calculate bearish trend sequence --------
buySetup = 0
buySetup := close < close ? buySetup == 13 ? 1 : buySetup + 1 : 0
// -------- Calculate bullish trend sequence --------
sellSetup = 0
sellSetup := close > close ? sellSetup == 13 ? 1 : sellSetup + 1 : 0
// -------- Paint bars --------
//barColour = buySetup >= 1 ? getBuyColor(buySetup) : sellSetup >= 1 ? getSellColor(sellSetup) : na
// Candle Coloring
// Input
FastteyLength = 12
SjlowLeyLength = 26
srrrc = close
signalXLength = 9
// Data reference
= ta.macd(srrrc, FastteyLength, SjlowLeyLength, signalXLength)
// 4 level of green
greenHigh = #7bff00
greenMidHigh = #7bff00
greenMidLow = #7bff00
greenLow = #7bff00
// Yellow
yellowLow = #693d8e
// 4 level of red
redHigh = #ff0000
redMidHigh = #ff0000
redMidLow = #ff0000
redLow = #ff0000
// Default color
candleBody = yellowLow
// Ranging trend
if histX > 0
if histX > histX and histX > 0
candleBody := greenLow
if histX < 0
if histX < histX and histX < 0
candleBody := redLow
// Bullish trend
if MacdX > 0 and histX > 0
candleBody := greenMidLow
if histX > histX and MacdX > 0 and histX > 0
candleBody := greenMidHigh
if histX > histX and MacdX > 0 and histX > 0
candleBody := greenHigh
// Bearish trend
if MacdX < 0 and histX < 0
candleBody := redMidLow
if histX < histX and MacdX < 0 and histX < 0
candleBody := redMidHigh
if histX < histX and MacdX < 0 and histX < 0
candleBody := redHigh
barcolor(candleBody)
//barcolor(TrendMap == 'RSI Gradient' ? barColour : na, title='Bar colors (heatmap)',editable=false)
//barcolor(momentumCandles and candlesMom() ? color.rgb(187, 187, 187) : TrendMap == 'Signal Based' ? (Presets == "Trend Scalper" ? colorBar : na(countBull) and na(countBear) ? color.gray : trigger ? bullcolor : bearcolor) : TrendMap == 'RSI Gradient' ? barColour : TrendMap == 'Trend Gradient' ? candleBody : na , editable=false)
//plotcandle(open, high, low, close , color = momentumCandles and candlesMom() ? color.rgb(187, 187, 187) : TrendMap == 'Signal Based' ? (Presets == "Trend Scalper" ? colorBar : na(countBull) and na(countBear) ? color.gray : trigger ? bullcolor : bearcolor) : TrendMap == 'RSI Gradient' ? barColour : TrendMap == 'Trend Gradient' ? candleBody : na , editable=false , wickcolor = momentumCandles and candlesMom() ? color.rgb(187, 187, 187) : TrendMap == 'Signal Based' ? (Presets == "Trend Scalper" ? colorBar : na(countBull) and na(countBear) ? color.gray : trigger ? bullcolor : bearcolor) : TrendMap == 'RSI Gradient' ? barColour : TrendMap == 'Trend Gradient' ? candleBody : na , editable=false , bordercolor = momentumCandles and candlesMom() ? color.rgb(187, 187, 187) : TrendMap == 'Signal Based' ? (Presets == "Trend Scalper" ? colorBar : na(countBull) and na(countBear) ? color.gray : trigger ? bullcolor : bearcolor) : TrendMap == 'RSI Gradient' ? barColour : TrendMap == 'Trend Gradient' ? candleBody : na , editable=false , editable = false)
fill(plot(showTrendCloud and periodTrendCloud == "Smooth" ? ema150 : na, "", na, editable=false), plot(showTrendCloud and periodTrendCloud == "Smooth" ? ema250 : na, "", na, editable=false), ema150 > ema250 ? color.new(bullcolor, 70) : ema150 < ema250 ? color.new(bearcolor, 70) : na)
plot(ShowTrailingSL and trigger and nz(ta.barssince(low < trailingStop), bar_index) > countBull ? trailingStop : na, "", green, 1, plot.style_linebr, editable=false)
plot(ShowTrailingSL and not trigger and nz(ta.barssince(high > trailingStop), bar_index) > countBear ? trailingStop : na, "", red , 1, plot.style_linebr, editable=false)
p0 = plot(avgOC, "", na , editable=false)
p1 = plot(ema5 , "", colorEma5 , editable=false)
p2 = plot(ema9 , "", colorEma9 , editable=false)
p3 = plot(ema21, "", colorEma21, editable=false)
plot(LongTrendAverage ? ta.ema(close, 250) : na, 'Trend Tracer', linewidth=2, color=close > ta.ema(close, 250) ? color.new(bullcolor, 45) : color.new(bearcolor, 45))
fill(p0, p1, fillEma5 )
fill(p1, p2, fillEma9 )
fill(p2, p3, fillEma21)
fill(plot(showTrendCloud and periodTrendCloud != "Smooth" and periodTrendCloud != "Scalping+" and trendcloud != 0 and close > trendcloud ? trendcloud : na, "", bullcolor, 1, plot.style_linebr, editable=false), p0, color.new(bullcolor, 90))
fill(plot(showTrendCloud and periodTrendCloud != "Smooth" and periodTrendCloud != "Scalping+" and trendcloud != 0 and close < trendcloud ? trendcloud : na, "", bearcolor , 1, plot.style_linebr, editable=false), p0, color.new(bearcolor , 90))
//fill(plot(hma, "", hma > hma ? green : hma < hma ? red : na, editable=false), plot(hma , "", hma > hma ? green : hma < hma ? red : na, editable=false), hma > hma ? green : hma < hma ? red : na)
////////////////////////////////////////////////////////////////////////////////////////////////
// Get user input
indicatorTF = "Chart"
// Functions
sqz(bbLen, bbMult, kcLen, kcMult, source) =>
upperBB = ta.sma(source, bbLen) + ta.stdev(source, bbLen) * bbMult
lowerBB = ta.sma(source, bbLen) - ta.stdev(source, bbLen) * bbMult
upperKC = ta.sma(source, kcLen) + ta.sma(ta.tr, kcLen) * kcMult
lowerKC = ta.sma(source, kcLen) - ta.sma(ta.tr, kcLen) * kcMult
sqzOn = lowerBB > lowerKC and upperBB < upperKC
sqzOff = lowerBB < lowerKC and upperBB > upperKC
qqe(rsiLen, rsiSmooth, factor, source, bbLen, bbMult) =>
rsiMa = ta.ema(ta.rsi(source, rsiLen), rsiSmooth)
delta = ta.ema(ta.ema(math.abs(ta.mom(rsiMa, 1)), rsiLen * 2 - 1), rsiLen * 2 - 1) * factor
longBand = 0.0, longBand := rsiMa > longBand and rsiMa > longBand ? math.max(longBand , rsiMa - delta) : rsiMa - delta
shortBand = 0.0, shortBand := rsiMa < shortBand and rsiMa < shortBand ? math.min(shortBand , rsiMa + delta) : rsiMa + delta
cross1 = ta.cross(rsiMa, shortBand )
cross2 = ta.cross(rsiMa, longBand )
trend = 0.0, trend := cross1 ? 1 : cross2 ? -1 : nz(trend , 1)
fastDelta = trend == 1 ? longBand : shortBand
_hist = rsiMa - 50
_line = fastDelta - 50
= ta.bb(_line, bbLen, bbMult)
// Get components
cond(_offset) =>
top = ta.highest(high, 10)
bot = ta.lowest(low, 10)
osc = ta.ema(hlc3, 5) - ta.ema(ohlc4, 20)
oscRis = osc > osc
oscFal = osc < osc
oscA0 = osc > 0
oscB0 = osc < 0
oscTop = oscFal and oscRis
oscBot = oscRis and oscFal
bullR = oscB0 and oscBot and ((osc > ta.valuewhen(oscB0 and oscBot, osc, 1) and bot < ta.valuewhen(oscB0 and oscBot, bot, 1)))
bearR = oscA0 and oscTop and ((osc < ta.valuewhen(oscA0 and oscTop, osc, 1) and top > ta.valuewhen(oscA0 and oscTop, top, 1)))
bullH = oscB0 and oscBot and ((osc < ta.valuewhen(oscB0 and oscBot, osc, 1) and bot > ta.valuewhen(oscB0 and oscBot, bot, 1)))
bearH = oscA0 and oscTop and ((osc > ta.valuewhen(oscA0 and oscTop, osc, 1) and top < ta.valuewhen(oscA0 and oscTop, top, 1)))
= sqz(20, 2, 20, 2, close)
= qqe(6, 6, 3, close, 50, 0.001)
= qqe(6, 5, 1.618, close, 50, 1)
= ta.dmi(14, 14)
[osc , oscRis , oscFal , oscA0 , oscB0 , oscTop , oscBot , bullR , bearR , bullH , bearH , sqzOn , sqzOff , _hist1 , upper1 , lower1 , _hist2 , _line2 , tvr ]
tf = indicatorTF == "Chart" ? timeframe.period : indicatorTF == "1 minute" ? "1" : indicatorTF == "3 minutes" ? "3" : indicatorTF == "5 minutes" ? "5" : indicatorTF == "10 minutes" ? "10" : indicatorTF == "15 minutes" ? "15" : indicatorTF == "30 minutes" ? "30" : indicatorTF == "45 minutes" ? "45" : indicatorTF == "1 hour" ? "60" : indicatorTF == "2 hours" ? "120" : indicatorTF == "3 hours" ? "180" : indicatorTF == "4 hours" ? "240" : indicatorTF == "12 hours" ? "720" : indicatorTF == "1 day" ? "1D" : indicatorTF == "1 week" ? "1W" : indicatorTF == "1 month" ? "1M" : na
= request.security(syminfo.tickerid, tf, cond(indicatorTF != "Chart" and barstate.isrealtime ? 1 : 0))
//colorTVR = tvr < 15 ? #F6525F : tvr > 15 and tvr < 25 ? #B2B5BE : #66BB6A
// Plots
//plot(Presets == "Money Moves TrendVR" ? tvr : na, "", colorTVR, editable=false)
TrendText = "Trending"
if tvr < 15 and tvr < 25
TrendText := "No trend"
if tvr > 15 and tvr < 25
TrendText := "Ranging"
//------------------------------------------------------------------------------------------------------- Volatitiry
//Calculates Volatility for Dashboard
atrr = 3 * ta.atr(10)
stdAtr = 2 * ta.stdev(atrr, 20)
smaAtr = ta.sma(atrr, 20)
topAtrDev = smaAtr + stdAtr
bottomAtrDev = smaAtr - stdAtr
calcDev = (atrr - bottomAtrDev) / (topAtrDev - bottomAtrDev)
percentVol = 40 * calcDev + 30
AvrLength = 21
PercentFilter = 144
xAavrVolume = ta.rma(volume, AvrLength)
nResLess = volume * 100 / xAavrVolume < PercentFilter ? 0 : volume
nRes = nResLess
clr = close < open ? #b2b5be : #00dbff
//plot(nRes, color=clr, style=plot.style_columns, title='Volume Filter', transp=20)
VolitiText = "Inactive"
if nRes
VolitiText := "Active"
//////////////////////////////////////////
ema69 = ta.ema(close, 9)
totalSentTxt = ema69 > ema69 ? 'Bullish' : ema69 < ema69 ? 'Bearish' : 'Flat'
// INputs
//Timezones
tz_incr = 0
use_exchange = false
//------------------------------------------------------------------------------
//Settings
//-----------------------------------------------------------------------------{
//Session A
NYSes = true
NYTxt = 'New York'
NYTime = '1300-2200'
//Session B
LDSes = true
sesb_txt = 'London'
sesb_ses = '0700-1600'
//Session C
show_sesc = true
sesc_txt = 'Tokyo'
sesc_ses = '0000-0900'
//Session D
show_sesd = true
sesd_txt = 'Sydney'
sesd_ses = '2100-0600'
//-----------------------------------------------------------------------------}
//Sessions
//-----------------------------------------------------------------------------{
tff = timeframe.period
var tz = use_exchange ? syminfo.timezone :
str.format('UTC{0}{1}', tz_incr >= 0 ? '+' : '-', math.abs(tz_incr))
is_sesa = math.sign(nz(time(tff, NYTime, tz)))
is_sesb = math.sign(nz(time(tff, sesb_ses, tz)))
is_sesc = math.sign(nz(time(tff, sesc_ses, tz)))
is_sesd = math.sign(nz(time(tff, sesd_ses, tz)))
////////////////////////////////////////////
SessionText = "Default"
if is_sesd
SessionText := sesd_txt
if is_sesc
SessionText := sesc_txt
if is_sesb
SessionText := sesb_txt
if is_sesa
SessionText := NYTxt
if is_sesd and is_sesc
SessionText := "Sydney/Tokyo"
if is_sesb and is_sesc
SessionText := "Tokyo/London"
if is_sesb and is_sesa
SessionText := "London/Newyork"
if is_sesa and is_sesd
SessionText := "Newyork/Sydney"
//-----------------------------------------------------------------------------}
//Overlays color.green : color.red
//
var dashboard_loc = locationDashboard == "Top Right" ? position.top_right : locationDashboard == "Middle Right" ? position.middle_right : locationDashboard == "Bottom Right" ? position.bottom_right : locationDashboard == "Top Center" ? position.top_center : locationDashboard == "Middle Center" ? position.middle_center : locationDashboard == "Bottom Center" ? position.bottom_center : locationDashboard == "Top Left" ? position.top_left : locationDashboard == "Middle Left" ? position.middle_left : position.bottom_left
var dashboard_size = sizeDashboard == "Large" ? size.large : sizeDashboard == "Normal" ? size.normal : sizeDashboard == "Small" ? size.small : size.tiny
var dashboard = showDashboard ? table.new(dashboard_loc, 3, 7, color.rgb(0, 0, 0, 60), #3d384300, 2, color.rgb(30, 34, 45 , 60), 1) : na
dashboard_cell(column, row, txt, signal=false) => table.cell(dashboard, column, row, txt, 0, 0, signal ? #000000 : color.white, text_size=dashboard_size)
dashboard_cell_bg(column, row, col) => table.cell_set_bgcolor(dashboard, column, row, col)
if barstate.islast and showDashboard
// MTF Trend
dashboard_cell(0, 0 , "MTF")
dashboard_cell(0, 2 , "M5") , dashboard_cell_bg(0, 2 , TF5Bull ? color.rgb(70, 153, 67) : #880000)
dashboard_cell(0, 3 , "M15") , dashboard_cell_bg(0, 3 , TF15Bull ? color.rgb(70, 153, 67) : #880000)
dashboard_cell(0, 4 , "M30") , dashboard_cell_bg(0, 4 , TF30Bull ? color.rgb(70, 153, 67) : #880000)
dashboard_cell(0, 5 , "1H") , dashboard_cell_bg(0, 5 , TF60Bull ? color.rgb(70, 153, 67) : #880000)
dashboard_cell(0, 6 , "4H") , dashboard_cell_bg(0, 6 , TF240Bull ? color.rgb(70, 153, 67) : #880000)
// Middel part
dashboard_cell(1, 0 , "PoseidonPips")
dashboard_cell(1, 2 , "Market State")
dashboard_cell(1, 3 , "Volatility")
dashboard_cell(1, 4 , "Institutional Activity")
dashboard_cell(1, 5 , "Current Session (UTC)")
dashboard_cell(1, 6 , "Trend Pressure")
// End part
dashboard_cell(2, 0 , "")
dashboard_cell(2, 2 , TrendText)
dashboard_cell(2, 3 , str.tostring(percentVol, '##.##') + '%')
dashboard_cell(2, 4 , VolitiText)
dashboard_cell(2, 5 , SessionText)
dashboard_cell(2, 6 , totalSentTxt)
// Alerts
// Cross Functions for SL and TP
f_sl_crossed() =>
ret = false
crossBull = low >= ta.lowest(low, 5) and low < ta.lowest(low, 5)
crossBear = high <= ta.highest(high, 5) and high > ta.highest(high, 5)
ret := trigger ? crossBull : crossBear
ret
f_tp_crossed(tp) =>
ret = false
crossBull = high <= tp and high > tp
crossBear = low >= tp and low < tp
ret := trigger ? crossBull : crossBear
ret
// Alert Conditions
alert04 = bull and close <= StrongFilter
alert07 = bull and close > StrongFilter
alert09 = f_sl_crossed()
alert11 = f_tp_crossed(60.0)
alert12 = f_tp_crossed(80.0)
alert13 = f_tp_crossed(100.0)
alert14 = periodTrendCloud == "Smooth" ? ta.crossunder(ema150, ema250) : (close < trendcloud) and (close > trendcloud )
alert15 = periodTrendCloud == "Smooth" ? ta.crossover(ema150, ema250) : (close > trendcloud) and (close < trendcloud )
// Signal Alerts
if alert04 and Normalbuy_alert
alert('Buy Signal Alert !!!', alert.freq_once_per_bar_close)
alert(syminfo.tickerid)
if alert07 and Strongbuy_alert
alert('Strong Buy Signal Alert !!!', alert.freq_once_per_bar_close)
alert(syminfo.tickerid)
if (bear and close >= StrongFilter) and Normalsell_alert
alert('Sell Signal Alert !!!', alert.freq_once_per_bar_close)
alert(syminfo.tickerid)
if (bear and close < StrongFilter) and Strongsell_alert
alert('Strong Sell Signal Alert !!!', alert.freq_once_per_bar_close)
alert(syminfo.tickerid)
// Risk Management Alerts
if alert09 and slalert
alert('SL Alert !!!', alert.freq_once_per_bar_close)
alert(syminfo.tickerid)
if alert11 and tp1alert
alert('Target 1 Alert !!!', alert.freq_once_per_bar_close)
alert(syminfo.tickerid)
if alert12 and tp2alert
alert('Target 2 Alert !!!', alert.freq_once_per_bar_close)
alert(syminfo.tickerid)
if alert13 and tp3alert
alert('Target 3 Alert !!!', alert.freq_once_per_bar_close)
alert(syminfo.tickerid)
// Cloud Alerts
if alert15 and bullcrosscloud_alert
alert('Cloud Turned Bullish !!!', alert.freq_once_per_bar_close)
alert(syminfo.tickerid)
if alert14 and bearcrosscloud_alert
alert('Cloud Turned Bearish !!!', alert.freq_once_per_bar_close)
alert(syminfo.tickerid)
// Alert Conditions for TradingView
alertcondition(alert04, "Normal Buy Alert", "Normal Buy Signal")
alertcondition(alert07, "Strong Buy Alert", "Strong Buy Signal")
alertcondition((bear and close >= StrongFilter), "Normal Sell Alert", "Normal Sell Signal")
alertcondition((bear and close < StrongFilter), "Strong Sell Alert", "Strong Sell Signal")
alertcondition(alert09, "SL Crossed Alert", "Stop Loss Crossed")
alertcondition(alert11, "TP1 Crossed Alert", "Target 1 Crossed")
alertcondition(alert12, "TP2 Crossed Alert", "Target 2 Crossed")
alertcondition(alert13, "TP3 Crossed Alert", "Target 3 Crossed")
// Input
fastLength = 12
slowLength = 26
srcceed = close
signalLength = 9
// Data reference
= ta.macd(srcceed, fastLength, slowLength, signalLength)
// 4 level of green
greenHighh = #7bff00
greenMidHighh = #7bff00
greenMidLowh = #7bff00
greenLowh = #7bff00
// Yellow
yellowLowh = #693d8e
// 4 level of red
redHighh = #ff0000
redMidHighh = #ff0000
redMidLowh = #ff0000
redLowh = #ff0000
// Default color
candleBodyd = yellowLowh
// Ranging trend
if hist > 0
if hist > hist and hist > 0
candleBodyd := greenLowh
if hist < 0
if hist < hist and hist < 0
candleBodyd := redLowh
// Bullish trend
if macdda > 0 and hist > 0
candleBodyd := greenMidLowh
if hist > hist and macd > 0 and hist > 0
candleBodyd := greenMidHighh
if hist > hist and macd > 0 and hist > 0
candleBodyd := greenHighh
// Bearish trend
if macdda < 0 and hist < 0
candleBodyd := redMidLowh
if hist < hist and macd < 0 and hist < 0
candleBodyd := redMidHighh
if hist < hist and macd < 0 and hist < 0
candleBodyd := redHighh
barcolor(candleBodyd) // Include suggestion by Shaheen204
//
tenkan_len = 365
tenkan_mult = 3
kijun_len = 365
kijun_mult = 7
spanB_len = 365
spanB_mult = 10
offset = 1
//------------------------------------------------------------------------------
avg(src,length,mult)=>
atr = ta.atr(50)*mult
up = hl2 + atr
dn = hl2 - atr
upper = 0.,lower = 0.
upper := src < upper ? math.min(up,upper ) : up
lower := src > lower ? math.max(dn,lower ) : dn
os = 0,max = 0.,min = 0.
os := src > upper ? 1 : src < lower ? 0 : os
spt = os == 1 ? lower : upper
max := ta.cross(src,spt) ? math.max(src,max ) : os == 1 ? math.max(src,max ) : spt
min := ta.cross(src,spt) ? math.min(src,min ) : os == 0 ? math.min(src,min ) : spt
math.avg(max,min)
//------------------------------------------------------------------------------
tenkan = avg(close,tenkan_len,tenkan_mult)
kijun = avg(close,kijun_len,kijun_mult)
senkouA = math.avg(kijun,tenkan)
senkouB = avg(close,spanB_len,spanB_mult)
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//Smart Money Concept
settings = "Settings"
zigzag_len = input.int(9, "ZigZag Length", group=settings)
show_zigzag = input.bool(false, "Show Zigzag", group=settings)
fib_factor = input.float(0.33, "Fib Factor for breakout confirmation", 0, 1, 0.01, group=settings)
text_size = input.string(size.tiny, "Text Size", , group=settings)
delete_boxes = input.bool(true, "Delete Old/Broken Boxes", group=settings)
bu_ob_inline_color = "Bu-OB Colors"
be_ob_inline_color = "Be-OB Colors"
bu_bb_inline_color = "Bu-BB Colors"
be_bb_inline_color = "Be-BB Colors"
bu_ob_display_settings = "Bu-OB Display Settings"
bu_ob_color = input.color(color.new(color.green, 70), "Color", group=bu_ob_display_settings, inline=bu_ob_inline_color)
bu_ob_border_color = input.color(color.green, "Border Color", group=bu_ob_display_settings, inline=bu_ob_inline_color)
bu_ob_text_color = input.color(color.green, "Text Color", group=bu_ob_display_settings, inline=bu_ob_inline_color)
be_ob_display_settings = "Be-OB Display Settings"
be_ob_color = input.color(color.new(color.red, 70), "Color", group=be_ob_display_settings, inline=be_ob_inline_color)
be_ob_border_color = input.color(color.red, "Border Color", group=be_ob_display_settings, inline=be_ob_inline_color)
be_ob_text_color = input.color(color.red, "Text Color", group=be_ob_display_settings, inline=be_ob_inline_color)
bu_bb_display_settings = "Bu-BB & Bu-MB Display Settings"
bu_bb_color = input.color(color.new(color.green, 70), "Color", group=bu_bb_display_settings, inline=bu_bb_inline_color)
bu_bb_border_color = input.color(color.green, "Border Color", group=bu_bb_display_settings, inline=bu_bb_inline_color)
bu_bb_text_color = input.color(color.green, "Text Color", group=bu_bb_display_settings, inline=bu_bb_inline_color)
be_bb_display_settings = "Be-BB & Be-MB Display Settings"
be_bb_color = input.color(color.new(color.red, 70), "Color", group=be_bb_display_settings, inline=be_bb_inline_color)
be_bb_border_color = input.color(color.red, "Border Color", group=be_bb_display_settings, inline=be_bb_inline_color)
be_bb_text_color = input.color(color.red, "Text Color", group=be_bb_display_settings, inline=be_bb_inline_color)
var float high_points_arr = array.new_float(5)
var int high_index_arr = array.new_int(5)
var float low_points_arr = array.new_float(5)
var int low_index_arr = array.new_int(5)
var box bu_ob_boxes = array.new_box(5)
var box be_ob_boxes = array.new_box(5)
var box bu_bb_boxes = array.new_box(5)
var box be_bb_boxes = array.new_box(5)
to_up = high >= ta.highest(zigzag_len)
to_down = low <= ta.lowest(zigzag_len)
trend = 1
trend := nz(trend , 1)
trend := trend == 1 and to_down ? -1 : trend == -1 and to_up ? 1 : trend
last_trend_up_since = ta.barssince(to_up )
low_val = ta.lowest(nz(last_trend_up_since > 0 ? last_trend_up_since : 1, 1))
low_index = bar_index - ta.barssince(low_val == low)
last_trend_down_since = ta.barssince(to_down )
high_val = ta.highest(nz(last_trend_down_since > 0 ? last_trend_down_since : 1, 1))
high_index = bar_index - ta.barssince(high_val == high)
if ta.change(trend) != 0
if trend == 1
array.push(low_points_arr, low_val)
array.push(low_index_arr, low_index)
if trend == -1
array.push(high_points_arr, high_val)
array.push(high_index_arr, high_index)
f_get_high(ind) =>
f_get_low(ind) =>
f_delete_box(box_arr) =>
if delete_boxes
box.delete(array.shift(box_arr))
else
array.shift(box_arr)
0
= f_get_high(0)
= f_get_high(1)
= f_get_low(0)
= f_get_low(1)
if ta.change(trend) != 0 and show_zigzag
if trend == 1
line.new(h0i, h0, l0i, l0)
if trend == -1
line.new(l0i, l0, h0i, h0)
market = 1
market := nz(market , 1)
// market := market == 1 and close < l0 and low < l0 - math.abs(h0 - l0) * fib_factor ? -1 : market == -1 and close > h0 and high > h0 + math.abs(h0 - l0) * fib_factor ? 1 : market
last_l0 = ta.valuewhen(ta.change(market) != 0, l0, 0)
last_h0 = ta.valuewhen(ta.change(market) != 0, h0, 0)
market := last_l0 == l0 or last_h0 == h0 ? market : market == 1 and l0 < l1 and l0 < l1 - math.abs(h0 - l1) * fib_factor ? -1 : market == -1 and h0 > h1 and h0 > h1 + math.abs(h1 - l0) * fib_factor ? 1 : market
bu_ob_index = bar_index
bu_ob_index := nz(bu_ob_index , bar_index)
for i=h1i to l0i
index = bar_index - i
if open > close
bu_ob_index := bar_index
bu_ob_since = bar_index - bu_ob_index
be_ob_index = bar_index
be_ob_index := nz(be_ob_index , bar_index)
for i=l1i to h0i
index = bar_index - i
if open < close
be_ob_index := bar_index
be_ob_since = bar_index - be_ob_index
be_bb_index = bar_index
be_bb_index := nz(be_bb_index , bar_index)
for i=h1i - zigzag_len to l1i
index = bar_index - i
if open > close
be_bb_index := bar_index
be_bb_since = bar_index - be_bb_index
bu_bb_index = bar_index
bu_bb_index := nz(bu_bb_index , bar_index)
for i=l1i - zigzag_len to h1i
index = bar_index - i
if open < close
bu_bb_index := bar_index
bu_bb_since = bar_index - bu_bb_index
if ta.change(market) != 0
if market == 1
line.new(h1i, h1, h0i, h1, color=color.green, width=1)
label.new(int(math.avg(h1i, l0i)), h1, "BoS", color=color.new(color.black, 100), style=label.style_label_down, textcolor=color.green, size=size.small)
bu_ob = box.new(bu_ob_index, high , bar_index + 10, low , bgcolor=bu_ob_color, border_color=bu_ob_border_color, text="Bu-OB", text_color=bu_ob_text_color, text_halign=text.align_right, text_size=text_size)
bu_bb = box.new(bu_bb_index, high , bar_index + 10, low , bgcolor=bu_bb_color, border_color=bu_bb_border_color, text=l0 < l1 ? "Bu-BB" : "Bu-MB", text_color=bu_bb_text_color, text_halign=text.align_right, text_size=text_size)
array.push(bu_ob_boxes, bu_ob)
array.push(bu_bb_boxes, bu_bb)
if market == -1
line.new(l1i, l1, l0i, l1, color=color.red, width=1)
label.new(int(math.avg(l1i, h0i)), l1, "BoS", color=color.new(color.black, 100), style=label.style_label_up, textcolor=color.red, size=size.small)
be_ob = box.new(be_ob_index, high , bar_index + 10, low , bgcolor=be_ob_color, border_color=be_ob_border_color, text="Be-OB", text_color=be_ob_text_color, text_halign=text.align_right, text_size=text_size)
be_bb = box.new(be_bb_index, high , bar_index + 10, low , bgcolor=be_bb_color, border_color=be_bb_border_color, text=h0 > h1 ? "Be-BB" : "Be-MB", text_color=be_bb_text_color, text_halign=text.align_right, text_size=text_size)
array.push(be_ob_boxes, be_ob)
array.push(be_bb_boxes, be_bb)
for bull_ob in bu_ob_boxes
bottom = box.get_bottom(bull_ob)
top = box.get_top(bull_ob)
if close < bottom
f_delete_box(bu_ob_boxes)
else if close < top
alert("Price in the BU-OB zone")
else
box.set_right(bull_ob, bar_index + 10)
for bear_ob in be_ob_boxes
top = box.get_top(bear_ob)
bottom = box.get_bottom((bear_ob))
if close > top
f_delete_box(be_ob_boxes)
if close > bottom
alert("Price in the BE-OB zone")
else
box.set_right(bear_ob, bar_index + 10)
for bear_bb in be_bb_boxes
top = box.get_top(bear_bb)
bottom = box.get_bottom(bear_bb)
if close > top
f_delete_box(be_bb_boxes)
else if close > bottom
alert("Price in the BE-BB zone")
else
box.set_right(bear_bb, bar_index + 10)
for bull_bb in bu_bb_boxes
bottom = box.get_bottom(bull_bb)
top = box.get_top(bull_bb)
if close < bottom
f_delete_box(bu_bb_boxes)
else if close < top
alert("Price in the BU-BB zone")
else
box.set_right(bull_bb, bar_index + 10)
alertcondition(ta.change(market) != 0, "MSB", "MSB")
enableAutoTrend = input(true, "Enable Auto Trendlines", group="AUTO TRENDLINES SETTINGS")
srcTrendChannel = input(close, "Trend channel source", group="AUTO TRENDLINES SETTINGS")
lenTrendChannel = input.int(50, "Trend channel loopback", 2, group="AUTO TRENDLINES SETTINGS")
a = ta.wma(srcTrendChannel, lenTrendChannel), b = ta.sma(srcTrendChannel, lenTrendChannel)
A = 4 * b - 3 * a, B = 3 * a - 2 * b
m = (A - B) / (lenTrendChannel - 1)
d = 0., for i = 0 to lenTrendChannel - 1 by 1
l = B + m * i
d += math.pow(srcTrendChannel - l, 2)
rmse = math.sqrt(d / (lenTrendChannel - 1)) * 2
l(css, k) =>
line lr = enableAutoTrend ? line.new(bar_index - lenTrendChannel + 1, A + k, bar_index, B + k, extend=extend.right, color=css) : na
line.delete(lr )
l(#808080, rmse), l(#808080, 0), l(#808080,-rmse)
// ==========================================================================================
// === Dashboard with Telegram Link ===
var table myTable = table.new(position.top_center, 1, 1, border_width=1, frame_color=color.black, bgcolor=color.white)
// Add Telegram Message to Dashboard
table.cell(myTable, 0, 0, "Join Telegram @KING OF BTC VIP", bgcolor=color.blue, text_color=color.white, text_size=size.normal)
Algo Reverse This indicator is a robust trend-following strategy designed to filter out market noise and "falling knife" scenarios. It combines Heikin Ashi reversal signals with a strict Smoothed EMA Slope Filter and a Candle Body Size Filter to ensure high-quality entries.
Unlike standard strategies that simply check if the price is above/below the EMA, this script verifies the actual angle/slope of the EMA to ensure the trend has genuinely shifted direction.
Key Features:
🛡️ Smoothed EMA Slope Filter:
Most indicators trigger a BUY the moment price crosses the EMA, leading to losses during fakeouts.
This script checks the EMA value against its value X bars ago (Setting: Slope Lookback).
Benefit: Signals are generated only when the EMA line itself is physically rising (Green) for Longs or falling (Red) for Shorts. This prevents entering too early on a sharp reversal.
🕯️ Candle Body Filter:
Filters out low-quality candles (Dojis, Spinning Tops) with long wicks.
Logic: A signal is valid only if the candle body constitutes at least 70% (default) of the total candle range.
Benefit: Ensures entries are made on strong momentum candles, not on market indecision.
🔹 Heikin Ashi + ATR Impulse:
Uses Heikin Ashi logic to detect smooth trend reversals.
Validates the move with an ATR multiplier to ensure sufficient volatility.
Settings Guide:
Confirmation Bars: 1 (Recommended). Waits for the candle to close to confirm the signal.
EMA Slope Lookback: 5 (Default). Compares current EMA to EMA 5 bars ago. Increase for more stability, decrease for faster (but riskier) signals.
Min Candle Body: 0.7 (70%). Lower to 0.5 for more signals, raise to 0.8 for stricter filtering.
Этот индикатор представляет собой надежную трендовую стратегию, разработанную для фильтрации рыночного шума и предотвращения входов против сильного тренда («ловли ножей»). Он объединяет разворотные сигналы Heikin Ashi со строгим Фильтром Сглаженного Наклона EMA и Фильтром Размера Тела Свечи.
В отличие от стандартных стратегий, которые просто смотрят положение цены относительно EMA, этот скрипт проверяет реальный угол наклона линии, гарантируя, что тренд действительно развернулся.
Ключевые особенности:
🛡️ Сглаженный Фильтр Наклона EMA (Smoothed Slope):
Обычные индикаторы часто дают ложный BUY при резком пробое EMA, когда тренд все еще смотрит вниз.
Этот скрипт сравнивает текущую EMA с её значением X баров назад (Настройка: Сглаживание наклона).
Польза: Сигнал появляется только тогда, когда сама линия EMA окрашивается в Зеленый (растет) или Красный (падает). Это защищает от ложных пробоев.
🕯️ Фильтр Тела Свечи (Body Filter):
Отсеивает «мусорные» свечи (Доджи, Волчки) с длинными тенями и маленьким телом.
Логика: Сигнал валиден, только если тело свечи занимает минимум 70% (по умолчанию) от всей длины свечи.
Польза: Входы совершаются только на сильных, полнотелых свечах, подтверждающих намерение рынка.
🔹 Heikin Ashi + ATR Импульс:
Использует логику Heikin Ashi для определения плавного разворота.
Подтверждает вход множителем ATR, чтобы исключить входы на низкой волатильности.
Настройки:
Подтверждение входа: 1 (Рекомендуется). Ждет закрытия свечи для фиксации сигнала.
Сглаживание наклона (Lookback): 5. Сравнивает EMA с EMA 5 свечей назад. Увеличьте для надежности, уменьшите для более быстрой реакции.
Мин. тело свечи: 0.7 (70%). Уменьшите до 0.5 для большего количества сигналов, увеличьте до 0.8 для строгого отбора.
RA Renko Wave ParticipationOverview
RA Renko Wave Participation measures market participation per completed Renko wave, using a Weis-style wave construction adapted for synthetic Renko logic.
The indicator focuses on effort, not direction, and is designed to evaluate initiative versus corrective behavior during price movement.
This tool does not generate buy/sell signals.
It provides context for trade decisions derived from price structure, Renko transitions, and higher-level confluence.
Core Concept
Markets move through alternating phases of:
Initiative activity (strong participation driving price)
Corrective activity (low participation rotations)
This indicator answers one question:
How much participation was required to produce the current Renko wave compared to recent history?
How It Works
Synthetic Renko Waves
Renko state is reconstructed internally using:
Traditional brick size or
ATR-based adaptive brick size
Reversal requires a configurable number of bricks
Wave Participation Accumulation
Volume (or True Range if volume unavailable) is accumulated per wave
Accumulation resets only when a Renko wave flips
Bidirectional Histogram
Up waves: plotted above zero
Down waves: plotted below zero
Zero line represents neutral participation
Wave Participation Average (WPA)
Calculated from completed waves only
Uses absolute wave size
Represents expected participation for a typical wave
Displayed on the active side of zero for visual alignment
(magnitude is real; placement is contextual)
Participation Strength
Ratio of current wave effort to average wave effort
Values > 1.0 indicate above-normal participation
Values < 1.0 indicate corrective or weak participation
How to Read the Indicator
Histogram
Expanding bars → increasing participation
Contracting bars → diminishing participation
Sustained expansion → initiative behavior
Shallow waves → rotation or absorption
Wave Participation Average
Acts as a baseline, not a signal
Used for comparison only
Large waves relative to the average often precede:
Trend continuation
Exhaustion
Regime shifts
Strength Line
Confirms whether effort is meaningful or anemic
Useful for:
Pullback validation
Failed continuation detection
Late-trend exhaustion awareness
What This Indicator Is NOT
Not a momentum oscillator
Not a MACD variant
Not a volume delta tool
Not an entry/exit generator
Direction must always come from price structure, Renko transitions, and contextual confluence.
Best Use Cases
Evaluating pullback quality
Identifying initiative vs corrective waves
Confirming trend health
Detecting participation divergence
Filtering low-quality continuation attempts
Works best when combined with:
Renko price structure
Session context
Higher-timeframe bias
Support/resistance or value zones
Reset Behavior
Optional reset modes:
None (continuous session)
New trading day
Custom session window (timezone aware)
Resets affect wave accumulation only, not Renko structure.
Design Philosophy
This indicator is intentionally:
Non-repainting
Flip-confirmed
Structure-aligned
Effort-focused
It prioritizes interpretability and discipline over signal density.
Internal Disclaimer
This indicator provides analytical context only.
Trading decisions remain the responsibility of the user.
Past participation patterns do not guarantee future behavior.
4H Synced Direction Divergence Alert US100 US500 US30Overview
This script monitors three index symbols on a 4-hour (4H) basis and triggers an alert only when their last completed 4H candles are time-synchronized and their directions diverge (i.e., not all close in the same direction).
What it does
Compares the 4H candle direction (UP / DOWN / FLAT) across:
US100 (reference clock)
US500
US30
Sends an alert on the confirmed close of the 4H candle (not mid-candle).
Includes a detailed alert message showing:
the 4H close time
direction for each symbol
open, close, and the close-open delta
How it works (high level)
Reference clock (sync anchor):
The script uses Symbol 1 as the timing reference for 4H candle boundaries.
Strict bar synchronization:
It validates that all three symbols share the same 4H time_close before comparing directions.
If any symbol is missing that specific 4H bar (gap) or doesn’t align to the same close timestamp, no alert is triggered.
No repaint / no lookahead:
Data is requested without looking ahead, so the comparison is based on completed candles only.
Duplicate protection:
The script remembers the last fired 4H close time and prevents repeated alerts caused by recalculation.
How to use
Add the script to a clean chart.
Set your preferred symbols in the inputs (default: US100 / US500 / US30).
Create an alert:
Condition: select this script
Choose “Any alert() function call” (required, because the script uses alert() for detailed messages)
When a synchronized 4H close occurs and directions diverge, you will receive a detailed notification.
Inputs
Comparison TF: default 240 (4H)
Symbol 1 (Reference clock): default CAPITALCOM:US100
Symbol 2: default CAPITALCOM:US500
Symbol 3: default CAPITALCOM:US30
Timezone for alert message: controls only the displayed timestamp in the alert text
Notes / limitations
This script is designed for cross-symbol candle comparison, so alignment matters. If your symbols have different trading sessions, gaps, or data availability, the script may intentionally skip alerts when candles are not perfectly synchronized.
The script is an informational alert tool and is not a trading signal by itself. Always confirm context, liquidity, and market conditions.
A.I. Market Cipher Z [RubiXalgo]A.I. 👑 Market Cipher Z
"Rubik's Algo" – Where Ichimoku mathematics meets Rubik's Cube solving speed under machine-learning color control.
Imagine a speed-cuber solving a Rubik's Cube while juggling — fast, precise, seemingly chaotic yet perfectly aligned layers.
This indicator visualizes that same layered, adaptive intelligence in markets:
Core Visual Metaphor
• Fast Rubik → short-term VSQC Kalman matrix (dynamic 9–21 lookback)
• Slow Rubik → long-horizon dynamic matrix (≈188 base length)
• Sharkwave → higher-timeframe TTM Squeeze + wave-momentum cipher
• Color language → machine-learned gradients (k-NN + Kalman + LOWESS)
Main elements on chart
• Dynamic fast + slow trend lines with gradient fill (bull/bear strength)
• Multi-layer Sharkwave plot (WaveCrest, DeepOcean, Undertow currents)
• Volume Recovery Zones (green/red imbalance rectangles – optional)
• Wick-pressure Bounce Boxes (extreme OB/OS zones – optional)
• GannB-inspired Vxt3 sonar dots (volume-confirmed turning points)
• Two momentum power tables:
❖ Kalman Trend Filter % → overall trend strength
◆ Stochastic Money Flow % → momentum / OB-OS heat
Key Trading Intuition
Green table(s) + green dot + price near fast line = high-probability reversal / continuation long
Red table(s) + red dot + price near slow line = high-probability reversal / continuation short
Bright/dark gradients = conviction | yellow/neutral = wait or fade
Settings highlights
VSQC Dynamic Scaling Lookback 18 ← heartbeat speed (9–21 sweet spot)
Dynamic Maximum Length 188 ← memory horizon
A.I. Money Flow Momentum Window 18 ← core rhythm
Prediction neighbours (k) 63 ← pattern memory depth
Sharkwave timeframe 60 ← usually 4×–24× chart tf
Not financial advice. Trading involves substantial risk of loss.
Use only as one piece of your decision process. Past performance ≠ future results.
© Jesse_Geluk 2025 • Mozilla Public License 2.0
Educational / non-commercial reuse encouraged under CC BY-NC-SA 4.0






















