Research-Based RSI Threshold ConfigurationResearch-Based RSI Threshold Configuration is an empirical RSI decision-support indicator based on the findings of research by Hatem Mabrouk, Federico Trigos, and Francisco Valderrey.
The underlying study systematically evaluated nine RSI threshold configurations across nine major cryptocurrencies and the S&P 500 using weekly RSI(14) data. The findings challenge the conventional assumption that the standard 30/70 configuration is universally optimal and identify asset-specific dominant threshold configurations based on win rate, geometric weekly return, and average holding period.
This indicator operationalizes those empirical findings directly within TradingView. For assets included in the study, it automatically displays the research-based RSI threshold configuration identified by the empirical analysis.
The indicator provides three display modes:
• Research-Based: Displays the empirically identified threshold configuration for the selected asset.
• Conventional 30/70: Displays the traditional RSI 30/70 configuration.
• Compare Both: Displays the research-based and conventional configurations simultaneously for direct comparison.
The indicator uses weekly RSI(14) regardless of the chart timeframe and provides visual entry and exit zones, threshold-entry markers, alerts, and an information dashboard.
Assets currently supported by the empirical research: BTC, ETH, ADA, AVAX, BNB, DOGE, SOL, TRX, XRP, and the S&P 500.
This indicator is intended for research, educational, and decision-support purposes. Historical empirical performance does not guarantee future results, and the indicator does not constitute financial or investment advice. مؤشر

EGADE Research-Based RSI Threshold ConfigurationEGADE Research-Based RSI Threshold Configuration is an empirical RSI decision-support indicator based on the findings of research by Hatem Mabrouk , Federico Trigos , and Francisco Valderrey , Tecnologico de Monterrey, EGADE Business School, Mexico
The underlying study systematically evaluated nine RSI threshold configurations across nine major cryptocurrencies and the S&P 500 using weekly RSI(14) data. The findings challenge the conventional assumption that the standard 30/70 configuration is universally optimal and identify asset-specific dominant threshold configurations based on win rate, geometric weekly return, and average holding period.
This indicator operationalizes those empirical findings directly within TradingView. For assets included in the study, it automatically displays the research-based RSI threshold configuration identified by the empirical analysis.
The indicator provides three display modes:
• Research-Based: Displays the empirically identified threshold configuration for the selected asset.
• Conventional 30/70: Displays the traditional RSI 30/70 configuration.
• Compare Both: Displays the research-based and conventional configurations simultaneously for direct comparison.
The indicator uses weekly RSI(14) regardless of the chart timeframe and provides visual entry and exit zones, threshold-entry markers, alerts, and an information dashboard.
Assets currently supported by the empirical research: BTC, ETH, ADA, AVAX, BNB, DOGE, SOL, TRX, XRP, and the S&P 500.
Disclaimer: The findings and information presented through this indicator are intended exclusively for academic, research, educational, and decision-support purposes. Nothing contained in the underlying study or this indicator constitutes financial or investment advice, an investment recommendation, or a solicitation to buy or sell any financial instrument. Historical empirical performance does not guarantee future results. Users should conduct their own analysis and exercise independent judgment when making financial or investment decisions. مؤشر

Bitcoin Halving Cycle PhasesBitcoin Halving Cycle Phases is a calendar-based visual indicator that highlights approximate Bitcoin halving cycle phase zones directly on the chart.
The indicator uses historical Bitcoin halving dates and predefined calendar phase boundaries to display different cycle regions, including Halving, Bullish, Bearish, Recovery, and Pre-halving phases. Future zones are projected using an approximate cycle length and are intended only as visual calendar references.
This script does not calculate price targets, buy or sell signals, trading entries, exits, stop losses, take profits, backtest results, or financial advice. The displayed future zones are approximate calendar projections only and should not be interpreted as forecasts or guaranteed market outcomes.
The indicator is designed for educational cycle visualization and long-term market context.
مؤشر

