MOEX Sectors: % Above MA 50/100/200 (EMA/SMA)🧠 Name:
MOEX Sectors: % Above MA 50/100/200 (EMA/SMA)
📋 Description (for TradingView “Description” tab):
This indicator shows the percentage of Moscow Exchange sectoral indices trading above the selected moving average (SMA or EMA) with periods of 50, 100, or 200.
It uses 10 official MOEX sector indices:
MOEXOG (Oil & Gas)
MOEXCH (Chemicals)
MOEXMM (Metals & Mining)
MOEXTN (Transport)
MOEXCN (Consumer)
MOEXFN (Financials)
MOEXTL (Telecom)
MOEXEU (Utilities)
MOEXIT (IT)
MOEXRE (Real Estate)
The indicator plots up to 3 lines representing the % of sectors trading above MA 50, 100, and/or 200. The MA type is user-selectable: EMA (default) or SMA.
Horizontal reference levels (90, 50, 10) help interpret market conditions:
🔼 >90% — Overbought zone, potential market exhaustion
⚖️ ~50% — Neutral state
🔽 <10% — Oversold zone, possible rebound
📈 How to Use in Strategy:
✅ 1. Trend Filter
If >50% of sectors are above MA 200 → market in long-term uptrend
If <50% → avoid long bias, bearish regime likely
✅ 2. Bottom Detection
When <10% of sectors are above MA 200, the market is heavily oversold — often a bottoming signal
✅ 3. Trend Confirmation
If the main index is rising and % of sectors above MA is growing, the trend is supported by breadth
If the index rises while breadth declines → bearish divergence
✅ 4. Contrarian Setups
>90% of sectors above MA 50 → market may be overheated, watch for pullback
<20% above MA 50 → potential local bottom
⚙️ Tips:
Overlay this indicator on the IMOEX index chart to detect narrow leadership
Combine with other breadth metrics or RSI on the index
Use the EMA/SMA toggle to fine-tune sensitivity
Indicators and strategies
Regime Filter IndicatorRegime Filter – Crypto Market Trend Indicator
📊 Overview
The Regime Filter is a powerful market analysis indicator designed specifically for crypto trading. It helps traders identify whether the market is in a bullish or bearish phase by analyzing key assets in the cryptocurrency market, including Bitcoin (BTC), Bitcoin Dominance (BTC.D), and the Altcoin Market (TOTAL3). The indicator compares these assets against their respective Simple Moving Averages (SMA) to determine the overall market regime, allowing traders to make more informed decisions.
🔍 How It Works
The Regime Filter evaluates three main components to determine the market's sentiment:
1. BTC Dominance (BTC.D) vs. 40 SMA (Medium Timeframe)
The Bitcoin Dominance (BTC.D) is compared to its 40-period SMA on a mid-timeframe (e.g.,
1-hour). If BTC.D is below the 40 SMA, it indicates that altcoins are performing well relative
to Bitcoin, suggesting a bullish altcoin market. If BTC.D is above the 40 SMA, Bitcoin is
gaining dominance, indicating a potential bearish phase for altcoins.
2. TOTAL3 Market Cap vs. 100 SMA (Medium Timeframe)
The TOTAL3 index, which tracks the total market capitalization of all cryptocurrencies except
Bitcoin and Ethereum, is compared to its 100-period SMA. A bullish signal occurs when TOTAL3
is above the 100 SMA, indicating strength in altcoins, while a bearish signal occurs when
TOTAL3 is below the 100 SMA, signaling a potential weakness in the altcoin market.
3. BTC Price vs. 200 SMA (Higher Timeframe)
The current Bitcoin price is compared to its 200-period Simple Moving Average (SMA) on a
higher timeframe (e.g., 4-hour). A bullish signal is given when the BTC price is above the 200
SMA, and a bearish signal when it's below.
🟢 Bullish Market Conditions
The market is considered bullish when:
- BTC Dominance (BTC.D) is below the 40 SMA, suggesting altcoins are gaining momentum.
- TOTAL3 Market Cap is above the 100 SMA, signaling strength in the altcoin market.
- BTC price is above the 200 SMA, indicating an uptrend in Bitcoin.
In these conditions, the background turns green 🟢, and a "Bullish" label is displayed on the chart.
🔴 Bearish Market Conditions
The market is considered bearish when:
- BTC Dominance (BTC.D) is above the 40 SMA, indicating Bitcoin is outperforming altcoins.
- TOTAL3 Market Cap is below the 100 SMA, signaling weakness in altcoins.
- BTC price is below the 200 SMA, indicating a downtrend in Bitcoin.
In these conditions, the background turns red 🔴, and a "Bearish" label appears on the chart.
⚙ Customization Options
- The Regime Filter offers flexibility for traders:
- Enable or Disable Specific SMAs: Customize the indicator by enabling or disabling the 200 SMA for Bitcoin, the 40 SMA for BTC Dominance, and the 100 SMA for TOTAL3.
- Adjust Timeframes: Choose the timeframes for each of the moving averages to suit your preferred trading strategy.
- Real-Time Data Adjustments: The indicator updates in real-time to reflect current market conditions, ensuring timely analysis.
📈 Best Use Cases
- Trend Confirmation: The Regime Filter is ideal for confirming the market's overall trend,
helping traders to align their positions with the dominant market sentiment.
- Trade Entry/Exit Signals: Use the indicator to identify favorable entry or exit points based on
whether the market is in a bullish or bearish phase.
- Market Overview: Gain a quick understanding of the broader crypto market, with a focus on
Bitcoin and altcoins, to make more strategic decisions.
⚠️ Important Notes
Trend-Following Indicator: The Regime Filter is a trend-following tool, meaning it works best in strong trending markets. It may not perform well in choppy, sideways markets.
Risk Management: This indicator is designed to assist in identifying market trends, but it does not guarantee profits. Always apply sound risk management strategies and use additional indicators when making trading decisions.
Not a Profit Guarantee: While this indicator can help identify potential market trends, no trading tool or strategy guarantees profits. Please trade responsibly and ensure that your decisions are based on comprehensive analysis and risk tolerance.
Candle Scale ComparisonCompares the scale of bullish and bearish candles and shows which side is currently dominant. Works in any symbol.
1. Input Parameters:
- LookbackPeriod: Allows you to set how many bars to look back for calculating averages (default: 20)
- showLabels: Toggle to show/hide dominance labels on the chart
2. Calculations:
- Calculates the scale of bullish candles (close - open)
Calculates the scale of bearish candles (open - close)
- Computes moving averages for both scales using the specified lookback period
- Determines which type of candles are dominating based on the averages
3. Visual Elements:
- Plots two lines showing the average scales:
- Green line for bullish candle scales
- Red line for bearish candle scales
- Adds a background color that changes based on dominance:
- Light green when bullish candles dominate
- Light red when bearish candles dominate
- Shows labels above the chart indicating current dominance
- Displays a table in the top-right corner showing:
- The current scale ratio (bullish/bearish)
- The current dominance status
4. Features:
- The indicator is plotted in a separate pane below the main chart
- Uses color coding for easy visual interpretation
- Provides both visual and numerical representation of the dominance
- Updates in real-time as new candles form
Volatility ContractionA very simple indicator which calculates the range of a definable period (the default is 5 bars) using a percentage range between the highest and lowest prices calculated from the candle bodies (i.e. open and close values). The plotted line makes it easy to see when price movement is tightening (volatility contraction). The dashed threshold line (default 10%) provides a reference point for setting alerts, helping to identify periods of low volatility (e.g. for stocks in your watchlist) that could signal upcoming market action.
TICK Bias Timer with EMA Position📌 Description
This indicator tracks the time in minutes that the Exponential Moving Average (EMA) of the NYSE USI:TICK remains above or below the zero line. It serves as a powerful market breadth confirmation tool to support your intraday directional bias.
Rather than focusing on momentary TICK spikes, this tool emphasizes duration and persistence of buying/selling pressure across the entire NYSE – helping traders stay on the right side of the flow.
🔧 Features
✅ Measures how long the EMA of TICK stays above or below 0
✅ Visual plots of upward and downward pressure duration (in minutes)
✅ Background color changes based on EMA position relative to 0
✅ Automatic daily reset at a customizable time (e.g. 15:30 for RTH open)
✅ Gap filter to avoid spikes during overnight or weekend sessions
✅ Clean, minimalist design – built for real-time decision making
🎯 How to Use
EMA > 0 for 10+ minutes → sustained bullish breadth → intraday bullish bias
EMA < 0 for 10+ minutes → sustained bearish breadth → intraday bearish bias
Frequent flip between sides → uncertain or choppy market → trade with caution
Can be used in confluence with Volume Profile, VWAP, price action, and Bookmap to reinforce trade setups.
💡 Ideal For:
Scalpers looking for flow confirmation
Day traders who want to filter fake strength/weakness
Professionals using TICK, USI:ADD , USI:VOLD , and other internals for decision-making
Abhi's Bollinger Band Reversal SignalThis Pine Script indicator is designed to detect reversal trade opportunities using Bollinger Band breakouts. It identifies both buy and sell setups with clearly defined entry, stop-loss (SL), and target (TP) conditions. It also manages trades visually with real-time signal plotting, and limits entries per trading day.
⚙️ How It Works
🔽 Sell Signal Conditions
- The previous candle must close above the upper Bollinger Band, and its entire body must be above the band
- The current candle must fail to break the previous high, and must break below the previous low
- Entry is taken at the previous candle’s low, with SL at its high
- Target is calculated based on a configurable Risk:Reward ratio
🔼 Buy Signal Conditions
- The previous candle must close below the lower Bollinger Band, and its entire body must be below the band
- The current candle must fail to break the previous low, and must break above the previous high
- Entry is at the previous candle’s high, with SL at its low
- Target is calculated using the same Risk:Reward ratio
⏰ Time-Based Exit
- If a trade is still active by a user-defined exit time (e.g. 15:15), the trade is closed
- Labels are plotted to show whether this exit was a profit or loss
🧩 User Inputs
- Start Time for signals
- Exit Time for open trades
- Bollinger Band Settings: Period and Std Dev
- Max Entries Per Day
- Risk:Reward Ratio: Dropdown for 1:1, 1:1.5, ..., 1:3
🎨 Visual Features
✅ BUY and SELL signals are plotted when valid conditions are detected
🟢 TP and 🔴 SL labels show trade outcome
🕒 TIME EXIT labels appear at user-set exit time with green/red coloring based on profitability
📉 Bollinger Bands plotted for visual context
📌 Notes:
- Designed for intraday trading, resets entry counter daily
- Uses bar_index > tradeBarIndex to avoid SL/TP being triggered on the same candle as entry
- Tracks only one trade at a time (tradeActive) — ensures clear, non-overlapping logic
London Session 15-min Range – Clean AEST Timestamp Fix (w/ EMAs)London Session 15-min Range – Clean AEST Timestamp Fix (with EMAs)
What it does:
This script is made for traders who want to track the high and low of the first 15-minute candle of the London session, using AEST (UTC+10) as the time reference. It also plots the 50 EMA and 200 EMA to help identify trend direction.
How it works:
Session Timing:
The London session is defined as starting at 6:00 PM AEST.
The session ends at 2:00 AM AEST the next day.
Detects the first 15 minutes of the London session:
During this time, it records the highest and lowest price.
Draws lines once the 15-minute window is over:
A red horizontal line is drawn at the session high.
A green horizontal line is drawn at the session low.
These lines extend 50 bars into the future.
It only draws these once per day/session.
Includes EMAs:
A 50-period EMA is calculated and plotted in yellow.
A 200-period EMA is calculated and plotted in white.
Why use it:
It helps visualise important price levels from the start of the London session and pairs that with moving averages to spot trends or potential breakouts.
Correlation Coefficient TableThis Pine Script generates a dynamic table for analyzing how multiple assets correlate with a chosen benchmark (e.g., NZ50G). Users can input up to 12 asset symbols, customize the benchmark, and define the beta calculation periods (e.g., 15, 30, 90, 180 days). The script calculates Correlation values for each asset over these periods and computes the average beta for better insights.
The table includes:
Asset symbols: Displayed in the first row.
Correlation values: Calculated for each defined period and displayed in subsequent columns.
Average Correlation: Presented in the final column as an overall measure of correlation strength.
Color coding: Background colors indicate beta magnitude (green for high positive beta, yellow for near-neutral beta, red for negative beta).
TriplePower55%🔴 Bearish Candle (Losing Candle)
🔹 Definition:
A candle that closes below the opening price.
Important condition: the body of the candle must be ≥ 55% of the entire candle's range.
It is automatically colored red on the platform.
🔹 Significance:
Used to identify resistance levels or initiate the Triple Power analysis.
The last valid bearish candle (with a body and that broke a bullish candle) is selected to draw Fibonacci levels.
🔹 How it's handled:
When the price closes above the high of the bearish candle, an upward wave begins.
The indicator draws a blue line at its high and a red line at its low, with the timeframe labeled (e.g., TF: M).
🟢 Bullish Candle (Winning Candle)
🔹 Definition:
A candle that closes above the opening price.
Its body must be ≥ 55% of the total candle's range.
It is automatically colored green on the platform.
🔹 Significance:
Used to identify support levels, or as a reference in extensions or pauses.
The last closed bullish candle is used to draw extension targets if there’s no valid bearish candle.
🔹 How it's handled:
If the price closes below the low of the monthly bullish candle, it signals the start of a strong downward trend.
If the low is not broken, the movement is considered a temporary pause.
The stop level is placed at the low of the last closed bullish candle.
Option Stop-Limit Calculator1. Indicator Overview
Purpose: Automates stop-loss calculations for call/put options by linking the underlying stock’s stop price to the option’s limit price using delta and a buffer percentage.
Key Features:
Plots a horizontal line for the stock’s stop price.
Displays real-time option limit prices in a table.
Supports alerts for stop triggers.
Complete Users Training Manual is embedded into the code of the indicator.
You may not use any portion of this code for monetization purposes.
The intent is to serve everyone in the community and hopefully make us all prosper.
Good Luck
UM Futures Dashboard with Moving Average DirectionUM Futures Dashboard with Moving Average Direction
Description :
This futures dashboard gives you quick glance of all “major” futures prices and percentage changes. The text color and trends are based on your configured moving average type and length. The dashboard will display LONG in green text when the configure MA is trending higher and SHORT in red when the configured MA is trending lower. The dashboard also includes the VIX futures roll yield and VIX futures status of Contango or Backwardation.
I have included the indicator twice on the sample chart to illustrate different table settings. I also included an 8 period WMA overlay on the price chart since this is the default of the dashboard. (The Moving Average color change is another one of my indicators titled “UM EMA SMA WMA HMA with Directional Color Change”)
Defaults and Configuration :
The default MA type is the Weighted Moving Average, (WMA) with a daily setting of 8. Choices include WMA, SMA, and EMA. The table location defaults to the upper right corner in landscape mode. It can also be set to “flip” to portrait mode. I have added the table to the chart twice to illustrate the table orientations.
Table location, orientation, timeframe, moving average type and length are user-configurable. The configured dashboard timeframe is independent of the chart timeframe. Percentage changes and Moving Averages are based on the configured dashboard timeframe.
Alerts :
Alerts can be configured on the directional change of the dashboard moving average. For example, if the daily 8 period weighted moving average begins trending higher it will turn from red to green. This color change would fire a LONG alert. A color trend change of the weighted moving average from green to red would fire a SHORT alert. Alerts are disabled by default but can be set for any or all of the futures contracts included.
Suggested Uses :
If you follow or trade futures, add this dashboard indicator to your chart layout. Configure your favorite moving average. Use this to quickly see where all the major futures are trading. This saved me from thumbing through the CNBC app on my phone.
One thing I do is to “stretch” moving average to a smaller timeframe. For example, if you like the 8 period WMA on the daily, try the 192 WMA on the hourly. ( The daily 8 period WMA is roughly a 192 WMA on an hourly chart) This can smooth out some of the violent price action and give better entries/exits.
Setup a FUTURES indicator template. I do this with the dashboard and couple other of my favorite indicators.
Suggested Settings :
Daily charts: 8 WMA
Exchange PrefixAllows users to show the exchange name of your currently-viewed ticker on the latest bars.
For example, viewing BTCUSDT on BINANCE would provide "BINANCE".
Similarly, viewing BTCUSDT on CRYPTO.COM would provide "CRYPTOCOM".
What is the purpose of this?
- Sometimes pine script coders would like to know the exact names of the exchanges. This script does the job.
M2 Global Liquidity Index - X Days LeadThis custom indicator overlays the Bitcoin price chart with the Global Liquidity M2 chart, providing a unique perspective on how monetary supply might influence Bitcoin's price movements. The indicator distinguishes between past and future segments of the liquidity data using two distinct colors.
- Past Segment: The portion of the Global Liquidity M2 chart that has already passed is displayed in one color, allowing users to assess historical correlations with Bitcoin's price.
- Future Segment: The upcoming part of the liquidity chart is shown in a different color, offering insights into potential future impacts on Bitcoin's price trajectory.
by walkin
Supply & Demand Zones + Order Block (Pro Fusion) SuroLevel up your trading edge with this all-in-one Supply and Demand Zones + Order Block TradingView indicator, built for precision traders who focus on price action and smart money concepts.
🔍 Key Features:
Automatic detection of Supply & Demand Zones based on refined swing highs and lows
Dynamic Order Block recognition with customizable thresholds
Highlights Breakout signals with volume confirmation and trend filters
Built-in EMA 50 trend detection
Take Profit (TP1, TP2, TP3) projection levels
Clean visual labels for Demand, Supply, and OB zones
Uses smart box plotting with long extended zones for better zone visibility
🔥 Ideal for:
Traders who follow Smart Money Concepts (SMC)
Supply & Demand strategy practitioners
Breakout & Retest pattern traders
Scalpers, swing, and intraday traders using Order Flow logic
📈 Works on all markets: Forex, Crypto, Stocks, Indices
📊 Recommended timeframes: M15, H1, H4, Daily
✅ Enhance your trading strategy using this powerful zone-based script — bringing structure, clarity, and automation to your chart.
#SupplyAndDemand #OrderBlock #TradingViewScript #SmartMoney #BreakoutStrategy #TPProjection #ForexIndicator #SMC
Trade Ladder Pro: Compounding & Risk ManagerTrade Ladder Pro: Compounding & Risk Manager
Inspired by the popular $20 to $52,000 trading challenge, this tool is designed to help you scale your trading account using systematic compounding and enhanced risk management techniques. Whether you’re aiming for disciplined growth or fine-tuning your risk/reward, Trade Ladder Pro offers a flexible approach to visualizing your trade levels.
How to Use:
Inputs:
Compounding Mode:
Set your starting balance, final balance goal, number of trades, and current trade level. You can move to the next trade after a successful trade in settings. The entries are not signals. They are there to help manage risk.
The script calculates the necessary compounding factor to grow your balance across the defined trades.
Risk Management Mode:
In addition to the above, specify a risk percentage and risk/reward ratio.
Input an entry price (or leave it at 0 to use the current price) to automatically compute the stop loss and take profit levels.
Display Options:
Choose the table’s position on the chart (e.g., Top Right, Top Left, Bottom Right, Bottom Left).
Pick between a vertical or horizontal layout for a display that suits your workflow.
Results:
The table will display the trade level, starting balance, risk amount, entry price, take profit, and (if in Risk Management mode) stop loss along with the projected ending balance.
Community & Feedback:
Your feedback is invaluable! Please share any tips or report any errors you encounter so we can continue to improve this tool. Happy trading!
SuperTrader Trend Analysis and Trade Study DashboardSuperTrader Trend Analysis and Trade Study Dashboard
Overview
This script offers a multi-faceted look at market behavior. It combines signals from different momentum indicators, daily cross checks, and a specialized dashboard to reveal trend strength, potential divergences, and how far price has traveled from its recent averages.
Three Musketeers Method
This script uses a special set of three indicators (the “Three Musketeers”) to determine bullish or bearish pressure on the current chart.
Trend Condition – Compares fast vs. slow EMAs (50 and 200) and checks which side of the line price is favoring.
Mean Reversion Condition – Watches RSI crossing typical oversold or overbought thresholds (e.g., crossing above 30 or below 70).
Bollinger Condition – Checks whether price pushes above/below the Bollinger Bands (based on a 20 SMA + standard deviations).
When at least two out of these three conditions align in a bullish way, the script issues a Buy Signal . Conversely, if at least two align in a bearish way, a Sell Signal is triggered. This “Three Musketeers” synergy ensures multiple confirmations before calling a potential market turn.
Mag 8 Daily Performance
The script tracks eight highly influential stocks (AAPL, AMZN, GOOG, NFLX, NVDA, TSLA, META, MSFT) to see which are green (higher) or red (lower) compared to yesterday’s close. It then prints a quick tally – helpful in gauging overall market mood via these major players.
Golden / Death Cross Signals
On a daily time frame, the script notes when the 50-day SMA crosses above or below the 200-day SMA. A “Golden Cross” often signals rising momentum, while a “Death Cross” can hint at oncoming weakness.
RSI & Divergence Checks
RSI helps identify hidden turning points. Whenever a bullish or bearish divergence is spotted, the script updates you via a concise readout.
Hardcoded Settings
EMA lengths for trend checks, Bollinger parameters, etc., are locked in, letting you focus on adjusting only the pivotal study inputs (e.g., RSI length, VIDYA momentum).
VIDYA Trend Line & Fill
Built on an adaptive Variable Index Dynamic Average, it plots a line that quickly reacts to changing momentum. Users can set a “Trend Band Distance” to mark ATR-based thresholds around that line, identifying possible breakouts or breakdowns.
YoYo Distance
This concept measures how far price strays from SMA(10). If it’s too far, the script colors your display to indicate potential snapbacks.
Gap Up/Down Probability
By weighing volume, MACD signals, and whether price sits above/below its midrange, the script estimates probabilities of a gap up or down on the next daily candle.
Table Output & Trend Label
Turning on Show Table Widget reveals a quick dashboard on the chart detailing RSI, CCI, divergences, bull/bear scores, and more. A label on the last bar further summarizes overall trend, gap distance, and the Mag 8 snapshot – perfect for a fast read of current market posture.
Use this script to unify multiple signals in one place, see how far price has ventured from typical patterns, and get daily cross signals plus real-time bullish/bearish calls – all at a glance.
Reversal + Confirm ZonesThis script is written in Pine Script (version 5) for TradingView and creates an indicator called **"Reversal + Confirm Zones"**. It overlays visual zones on a price chart to identify potential reversal points and confirmation signals for trading. The indicator combines **Bollinger Bands** and **RSI** to detect overbought/oversold conditions (reversal zones) and uses **EMA crosses** and **MACD zero-line crosses** to confirm bullish or bearish trends. Below is a detailed explanation:
---
### **1. Purpose**
- The script highlights:
- **Reversal Zones**: Areas where the price might reverse due to being overbought (green) or oversold (red).
- **Confirmation Zones**: Areas where a trend reversal is confirmed using EMA and MACD signals (green for bullish, red for bearish).
- It provides visual backgrounds and alerts to assist traders in spotting potential trade setups.
---
### **2. Components**
The script is divided into two main parts: **Reversal Logic** and **Confirmation Logic**.
---
### **3. Reversal Logic (Red & Green Zones)**
#### **Bollinger Bands**
- **Parameters**:
- Length: 20 periods.
- Source: Closing price (`close`).
- Multiplier: 2.0 (standard deviations).
- **Calculation**:
- `basis`: 20-period Simple Moving Average (SMA).
- `dev`: 2 times the standard deviation of the price over 20 periods.
- `upper`: `basis + dev` (upper band).
- `lower`: `basis - dev` (lower band).
- **Purpose**: Identifies when the price moves outside the normal range (beyond 2 standard deviations).
#### **Relative Strength Index (RSI)**
- **Parameters**:
- Length: 14 periods.
- Low Threshold: 30 (oversold).
- High Threshold: 70 (overbought).
- **Calculation**: `rsiValue = ta.rsi(close, rsiLength)`.
- **Purpose**: Measures momentum to confirm overbought or oversold conditions.
#### **Zone Conditions**
- **Red Zone (Oversold)**:
- Condition: `close < lower` (price below lower Bollinger Band) AND `rsiValue < rsiLowThreshold` (RSI < 30).
- Visual: Light red background (`color.new(color.red, 80)`).
- Alert: "Deep Oversold Signal triggered!".
- **Green Zone (Overbought)**:
- Condition: `close > upper` (price above upper Bollinger Band) AND `rsiValue > rsiHighThreshold` (RSI > 70).
- Visual: Light green background (`color.new(color.green, 80)`).
- Alert: "Deep Overbought Signal triggered!".
#### **Interpretation**
- Red Zone: Suggests the price is oversold and may reverse upward.
- Green Zone: Suggests the price is overbought and may reverse downward.
---
### **4. Confirmation Logic (EMA and MACD Crosses)**
#### **Exponential Moving Averages (EMAs)**
- **Parameters**:
- Short EMA Length: 9 periods (user adjustable).
- Long EMA Length: 21 periods (user adjustable).
- **Calculation**:
- `emaShort = ta.ema(close, emaShortLength)`.
- `emaLong = ta.ema(close, emaLongLength)`.
- **Conditions**:
- **Bullish EMA Cross**: `emaCrossBullish = ta.crossover(emaShort, emaLong)` (9 EMA crosses above 21 EMA).
- **Bearish EMA Cross**: `emaCrossBearish = ta.crossunder(emaShort, emaLong)` (9 EMA crosses below 21 EMA).
#### **MACD**
- **Parameters**:
- Fast Length: 12 periods (user adjustable).
- Slow Length: 26 periods (user adjustable).
- Signal Smoothing: 9 periods (user adjustable).
- **Calculation**:
- ` = ta.macd(close, macdFastLength, macdSlowLength, macdSignalSmoothing)`.
- Only the MACD line and signal line are used; the histogram is ignored (`_`).
- **Conditions**:
- **Bullish MACD Cross**: `macdCrossBullish = ta.crossover(macdLine, 0)` (MACD crosses above zero).
- **Bearish MACD Cross**: `macdCrossBearish = ta.crossunder(macdLine, 0)` (MACD crosses below zero).
#### **Combined Confirmation Conditions**
- **Bullish Confirmation**:
- Condition: `bullishConfirmation = emaCrossBullish and macdCrossBullish`.
- Visual: Very light green background (`color.new(color.green, 90)`).
- Meaning: A bullish trend is confirmed when the 9 EMA crosses above the 21 EMA AND the MACD crosses above zero.
- **Bearish Confirmation**:
- Condition: `bearishConfirmation = emaCrossBearish and macdCrossBearish`.
- Visual: Very light red background (`color.new(color.red, 90)`).
- Meaning: A bearish trend is confirmed when the 9 EMA crosses below the 21 EMA AND the MACD crosses below zero.
---
### **5. Visual Outputs**
- **Reversal Zones**:
- Red background for oversold conditions.
- Green background for overbought conditions.
- **Confirmation Zones**:
- Light green background for bullish confirmation.
- Light red background for bearish confirmation.
- Note: The script does not plot the Bollinger Bands, EMAs, or MACD lines—only the background zones are visualized.
---
### **6. Alerts**
- **Deep Oversold Alert**: Triggers when the red zone condition is met.
- **Deep Overbought Alert**: Triggers when the green zone condition is met.
- No alerts are set for the confirmation zones (EMA/MACD crosses).
---
### **7. How It Works**
1. **Reversal Detection**:
- The script uses Bollinger Bands and RSI to flag extreme price levels (red for oversold, green for overbought).
- These zones suggest potential reversals but are not confirmed yet.
2. **Trend Confirmation**:
- EMA crosses (9/21) and MACD zero-line crosses provide confirmation of a trend direction.
- Bullish confirmation (green) occurs when both indicators align upward.
- Bearish confirmation (red) occurs when both indicators align downward.
3. **Trading Strategy**:
- Look for a red zone (oversold) followed by a bullish confirmation for a potential long entry.
- Look for a green zone (overbought) followed by a bearish confirmation for a potential short entry.
---
### **8. How to Use**
1. Add the script to TradingView.
2. Adjust inputs (EMA lengths, MACD settings) if desired.
3. Monitor the chart:
- Red zones indicate oversold conditions—watch for a potential upward reversal.
- Green zones indicate overbought conditions—watch for a potential downward reversal.
- Light green/red backgrounds confirm the trend direction after a reversal zone.
4. Set up alerts for oversold/overbought conditions to catch reversal signals early.
---
### **9. Key Features**
- **Dual Purpose**: Combines reversal detection (Bollinger Bands + RSI) with trend confirmation (EMA + MACD).
- **Visual Simplicity**: Uses background colors instead of plotting lines, keeping the chart clean.
- **Customizable**: Allows users to tweak EMA and MACD periods.
- **Alerts**: Notifies users of extreme conditions for timely action.
---
### **10. Limitations**
- No plotted indicators (e.g., Bollinger Bands, EMAs, MACD) for visual reference—relies entirely on background shading.
- Confirmation signals (EMA/MACD) may lag behind reversal zones, potentially missing fast reversals.
- No alerts for confirmation zones, limiting real-time notification of trend confirmation.
This script is ideal for traders who want a straightforward way to spot potential reversals and confirm them with trend-following indicators, all overlaid on the price chart.
Moving Average Convergence DivergenceThis script is written in Pine Script (version 6) for TradingView and implements the **Moving Average Convergence Divergence (MACD)** indicator. The MACD is a popular momentum oscillator used to identify trend direction, strength, and potential reversals. This version includes customizable inputs, visual enhancements (like crossover markers), and alerts for key events. Below is a detailed explanation of the script:
---
### **1. Purpose**
- The script calculates and displays the MACD line, signal line, and histogram.
- It highlights key events such as MACD/signal line crossovers and zero-line crosses with shapes and colors.
- It provides alerts for changes in the histogram's direction (rising to falling or vice versa).
---
### **2. User Inputs**
- **Fast Length**: Period for the fast moving average (default: 12).
- **Slow Length**: Period for the slow moving average (default: 26).
- **Source**: Data input for calculation (default: closing price, `close`).
- **Signal Smoothing**: Period for the signal line (default: 9, range: 1–50).
- **Oscillator MA Type**: Type of moving average for MACD calculation (options: SMA or EMA, default: EMA).
- **Signal Line MA Type**: Type of moving average for the signal line (options: SMA or EMA, default: EMA).
---
### **3. MACD Calculation**
The MACD is calculated in three parts:
1. **MACD Line**: Difference between the fast and slow moving averages.
- Fast MA: Either SMA or EMA of the source over `fast_length`.
- Slow MA: Either SMA or EMA of the source over `slow_length`.
- Formula: `macd = fast_ma - slow_ma`.
2. **Signal Line**: A moving average (SMA or EMA) of the MACD line over `signal_length`.
- Formula: `signal = sma_signal == "SMA" ? ta.sma(macd, signal_length) : ta.ema(macd, signal_length)`.
3. **Histogram**: Difference between the MACD line and the signal line.
- Formula: `hist = macd - signal`.
---
### **4. Key Events Detection**
#### **MACD/Signal Line Crossovers**
- **Bullish Cross**: MACD crosses above the signal line (`ta.crossover(macd, signal)`).
- **Bearish Cross**: MACD crosses below the signal line (`ta.crossunder(macd, signal)`).
#### **Zero Line Crosses**
- **Cross Above Zero**: MACD crosses above 0 (`ta.crossover(macd, 0)`).
- **Cross Below Zero**: MACD crosses below 0 (`ta.crossunder(macd, 0)`).
---
### **5. Colors**
- **MACD Line**: Green (#089981) if MACD > signal (bullish), red (#f23645) if MACD < signal (bearish).
- **Signal Line**: White (`color.white`).
- **Histogram**:
- Positive (MACD > signal): Light green (#B2DFDB) if decreasing, darker green (#26A69A) if increasing.
- Negative (MACD < signal): Light red (#FFCDD2) if increasing in magnitude, darker red (#FF5252) if decreasing in magnitude.
- **Zero Line**: Gray with 50% transparency (`color.new(#787B86, 50)`).
---
### **6. Visual Outputs**
#### **Plotted Lines**
- **MACD Line**: Plotted with dynamic coloring based on its position relative to the signal line.
- **Signal Line**: Plotted in white.
- **Histogram**: Displayed as columns, with colors indicating direction and momentum.
- **Zero Line**: Horizontal line at 0 for reference.
#### **Shapes for Key Events**
- **Bullish Cross Below Zero**: Green circle on the MACD line when MACD crosses above the signal line while still below zero.
- **Bearish Cross Above Zero**: Red circle on the MACD line when MACD crosses below the signal line while still above zero.
- **Cross Above Zero**: Green upward label at the zero line when MACD crosses above 0.
- **Cross Below Zero**: Red downward label at the zero line when MACD crosses below 0.
---
### **7. Alerts**
- **Rising to Falling**: Triggers when the histogram switches from positive (or zero) to negative.
- Condition: `hist >= 0 and hist < 0`.
- Message: "MACD histogram switched from rising to falling".
- **Falling to Rising**: Triggers when the histogram switches from negative (or zero) to positive.
- Condition: `hist <= 0 and hist > 0`.
- Message: "MACD histogram switched from falling to rising".
---
### **8. How It Works**
1. **Trend Direction**:
- MACD above signal line (green) suggests bullish momentum.
- MACD below signal line (red) suggests bearish momentum.
2. **Momentum Strength**:
- Histogram height shows the strength of the momentum (larger bars = stronger momentum).
- Histogram color changes indicate whether momentum is increasing or decreasing.
3. **Reversal Signals**:
- Crossovers between MACD and signal lines often signal potential trend changes.
- Zero-line crosses indicate shifts between bullish (above 0) and bearish (below 0) territory.
---
### **9. How to Use**
1. Add the script to TradingView.
2. Adjust inputs (e.g., fast/slow lengths, MA types) to suit your trading style.
3. Monitor the chart:
- Green MACD and upward histogram bars suggest bullish conditions.
- Red MACD and downward histogram bars suggest bearish conditions.
- Watch for circles (crossovers) and labels (zero-line crosses) for trade signals.
4. Set up alerts to notify you of histogram direction changes.
---
### **10. Key Features**
- **Customization**: Flexible MA types and periods.
- **Visual Clarity**: Dynamic colors and shapes highlight key events.
- **Alerts**: Notifies users of momentum shifts via histogram changes.
- **Intuitive**: Combines all MACD components (line, signal, histogram) in one indicator.
This script is ideal for traders who rely on MACD for momentum analysis and want clear visual cues and alerts for decision-making.
Combined EMA Technical AnalysisThis script is written in Pine Script (version 5) for TradingView and creates a comprehensive technical analysis indicator called "Combined EMA Technical Analysis." It overlays multiple technical indicators on a price chart, including Exponential Moving Averages (EMAs), VWAP, MACD, PSAR, RSI, Bollinger Bands, ADX, and external data from the S&P 500 (SPX) and VIX indices. The script also provides visual cues through colors, shapes, and a customizable table to help traders interpret market conditions.
Here’s a breakdown of the script:
---
### **1. Purpose**
- The script combines several popular technical indicators to analyze price trends, momentum, volatility, and market sentiment.
- It uses color coding (green for bullish, red for bearish, gray/white for neutral) and a table to display key information.
---
### **2. Custom Colors**
- Defines custom RGB colors for bullish (`customGreen`), bearish (`customRed`), and neutral (`neutralGray`) signals to enhance visual clarity.
---
### **3. User Inputs**
- **EMA Colors**: Users can customize the colors of five EMAs (8, 20, 9, 21, 50 periods).
- **MACD Settings**: Adjustable short length (12), long length (26), and signal length (9).
- **RSI Settings**: Adjustable length (14).
- **Bollinger Bands Settings**: Length (20), multiplier (2), and proximity threshold (0.1% of band width).
- **ADX Settings**: Adjustable length (14).
- **Table Settings**: Position (e.g., "Bottom Right") and text size (e.g., "Small").
---
### **4. Indicator Calculations**
#### **Exponential Moving Averages (EMAs)**
- Calculates five EMAs: 8, 20, 9, 21, and 50 periods based on the closing price.
- Used to identify short-term and long-term trends.
#### **Volume Weighted Average Price (VWAP)**
- Resets daily and calculates the average price weighted by volume.
- Color-coded: green if price > VWAP (bullish), red if price < VWAP (bearish), white if neutral.
#### **MACD (Moving Average Convergence Divergence)**
- Uses short (12) and long (26) EMAs to compute the MACD line, with a 9-period signal line.
- Displays "Bullish" (green) if MACD > signal, "Bearish" (red) if MACD < signal.
#### **Parabolic SAR (PSAR)**
- Calculated with acceleration factors (start: 0.02, increment: 0.02, max: 0.2).
- Indicates trend direction: green if price > PSAR (bullish), red if price < PSAR (bearish).
#### **Relative Strength Index (RSI)**
- Measures momentum over 14 periods.
- Highlighted in green if > 70 (overbought), red if < 30 (oversold), white otherwise.
#### **Bollinger Bands (BB)**
- Uses a 20-period SMA with a 2-standard-deviation multiplier.
- Color-coded based on price position:
- Green: Above upper band or close to it.
- Red: Below lower band or close to it.
- Gray: Neutral (within bands).
#### **Average Directional Index (ADX)**
- Manually calculates ADX to measure trend strength:
- Strong trend: ADX > 25.
- Very strong trend: ADX > 50.
- Direction: Bullish if +DI > -DI, bearish if -DI > +DI.
#### **EMA Crosses**
- Detects bullish (crossover) and bearish (crossunder) events for:
- EMA 9 vs. EMA 21.
- EMA 8 vs. EMA 20.
- Visualized with green (bullish) or red (bearish) circles.
#### **SPX and VIX Data**
- Fetches daily closing prices for the S&P 500 (SPX) and VIX (volatility index).
- SPX trend: Bullish if EMA 9 > EMA 21, bearish if EMA 9 < EMA 21.
- VIX levels: High (> 25, fear), Low (< 15, stability).
- VIX color: Green if SPX bullish and VIX low, red if SPX bearish and VIX high, white otherwise.
---
### **5. Visual Outputs**
#### **Plots**
- EMAs, VWAP, and PSAR are plotted on the chart with their respective colors.
- EMA crosses are marked with circles (green for bullish, red for bearish).
#### **Table**
- Displays a summary of indicators in a customizable position and size.
- Indicators shown (if enabled):
- EMA 8/20, 9/21, 50: Green dot if bullish, red if bearish.
- VWAP: Green if price > VWAP, red if price < VWAP.
- MACD: Green if bullish, red if bearish.
- MACD Zero: Green if MACD > 0, red if MACD < 0.
- PSAR: Green if price > PSAR, red if price < PSAR.
- ADX: Arrows for very strong trends (↑/↓), dots for weaker trends, colored by direction.
- Bollinger Bands: Arrows (↑/↓) or dots based on price position.
- RSI: Numeric value, colored by overbought/oversold levels.
- VIX: Numeric value, colored based on SPX trend and VIX level.
---
### **6. Alerts**
- Triggers alerts for EMA 8/20 crosses:
- Bullish: "EMA 8/20 Bullish Cross on Candle Close!"
- Bearish: "EMA 8/20 Bearish Cross on Candle Close!"
---
### **7. Key Features**
- **Flexibility**: Users can toggle indicators on/off in the table and adjust parameters.
- **Visual Clarity**: Consistent use of green (bullish), red (bearish), and neutral colors.
- **Comprehensive**: Combines trend, momentum, volatility, and market sentiment indicators.
---
### **How to Use**
1. Add the script to TradingView.
2. Customize inputs (colors, lengths, table position) as needed.
3. Interpret the chart and table:
- Green signals suggest bullish conditions.
- Red signals suggest bearish conditions.
- Neutral signals indicate indecision or consolidation.
4. Set up alerts for EMA crosses to catch trend changes.
This script is ideal for traders who want a multi-indicator dashboard to monitor price action and market conditions efficiently.
Smart % Levels📈 Smart % Levels – Visualize Significant Percentage Moves
What it does:
This indicator plots horizontal levels based on a percentage change from the previous day's close (or open, if selected). It allows traders to visualize price movements relative to meaningful thresholds like ±1%, ±2%, etc.
What makes it different:
Unlike other level indicators, Smart % Levels only displays the relevant levels based on current price action. This avoids clutter by showing only the levels that are being approached or crossed by the current price. It's a clean and dynamic way to visualize key price zones for intraday analysis.
How it works:
- Select between using the previous day's Close or Open as the reference
- Choose the percentage spacing between levels (e.g., 1%, 0.5%, etc.)
- Enable optional labels to see the exact percentage of each level
- Automatically filters levels to only show those between yesterday's price and today's current price
- Includes customization for colors, line styles, widths, and opacity
Best for:
Day traders and scalpers who want a quick, clean view of how far the current price has moved from yesterday’s reference, without being overwhelmed by unnecessary lines.
Extra notes:
- The levels are recalculated each day at the market open
- All graphics reset at the start of each session to maintain clarity
- This script avoids repainting by only plotting levels relative to available historical data (no lookahead)
This tool is for informational purposes only and should not be considered as financial advice. Always do your own research before making trading decisions.
ATR & PTR TableThe ATR & PTR Table Indicator displays a dynamic table that provides Average True Range (measures market volatility over 1D, 1W, and 1M timeframes), Price trading range (difference between the high and low prices over the same periods) & percentage of the typical range that has been traded. This indicator will help traders identify potential breakout zones and assess volatility across multiple timeframes.
This had been optimized to show ATR and PTR on every time frame. The (1D) represents ATR on whatever timeframe you are currently on.
MA SniperThis indicator automatically finds the most effective moving average to use in a price crossover strategy—so you can focus on trading, not testing. It continuously evaluates a wide range of moving average periods, ranks them based on real-time market performance, and selects the one delivering the highest quality signals. The result? A smarter, adaptive tool that shows you exactly when price crosses its optimal moving average—bullish signals in green, bearish in red.
What makes it unique is the way it thinks.
Under the hood, the script doesn’t just pick a random MA or let you choose one manually. Instead, it backtests a large panel of moving average lengths for the current asset and timeframe. It evaluates each one by calculating its **Profit Factor**—a key performance metric used by pros to measure the quality of a strategy. Then, it assigns each MA a score and ranks them in a clean, built-in table so you can see, at a glance, which ones are currently most effective.
From that list, it picks the top-performing MA and uses it to generate live crossover signals on your chart. That MA is plotted automatically, and the signals adapt in real-time. This isn’t a static setup—it’s a dynamic system that evolves as the market evolves.
Even better: the indicator detects the type of instrument you’re trading (forex, stocks, etc.) and adjusts its internal calculations accordingly, including how many bars per day to consider. That means it remains highly accurate whether you’re trading EURUSD, SPX500, or TSLA.
You also get a real-time dashboard (via the table) that acts as a transparent scorecard. Want to see how other MAs are doing? You can. Want to understand why a certain MA was selected? The data is right there.
This tool is for traders who love crossover strategies but want something smarter, faster, and more precise—without spending hours manually testing. Whether you're scalping or swing trading, it offers a data-driven edge that’s hard to ignore.
Give it a try—you’ll quickly see how powerful it can be when your MA does the thinking for you.
This tool is for informational and educational purposes only. Trading involves risk, and past performance does not guarantee future results. Use responsibly.
Opening Range BreakoutThis is an Opening Range Breakout script. It will plot the opening range high and low (green and red lines, respectively) as determined by the user input (default is a 15 min window from market open, 9:30 - 9:45 am). The time period for the breakout is also configured by a user input (default is from 9:45 am - 2:30 pm).
Alerts are sent for breakouts either above (bullish) or below (bearish) the opening range high and low. An EMA is also used for trend confirmation before sending alerts for breakouts (to avoid false signals).
A bullish breakout is determined by all of the following being true:
- The current price being above the opening range high (green line)
- The EMA trending up (ie the current value of the EMA > prior EMA value)
- The current price is > the EMA
- The EMA is > the opening range high
A bearish breakout is determined by all of the following being true:
- The current price being below the opening range low (red line)
- The EMA trending down (ie the current value of the EMA < prior EMA value)
- The current price is < the EMA
- the EMA is < the opening range low
Enjoy this simple indicator!