CGMALibrary "CGMA"
This library provides a function to calculate a moving average based on Chebyshev-Gauss Quadrature. This method samples price data more intensely from the beginning and end of the lookback window, giving it a unique character that responds quickly to recent changes while also having a long "memory" of the trend's start. Inspired by reading rohangautam.github.io
What is Chebyshev-Gauss Quadrature?
It's a numerical method to approximate the integral of a function f(x) that is weighted by 1/sqrt(1-x^2) over the interval . The approximation is a simple sum: ∫ f(x)/sqrt(1-x^2) dx ≈ (π/n) * Σ f(xᵢ) where xᵢ are special points called Chebyshev nodes.
How is this applied to a Moving Average?
A moving average can be seen as the "mean value" of the price over a lookback window. The mean value of a function with the Chebyshev weight is calculated as:
Mean = /
The math simplifies beautifully, resulting in the mean being the simple arithmetic average of the function evaluated at the Chebyshev nodes:
Mean = (1/n) * Σ f(xᵢ)
What's unique about this MA?
The Chebyshev nodes xᵢ are not evenly spaced. They are clustered towards the ends of the interval . We map this interval to our lookback period. This means the moving average samples prices more intensely from the beginning and the end of the lookback window, and less intensely from the middle. This gives it a unique character, responding quickly to recent changes while also having a long "memory" of the start of the trend.
Chỉ báo và chiến lược
Internal Bar Strength (IBS)This script calculates the Internal Bar Strength (IBS), a mean-reversion indicator defined as (Close - Low) / (High - Low). IBS values range from 0 to 1, with lower values indicating potential oversold conditions and higher values suggesting overbought conditions. Useful for intraday reversal strategies.
Scalping Edge StrategyScalping Edge Strategy
Major exchanges: OKX, KuCoin, Bybit
Trading Checklist
- Is volatility and liquidity present?
- Are indicators aligned?
- Is entry clean?
- Is SL/TP defined before entry?
EMA20-EMA50 DifferenceThe indicator shows whether the EMA20 is above or below the EMA50.
If the curve is above the zero line, the EMA20 is above the EMA50.
If the curve is below the zero line, the EMA20 is below the EMA50.
The greater the distance from the zero line is, the further apart the EMA20 and EMA50 are.
Smart Bar Counter with Alerts🚀 Smart Bar Counter with Alerts 🚀
-----------------------------------------------------
Overview
-----------------------------------------------------
Ever wanted to count a specific number of bars from a key point on your chart—such as after a Break of Structure (BOS), the start of a new trading session, or from any point of interest— without having to stare at the screen?
This "Smart Bar Counter" indicator was created to solve this exact problem. It's a simple yet powerful tool that allows you to define a custom "Start Point" and a "Target Bar Count." Once the target count is reached, it can trigger an Alert to notify you immediately.
-----------------------------------------------------
Key Features
-----------------------------------------------------
• Manual Start Point: Precisely select the date and time from which you want the count to begin, offering maximum flexibility in your analysis.
• Custom Bar Target: Define exactly how many bars you want to count, whether it's 50, 100, or 200 bars.
• On-Chart Display: A running count is displayed on each bar after the start time, allowing you to visually track the progress.
• Automatic Alerts: Set up alerts to be notified via TradingView's various channels (pop-up, mobile app, email) once the target count is reached.
-----------------------------------------------------
How to Use
-----------------------------------------------------
1. Add this indicator to your chart.
2. Go to the indicator's Settings (Gear Icon ⚙️).
- Select Start Time: Set the date and time you wish to begin counting.
- Number of Bars to Count: Input your target number.
3. Set up the Alert ( Very Important! ).
- Right-click on the chart > Select " Add alert ."
- In the " Condition " dropdown, select this indicator: Smart Bar Counter with Alerts .
- In the next dropdown, choose the available alert condition.
- Set " Options " to Once Per Bar Close .
- Choose your desired notification methods under " Alert Actions ."
- Click " Create ."
-----------------------------------------------------
Use Cases
-----------------------------------------------------
• Post-Event Analysis: Count bars after a key event like a Break of Structure (BOS) or Change of Character (CHoCH) to observe subsequent price action.
• Time-based Analysis: Use it to count bars after a market open for a specific session (e.g., London, New York).
• Strategy Backtesting: Useful for testing trading rules that are based on time or a specific number of bars.
-----------------------------------------------------
Final Words
-----------------------------------------------------
Hope you find this indicator useful for your analysis and trading strategies! Feel free to leave comments or suggestions below.
BreakoutLibrary "Breakout"
init()
method run(state, opts)
Namespace types: BreakoutState
Parameters:
state (BreakoutState)
opts (BreakoutOpts)
BreakoutState
Fields:
levelUps (array)
levelDowns (array)
levelUpTargets (array)
levelDownTargets (array)
levelUpConfirmed (array)
levelDownConfirmed (array)
levelUpNumLevels (array)
levelDownNumLevels (array)
breakoutSignalUp (series bool)
breakoutSignalDown (series bool)
BreakoutOpts
Fields:
canConfirmUp (series bool)
canConfirmDown (series bool)
numLevelMinToConfirm (series int)
numLevelMaxToConfirm (series int)
zigZagPeriod (series int)
rsi (series float)
rsiMA (series float)
DMI-LuminateIndicator Description: DMI-Luminate (DMI-LMT)
DMI-Luminate is an enhanced version of the Directional Movement Index (DMI) indicator that combines multiple moving averages for smoothing and offers various options to customize the calculation of ADX, +DM, -DM, DX, and ADXR. It is ideal for traders looking to analyze trend strength and equilibrium points between buyers and sellers.
Components and Features
+DM and -DM: Indicators measuring positive and negative directional movement, helping identify trend direction.
DX (Directional Movement Index): Measures the relative difference between +DM and -DM, indicating the current trend strength.
ADX (Average Directional Index): A smoothed line showing trend strength regardless of direction. Values above 25 generally indicate a strong trend.
ADXR (Average Directional Movement Rating): A moving average of ADX that detects trend strength changes with less sensitivity.
Equilibrium Points: Visual markers (blue circles) that appear when +DM and -DM cross, signaling potential reversals or changes in trend strength.
Customizable Settings
DM Length: The period used to calculate directional movements.
ADX Smoothing: The smoothing period for ADX.
MA Type Universal: Select the moving average type used for smoothing calculations. Options include SMA, EMA, WMA, ALMA, T3, and advanced averages like DNA⚡ and RNA🐢.
T3 Hot Factor: Parameter to adjust the intensity of the T3 moving average (when selected).
Show Lines: Toggle the display of ADX, ADXR, DX, and +DM/-DM lines as you prefer.
Show Equilibrium Points: Enable to visualize crossing points between +DM and -DM.
Background Color and Offset: Customize the background color and offset for better visibility.
How to Use
Trend Identification
Watch the ADX line to gauge trend strength. When ADX is above 25, the trend is considered strong. The +DM and -DM lines indicate if the trend is bullish (+DM > -DM) or bearish (-DM > +DM).
Entry/Exit Signals
Use the equilibrium points (blue circles) to identify potential reversals or changes in trend dynamics based on +DM and -DM crossings.
Moving Average Selection
Experiment with different moving averages to smooth the data and tailor the indicator to your trading style and asset. Faster averages like EMA react better in volatile markets, while SMMA and ALMA suit more stable conditions.
Using ADXR
ADXR offers a smoother view of trend strength to avoid false signals during sideways markets.
Visual Customization
Adjust colors and background to improve readability, especially across different chart themes.
Recommendations
Combine DMI-Luminate with other indicators (e.g., volume, RSI, chart patterns) to confirm entries and exits.
Adjust DM Length and ADX Smoothing according to the timeframe you trade.
Use different moving average types to find the setup that works best for your asset and strategy.
🦌 Horn Pattern - Horn + FT - Ming Joo太棒了!以下是你策略的中英文简介版本,专为 **TradingView 发布页面** 编写,突出你当前唯一的 context filter(基于 EMA20)。
---
## 🇬🇧 English Description — Horn Pattern Strategy with EMA Context Filter
**🦌 Horn Pattern Reversal Strategy (By Ming Joo)**
This strategy is based on a 3-bar reversal pattern known as the **Horn Pattern** (bull-bear-bull for longs, bear-bull-bear for shorts). A confirmation bar (bar\ ) follows the pattern to validate a breakout.
🔍 **Context Filter:**
To ensure high-quality trades, a simple trend filter is applied using EMA(20):
* ✅ **Bullish Horn** signals are valid **only if** the confirmation bar closes **above EMA20**
* ✅ **Bearish Horn** signals are valid **only if** the confirmation bar closes **below EMA20**
This prevents taking counter-trend reversals in weak conditions.
🎯 Entry Logic:
* Long entry: Horn high + 1 tick
* Short entry: Horn low – 1 tick
* Target: 1R
* Stop: Structural extreme (low/high of the horn)
* Optionally shows 0.5R line
This structure-based reversal model is suitable for 5min–1H timeframes, and works best on volatile instruments (e.g. ES1!, NQ1!, BTCUSD, AAPL).
---
## 🇨🇳 中文简介 — Horn 结构反转策略(含 EMA 趋势滤网)
**🦌 Horn 反转策略(By Ming Joo)**
本策略基于经典的 **Horn 形态**(多头为 bull-bear-bull,空头为 bear-bull-bear),由三根结构K线 + 一根确认K线构成,搭配 **EMA20 趋势过滤器** 筛选优质信号。
🔍 **上下文过滤条件(唯一 context filter):**
* ✅ **Bullish Horn** 仅在确认K线的收盘 **高于 EMA20** 时触发
* ✅ **Bearish Horn** 仅在确认K线的收盘 **低于 EMA20** 时触发
防止在弱趋势中逆势进场,提升成功率。
🎯 入场逻辑:
* 多头:Horn 高点 +1 tick 挂多
* 空头:Horn 低点 –1 tick 挂空
* 止盈:1R
* 止损:Horn 的结构极点
* 可选显示 0.5R 虚线
适合用于 5分钟至 1小时图表,特别适用于高波动性品种(如 ES1!, NQ1!, BTCUSD, AAPL 等)。
---
Fallback VWAP (No Volume? No Problem!) – Yogi365Fallback VWAP (No Volume? No Problem!) – Yogi365
This script plots Daily, Weekly, and Monthly VWAPs with ±1 Standard Deviation bands. When volume data is missing or zero (common in indices or illiquid assets), it automatically falls back to a TWAP-style calculation, ensuring that your VWAP levels always remain visible and accurate.
Features:
Daily, Weekly, and Monthly VWAPs with ±1 Std Dev bands.
Auto-detection of missing volume and seamless fallback.
Clean, color-coded trend table showing price vs VWAP/bands.
Uses hlc3 for VWAP source.
Labels indicate when fallback is used.
Best Used On:
Any asset or index where volume is unavailable.
Intraday and swing trading.
Works on all timeframes but optimized for overlay use.
How it Works:
If volume == 0, the script uses a constant fallback volume (1), turning the VWAP into a TWAP (Time-Weighted Average Price) — still useful for intraday or index-based analysis.
This ensures consistent plotting on instruments like indices (e.g., NIFTY, SENSEX,DJI etc.) which might not provide volume on TradingView.
Bounce Zone📘 Bounce Zone – Indicator Description
The "Bounce Zone" indicator is a custom tool designed to highlight potential reversal zones on the chart based on volume exhaustion and price structure. It identifies sequences of candles with low volume activity and marks key price levels that could act as "bounce zones", where price is likely to react.
🔍 How It Works
Volume Analysis:
The indicator calculates a Simple Moving Average (SMA) of volume (default: 20 periods).
It looks for at least 6 consecutive candles (configurable) where the volume is below this volume SMA.
Color Consistency:
The candles must all be of the same color:
Green candles (bullish) for potential downward bounce zones.
Red candles (bearish) for potential upward bounce zones.
Zone Detection:
When a valid sequence is found:
For green candles: it draws a horizontal line at the low of the last red candle before the sequence.
For red candles: it draws a horizontal line at the high of the last green candle before the sequence.
Bounce Tracking:
Each horizontal line remains on the chart until it is touched twice by price (high or low depending on direction).
After two touches, the line is automatically removed, indicating the zone has fulfilled its purpose.
📈 Use Cases
Identify areas of price exhaustion after strong directional pushes.
Spot liquidity zones where institutions might step in.
Combine with candlestick confirmation for reversal trades.
Useful in both trending and range-bound markets for entry or exit signals.
⚙️ Parameters
min_consecutive: Minimum number of consecutive low-volume candles of the same color (default: 6).
vol_ma_len: Length of the volume moving average (default: 20).
🧠 Notes
The indicator does not repaint and is based purely on historical candle and volume structure.
Designed for manual strategy confirmation or support for algorithmic setups.
Color Change EMA 200 (4H)200 Color Change EMA (4H Locked)
Overview
This indicator displays a 200-period Exponential Moving Average (EMA) that is locked to the 4-hour timeframe, regardless of what chart timeframe you're currently viewing. The EMA line changes color dynamically based on price action to provide clear visual trend signals.
Key Features
• Multi-Timeframe Capability : Always shows the 4H 200 EMA on any chart timeframe
• Dynamic Color Coding :
- Green: Price is above the 200 EMA (bullish condition)
- Red: Price is below the 200 EMA (bearish condition)
• Clean Visual Design : Bold 2-pixel line width for clear visibility
• Real-time Updates : Colors change instantly as price crosses above or below the EMA
How to Use
1. Add the indicator to any timeframe chart
2. The 4H 200 EMA will appear as a smooth line
3. Watch for color changes:
- When the line turns green, it indicates price strength above the key moving average
- When the line turns red, it suggests price weakness below the moving average
4. Use for trend identification, support/resistance levels, and entry/exit timing
Best Practices
• Combine with other technical analysis tools for confirmation
• Use the color changes as alerts for potential trend shifts
• Consider the 200 EMA as a major support/resistance level
• Works well for swing trading and position sizing decisions
Settings
• Length : Default 200 periods (customizable)
• Source : Default closing price (customizable)
Perfect for traders who want to keep the important 4H 200 EMA visible across all timeframes with instant visual trend feedback.
SuperTrend Adaptive (STD Smooth)Supertrend DeNoise (StdDev + Smoothing) is an advanced trend-following indicator designed to reduce false signals and market noise. This version enhances the classic Supertrend by incorporating standard deviation into the channel calculation and a smoothing factor, making the bands wider and more adaptive to volatility. The result is fewer whipsaws and clearer, more robust trend signals. Buy and sell labels appear only at the latest signal, keeping your chart uncluttered and focused. Ideal for traders seeking a cleaner trend indicator for any timeframe.
Smart Money Index (SMI) EnhancedSmart Money Index (SMI) Enhanced is an indicator that visualizes the behavior of "smart money" based on intraday price movements.
📌 Based on Don Hays’ classic formula:
SMI = Yesterday’s value – Morning movement + Late-day movement
🔍 Key Features:
Highlighted buy/sell zones for accumulation and distribution;
Alerts for crossovers between SMI and its moving average;
Supports multiple timeframes (hourly, daily, weekly).
✅ Useful for identifying institutional sentiment and potential market reversal points.
ℹ️ Works with stocks, indices, and cryptocurrencies.
This script is for educational purposes only and not financial advice.
Year/Quarter Open LevelsDeveloped by ADEL CEZAR and inspired by insights from ERDAL Y, this indicator is designed to give traders a clear edge by automatically plotting the Yearly Open and Quarterly Open levels — two of the most critical institutional reference points in price action.
These levels often act as magnets for liquidity, bias confirmation zones, and support/resistance pivots on higher timeframes. With customizable settings, you can display multiple past opens, fine-tune label positions, and align your strategy with high-timeframe structure — all in a lightweight, non-intrusive design.
If you follow Smart Money Concepts (SMC), ICT models, or build confluence using HTF structures and range theory, this script will integrate seamlessly into your workflow.
Mariam Ichimoku DashboardPurpose
The Mariam Ichimoku Dashboard is designed to simplify the Ichimoku trading system for both beginners and experienced traders. It provides a complete view of trend direction, strength, momentum, and key signals all in one compact dashboard on your chart. This tool helps traders make faster and more confident decisions without having to interpret every Ichimoku element manually.
How It Works
1. Trend Strength Score
Calculates a score from -5 to +5 based on Ichimoku components.
A high positive score means strong bullish momentum.
A low negative score shows strong bearish conditions.
A near-zero score indicates a sideways or unclear market.
2. Future Cloud Bias
Looks 26 candles ahead to determine if the future cloud is bullish or bearish.
This helps identify the longer-term directional bias of the market.
3. Flat Kijun / Flat Senkou B
Detects flat zones in the Kijun or Senkou B lines.
These flat areas act as strong support or resistance and can attract price.
4. TK Cross
Identifies Tenkan-Kijun crosses:
Bullish Cross means Tenkan crosses above Kijun
Bearish Cross means Tenkan crosses below Kijun
5. Last TK Cross Info
Shows whether the last TK cross was bullish or bearish and how many candles ago it happened.
Helps track trend development and timing.
6. Chikou Span Position
Checks if the Chikou Span is above, below, or inside past price.
Above means bullish momentum
Below means bearish momentum
Inside means mixed or indecisive
7. Near-Term Forecast (Breakout)
Warns when price is near the edge of the cloud, preparing for a potential breakout.
Useful for anticipating price moves.
8. Price Breakout
Shows if price has recently broken above or below the cloud.
This can confirm the start of a new trend.
9. Future Kumo Twist
Detects upcoming twists in the cloud, which often signal potential trend reversals.
10. Ichimoku Confluence
Measures how many key Ichimoku signals are in agreement.
The more signals align, the stronger the trend confirmation.
11. Price in or Near the Cloud
Displays if the price is inside the cloud, which often indicates low clarity or a choppy market.
12. Cloud Thickness
Shows whether the cloud is thin or thick.
Thick clouds provide stronger support or resistance.
Thin clouds may allow easier breakouts.
13. Recommendation
Gives a simple trading suggestion based on all major signals.
Strong Buy, Strong Sell, or Hold.
Helps simplify decision-making at a glance.
Features
All major Ichimoku signals summarized in one panel
Real-time trend strength scoring
Detects flat zones, crosses, cloud twists, and breakouts
Visual alerts for trend alignment and signal confluence
Compact, clean design
Built with simplicity in mind for beginner traders
Tips
Best used on 15-minute to 1-hour charts for short-term trading
Avoid entering trades when price is inside the cloud because the market is often indecisive
Wait for alignment between trend score, TK cross, cloud bias, and confluence
Use the dashboard to support your trading strategy, not replace it
Enable alerts for major confluence or upcoming Kumo twists
Alpha Trader University - Average Session VolatilityCalculate the Average session Volatility through this
Gold Buy/Sell Signals with Engulfing & S&D ZonesTrade base on the Fast & Slow Moving Average. When the Fast MA line is below the candle, it is an uptrend to BUY. if Fast MA line is above the candle, it's time to SELL.
NIFTY Intraday Strategy - 50 Points📊 NIFTY Intraday Strategy – Description
This Pine Script defines an intraday trading strategy targeting +50 points per trade on NIFTY, using a blend of trend-following and momentum indicators. Here's a breakdown:
🔍 Core Components
1. Indicators Used
VWAP: Volume-Weighted Average Price – institutional anchor for fair value.
Supertrend: Trend direction indicator (parameters: 10, 3.0).
RSI (14): Measures strength/momentum.
ATR (14): Determines volatility for stop-loss calculation.
📈 Entry Conditions
✅ Buy Entry
Price is above VWAP
Supertrend direction is bullish
RSI is above 50
Time is between 9:15 AM and 3:15 PM (India time)
❌ Sell Entry
Price is below VWAP
Supertrend direction is bearish
RSI is below 50
Time is within same market hours
🎯 Exit Logic
Target: 50 points from entry
Stop Loss: 1 × ATR from entry
If neither is hit by 3:15 PM, the position is held (though you may add exit logic at that time).
📌 Visualization
VWAP: orange line
Supertrend: green (uptrend), red (downtrend)
Buy Signal: green triangle below bar
Sell Signal: red triangle above bar
This strategy is ideal for intraday scalping or directional momentum trading in NIFTY Futures or Options.
a. Add end-of-day exit at 3:15 PM to fully close all trades
b. Add a risk-reward ratio input to dynamically adjust target vs stop-loss
🔥 Volatility Squeeze Breakout Strategy (TP/SL in Points)This strategy is designed to catch explosive breakout moves from low-volatility consolidations using a "volatility squeeze" + breakout + momentum" approach. It identifies high-probability buy opportunities when the market is in a tight range and preparing for expansion.
✅ Entry Condition:
- Previous candle is in a squeeze
- Current candle breaks above channel high
- Momentum is positive (ROC)
🎯 Exit Conditions:
- Take Profit in fixed points above entry price
- Stop Loss in fixed points below entry price
🧰 Inputs:
- ATR Length for volatility
- Channel Length for breakout levels
- ROC Length for momentum
- Squeeze threshold (ATR/close)
- TP/SL in absolute price points
📊 Plots:
- Buy signals shown as green triangles
- Channel high/low plotted
- TP/SL levels shown as live lines when in position
Suitable for intraday breakout scalping or directional trades
when price expands from compression zones.
SMEMA Trend CoreSMEMA Trend Core is a multi-timeframe trend analysis tool designed to provide a clean, adaptive and structured view of the market’s directional bias. It can be used in short term, swing or long term contexts. The internal calculation adjusts automatically based on the selected trading style, while always combining data from six timeframes.
At its core, the indicator uses a SMEMA, which is a Simple Moving Average applied to an EMA. This combination improves smoothness without losing reactivity. The SMEMA is calculated separately on 1H, 4H, 1D, 3D, 1W and 1M timeframes. These six values are then combined using dynamic weights that depend on the trading mode:
Short Term mode gives more influence to 1H and 4H
Swing Trading mode gives more influence to 1D, 3D and 1W
Long Term mode gives more influence to 1W and 1M
However, all six timeframes are always included in the final result. This avoids the tunnel vision of relying on a single resolution and ensures that the indicator captures both local and structural movements.
The result is a synthetic trend line, called Global SMEMA, that adapts to market conditions and offers a realistic view of the ongoing trend. To enhance the reading, the indicator calculates a Trend Score. This score reflects the position of price relative to the Global SMEMA, scaled by a long-term ATR, and adjusted by the slope of the trend line. A hyperbolic tangent function is used to normalize values and reduce distortion from outliers.
The final score is capped between -10 and +10, and used to define the trend state:
Green when the trend is bullish (score > +1.5)
Red when the trend is bearish (score < -1.5)
Brown when the trend is neutral (score between -1.5 and +1.5)
Optional Deviation Bands can be displayed at ±1, ±2 and ±3 ATR distances around the central line. These dynamic zones help identify extended price movements or potential support and resistance areas, depending on the current trend bias.
Main features:
A single, stable trend line based on six timeframes
Automatic rebalancing depending on trading mode
Quantified score integrating distance and slope
No overreaction to short-term noise
Deviation zones for advanced market context
No repainting, no lookahead, 100% real-time
SMEMA Trend Core is not a signal tool. It is a directional framework that helps you stay aligned with the real structure of the market. Use it to confirm setups, filter trades or simply understand where the market stands in its trend cycle.
David_FairPriceCandlestick_calculatedDescription:
This indicator displays the "Typical Price" for each candle as a visual marker (cross) directly on the chart. The Typical Price is calculated as the average of the High, Low, and Close values of each bar:
(High + Low + Close) / 3
The marker provides a quick visual reference to the fair or average price level within every single candle.
Unlike a Point of Control (POC) or volume-based indicators, this script works purely with price data and is independent of volume or order flow.
Use cases:
Identify where most trading activity may have been concentrated within the candle (for price-based strategies)
Support as a reference line for mean-reversion or fair value concepts
Works on all timeframes and instruments
Customization:
You can easily change the marker style (cross, dot, triangle, etc.) and color within the script.