CBBI Rainbow Approximation (BTC Only)# CBBI Rainbow Approximation
## Overview
This indicator is a Pine Script **approximation inspired by the ColinTalksCrypto Bitcoin Bull Run Index (CBBI)** methodology. It is **not** the official CBBI and does not claim to reproduce its behavior — it follows the same general philosophy of combining multiple complementary valuation metrics into a single 0–100 confidence score, but uses a different set of inputs adapted to what is computable directly in Pine Script.
The original CBBI relies on 9 on-chain metrics (RHODL Ratio, Reserve Risk, Terminal Price, etc.) that are not available in Pine Script. This script substitutes those with 6 widely studied technical metrics and packages them into a single rainbow-colored oscillator for cycle context.
## Why a Composite Index Rather Than Individual Metrics
Each Bitcoin valuation metric has known weaknesses when used in isolation:
- The **Mayer Multiple** can stay elevated for months during strong bull runs without marking a top
- The **Pi Cycle Top** has fired only a handful of times historically — small sample size
- The **200-Week MA** is too slow to react during fast cycles
- The **Monthly RSI** is purely momentum-based with no valuation anchor
- The **Power Law** ignores cyclical behavior entirely
- The **Golden Ratio Multiplier** depends heavily on calibration
A composite score smooths out the individual weaknesses by requiring **broad agreement** across different methodological families before signaling a cycle extreme. A single metric flashing red is a weak signal; five or six aligning is a stronger one.
## Why These 6 Metrics Specifically
The metrics were chosen so that each one measures a **different dimension** of the market cycle, minimizing redundancy:
| Metric | Dimension Measured | Time Horizon |
|---|---|---|
| Mayer Multiple | Price extension above baseline | Medium term (200d) |
| Pi Cycle Top | Trend acceleration / MA convergence | Medium-long term |
| 200-Week MA Heatmap | Distance from multi-year support | Very long term |
| Golden Ratio Multiplier | Fibonacci-based cycle expansion | Long term |
| Monthly RSI | Pure momentum, no MA dependency | Macro |
| Power Law Regression | Log-log valuation anchor (no MA) | All-history |
Four of the six rely on moving averages of different lengths (111, 200, 350, 1400 days), but each one transforms that information in a structurally different way (ratio, crossover convergence, distance, multiplier band, regression). The remaining two (RSI, Power Law) intentionally bypass moving averages entirely to avoid over-weighting MA-based behavior.
## How the Score Is Built
1. Each metric is computed in **daily timeframe** (regardless of the chart's display timeframe)
2. Each metric is normalized to a **0–100 scale** based on its historical extremes
3. Available metrics are averaged into a raw composite score
4. The raw score is smoothed by a configurable SMA (default: 7 days)
When some metrics return NaN (e.g. the 200-week MA before mid-2014 because Bitcoin lacked the historical data), the script averages only the available ones. The "Metrics OK: X/6" cell in the info table shows how many metrics contributed to the current score.
## Rainbow Zones
The score is plotted against six color-coded zones derived from historical CBBI patterns:
- **0–20 (Blue)** — Capitulation: extreme value, historical accumulation zones
- **20–40 (Cyan)** — Accumulation: still undervalued
- **40–60 (Green)** — Neutral: fair value range
- **60–75 (Yellow)** — Bullish: trending toward overheated
- **75–85 (Orange)** — Overheated: caution advised
- **85–100 (Red)** — Blow-off Top: historical sell zones
Triangle markers print automatically when the score crosses 85 upward (probable top) or 15 downward (probable bottom).
## Multi-Timeframe Behavior
A common issue with Bitcoin cycle indicators is that switching from daily to weekly or monthly view distorts moving-average-based metrics. To prevent this, **all six metrics are computed in daily resolution via a single grouped `request.security` call**, regardless of the timeframe shown on the chart. The score therefore stays consistent whether you view it on the 1D, 1W, 1M, or higher timeframes — the line you see is always the daily score.
## Key Features
- 6 normalized metrics combined into a 0–100 composite score
- Multi-timeframe consistent (calculations forced to daily)
- Safe NaN handling for early Bitcoin history
- Live metrics table showing each component's contribution
- Built-in alerts for top (>85) and bottom (<15) crossovers
- Toggleable rainbow bands, score line, signals, and table
## How to Use
1. Apply the indicator to a Bitcoin chart (default symbol: `INDEX:BTCUSD`)
2. View on any timeframe — the score is computed in daily and remains consistent
3. The score entering the red zone (>85) historically aligns with cycle peaks
4. The score entering the blue zone (<20) historically aligns with cycle bottoms
5. Use as macro cycle context, not as a short-term timing tool
## Important Notes
- **This is not the official CBBI.** It is an open-source approximation. The official CBBI is maintained at colintalkscrypto.com and uses proprietary on-chain data feeds not accessible from Pine Script.
- **Past patterns may not repeat.** The thresholds and metric calibrations are based on Bitcoin's prior cycles. Future cycle behavior may differ as the market matures.
- **This is not financial advice.** The indicator provides cycle context only. Always combine multiple tools and conduct your own research before making investment decisions.
- **Not suitable for short-term trading.** The metrics are macro by design and update slowly.
## Credits
Conceptual inspiration from **Colin Talks Crypto** for the original CBBI methodology of combining multiple valuation metrics into a composite confidence score. Individual metrics (Mayer Multiple, Pi Cycle Top, 200-Week MA Heatmap, Golden Ratio Multiplier) are well-known public-domain Bitcoin cycle tools, none of which are reproduced from any specific TradingView script. مؤشر

Meme Season Score | Memecoin Cycle Timing
One number, 0 to 100, that answers a single question: is it meme season right now?
The Meme Season Score is a composite oscillator that condenses six different memecoin-cycle factors into one decision-relevant signal. Instead of staring at half a dozen separate dominance and market-cap charts trying to interpret what the data is saying together, you get a single weighted reading and a climate label.
▸ WHY THIS INDICATOR EXISTS
Existing memecoin tools on TradingView each do one narrow thing: one plots a meme dominance ratio, one shows Z-scores of individual coins, one is an EMA crossover on a single sector index. None of them blend multiple cycle factors into a single comparable score.
Generic "altseason indices" treat all alts as a homogeneous block — they cannot tell you whether memecoins specifically are leading or lagging the broader alt rotation. Memecoins behave differently from L1s, DeFi, or RWAs. They need their own framework.
This script is that framework: six factors, all relevant to memecoin cycle behavior, all weighted by their historical importance, all blended into one number you can act on.
▸ METHODOLOGY
Each of the six input factors is first converted to a rate-of-change over a rolling momentum window (default: 14 bars). That ROC is then converted to a percentile rank within a longer normalization window (default: 180 bars), giving a 0–100 score that reflects "where does today's reading sit within the recent distribution."
Inverse factors (where falling values are bullish for memes) have their percentile rank flipped before contributing to the composite.
The six factors and default weights:
• MEME.D trend — 25% — meme sector dominance rising = bullish
• MEME.C momentum — 20% — meme sector market cap accelerating = bullish
• BTC.D inverse — 20% — BTC dominance falling = capital rotating to alts
• OTHERS.D trend — 15% — altcoin dominance rising = risk-on environment
• STABLE.C inverse — 10% — stablecoin cap declining = stables being deployed
• MEME.C/TOTAL acceleration — 10% — meme share growing faster than market
All weights are user-adjustable in the inputs and are auto-normalized, so they don't have to sum to 100.
Note: MEME.D is not currently a native CRYPTOCAP ticker on TradingView, so it is derived as MEME.C / TOTAL × 100 inside the script.
▸ CLIMATE ZONES
The score is divided into five regimes, each with its own color and emoji label that appears on the chart:
• 0–20 ❄️ Meme Winter Capital fleeing memes (deep accumulation zone)
• 20–40 🌧️ Cool Mixed signals — selective plays only
• 40–60 ☀️ Warming Up Rotation beginning — early meme season
• 60–80 🔥 Meme Season Active Broad memecoin pumps — high conviction window
• 80–100 🚀 Peak Mania Extreme readings — historically precedes retracements
The main score line shifts color as it crosses zone boundaries. Background of the pane tints faintly with the current zone color (toggleable). A label on the last bar shows the live score and zone name.
▸ HOW TO READ IT
• Score above its 50-period EMA = momentum is strengthening
• Score below its 50-period EMA = momentum is weakening
• Cross above 60 = season conditions activating
• Cross above 80 = extreme conditions, historical risk zone
• Cross below 40 = season cooling off
• Cross below 20 = winter conditions, sentiment capitulation
The 50-EMA line is the slower trend reference; the colored line is the live signal. Watching their relationship is often more useful than watching either one alone.
▸ HOW TO USE IT
The script pulls all of its data from CRYPTOCAP indices via request.security, so the chart symbol does not affect the calculation. Putting it on CRYPTOCAP:MEME.C on the Daily timeframe gives the cleanest visual context (price chart of the meme sector above, score sub-pane below) but you can use any chart.
The default calculation timeframe is Daily, which is appropriate for cycle-level analysis. The score will show the same Daily-derived value regardless of what chart timeframe you are viewing.
▸ INPUT SETTINGS
Calculation Settings:
• Calculation Timeframe (default: Daily)
• Momentum Lookback in bars (default: 14)
• Normalization Lookback in bars (default: 180)
• Score Smoothing EMA (default: 3 — set to 1 for raw unsmoothed score)
Factor Weights — all six factor weights are individually adjustable from 0 to 100. Weights are auto-normalized so any combination is valid.
Display Options:
• Toggle the 50-period EMA of the score
• Toggle the floating score label
• Toggle the background climate tint
• Label size (small / normal / large / huge — use huge for screenshots)
▸ BUILT-IN ALERTS
Four alert conditions are defined and can be activated through the standard Add Alert dialog:
• 🔥 Meme Season Starting (score crosses above 60)
• 🚀 Peak Mania Warning (score crosses above 80)
• ☁️ Meme Season Ending (score crosses below 40)
• ❄️ Meme Winter (score crosses below 20)
▸ LIMITATIONS AND HONEST CAVEATS
• This is a contextual/regime tool, not a predictive one. The score tells you the current state of the meme cycle based on factors that have historically mattered. It does not predict future prices or guarantee any outcome.
• Percentile rank is by definition backward-looking. The score reflects how today's momentum compares to the recent past, not where prices are going.
• With default settings, the script needs roughly 194 daily bars of valid CRYPTOCAP data to warm up before producing a meaningful score (14-bar ROC plus 180-bar percentile window). MEME.C history begins in early 2024, so this is not a constraint for current charts.
• Memecoin market structure changes quickly. Tokens that drove the sector last cycle may be irrelevant in the next. The score works at the sector level and is robust to individual token churn, but it cannot tell you which specific memecoin to buy.
• Factor weights are calibrated to behavior observed in available CRYPTOCAP history. If the underlying market structure shifts substantially, weights may need adjustment.
▸ TECHNICAL NOTES
• Pine Script v6
• Open-source under the Mozilla Public License 2.0
• Uses 5 request.security calls (well below the 40-call limit), all to official CRYPTOCAP indices
• No repainting — all calculations use confirmed bar close values from the requested timeframe
▸ DISCLAIMER
For educational and informational purposes only. This script is a market analysis tool, not financial advice. Nothing here constitutes a recommendation to buy or sell any asset. Past behavior of the score in historical data is not a guarantee of future behavior. Cryptocurrency markets, and memecoin markets in particular, are highly volatile and can result in substantial losses. Always do your own research and trade with risk you can afford to lose.
مؤشر

RSI Confluence Matrix**RSI Confluence Matrix**
A structured, multi-layer confirmation indicator designed to identify high-probability trade setups by combining momentum, exhaustion, and higher timeframe trend alignment.
---
### 🔍 Core Concept
This tool is built around a simple idea:
> **Trades are only valid when momentum shift aligns with broader trend direction.**
Instead of relying on a single signal, the RSI Confluence Matrix stacks three independent conditions:
---
### ⚙️ How It Works
**1. RSI Exhaustion (Setup Phase)**
* Detects when RSI reaches extreme levels:
* Below 30 (oversold)
* Above 70 (overbought)
* Requires this condition to occur **twice**, filtering out weak or premature signals.
**2. Momentum Shift (Trigger Phase)**
* Confirms direction using the RSI 50 level:
* Cross above 50 → bullish shift
* Cross below 50 → bearish shift
**3. Multi-Timeframe Trend Alignment (Filter Phase)**
* Tracks price position relative to the **EMA 200** across:
* 4H, 2H, 1H, 45M, 30M, 15M
* Each timeframe is classified as:
* **Green** → price above EMA 200
* **Red** → price below EMA 200
A valid trade requires **at least 5 timeframes aligned** in the same direction.
---
### 🟢 Signal Conditions
**BUY Setup**
* RSI crosses below 30 twice
* RSI crosses above 50
* At least 5 timeframes above EMA 200 (Green)
**SELL Setup**
* RSI crosses above 70 twice
* RSI crosses below 50
* At least 5 timeframes below EMA 200 (Red)
---
### 📊 Table Overview
The built-in matrix displays real-time trend alignment:
* Each column represents a timeframe
* Color-coded bias (Green / Red)
* Final column shows dominant direction:
* Majority Green → Bullish bias
* Majority Red → Bearish bias
* Equal → Neutral (No Trade)
---
### 🎯 How to Use
* Focus only on signals that align with the matrix bias
* Avoid trades when the table shows mixed or neutral conditions
* Best used in conjunction with key levels (structure, pivots, liquidity zones)
---
### ⚠️ Notes
* This indicator is designed to **filter noise and reduce low-quality trades**, not to increase trade frequency
* Signals may be less frequent but are intended to offer stronger confirmation
* This tool does not guarantee outcomes; proper risk management is essential
---
### 🤖 Development Note
This indicator includes enhancements developed with the assistance of AI to improve structure, clarity, and efficiency of the underlying logic.
مؤشر

Backtest Template [Backtest Terminal]Overview — What Is This Script?
Backtest Template (BTT) is an open-source strategy framework designed to let traders test their own indicator logic without building the backtest infrastructure from scratch. Instead of writing stop loss management, session filters, alert systems, and trailing stops yourself, BTT handles all of that automatically. You bring your signal idea — BTT handles the rest.
The template is designed for all markets: stocks, Forex, gold (XAUUSD), crypto spot, and crypto futures. It ships with a pre-built Moving Average Cross trigger and Moving Average Trend filter as working examples that you replace with your own logic.
What Makes It Original
Most backtest templates on TradingView are fixed strategies that test one specific indicator. BTT introduces a User Zone architecture: a single clearly marked section near the top of the script where the user replaces one pre-built trigger and one pre-built filter with their own Pine Script code. The engine below reads four fixed variable names and runs automatically — the user never needs to touch strategy orders, stop management, session logic, or the alert system.
This design means a complete beginner can run their first backtest by changing fewer than ten lines of code, while an advanced user can plug in arrays, multi-timeframe calculations, or complex signal logic and the engine handles it identically.
What The Engine Handles Automatically
Once your signal is connected through the User Zone, the following run without any additional code:
Stop Loss and Take Profit — three unit modes: percentage of price, fixed points (Forex / CFD), or fixed dollar amount (crypto / stocks)
Stop Mode — Fixed (original level), Trailing (follows price), or Breakeven (moves to entry price)
Trailing Stop — configurable distance and activation offset, each with matching %, point, and dollar unit inputs consistent with your Stop/Target Mode selection
Breakeven Stop — configurable activation offset in the same unit system
Disable Take Profit — when using Trailing mode, an optional toggle removes the fixed TP so the trailing stop becomes the sole exit
Trade Direction — Long only, Short only, or Both
Backtest Date Range — start and end date inputs
Trading Day Filter — enable or disable any day of the week
Trade Session Hours — exchange server time filter (HHMM-HHMM format)
Trade Windows — four configurable local-time windows each independently set to Off, Blackout, or Trade Only mode with full timezone support
Entry Signal Markers — green and red triangles that only appear when all conditions pass, so chart visuals exactly match what the strategy trades
App Alerts — pre-formatted alert messages with ticker, direction, stop and target prices
Custom JSON Alerts — four separate input fields for webhook bot integration, one per order event
How To Use It — Quick Start
Open the script in Pine Editor
Find the User Zone near the top — it is clearly marked with a visual border and is the only section you need to edit
Replace the pre-built Moving Average Cross trigger block with your own indicator signal, assigning your long condition to userLong and your short condition to userShort — always add and confirmed to both
Replace the pre-built Moving Average Trend filter block with your own market condition, assigning to userFilterLong and userFilterShort
Add to chart and open Strategy Tester
User Zone Contract
The engine connects to your signal through exactly four variables. Do not rename them:
userLong → true on the bar you want to enter Long
userShort → true on the bar you want to enter Short
userFilterLong → true when Long entries are allowed
userFilterShort → true when Short entries are allowed
Always add and confirmed (barstate.isconfirmed) to userLong and userShort. This ensures the signal locks in only when the bar closes, preventing signals from changing value mid-bar.
Setting userFilterLong = true disables the Long filter entirely. Setting it to a condition like close > ta.ema(close, 200) means Long entries are only allowed when price is above that EMA. Long and Short filters are independent — you can filter one direction while leaving the other open.
Stop Loss and Take Profit — Three Unit Modes
The Stop/Target Mode setting controls how SL and TP distances are measured:
% (Percentage) — distance as a percentage of price. Suitable for stocks and crypto. Stop source can be the close price or the candle High/Low. Take profit is derived from stop distance × Risk:Reward ratio.
Point - Forex / CFD — distance in instrument ticks (syminfo.mintick). Suitable for XAUUSD, EURUSD, and other Forex/CFD instruments. Example: 100 points on EURUSD (mintick = 0.00001) = 1 pip.
Dollar - Crypto / Stock — fixed dollar distance from entry. Suitable for BTCUSD and US stocks.
All trailing and breakeven offset inputs follow the same three-unit system. Use the , , or input that matches your selected Stop/Target Mode. Using the wrong unit input will result in a mismatch between your intended stop distance and the actual calculation.
Stop Mode — Fixed, Trailing, Breakeven
Fixed — stop loss stays at the original level from entry until hit or TP is reached
Trailing — stop follows price at a configurable distance, locking in profit as price moves. The trailing activation offset controls how far price must move before trailing begins (shown as a yellow line on chart). Enable "Disable Take Profit" to let the trailing stop manage the entire exit without a fixed TP ceiling
Breakeven — stop moves to the exact entry price once price moves a configurable distance in your favour (shown as a white line on chart)
Trade Windows — Off, Blackout, Trade Only
Each of the four time windows (Tokyo, London, New York, Custom) has an independent mode selector:
Off — this window has no effect on entries (default for all four)
Blackout — block all new entries while the current time is inside this window. Useful for avoiding high-volatility opens or news events
Trade Only — only allow new entries while the current time is inside this window. Useful for targeting specific sessions or news event windows such as NFP or Fed announcements
All times are entered in your local timezone selected from the My Timezone dropdown. The engine converts to UTC internally.
Logic rules:
Multiple Blackout windows use AND NOT logic — entries are blocked if the current time is inside any Blackout window
Multiple Trade Only windows use OR logic — entries are allowed when the current time is inside any one Trade Only window
If no windows are set to Trade Only, there is no time restriction on entries (same as all Off)
Blackout and Trade Only can be combined: for example, set London to Trade Only and New York to Blackout to only trade the London session while avoiding NY volatility
Trading Day and Session
Trading Days — enable or disable any individual day of the week. Disabling a day prevents new entries — open positions are still managed on disabled days.
Trade Session — set allowed hours in exchange server time (HHMM-HHMM format). Default 0000-0000 means 24 hours with no restriction. This uses exchange server time, not your local time.
Alert System — App Alert and Custom JSON
How to activate alerts:
Set the alert mode to App Alert or Custom in the settings panel
Create a TradingView alert on the chart (right-click → Add Alert)
In the alert message box, paste exactly: {{strategy.order.alert_message}}
This placeholder delivers the correct message for each order event automatically
App Alert mode sends a pre-formatted text message for each event:
ENTRY LONG : {price}
STOP LOSS : {stop level}
TARGET PRICE : {target level}
Exit alerts include a PNL percentage. No additional setup is required.
Custom mode — JSON webhook for bot integration:
Four separate input fields accept a single-line JSON string — one per order event:
Long Entry — fires when a Long position opens
Long Exit — fires when a Long position closes (TP, SL, or trailing stop)
Short Entry — fires when a Short position opens
Short Entry — fires when a Short position opens
Short Exit — fires when a Short position closes (TP, SL, or trailing stop)
Paste your JSON as a single line into each field. TradingView's input.string stores the content as a single line regardless of how it was formatted, making it safe for all webhook receivers.
Settings Guide — Commission, Slippage, Margin
Default values are conservative starting points. Edit the strategy() declaration at the top of the script to match your broker and market. Detailed inline comments in the script explain every parameter.
Commission defaults (0.1% per side, 2 ticks slippage):
Stocks zero-commission broker → 0.0%
Stocks SET Thailand → 0.16%
Crypto spot (Binance) → 0.1%
Crypto futures (Binance taker) → 0.04%
XAUUSD $7 per standard lot → change commission_type to strategy.commission.cash_per_contract and commission_value to 0.07 ($7 ÷ 100 oz)
Position sizing (default 2% of equity):
For lot-based markets (Forex, XAUUSD) change default_qty_type to strategy.fixed and default_qty_value to the number of units. On XAUUSD: 1 unit = 1 oz, so 0.01 lot = value of 1, 0.10 lot = value of 10, 1.00 lot = value of 100.
Margin/leverage simulation:
Both margin_long and margin_short are 0 by default (no margin simulation). Formula: margin value = 100 / leverage ratio. Example: 1:500 leverage → margin_long = 0.2. These values cannot be set from the input panel — edit them directly in the strategy() call.
Repainting Warning
Before connecting any indicator to the User Zone, verify it does not repaint. A repainting indicator places signal arrows on past bars using data from future bars that did not exist at the time — backtest results will look excellent while live trading produces nothing like it.
How to check using Bar Replay:
Open the indicator on your chart and find a signal arrow in the past
Open Bar Replay and rewind to before that signal appeared
Step forward one bar at a time using Shift + →
Do not use the Play button (Shift + ↓) — bars move too fast to catch a disappearing arrow
If the arrow appears and stays permanently → safe to use. If the arrow appears then disappears or moves as you advance → repainting confirmed, do not use in a strategy.
How to check using Alert Log:
Enable the indicator's built-in alert, wait for it to fire on a live bar, then compare the alert log entry to the signal arrow on the chart. If they do not match in timing or direction → repainting.
Disclaimer
This script is published for educational purposes only. It is a framework and template — not a complete trading system and not financial advice. Backtest results shown in Strategy Tester reflect historical data only and do not guarantee future performance. Past performance is not indicative of future results.
All trading involves significant risk of loss. Do not trade with money you cannot afford to lose. The results produced by this template depend entirely on the signal logic the user provides — the author accepts no responsibility for any trading decisions made using this script or any modifications of it.
Before using any strategy in live trading, you should fully understand how it works, verify its logic independently, and test it thoroughly on a demo account. Always consult a qualified financial advisor before making investment decisions.
The pre-built Moving Average Cross trigger and Moving Average Trend filter included in the User Zone are provided as examples only — they are not recommendations to trade any specific method. استراتيجية

Pi Cycle Top OscillatorOverview
The Pi Cycle Top Oscillator is an advanced, adaptive iteration of the classic Pi Cycle Top indicator, reimagined as a continuous risk metric. While the original indicator famously predicted Bitcoin’s macro peaks by waiting for a binary crossover of the 111-day SMA and the 2x 350-day SMA, this script translates the relationship between these two moving averages into a normalized 0 to 1 oscillator, providing both buy and sell signals.
As an asset matures, its volatility historically compresses. In the 2021 cycle, the classic moving averages barely touched, meaning future cycles might never see a pure crossover due to the law of diminishing returns. This oscillator solves that problem by replacing the rigid crossover requirement with dynamic, regression-based boundaries.
Tip
Hide the Bitcoin price chart to clearly view the metric in the main chart pane:
How it Works
Instead of waiting for a binary signal, this indicator calculates the exact mathematical ratio between the two moving averages:
ratio = ta.sma(close, 111) / (ta.sma(close, 350) * 2)
Using historical extremes of this ratio, the script projects two dynamic boundaries:
Top Boundary: A logarithmic regression curve that accounts for historical volatility decay, descending over time.
Bottom Boundary: A linear regression line representing macro bottoms.
The current ratio is then normalized between these two converging lines, producing a continuous Risk metric.
Key Features
Continuous Risk Scale: Unlike the classic indicator which is either "on" or "off", this oscillator provides a constant reading from 0 (historical bottom) to 1 (probable macro top).
Volatility Adjusted: The logarithmic top line factors in macro volatility decay, ensuring the indicator remains relevant in future cycles even if a classic crossover never occurs.
Visual Chart Feedback: The main chart automatically highlights price bars in Green when Risk falls below your custom Buy Zone Level, and Red when Risk exceeds your Sell Zone Level.
Dual Display Modes: Use the indicator settings to toggle between the normalized 0-1 "Oscillator" view and the raw "Fit Lines" view to see the actual ratio and regression curves.
How to Use
This tool is designed for macro-level portfolio risk management rather than short-term trading.
Accumulation: Readings near or below 0.1 historically correlate with macro bottoms, presenting potential long-term accumulation zones.
Distribution: Readings near or above 0.9 indicate severe market overheating, signaling potential distribution zones.
You can adjust the Buy and Sell zone thresholds in the indicator settings to fit your personal risk tolerance.
Limitations
Bitcoin Exclusive: This indicator is designed strictly for analyzing Bitcoin. Its mathematical model is based entirely on Bitcoin's historical macro cycles and is not applicable to other cryptocurrencies or traditional assets.
No Guaranteed Extremes: There are no guarantees that the oscillator will reach the upper or lower boundaries in future cycles, nor that it will remain strictly within the 0 to 1 range. For example, during the 2025 cycle, the oscillator never reached the theoretical sell zone, demonstrating that market dynamics can and do shift.
Static Curve Fitting: The regression curves for the upper and lower boundaries were fitted using the global tops and bottoms of the 111-day and 2x 350-day SMA ratio prior to 2023. The resulting equation coefficients are hardcoded directly into the script. As new macro extremes form in the future, these boundary models may eventually require a new approximation to maintain their accuracy.
مؤشر

SuperTrend AI Adaptive - Strategy [BTC]+2,091% returns. 1.94 profit factor. 28% max drawdown.
Buy and hold returned ~785% over the same period with 75%+ drawdowns. This strategy returned 2,091% with less than a third of the drawdown. Consistent upward equity curve through bull markets, bear markets, and sideways chop.
This is the strategy version of SuperTrend AI . Same regime-adaptive engine, same AI scoring, now with full entries, exits, and risk management built in.
◈ How It Works
The strategy detects market regime shifts (trending, volatile, ranging) and adapts the SuperTrend multiplier automatically. Every trend flip is scored 0-100 by a 5-factor AI engine. Only high-scoring flips become trade entries.
The 5 scoring factors:
Volume Surge: was there conviction behind the flip?
Displacement: how far did price break through the band?
Trend Alignment: does the EMA agree with the direction?
Regime Quality: trending regimes score highest, ranging get penalized
Band Distance: how far did price travel to reach the flip point?
Low-scoring flips are skipped entirely. This is the main edge. Standard SuperTrend enters on every flip. This strategy is selective.
◈ Regime Adaptation
TRENDING regime: multiplier stays at base. Normal conditions, normal entries.
VOLATILE regime: multiplier widens automatically. Prevents noise-driven entries. Band turns amber on chart.
RANGING regime: multiplier tightens slightly. Entries are blocked by default because SuperTrend gets chopped in ranges.
The regime filter alone eliminates most of the losing trades that kill standard SuperTrend strategies.
◈ Risk Management
Three stop loss modes:
ATR-based (default): dynamic stop that adjusts to current volatility
Percent: fixed percentage stop
SuperTrend: exit only on trend flip
Take profit modes:
Risk:Reward ratio (default 2.5:1): TP based on SL distance
Percent: fixed percentage target
None: hold until stop or flip
Optional trailing stop for locking in profits on extended trends. All parameters are adjustable.
◈ Why It Beats Buy and Hold
Buy and hold works in hindsight. In real time, you sit through 50-75% drawdowns hoping for recovery. This strategy:
Shorts during bear markets instead of bleeding. The 2022 and early 2026 bear legs were profitable, not just survivable.
Stays flat during ranging markets. No entries when conditions are bad.
Compounds gains from both directions. Longs in uptrends, shorts in downtrends.
The equity curve tells the story. Consistent staircase up with controlled pullbacks vs the rollercoaster of buy and hold.
◈ Default Settings (optimized for BTCUSDT 4H)
SuperTrend: ATR 10, Base Multiplier 3.0
Regime: Lookback 40, ADX 14, Threshold 20
AI Engine: Trend EMA 50, Volume MA 20, Min Score 65
Risk: SL Mode ATR, SL ATR Mult 6.0, TP Mode RR 2.5:1
Filters: EMA Trend Filter on, Skip Ranging on, Volume Filter on, Cooldown 5
Position: 80% of equity per trade
Commission: 0.06% (Binance futures level), 2 ticks slippage
◈ Adapting to Other Assets
These defaults are tuned for BTCUSDT 4H. For other assets, adjust:
Other crypto (ETH, SOL) 4H: Same settings, may need Min Score 60
Forex 1H to 4H: Lower position size to 20-30%, tighten SL to 2.5-3.0 ATR, trend following works less well on forex
Indices 1H: SL ATR 3.0-4.0, position size 30-50%
SuperTrend strategies work best on assets that trend. Crypto on higher timeframes trends the hardest.
◈ Backtest Notes
Period: Jan 2015 to Feb 2026 (10+ years, includes multiple bull and bear cycles)
Initial capital: $10,000 USDT
Commission: 0.06% per trade (realistic for Binance futures)
Slippage: 2 ticks
Position sizing: 80% of equity (compounding)
No pyramiding. One position at a time.
Signals are non-repainting. Entries on confirmed bar close only.
Returns are compounded. The 2,091% figure reflects reinvesting profits at 80% equity per trade. Without compounding, the raw edge is captured by the profit factor (1.94) and win rate (46% at 2.5:1 RR).
◈ Key Metrics
Total P&L: +2,091%
Profit Factor: 1.94
Win Rate: 46.10% (71 of 154 trades)
Max Drawdown: 28.16%
Average trade count: roughly 15 per year
◈ Features
✓ Regime-adaptive SuperTrend with automatic multiplier adjustment
✓ AI signal scoring filters out low-quality trend flips
✓ Three SL modes (ATR, Percent, SuperTrend flip)
✓ Three TP modes (Risk:Reward, Percent, None)
✓ Optional trailing stop
✓ EMA trend filter, regime filter, volume filter
✓ Realistic commission and slippage included
✓ Dashboard showing trend, regime, position status, and signal score
✓ Non-repainting entries on confirmed bar close
✓ 100% original code
◈ Companion Indicator
This strategy is built on the SuperTrend AI indicator. Use the indicator for live chart analysis and the strategy for backtesting and validation. Both available free on my profile.
◈ Disclaimer
Past backtest performance does not guarantee future results. All backtests have inherent limitations including look-ahead bias in parameter selection. These settings were optimized on the full sample period. Always forward-test before risking real capital. Use proper position sizing and risk management. This is not financial advice.
Happy trading. استراتيجية

مؤشر

استراتيجية

MACD Forecast Colorful [DiFlip]MACD Forecast Colorful
The Future of Predictive MACD — is one of the most advanced and customizable MACD indicators ever published on TradingView. Built on the classic MACD foundation, this upgraded version integrates statistical forecasting through linear regression to anticipate future movements — not just react to the past.
With a total of 22 fully configurable long and short entry conditions, visual enhancements, and full automation support, this indicator is designed for serious traders seeking an analytical edge.
⯁ Real-Time MACD Forecasting
For the first time, a public MACD script combines the classic structure of MACD with predictive analytics powered by linear regression. Instead of simply responding to current values, this tool projects the MACD line, signal line, and histogram n bars into the future, allowing you to trade with foresight rather than hindsight.
⯁ Fully Customizable
This indicator is built for flexibility. It includes 22 entry conditions, all of which are fully configurable. Each condition can be turned on/off, chained using AND/OR logic, and adapted to your trading model.
Whether you're building a rules-based quant system, automating alerts, or refining discretionary signals, MACD Forecast Colorful gives you full control over how signals are generated, displayed, and triggered.
⯁ With MACD Forecast Colorful, you can:
• Detect MACD crossovers before they happen.
• Anticipate trend reversals with greater precision.
• React earlier than traditional indicators.
• Gain a powerful edge in both discretionary and automated strategies.
• This isn’t just smarter MACD — it’s predictive momentum intelligence.
⯁ Scientifically Powered by Linear Regression
MACD Forecast Colorful is the first public MACD indicator to apply least-squares predictive modeling to MACD behavior — effectively introducing machine learning logic into a time-tested tool.
It uses statistical regression to analyze historical behavior of the MACD and project future trajectories. The result is a forward-shifted MACD forecast that can detect upcoming crossovers and divergences before they appear on the chart.
⯁ Linear Regression: Technical Foundation
Linear regression is a statistical method that models the relationship between a dependent variable (y) and one or more independent variables (x). The basic formula for simple linear regression is:
y = β₀ + β₁x + ε
Where:
y = predicted variable (e.g., future MACD value)
x = independent variable (e.g., bar index)
β₀ = intercept
β₁ = slope
ε = random error (residual)
The regression model calculates β₀ and β₁ using the least squares method, minimizing the sum of squared prediction errors to produce the best-fit line through historical values. This line is then extended forward, generating a forecast based on recent price momentum.
⯁ Least Squares Estimation
The regression coefficients are computed with the following formulas:
β₁ = Σ((xᵢ - x̄)(yᵢ - ȳ)) / Σ((xᵢ - x̄)²)
β₀ = ȳ - β₁x̄
Where:
Σ denotes summation; x̄ and ȳ are the means of x and y; and i ranges from 1 to n (number of observations). These equations produce the best linear unbiased estimator under the Gauss–Markov assumptions — constant variance (homoscedasticity) and a linear relationship between variables.
⯁ Regression in Machine Learning
Linear regression is a foundational model in supervised learning. Its ability to provide precise, explainable, and fast forecasts makes it critical in AI systems and quantitative analysis.
Applying linear regression to MACD forecasting is the equivalent of injecting artificial intelligence into one of the most widely used momentum tools in trading.
⯁ Visual Interpretation
Picture the MACD values over time like this:
Time →
MACD →
A regression line is fitted to recent MACD values, then projected forward n periods. The result is a predictive trajectory that can cross over the real MACD or signal line — offering an early-warning system for trend shifts and momentum changes.
The indicator plots both current MACD and forecasted MACD, allowing you to visually compare short-term future behavior against historical movement.
⯁ Scientific Concepts Used
Linear Regression: models the relationship between variables using a straight line.
Least Squares Method: minimizes squared prediction errors for best-fit.
Time-Series Forecasting: projects future data based on past patterns.
Supervised Learning: predictive modeling using labeled inputs.
Statistical Smoothing: filters noise to highlight trends.
⯁ Why This Indicator Is Revolutionary
First open-source MACD with real-time predictive modeling.
Scientifically grounded with linear regression logic.
Automatable through TradingView alerts and bots.
Smart signal generation using forecasted crossovers.
Highly customizable with 22 buy/sell conditions.
Enhanced visuals with background (bgcolor) and area fill (fill) support.
This isn’t just an update — it’s the next evolution of MACD forecasting.
⯁ Example of simple linear regression with one independent variable
This example demonstrates how a basic linear regression works when there is only one independent variable influencing the dependent variable. This type of model is used to identify a direct relationship between two variables.
⯁ In linear regression, observations (red) are considered the result of random deviations (green) from an underlying relationship (blue) between a dependent variable (y) and an independent variable (x)
This concept illustrates that sampled data points rarely align perfectly with the true trend line. Instead, each observed point represents the combination of the true underlying relationship and a random error component.
⯁ Visualizing heteroscedasticity in a scatterplot with 100 random fitted values using Matlab
Heteroscedasticity occurs when the variance of the errors is not constant across the range of fitted values. This visualization highlights how the spread of data can change unpredictably, which is an important factor in evaluating the validity of regression models.
⯁ The datasets in Anscombe’s quartet were designed to have nearly the same linear regression line (as well as nearly identical means, standard deviations, and correlations) but look very different when plotted
This classic example shows that summary statistics alone can be misleading. Even with identical numerical metrics, the datasets display completely different patterns, emphasizing the importance of visual inspection when interpreting a model.
⯁ Result of fitting a set of data points with a quadratic function
This example illustrates how a second-degree polynomial model can better fit certain datasets that do not follow a linear trend. The resulting curve reflects the true shape of the data more accurately than a straight line.
⯁ What is the MACD?
The Moving Average Convergence Divergence (MACD) is a technical analysis indicator developed by Gerald Appel. It measures the relationship between two moving averages of a security’s price to identify changes in momentum, direction, and strength of a trend. The MACD is composed of three components: the MACD line, the signal line, and the histogram.
⯁ How to use the MACD?
The MACD is calculated by subtracting the 26-period Exponential Moving Average (EMA) from the 12-period EMA. A 9-period EMA of the MACD line, called the signal line, is then plotted on top of the MACD line. The MACD histogram represents the difference between the MACD line and the signal line.
Here are the primary signals generated by the MACD:
• Bullish Crossover: When the MACD line crosses above the signal line, indicating a potential buy signal.
• Bearish Crossover: When the MACD line crosses below the signal line, indicating a potential sell signal.
• Divergence: When the price of the security diverges from the MACD, suggesting a potential reversal.
• Overbought/Oversold Conditions: Indicated by the MACD line moving far away from the signal line, though this is less common than in oscillators like the RSI.
⯁ How to use MACD forecast?
The MACD Forecast is built on the same foundation as the classic MACD, but with predictive capabilities.
Step 1 — Spot Predicted Crossovers:
Watch for forecasted bullish or bearish crossovers. These signals anticipate when the MACD line will cross the signal line in the future, letting you prepare trades before the move.
Step 2 — Confirm with Histogram Projection:
Use the projected histogram to validate momentum direction. A rising histogram signals strengthening bullish momentum, while a falling projection points to weakening or bearish conditions.
Step 3 — Combine with Multi-Timeframe Analysis:
Use forecasts across multiple timeframes to confirm signal strength (e.g., a 1h forecast aligned with a 4h forecast).
Step 4 — Set Entry Conditions & Automation:
Customize your buy/sell rules with the 20 forecast-based conditions and enable automation for bots or alerts.
Step 5 — Trade Ahead of the Market:
By preparing for future momentum shifts instead of reacting to the past, you’ll always stay one step ahead of lagging traders.
📈 BUY
🍟 Signal Validity: The signal will remain valid for X bars.
🍟 Signal Sequence: Configurable as AND or OR.
🍟 MACD > Signal Smoothing
🍟 MACD < Signal Smoothing
🍟 Histogram > 0
🍟 Histogram < 0
🍟 Histogram Positive
🍟 Histogram Negative
🍟 MACD > 0
🍟 MACD < 0
🍟 Signal > 0
🍟 Signal < 0
🍟 MACD > Histogram
🍟 MACD < Histogram
🍟 Signal > Histogram
🍟 Signal < Histogram
🍟 MACD (Crossover) Signal
🍟 MACD (Crossunder) Signal
🍟 MACD (Crossover) 0
🍟 MACD (Crossunder) 0
🍟 Signal (Crossover) 0
🍟 Signal (Crossunder) 0
🔮 MACD (Crossover) Signal Forecast
🔮 MACD (Crossunder) Signal Forecast
📉 SELL
🍟 Signal Validity: The signal will remain valid for X bars.
🍟 Signal Sequence: Configurable as AND or OR.
🍟 MACD > Signal Smoothing
🍟 MACD < Signal Smoothing
🍟 Histogram > 0
🍟 Histogram < 0
🍟 Histogram Positive
🍟 Histogram Negative
🍟 MACD > 0
🍟 MACD < 0
🍟 Signal > 0
🍟 Signal < 0
🍟 MACD > Histogram
🍟 MACD < Histogram
🍟 Signal > Histogram
🍟 Signal < Histogram
🍟 MACD (Crossover) Signal
🍟 MACD (Crossunder) Signal
🍟 MACD (Crossover) 0
🍟 MACD (Crossunder) 0
🍟 Signal (Crossover) 0
🍟 Signal (Crossunder) 0
🔮 MACD (Crossover) Signal Forecast
🔮 MACD (Crossunder) Signal Forecast
🤖 Automation
All BUY and SELL conditions can be automated using TradingView alerts. Every configurable condition can trigger alerts suitable for fully automated or semi-automated strategies.
⯁ Unique Features
Linear Regression: (Forecast)
Signal Validity: The signal will remain valid for X bars
Signal Sequence: Configurable as AND/OR
Table of Conditions: BUY/SELL
Conditions Label: BUY/SELL
Plot Labels in the graph above: BUY/SELL
Automate & Monitor Signals/Alerts: BUY/SELL
Background Colors: "bgcolor"
Background Colors: "fill"
Linear Regression (Forecast)
Signal Validity: The signal will remain valid for X bars
Signal Sequence: Configurable as AND/OR
Table of Conditions: BUY/SELL
Conditions Label: BUY/SELL
Plot Labels in the graph above: BUY/SELL
Automate & Monitor Signals/Alerts: BUY/SELL
Background Colors: "bgcolor"
Background Colors: "fill"
مؤشر

Dumb Money Flow - Retail Panic & FOMO# Dumb Money Flow (DMF) - Retail Panic & FOMO
## 🌊 Overview
**Dumb Money Flow (DMF)** is a powerful **contrarian indicator** designed to track the emotional state of the retail "herd." It identifies moments of extreme **Panic** (irrational selling) and **FOMO** (irrational buying) by analyzing on-chain data, volume anomalies, and price velocity.
In crypto markets, retail traders often buy the top (FOMO) and sell the bottom (Panic). This indicator helps you do the opposite: **Buy when the herd is fearful, and Sell when the herd is greedy.**
---
## 🧠 How It Works
The indicator combines multiple data points into a single **Sentiment Index** (0-100), normalized over a 90-day period to ensure it always uses the full range of the chart.
### 1. Panic Index (Bearish Sentiment)
Tracks signs of capitulation and fear. High values contribute to the **Panic Zone**.
* **Exchange Inflows:** Spikes in funds moving to exchanges (preparing to sell).
* **Volume Spikes:** High volume during price drops (panic selling).
* **Price Crash (ROC):** Rapid, emotional price drops over 3 days.
* **Volatility (ATR):** High market nervousness and instability.
### 2. FOMO Index (Bullish Sentiment)
Tracks signs of euphoria and greed. High values contribute to the **FOMO Zone**.
* **Exchange Outflows:** Funds moving to cold storage (HODLing/Greed).
* **Profitable Addresses:** When >90% of holders are in profit, tops often form.
* **Parabolic Rise:** Rapid, unsustainable price increases.
---
## 🎨 Visual Guide
The indicator uses a distinct color scheme to highlight extremes:
* **🟢 Dark Green Zone (> 80): Extreme FOMO**
* **Meaning:** The crowd is euphoric. Risk of a correction is high.
* **Action:** Consider taking profits or looking for short entries.
* **🔴 Dark Burgundy Zone (< 20): Extreme Panic**
* **Meaning:** The crowd is capitulating. Prices may be oversold.
* **Action:** Look for buying opportunities (catching the knife with confirmation).
* **🔵 Light Blue Line:**
* The smoothed moving average of the sentiment, helpful for seeing the trend direction.
---
## 🛠️ How to Use (Trading Strategies)
### 1. Contrarian Reversals (The Primary Strategy)
* **Buy Signal:** Wait for the line to drop deep into the **Burgundy Panic Zone (< 20)** and then start curling up. This indicates that the worst of the selling pressure is over.
* **Sell Signal:** Wait for the line to spike into the **Green FOMO Zone (> 80)** and then start curling down. This suggests buying exhaustion.
### 2. Divergences
* **Bullish Divergence:** Price makes a **Lower Low**, but the DMF Indicator makes a **Higher Low** (less panic on the second drop). This is a strong reversal signal.
* **Bearish Divergence:** Price makes a **Higher High**, but the DMF Indicator makes a **Lower High** (less FOMO/buying power on the second peak).
### 3. Trend Confirmation (Midline Cross)
* **Crossing 50 Up:** Sentiment is shifting from Fear to Greed (Bullish).
* **Crossing 50 Down:** Sentiment is shifting from Greed to Fear (Bearish).
---
## ⚙️ Settings
* **Data Source:** Defaults to `INTOTHEBLOCK` for on-chain data.
* **Crypto Asset:** Auto-detects BTC/ETH, but can be forced.
* **Normalization Period:** Default 90 days. Determines the "window" for defining what is considered "Extreme" relative to recent history.
* **Weights:** You can customize how much each factor (Volume, Inflows, Price) contributes to the index.
---
**Disclaimer:** This indicator is for educational purposes only. "Dumb Money" analysis is a probability tool, not a crystal ball. Always manage your risk.
**Indicator by:** @iCD_creator
**Version:** 1.0
**Pine Script™ Version:** 6
---
## Updates & Support
For questions, suggestions, or bug reports, please comment below or message the author.
**Like this indicator? Leave a 👍 and share your feedback!**
مؤشر

مؤشر

Crypto Index Price# Crypto Index Price - Indicator Description
## 📊 What is this indicator?
**Crypto Index Price** is an indicator for creating your own cryptocurrency index based on an equal-weighted portfolio. It allows you to track the overall dynamics of the cryptocurrency market through a composite index of selected assets.
## 🎯 Key Features
- **Up to 20 assets in the index** — create an index from any trading pairs
- **Equal-weighted methodology** — each asset has the same weight in the index
- **Moving average** — optional trend filter for the index
- **Flexible visualization settings** — customizable colors and line thickness
## 📈 How to Use
The indicator is displayed in a separate pane below the chart and shows:
1. **Blue line** — crypto index value
2. **Orange line** (optional) — moving average of the index
### Trading Applications:
- **Identify overall market trend** — if the index is rising, most coins are in an uptrend
- **Divergences** — divergence between your asset and the index may signal local opportunities
- **Signal confirmation** — use the index to confirm trading decisions on individual coins
- **Market condition filter** — trade longs when index is above MA, shorts when below
## ⚙️ Settings
### Assets (Symbols)
- **Asset 1-10** — main cryptocurrencies (default: BTC, ETH, BNB, SOL, XRP, ADA, AVAX, LINK, DOGE, TRX)
- **Asset 11-20** — additional slots for index expansion
### Visual Parameters
- **Index line color** — main line color (default: blue)
- **Line width** — from 1 to 5 pixels
- **Show moving average** — enable/disable MA
- **MA period** — moving average calculation period (default: 20)
- **MA color** — moving average line color (default: orange)
## 💡 Recommendations
- For a top coins index, use 5-10 largest cryptocurrencies by market cap
- For an altcoin index, add medium and small coins from your sector
- Use MA to filter false signals and identify the global trend
- Compare individual asset behavior with the index to find anomalies
## ⚠️ Important
The indicator uses equal-weighted methodology — each coin contributes equally regardless of price or market cap. This differs from cap-weighted indices and may provide a different market perspective.
---
*This indicator is intended for analysis and is not trading advice. Always conduct your own analysis before making trading decisions.*
--- مؤشر

Hello Crypto! Modern Combo Snapshot
Unified long/short analyzer blending EMA structure, SuperTrend, WaveTrend, QQE, and volume pressure.
Background shading flags “watch” and “ready” states; optional long/short modules let you focus on one side.
Alerts fire when every checklist item aligns, while the side-panel table summarizes trend, momentum, liquidity, and overall score in real time.
Indicator → Trend Analysis
Indicator → Momentum Oscillators
Indicator → Volume Indicators
Tags:
cryptocurrency, bitcoin, altcoins, trend-following, momentum, volume, ema, supertrend, intraday, swing-trading, alerts, checklist, trading-strategy, risk-management مؤشر

Aggregated Open Interest Multi-Exchange (USD)This indicator aggregates Open Interest (OI) data from multiple major cryptocurrency exchanges into a single unified view in USD, using data available on TradingView. It automatically adapts to the asset you're viewing on the chart.
Features:
Aggregates OI from 7 major exchanges: Binance, Bybit, OKX, Bitget, Deribit, HTX, and Coinbase
All values converted to USD - unlike native OI which shows contracts/coins
Uses only data available on TradingView platform
Automatically detects the asset from your chart (BTC, ETH, SOL, etc.)
True apples-to-apples comparison across exchanges
Displays as candlesticks showing OI open, high, low, and close
Toggle exchanges on/off individually
Handles different contract types per exchange automatically
Why USD conversion matters:
Traditional OI indicators show values in contracts or crypto units, making it difficult to compare across exchanges. This indicator converts everything to USD, giving you the real dollar value of open positions across all exchanges.
How it works:
Simply add the indicator to any crypto perpetual futures chart. It will automatically fetch and aggregate OI data from all supported exchanges for that asset using TradingView's built-in data feeds, converting everything to USD.
Supported Exchanges:
Binance, Bybit, Bitget, HTX: USDT perpetuals
Deribit: BTC/ETH use USD contracts, others use USDC
OKX: Contract-based (automatically converted)
Coinbase: USDC perpetuals
Perfect for traders who want a comprehensive view of total market Open Interest in USD across exchanges using reliable TradingView data.
مؤشر

Crypto OI AgregatedCrypto OI Aggregated — Open Interest Aggregator for Crypto Exchanges
General Description
The indicator is designed for comprehensive analysis of Open Interest (OI) across major cryptocurrency exchanges. It consolidates data from multiple platforms, visualizes it as candlestick charts or deltas, and builds tables with breakdowns by exchange and contract type. This allows traders to quickly understand where market interest is concentrated and how the market structure is shifting.
Unlike standard tools that only show data from a single exchange, this indicator provides a full market overview and makes it easy to compare dynamics across different platforms.
⸻
Key Features
• Aggregation of OI data from exchanges: Binance, Bybit, OKX, Bitget, Kraken, HTX, Deribit (feel free to leave a comment if you’d like me to add other exchanges that provide open interest data)
• Support for contract types: USDT.P, USD.P, USDC.P, USD.PM
• Automatic normalization of various OI data formats from different providers
• Display modes:
• OI candlestick chart (total aggregated OI)
• OI Delta (change in OI per bar)
• Full table with detailed data by exchange and contract type
• Short summary table with totals in USD and base assets
• Support for USD or COIN denomination
• Convenient formatting for large numbers
• Customizable colors
⸻
How to Use the Indicator
1. Select Exchanges
In the settings, enable or disable specific exchanges. It is recommended to activate only the ones you need for analysis — this will make the indicator faster.
2. Choose Data Type
• OI — aggregated open interest from selected exchanges.
• OI delta — delta (change in OI compared to the previous bar).
3. Denomination
• USD — values are converted into USD equivalents.
• COIN — values are shown in the base asset (BTC, ETH, etc.).
4. Reading the Chart
• OI candlesticks show the overall OI dynamics.
• Delta histogram highlights how much OI has grown or decreased per bar.
• Colors are fully customizable.
5. Tables
• Enabled via the Show table option.
• Full Table → Rows = exchanges, Columns = contract types. Cells contain OI values in either USD or the base asset, depending on settings. Quickly shows where the main interest is concentrated.
• Short Table → Displays only the total OI values in USD and the base asset.
⸻
Important Notes
• For better readability of large values, two custom formatting functions were implemented. They work similarly to format.volume, but with improved digit grouping and adjustable decimal precision. In the tables, the top row is formatted using format.volume, while the bottom row uses the improved formatting functions for clearer representation.
str(d, n, s) =>
str.substring(d, 0, str.length(d) - n) + '.' + str.substring(d, str.length(d) - n, str.length(d) - (n - 2)) + s
format(_r) =>
d = str.tostring(math.round(_r))
str.length(d) > 9 ? str(d, 9, " B") : str.length(d) > 6 ? str(d, 6, " M") : str.length(d) > 3 ? str(d, 3, " K") : d
⸻
Conclusion: Crypto OI Aggregated is a convenient and powerful tool for cryptocurrency derivatives traders. It enables tracking of OI dynamics across multiple exchanges simultaneously, detecting imbalances between contracts, and identifying signals that are not visible when analyzing a single exchange.
مؤشر

Mutanabby_AI | ATR+ | Trend-Following StrategyThis document presents the Mutanabby_AI | ATR+ Pine Script strategy, a systematic approach designed for trend identification and risk-managed position entry in financial markets. The strategy is engineered for long-only positions and integrates volatility-adjusted components to enhance signal robustness and trade management.
Strategic Design and Methodological Basis
The Mutanabby_AI | ATR+ strategy is constructed upon a foundation of established technical analysis principles, with a focus on objective signal generation and realistic trade execution.
Heikin Ashi for Trend Filtering: The core price data is processed via Heikin Ashi (HA) methodology to mitigate transient market noise and accentuate underlying trend direction. The script offers three distinct HA calculation modes, allowing for comparative analysis and validation:
Manual Calculation: Provides a transparent and deterministic computation of HA values.
ticker.heikinashi(): Utilizes TradingView's built-in function, employing confirmed historical bars to prevent repainting artifacts.
Regular Candles: Allows for direct comparison with standard OHLC price action.
This multi-methodological approach to trend smoothing is critical for robust signal generation.
Adaptive ATR Trailing Stop: A key component is the Average True Range (ATR)-based trailing stop. ATR serves as a dynamic measure of market volatility. The strategy incorporates user-defined parameters (
Key Value and ATR Period) to calibrate the sensitivity of this trailing stop, enabling adaptation to varying market volatility regimes. This mechanism is designed to provide a dynamic exit point, preserving capital and locking in gains as a trend progresses.
EMA Crossover for Signal Generation: Entry and exit signals are derived from the interaction between the Heikin Ashi derived price source and an Exponential Moving Average (EMA). A crossover event between these two components is utilized to objectively identify shifts in momentum, signaling potential long entry or exit points.
Rigorous Stop Loss Implementation: A critical feature for risk mitigation, the strategy includes an optional stop loss. This stop loss can be configured as a percentage or fixed point deviation from the entry price. Importantly, stop loss execution is based on real market prices, not the synthetic Heikin Ashi values. This design choice ensures that risk management is grounded in actual market liquidity and price levels, providing a more accurate representation of potential drawdowns during backtesting and live operation.
Backtesting Protocol: The strategy is configured for realistic backtesting, employing fill_orders_on_standard_ohlc=true to simulate order execution at standard OHLC prices. A configurable Date Filter is included to define specific historical periods for performance evaluation.
Data Visualization and Metrics: The script provides on-chart visual overlays for buy/sell signals, the ATR trailing stop, and the stop loss level. An integrated information table displays real-time strategy parameters, current position status, trend direction, and key price levels, facilitating immediate quantitative assessment.
Applicability
The Mutanabby_AI | ATR+ strategy is particularly suited for:
Cryptocurrency Markets: The inherent volatility of assets such as #Bitcoin and #Ethereum makes the ATR-based trailing stop a relevant tool for dynamic risk management.
Systematic Trend Following: Individuals employing systematic methodologies for trend capture will find the objective signal generation and rule-based execution aligned with their approach.
Pine Script Developers and Quants: The transparent code structure and emphasis on realistic backtesting provide a valuable framework for further analysis, modification, and integration into broader quantitative models.
Automated Trading Systems: The clear, deterministic entry and exit conditions facilitate integration into automated trading environments.
Implementation and Evaluation
To evaluate the Mutanabby_AI | ATR+ strategy, apply the script to your chosen chart on TradingView. Adjust the input parameters (Key Value, ATR Period, Heikin Ashi Method, Stop Loss Settings) to observe performance across various asset classes and timeframes. Comprehensive backtesting is recommended to assess the strategy's historical performance characteristics, including profitability, drawdown, and risk-adjusted returns.
I'd love to hear your thoughts, feedback, and any optimizations you discover! Drop a comment below, give it a like if you find it useful, and share your results.
استراتيجية

MVRV Ratio [Alpha Extract]The MVRV Ratio Indicator provides valuable insights into Bitcoin market cycles by tracking the relationship between market value and realized value. This powerful on-chain metric helps traders identify potential market tops and bottoms, offering clear buy and sell signals based on historical patterns of Bitcoin valuation.
🔶 CALCULATION The indicator processes MVRV ratio data through several analytical methods:
Raw MVRV Data: Collects MVRV data directly from INTOTHEBLOCK for Bitcoin
Optional Smoothing: Applies simple moving average (SMA) to reduce noise
Status Classification: Categorizes market conditions into four distinct states
Signal Generation: Produces trading signals based on MVRV thresholds
Price Estimation: Calculates estimated realized price (Current price / MVRV ratio)
Historical Context: Compares current values to historical extremes
Formula:
MVRV Ratio = Market Value / Realized Value
Smoothed MVRV = SMA(MVRV Ratio, Smoothing Length)
Estimated Realized Price = Current Price / MVRV Ratio
Distance to Top = ((3.5 / MVRV Ratio) - 1) * 100
Distance to Bottom = ((MVRV Ratio / 0.8) - 1) * 100
🔶 DETAILS Visual Features:
MVRV Plot: Color-coded line showing current MVRV value (red for overvalued, orange for moderately overvalued, blue for fair value, teal for undervalued)
Reference Levels: Horizontal lines indicating key MVRV thresholds (3.5, 2.5, 1.0, 0.8)
Zone Highlighting: Background color changes to highlight extreme market conditions (red for potentially overvalued, blue for potentially undervalued)
Information Table: Comprehensive dashboard showing current MVRV value, market status, trading signal, price information, and historical context
Interpretation:
MVRV ≥ 3.5: Potential market top, strong sell signal
MVRV ≥ 2.5: Overvalued market, consider selling
MVRV 1.5-2.5: Neutral market conditions
MVRV 1.0-1.5: Fair value, consider buying
MVRV < 1.0: Potential market bottom, strong buy signal
🔶 EXAMPLES
Market Top Identification: When MVRV ratio exceeds 3.5, the indicator signals potential market tops, highlighting periods where Bitcoin may be significantly overvalued.
Example: During bull market peaks, MVRV exceeding 3.5 has historically preceded major corrections, helping traders time their exits.
Bottom Detection: MVRV values below 1.0, especially approaching 0.8, have historically marked excellent buying opportunities.
Example: During bear market bottoms, MVRV falling below 1.0 has identified the most profitable entry points for long-term Bitcoin accumulation.
Tracking Market Cycles: The indicator provides a clear visualization of Bitcoin's market cycles from undervalued to overvalued states.
Example: Following the progression of MVRV from below 1.0 through fair value and eventually to overvalued territory helps traders position themselves appropriately throughout Bitcoin's market cycle.
Realized Price Support: The estimated realized price often acts as a significant
support/resistance level during market transitions.
Example: During corrections, price often finds support near the realized price level calculated by the indicator, providing potential entry points.
🔶 SETTINGS
Customization Options:
Smoothing: Toggle smoothing option and adjust smoothing length (1-50)
Table Display: Show/hide the information table
Table Position: Choose between top right, top left, bottom right, or bottom left positions
Visual Elements: All plots, lines, and background highlights can be customized for color and style
The MVRV Ratio Indicator provides traders with a powerful on-chain metric to identify potential market tops and bottoms in Bitcoin. By tracking the relationship between market value and realized value, this indicator helps identify periods of overvaluation and undervaluation, offering clear buy and sell signals based on historical patterns. The comprehensive information table delivers valuable context about current market conditions, helping traders make more informed decisions about market positioning throughout Bitcoin's cyclical patterns.
مؤشر

مؤشر

Aggregated Open Interest [Alpha Extract]The Aggregated Open Interest indicator provides a comprehensive view of open interest across multiple cryptocurrency exchanges, allowing traders to monitor institutional positioning and market sentiment. By aggregating data from major exchanges like Binance, BitMEX, and Kraken, this indicator offers valuable insights into potential price movements and market shifts.
🔶 CALCULATION
The indicator processes open interest data through multiple analytical methods:
Exchange Aggregation: Collects and normalizes open interest data from multiple exchanges (Binance, BitMEX, Kraken) with proper currency normalization.
Multi-Mode Analysis: Calculates various metrics including raw open interest values, OI change, OI delta, volume-weighted delta, and OI RSI.
Divergence Detection: Uses pivot point analysis to identify divergences between price action and open interest movements.
Activity Assessment: Tracks bullish and bearish activity patterns by correlating open interest changes with price movements.
Formula:
Aggregate OI = Sum of normalized open interest from selected exchanges
OI Change = Current OI - Previous OI
OI Delta = Net change in open interest across timeframes
OI Delta × Volume = OI Delta weighted by relative volume
OI RSI = Relative Strength Index applied to open interest values
OI Heatmap = Multi-timeframe visualization of OI changes across 7 distinct periods
🔶 DETAILS
Visual Features:
Open Interest: Candlestick representation of aggregated open interest
OI Change: Histogram showing period-to-period changes
OI Delta: Histogram displaying net OI movements
OI Delta × Volume: Volume-weighted OI delta for enhanced signals
OI RSI: Oscillator showing overbought/oversold OI conditions
OI Heatmap: Multi-timeframe visualization showing OI changes across 7 periods (3, 5, 8, 13, 21, 34, and 55 days)
Divergence Detection: Color-coded markers (teal for bullish, red for bearish) highlighting significant divergences between price and open interest
Analysis Table: Real-time summary of key metrics including aggregate OI, recent changes, and bullish/bearish activity.
Interpretation:
Increasing Open Interest + Rising Price: Strong bullish trend confirmation
Increasing Open Interest + Falling Price: Strong bearish trend confirmation
Decreasing Open Interest + Rising Price: Weak bullish trend (potential reversal)
Decreasing Open Interest + Falling Price: Weak bearish trend (potential reversal)
Divergences: Signal potential trend exhaustion and reversals when price moves in one direction while open interest moves in the opposite direction
Heatmap: Provides at-a-glance insight into open interest trends across multiple timeframes, with green bars indicating rising OI and red bars indicating falling OI
🔶 EXAMPLES
Trend Confirmation: Rising open interest accompanying a price increase confirms strong bullish momentum with institutional backing.
Example: During January-February 2025, rising OI during price advances confirms institutional participation in the uptrend.
Bearish Divergence: Price makes a higher high while open interest makes a lower high, signaling potential trend reversal.
Example: Red markers appear at market tops where price continues higher but open interest fails to confirm, preceding significant corrections.
Bullish Divergence : Price makes a lower low while open interest makes a higher low, indicating potential bottoming.
Example: Teal markers appear at market bottoms where price continues lower but open interest fails to confirm, preceding significant rallies.
OI Heatmap Analysis : Multiple timeframes showing consistent red signals across short to long-term periods indicate strong institutional selling pressure.
Example: When all 7 periods (3-55 days) show red during a price uptrend, this signals institutional selling into retail strength, often preceding major corrections.
🔶 SETTINGS
Customization Options:
Data Sources: Toggle different exchanges (Binance USDT/USD/BUSD, BitMEX USD/USDT, Kraken USD)
Display Mode: Choose between Open Interest, OI Change, OI Delta, OI Delta × Volume, OI RSI, and OI Heatmap
Currency Units: Display in USD or base cryptocurrency (COIN)
Analysis Tools: Moving Average (length and color), RSI (length and color)
Divergence Detection: Enable/disable signals, adjust lookback period and threshold percentage, customize bullish/bearish divergence colors
OI Heatmap Colors: Customize bullish (green) and bearish (red) signal colors for the multi-timeframe heatmap visualization
The Aggregated Open Interest indicator provides traders with comprehensive insights into institutional positioning across major exchanges, helping identify potential trend continuations, reversals, and key market turning points driven by smart money movements. The addition of the OI Heatmap feature enables traders to quickly visualize open interest trends across multiple timeframes, providing valuable context for institutional positioning over different market cycles.
مؤشر

Stablecoin Supply Ratio [Alpha Extract]Stablecoin Supply Ratio Indicator
The Stablecoin Supply Ratio (SSR) indicator compares Bitcoin's market capitalization to the aggregate supply of major stablecoins, offering insights into relative purchasing power and liquidity. This tool helps traders:
✔ Assess Bitcoin's buying power relative to the available stablecoin liquidity.
✔ Detect periods of capital inflow or outflow from stablecoins.
✔ Identify market sentiment shifts based on stablecoin reserves.
🔶 CALCULATION
The indicator aggregates the supply of key stablecoins and compares it to Bitcoin's market cap:
Stablecoin Aggregation
• Inputs:
USDT, USDC, DAI, USDD (daily closing values).
BUSD Market Cap (Glassnode data).
• Total Stablecoin Supply:
Sum of the listed stablecoins' market caps.
Stablecoin Supply Ratio (SSR)
• Formula:
SSR = Bitcoin Market Cap / Total Stablecoin Supply
• Normalized SSR:
Normalized by dividing SSR by its 200-day SMA.
Bollinger Bands
• Bands are applied to the normalized SSR using a configurable moving average type and 2 standard deviations.
Example Calculation:
ssr = btcmc / stablecoin_liq
ratio = ssr / ta.sma(ssr, 200)
basis = ta.sma(ratio, 200)
dev = 2 * ta.stdev(ratio, 200)
upper = basis + dev
lower = basis - dev
🔶 DETAILS
Visual Features:
• Normalized SSR:
Plotted as a light green line.
• Upper Band:
Red line indicating SSR overbought zone.
• Lower Band:
Green line signaling SSR oversold zone.
Interpretation:
• High SSR: Indicates stablecoin reserves are low relative to Bitcoin's market cap, reducing stablecoin buying power.
• Low SSR: Suggests high stablecoin liquidity relative to Bitcoin's market cap, increasing potential buying pressure.
• Band Crosses: Movements beyond the upper or lower bands may signal sentiment extremes.
🔶 EXAMPLES
Market insights include:
• Capital Outflows: SSR rising into the upper band may reflect decreasing stablecoin reserves, potentially signaling a liquidity drain.
• Capital Inflows: SSR dropping near the lower band could indicate growing stablecoin reserves, potentially fueling Bitcoin demand.
🔶 SETTINGS
Customization Options:
• MA Type: Choose between SMA, EMA, WMA, SMMA, and VWMA for band calculation.
• Period: Adjust the 200-day smoothing period.
• Deviation Multiplier: Modify the standard deviation multiplier (default: 2).
The Stablecoin Supply Ratio indicator is a valuable tool for traders monitoring liquidity dynamics and stablecoin trends to anticipate Bitcoin market moves and capital flows. مؤشر
