TrendSync Pro (SMC)📊 TrendSync Pro (SMC) – Advanced Trend-Following Strategy with HTF Alignment
Created by Shubham Singh
🔍 Strategy Overview
TrendSync Pro (SMC) is a precision-based smart trend-following strategy inspired by Smart Money Concepts (SMC). It combines: Real-time pivot-based trendline detection
Higher Time Frame (HTF) filtering to align trades with dominant trend
Risk management via adjustable Stop Loss (SL) and Take Profit (TP)
Directional control — trade only bullish, bearish, or both setups
Realistic backtesting using commissions and slippage
Pre-optimized profiles for scalpers, intraday, swing, and long-term traders
🧠 How It Works:
🔧 Strategy Settings Image:
beeimg.com
The strategy dynamically identifies trend direction by using swing high/low pivots. When a new pivot forms: It draws a trendline from the last significant pivot
Detects whether the trend is up (based on pivot lows) or down (based on pivot highs)
Waits for price to break above/below the trendline
Confirms with HTF price direction (HTF close > previous HTF close = bullish)
Only then it triggers a long or short trade
It exits either at TP, SL, or a manual trendline break
🛠️ Adjustable Parameters:
Trend Period: Length for pivot detection (affects sensitivity of trendlines)
HTF Timeframe: Aligns lower timeframe entries with higher timeframe direction
SL% and TP%: Customize your risk-reward profile
Commission & Slippage: Make backtests more realistic
Trade Direction: Choose to trade: Long only, Short only, or Both
🎛️ Trade Direction Control:
In settings, you can choose: Bullish Only: Executes only long entries
Bearish Only: Executes only short entries
Both: Executes both long and short entries when conditions are met
This allows you to align trades with your own market bias or external analysis.
📈 Entry Logic: Long Entry:
• Price crosses above trendline
• HTF is bullish (HTF close > previous close)
• Latest pivot is a low (trend is considered up)
Short Entry:
• Price crosses below trendline
• HTF is bearish (HTF close < previous close)
• Latest pivot is a high (trend is considered down)
📉 Exit Logic: Hit Take Profit or Stop Loss
Manual trendline invalidation: If price crosses opposite of the trend direction
⏰ Best Timeframes & Recommended Settings:
Scalping (1m to 5m):
HTF = 15m | Trend Period = 7
SL = 0.5% | TP = 1% to 2%
Intraday (15m to 30m):
HTF = 1H | Trend Period = 10–14
SL = 0.75% | TP = 2% to 3%
6 Hour Trading (30m to 1H):
HTF = 4H | Trend Period = 20
SL = 1% | TP = 4% to 6%
Swing Trading (4H to 1D):
HTF = 1D | Trend Period = 35
SL = 2% | TP = 8% to 12%
Long-Term Investing (1D+):
HTF = 1W | Trend Period = 50
SL = 3% | TP = 15%+
Note: These are recommended base settings. Adjust based on volatility, asset class, or personal trading style.
📸 Testing Note:
beeimg.com
TradingView limits test length to 20k bars (~40 trades on smaller timeframes). To show long-term results: Test on higher timeframes (e.g., 1H, 4H, 1D)
Share images of backtest result in description
Host longer test result screenshots on Imgur or any public drive
📍 Asset Behavior Insight:
This strategy works on multiple assets, including BTC, ETH, etc.
Performance varies by trend strength:
Sometimes BTC performs better than ETH
Other times ETH gives better results
That’s normal as both assets follow different volatility and trend behavior
It’s a trend-following setup. Longer and clearer the trend → better the results.
✅ Best Practices: Avoid ranging markets
Use proper SL/TP for each timeframe
Use directional filter if you already have a directional bias
Always forward test before going live
⚠️ Trading Disclaimer:
This script is for educational and backtesting purposes only. Trading involves risk. Always use risk management and never invest more than you can afford to lose.
Indicators and strategies
Rolling ATR Momentum
Rolling ATR Momentum Indicator – User Manual
---
🔍 Overview
The Rolling ATR Momentum Indicator is a simple yet powerful tool designed to detect shifts in market volatility. It compares the current Average True Range (ATR) with the ATR from a previous point in time to measure how market volatility is changing.
This indicator is especially useful for:
- Spotting the beginning or fading of a momentum phase
- Filtering out low-volatility market conditions
- Enhancing timing for entries and exits in trending or breakout trades
---
📊 Key Components
✅ ATR Delta (Rolling)
- Definition: `ATR Delta = Current ATR - Past ATR`
- Inputs:
- ATR Period (default: 14): The base ATR calculation window
- Lookback Period (default: 5): How many bars ago to compare ATR
- Interpretation:
- Positive ATR Delta (Green Line): Market volatility is increasing
- Negative ATR Delta (Red Line): Market volatility is decreasing
📈 Zero Line
- A horizontal baseline at zero helps you easily see when ATR momentum shifts from negative to positive (or vice versa).
🟩/🟥 Background Color
- Green Background: ATR Delta is positive (rising volatility)
- Red Background: ATR Delta is negative (falling volatility)
🔵 Optional: ATR Reference Lines
- You can optionally display raw Current ATR and Past ATR by changing their visibility settings.
---
✅ How to Use It
Entry Timing (Futures/Options)
- Use ATR Delta as a filter:
- Only take trades when ATR Delta is positive → confirms momentum is building
- Avoid trades when ATR Delta is negative → market might be slow, sideways, or losing steam
Breakout Anticipation
- A rising ATR Delta after a tight range or consolidation can suggest that a breakout is underway
Stop-loss Strategy
- Use high ATR periods for wider stops (to avoid noise)
- Use low ATR periods for tighter stops or skip trading
---
🧠 Pro Tips
- This indicator doesn’t predict direction—combine with trend or price structure tools (like EMA, PPMA, candlesticks)
- Works best in trending or breakout environments
- Add it to multi-timeframe layouts to see volatility buildup on higher timeframes
---
⚙️ Settings
| Parameter | Description |
|----------|-------------|
| ATR Period | Length of the ATR calculation (default 14) |
| Lookback Period | How many bars back to compare ATR values |
---
🧭 Best For:
- Index futures (Nifty, BankNifty)
- Option buyers needing volatility confirmation
- Intraday & swing traders looking to trade momentum setups
---
Use the Rolling ATR Momentum indicator as your volatility radar—simple, clean, and highly effective for staying on the right side of market energy.
End of Manual
Fibonacci Trend TradingRules:
1. Trading Bias
Bullish
Price > EMA 200 = Bullish
Price < EMA 200 = Bearish
2. Trade signal
- Fibonacci retracement @ 50% - 61.8% for LONG
- Fibonacci retracement @61.8% - 78.6% for SHORT
- Look for engulfing candle before entering
3. TP, recent high
4. Trail Stop EMA 10 crossover or session end.
5. Trading session London and NY
SMA Trend Panel// This indicator presents a compact panel for traders, combining SMA-based trend tracking and key volume/momentum technical indicators.
// The panel displays short-, mid-, and long-term SMAs (13, 50, 200), MACD, ADX, Stochastic RSI,
// OBV, CMF, volume change, weekly/monthly pivot levels, and ATR (volatility) directly on the chart.
// Each cell shows the current condition of its indicator with a symbol: positive (✅), negative (❌), or neutral (🔄).
// It is designed for traders who want to quickly assess overall technical conditions at a glance.
Volume Spikes Pro - relative volume comparisonThe Enhanced Volume Spike Detector builds on the basic relative volume comparison by adding price direction analysis and more sophisticated categorization of volume events.
Directional Analysis
This indicator doesn't just identify volume spikes, but categorizes them as:
- **Bullish**: Volume spike with upward price movement
- **Bearish**: Volume spike with downward price movement
- **Neutral**: Volume spike with minimal price change
- **Strong**: Exceptional volume spike (2.5x+ default) regardless of direction
Visual Classification
Different color schemes instantly communicate the volume spike type:
- Green for bullish volume (price rising)
- Red for bearish volume (price falling)
- Dark Green for strong bullish volume
- Dark Red for strong bearish volume (price falling)
Customization Tips
- For day trading or short timeframes: Consider reducing MA length to 10-15
- For swing trading: The default 20 is appropriate
- For position trading or longer timeframes: Consider increasing to 30-50
- For more selective signals: Increase multiplier to 2.0 or higher
- For more comprehensive detection: Decrease multiplier to 1.3-1.4
Moving Average CrossoverSimple moving average crossover configurable by period.
The indicator displays a bullish crossover with a green circle and a bearish crossover with a red circle just below or above the candle where the moving average crossover occurs.
FRACTAL DIMENSIONSFRACTAL DIMENSIONS was created to allow us to properly visualize
the higher time frame dimensional data, While remaining on a lower
time frame. The Fractal dimensions are basically the higher time frames.
Remaining on a lower time frame allows us to get tighter entries and exits.
Each dimension is set in a wave degree formation. From primary to sub-minute,
depending on the time frame being utilized.
These multidimensional wave degrees will be utilized later in the strategy.
This indicator was broken off of the whole for the sake of drawing lines.
The data here is just for debugging purposes and is not used in the strategy,
but yet remains pretty awesome by itself.
Fractal dimensions is the foundation of the main strategy to come.
Now that we have this data, what are we going to do with it?
NasyI## NasyI - Multi-Timeframe Technical Analysis Toolkit
### English Description
**NasyI** is a comprehensive technical analysis indicator designed to provide traders with a complete view of market dynamics across multiple timeframes. This indicator combines the power of Exponential Moving Averages (EMAs), Simple Moving Averages (MAs), Volume Weighted Average Price (VWAP), and key support/resistance levels to help traders identify trend direction, potential reversal points, and optimal entry/exit opportunities.
#### Key Features
1. **Multi-Timeframe Analysis System**
- 2-minute EMAs (13, 48) for ultra-short-term trend identification
- 5-minute EMAs (9, 13, 21, 48, 200) for short-term trend confirmation
- Daily EMAs (5, 13, 21, 48, 100, 200) and MAs (20, 50, 100, 200) for longer-term perspective
- Color-coded bands between key EMAs to visually identify trend strength and direction
2. **Advanced VWAP Integration**
- Daily VWAP for intraday support/resistance
- Weekly VWAP for medium-term price reference
- Monthly VWAP for long-term institutional price levels
- All VWAPs properly reset at their respective time period boundaries
3. **Critical Price Level Identification**
- Previous day high/low lines for identifying key breakout and breakdown levels
- Pre-market high/low tracking to identify potential intraday support/resistance zones
- All levels displayed with distinct line styles for easy identification
4. **Dynamic Trend Analysis**
- Color-coded bands between EMAs display trend strength and direction:
- Green bands indicate uptrend conditions (9 EMA > 21 EMA > 48 EMA)
- Red bands indicate downtrend conditions (9 EMA < 21 EMA < 48 EMA)
- Yellow bands indicate neutral/confused market conditions
- Visual representation makes trend changes immediately apparent
5. **Comprehensive Customization Options**
- Fully customizable colors for all indicators and bands
- Adjustable transparency settings for visual clarity
- Optional price labels with customizable placement and appearance
- Ability to show/hide specific components based on trading preferences
#### Trading Applications
This indicator is particularly valuable for:
1. **Day Trading & Scalping**: The 2-minute and 5-minute EMAs with color bands provide clear short-term trend direction and potential reversal signals.
2. **Swing Trading**: Daily EMAs and MAs offer perspective on the larger trend, helping to align short-term trades with the broader market direction.
3. **Gap Trading**: Previous day and pre-market levels help identify potential gap fill scenarios and breakout/breakdown opportunities.
4. **VWAP Trading Strategies**: Multiple timeframe VWAPs allow for identifying institutional participation levels and potential reversal zones.
5. **EMA Cross Systems**: The various EMAs can be used to identify golden crosses and death crosses across multiple timeframes.
#### How the Components Work Together
The power of NasyI comes from the integration of these different technical elements:
1. The short-timeframe EMAs (2m, 5m) provide immediate trend information, while the daily EMAs/MAs provide context about the larger market structure.
2. The color bands between EMAs offer instant visual confirmation of trend alignment or divergence across timeframes.
3. Previous day and pre-market levels add horizontal support/resistance zones to complement the dynamic moving averages.
4. Multiple timeframe VWAPs provide additional confirmation of institutional activity levels and potential reversal points.
By combining these elements, traders can develop a comprehensive market view that integrates price action, trend direction, and key support/resistance levels all in one indicator.
#### Usage Instructions
1. Apply the NasyI indicator to your chart (works best on intraday timeframes from 1-minute to 30-minute).
2. Observe the relationship between price and the various EMAs:
- Price above the 2m/5m EMAs with green bands indicates bullish short-term conditions
- Price below the 2m/5m EMAs with red bands indicates bearish short-term conditions
3. Use the daily EMAs/MAs and VWAPs as targets for potential price movements and reversal zones.
4. Previous day and pre-market high/low lines provide key levels to watch for breakouts or breakdowns.
5. Customize the appearance according to your preferences using the extensive settings options.
This indicator represents a unique approach to technical analysis by combining multiple timeframe perspectives into a single, visually intuitive display that helps traders make more informed decisions based on a comprehensive view of market conditions.
### 中文描述
**NasyI** 是一个全面的技术分析指标,旨在为交易者提供跨多个时间周期的完整市场动态视图。该指标结合了指数移动平均线(EMA)、简单移动平均线(MA)、成交量加权平均价格(VWAP)和关键支撑/阻力水平的力量,帮助交易者识别趋势方向、潜在反转点和最佳进出场机会。
#### 主要特点
1. **多时间周期分析系统**
- 2分钟EMAs(13,48)用于超短期趋势识别
- 5分钟EMAs(9,13,21,48,200)用于短期趋势确认
- 日线EMAs(5,13,21,48,100,200)和MAs(20,50,100,200)用于更长期的视角
- 关键EMAs之间的彩色带状区域直观显示趋势强度和方向
2. **高级VWAP整合**
- 日内VWAP作为日内支撑/阻力
- 周内VWAP作为中期价格参考
- 月内VWAP作为长期机构价格水平
- 所有VWAP在各自的时间周期边界正确重置
3. **关键价格水平识别**
- 前一交易日高点/低点线用于识别关键突破和跌破水平
- 盘前高点/低点跟踪用于识别潜在的日内支撑/阻力区域
- 所有水平以不同的线条样式显示,便于识别
4. **动态趋势分析**
- EMAs之间的彩色带状区域显示趋势强度和方向:
- 绿色带状区域表示上升趋势(9 EMA > 21 EMA > 48 EMA)
- 红色带状区域表示下降趋势(9 EMA < 21 EMA < 48 EMA)
- 黄色带状区域表示中性/混乱市场条件
- 视觉表示使趋势变化立即显现
5. **全面的自定义选项**
- 所有指标和带状区域的颜色完全可定制
- 可调节的透明度设置,提高视觉清晰度
- 可选的价格标签,带有可定制的位置和外观
- 能够根据交易偏好显示/隐藏特定组件
#### 交易应用
此指标对以下方面特别有价值:
1. **日内交易和短线交易**:2分钟和5分钟EMAs与色带提供清晰的短期趋势方向和潜在反转信号。
2. **摇摆交易**:日线EMAs和MAs提供对更大趋势的视角,帮助将短期交易与更广泛的市场方向对齐。
3. **缺口交易**:前一日和盘前水平帮助识别潜在的缺口填充情况和突破/跌破机会。
4. **VWAP交易策略**:多时间周期VWAP允许识别机构参与水平和潜在反转区域。
5. **EMA交叉系统**:各种EMAs可用于识别跨多个时间周期的黄金交叉和死亡交叉。
#### 组件如何协同工作
NasyI的强大之处在于这些不同技术元素的集成:
1. 短时间周期EMAs(2m,5m)提供即时趋势信息,而日线EMAs/MAs提供关于更大市场结构的背景。
2. EMAs之间的色带提供趋势对齐或跨时间周期分歧的即时视觉确认。
3. 前一日和盘前水平添加水平支撑/阻力区域,补充动态移动平均线。
4. 多时间周期VWAP提供机构活动水平和潜在反转点的额外确认。
通过结合这些元素,交易者可以发展出全面的市场视图,整合价格行动、趋势方向和关键支撑/阻力水平于一个指标中。
#### 使用说明
1. 将NasyI指标应用到您的图表上(最适合1分钟至30分钟的日内时间周期)。
2. 观察价格与各种EMAs之间的关系:
- 价格位于2m/5m EMAs之上,带有绿色带状区域,表示看涨的短期条件
- 价格位于2m/5m EMAs之下,带有红色带状区域,表示看跌的短期条件
3. 使用日线EMAs/MAs和VWAPs作为潜在价格移动和反转区域的目标。
4. 前一日和盘前高点/低点线提供需要关注的突破或跌破的关键水平。
5. 使用广泛的设置选项根据您的偏好自定义外观。
这个指标代表了一种独特的技术分析方法,将多个时间周期的视角结合到一个单一的、视觉直观的显示中,帮助交易者基于对市场条件的全面视图做出更明智的决策。
XTE+ Optimized Trend Tracker📊 XTE+ Optimized Trend Tracker (OTT)
XTE+ OTT is a powerful, trend-following indicator designed for traders who value clarity, precision, and advanced analytics. It offers not only accurate entry and exit signals but also visual zones, historical signal analysis, and real-time trend monitoring.
🧠 How It Works
XTE+ OTT is based on an improved version of the Optimized Trend Tracker. It utilizes multiple customizable moving average types (VAR, EMA, SMA, WMA, and more) combined with volatility filtering (ATR logic) to generate cleaner, more reliable trend-following signals.
✅ Features
Trend Direction Detection with automatic switch logic
Buy/Sell Signal Icons with distinct large markers
Entry/Exit Zones drawn visually on chart
Custom Take-Profit / Stop-Loss settings for Buy and Sell signals
Statistical Panel showing:
Current Trend (Up/Down)
Number of total signals
Number of winning trades
Win percentage
Configurable Display Options:
Show/hide signals
Show/hide trend zones
Show/hide OTT and MA lines
Supports multiple MA types including EMA, SMA, VAR, ZLEMA, TSF and more
Non-repainting logic — signals are confirmed at bar close
⚙️ Inputs and Customization
OTT Period & Sensitivity (%)
MA Type Selection (VAR, EMA, etc.)
Entry Zone Visualization On/Off
Trend Panel Display On/Off
TP/SL % per direction (Buy/Sell separately)
Option to disable MA or OTT line display
📈 Visuals
Signal icons: BUY (Green Up Label), SELL (Red Down Label)
Entry zones: circles near breakout levels
Trendlines change color dynamically (green for uptrend, red for downtrend)
Trend Panel is pinned in the top-right corner for quick reference
💡 Usage Tips
Best used on higher timeframes (15min, 1H, 4H+) for more meaningful trend signals
Combine with volume/volatility indicators or support/resistance zones for enhanced decision making
Use TP/SL logic to track signal success over time and optimize strategies
📌 Disclaimer
This script is for educational and informational purposes only. It is not financial advice. Always test and validate your strategy before applying it in live markets.
Coppock Curve
The Coppock Curve is a long-term momentum indicator, also known as the "Coppock Guide," used to identify potential long-term market turning points, particularly major downturns and upturns, by smoothing the sum of 14-month and 11-month rates of change with a 10-month weighted moving average.
Here's a more detailed breakdown:
What it is:
The Coppock Curve is a technical indicator designed to identify long-term buy and sell signals in major stock market indices and related ETFs.
How it's calculated:
Rate of Change (ROC): The indicator starts by calculating the rate of change (ROC) for 14 and 11 periods (usually months).
Sum of ROCs: The ROC for the 14-period and 11-period are summed.
Weighted Moving Average (WMA): A 10-period weighted moving average (WMA) is then applied to the sum of the ROCs.
Interpreting the Curve:
Buy Signals: A buy signal is often generated when the Coppock Curve crosses above the zero line, suggesting a potential transition from a bearish to a bullish phase.
Sell Signals: While primarily designed to identify market bottoms, some traders may interpret a cross below the zero line as a sell signal or a bearish warning.
Origin and Purpose:
The Coppock Curve was introduced by economist Edwin Coppock in 1962.
It was originally designed to help investors identify opportune moments to enter the market.
Coppock's inspiration came from the Episcopal Church's concept of the average mourning period, which he believed mirrored the stock market's recovery period.
Limitations:
The Coppock Curve is primarily used for long-term analysis and may not be as effective for short-term or intraday trading.
It may lag in rapidly changing markets, and its signals may not always be reliable.
Trend Break + Fibonacci + RSI Filter//@version=5
indicator("Trend Break + Fibonacci + RSI Filter", overlay=true)
// === INPUTS ===
lookback = input.int(100, title="Lookback период для минимума/максимума")
rsiLen = input.int(14, title="RSI Length")
rsiShortLevel = input.int(55, title="RSI Min для Шорта (на ретесте)")
rsiLongLevel = input.int(45, title="RSI Max для Лонга (на ретесте)")
// === PRICE EXTREMES ===
var float hi = na
var float lo = na
hi := ta.highest(close, lookback)
lo := ta.lowest(close, lookback)
// === FIB LEVELS ===
fib0 = hi
fib1 = lo
fib0382 = fib1 + (fib0 - fib1) * 0.382
fib05 = fib1 + (fib0 - fib1) * 0.5
fib0618 = fib1 + (fib0 - fib1) * 0.618
// === RSI ===
rsi = ta.rsi(close, rsiLen)
// === EMA TREND (вместо трендовой линии как пример) ===
fastEMA = ta.ema(close, 8)
slowEMA = ta.ema(close, 21)
// === CONDITIONS ===
// Пробой EMA-линии (как замена отбойной трендовой)
breakDown = ta.crossunder(fastEMA, slowEMA)
breakUp = ta.crossover(fastEMA, slowEMA)
// Ретест фибо зоны (внутри 0.382–0.5)
inFibZoneShort = close < fib0382 and close > fib05
inFibZoneLong = close > fib0382 and close < fib05
// RSI фильтр
validRSI_short = rsi > rsiShortLevel
validRSI_long = rsi < rsiLongLevel
// === TRADING SIGNALS ===
shortSignal = breakDown and inFibZoneShort and validRSI_short
longSignal = breakUp and inFibZoneLong and validRSI_long
// === PLOTS ===
plotshape(shortSignal, location=location.abovebar, color=color.red, style=shape.labeldown, text="SHORT")
plotshape(longSignal, location=location.belowbar, color=color.green, style=shape.labelup, text="LONG")
plot(fib0, title="Fibo 0", color=color.gray)
plot(fib0382, title="Fibo 0.382", color=color.orange)
plot(fib05, title="Fibo 0.5", color=color.orange)
plot(fib0618, title="Fibo 0.618", color=color.orange)
plot(fib1, title="Fibo 1", color=color.gray)
// === ALERTS ===
alertcondition(shortSignal, title="Short Signal", message="💥 SHORT сигнал!")
alertcondition(longSignal, title="Long Signal", message="🚀 LONG сигнал!")
Iron Condor Sideways Market Detector📘 Description: Iron Condor Sideways Market Detector
This indicator helps option traders find sideways markets for Iron Condor strategy.
🔍 What it does:
📏 Detects when the market is moving in a small range.
✅ Gives a signal when the price is not trending and staying flat.
📉 Shows a label below the candle when conditions are right for an Iron Condor setup.
📊 How it works:
RSI between 40 and 60
→ Market is not overbought or oversold.
ADX below 25
→ Market has low trend strength.
Bollinger Band width is small
→ Price volatility is low.
Price range is within a fixed %
→ Market is moving inside a tight range.
🔔 Alerts:
You get an alert when all sideways conditions are true.
Great for planning neutral option strategies like Iron Condor.
---------------------------------------------------------------------------
⚠️ Risk Disclaimer
📈 Trading involves risk. Always trade with proper knowledge and money management.
💸 You can lose part or all of your capital. Only invest what you can afford to lose.
🧠 This indicator is a tool, not a guarantee of profit.
🕵️♂️ Always verify signals with your own analysis before taking any position.
🛠️ Past performance of any strategy or tool does not guarantee future results.
📊 Options strategies like Iron Condor require understanding of option greeks, volatility, and risk/reward balance.
VWAP with EMA Cross + Dynamic Colorupdated version of the vwap plus with 9ema cross and changes color based on if price is above or blow vwap . and a floating bullish or bearish sign to stay on right side of market
CANDLESThe script is designed to display Higher Timeframe (HTF) candles on a chart, with a maximum of 6 candle sets
EMA x 6 Set6 Sets of Exponential Moving Averages (EMAs)
Exponential Moving Averages (EMAs) are a type of weighted moving average that gives more importance to recent price data. Using multiple EMAs with different periods helps traders and analysts identify trends, potential reversals, and market momentum more effectively.
A set of EMAs typically refers to one specific EMA calculated over a defined number of periods (e.g., 10-day EMA, 50-day EMA). So, 6 sets of EMAs would involve calculating EMAs over six different timeframes.
Example:
EMA(5) – Very short-term trend
EMA(10) – Short-term trend
EMA(20) – Medium-term trend
EMA(50) – Intermediate-term trend
EMA(100) – Long-term trend
EMA(200) – Major long-term trend
Why Use Multiple EMAs?
Trend confirmation: Aligning EMAs across timeframes can confirm a strong trend.
Crossovers: When shorter EMAs cross above or below longer EMAs, it may signal a trend reversal.
Support & resistance: EMAs often act as dynamic support or resistance levels.
Momentum analysis: The distance between EMAs can give a sense of market momentum or volatility.
Key-level-3.1 ob bb msb fvg
//@version=5
indicator("Key-level-3.1 ob bb msb fvg","key level 3" ,overlay = true, max_lines_count = 66, max_labels_count = 66)
// -----------------------------------------------------------------------------
// edited by berkusa
// -----------------------------------------------------------------------------
showprice= input.bool(true, title = "fiyatlari goster veya gosterme ")
///level func
f_create_level(_type, _start_condition, _active_condition, _global_level_array, _color, _line_width, _line_ext, _line_style, _label_size, _title, _iter, _is_enabled) =>
var float _price = na
var int _start_time = na
var float _hh = na
var float _ll = na
var line _price_line = line.new(x1 = na, y1 = na, x2 = na, y2 = na, xloc = xloc.bar_time, color = _color, width = _line_width, style = _line_style)
var label _price_label = label.new(x = na, y = na, xloc = xloc.bar_time, style = label.style_label_left, color = #00000000, size = _label_size, textcolor = _color)
_end_time = int(time + _line_ext * ta.change(time))
if _type == "open"
if _start_condition
_price := open
_start_time := time
else if _type == "high"
if _start_condition
_price := high
_start_time := time
else if _active_condition
_price := math.max(_price, high)
else if _type == "low"
if _start_condition
_price := low
_start_time := time
else if _active_condition
_price := math.min(_price, low)
else if _type == "eq"
if _start_condition
_hh := high
_ll := low
_price := math.avg(_hh, _ll)
_start_time := time
else if _active_condition
_hh := math.max(_hh, high)
_ll := math.min(_ll, low)
_price := math.avg(_hh, _ll)
float _price_val = _iter == 0 ? _price : ta.valuewhen(_start_condition, _price , _iter - 1)
int _start_time_val = _iter == 0 ? _start_time : ta.valuewhen(_start_condition, _start_time , _iter - 1)
_found_existing = array.indexof(_global_level_array, _price_val) > -1
if _is_enabled
if _found_existing
line.set_xy1(_price_line, x = na, y = na)
line.set_xy2(_price_line, x = na, y = na)
label.set_xy(_price_label, x = na, y = na)
else
array.push(_global_level_array, _price_val)
line.set_xy1(_price_line, x = _start_time_val, y = _price_val)
line.set_xy2(_price_line, x = _end_time, y = _price_val)
label.set_xy(_price_label, x = _end_time, y = _price_val)
label.set_text(_price_label , text = showprice? _title + " : " + str.tostring(_price_val): _title )
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
// }
// Necessary Variables {
// -----------------------------------------------------------------------------
// Global arrays used to detect duplicate levels.
// Duplication is detected implicitly by execution order and whether the level has already been placed in the global array.
float global_open_array = array.new_float()
float global_high_array = array.new_float()
float global_low_array = array.new_float()
float global_eq_array = array.new_float()
new_H4 = ta.change(time("240")) != 0
new_day = ta.change(time("D")) != 0
new_week = ta.change(time("W")) != 0
new_month = ta.change(time("M")) != 0
new_quarter = ta.change(time("3M")) != 0
new_year = ta.change(time("12M")) != 0
is_monday = dayofweek == dayofweek.monday
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
// }
// Global settings {
// -----------------------------------------------------------------------------
//inp_open_line_style = input.string("Solid", options = , title = "Open Line Style", group = "Global Settings")
//inp_high_line_style = input.string("Dashed", options = , title = "High Line Style", group = "Global Settings")
//inp_low_line_style = input.string("Dashed", options = , title = "Low Line Style", group = "Global Settings")
//inp_eq_line_style = input.string("Dotted", options = , title = "EQ Line Style", group = "Global Settings")
inp_open_line_style = "Solid"// input.string("Solid", options = , title = "Open Line Style", group = "Global Settings")
inp_high_line_style = "Dashed"// input.string("Dashed", options = , title = "High Line Style", group = "Global Settings")
inp_low_line_style = "Dashed"// input.string("Dashed", options = , title = "Low Line Style", group = "Global Settings")
inp_eq_line_style = "Dotted"// input.string("Dotted", options = , title = "EQ Line Style", group = "Global Settings")
inp_text_size = input.string("Small", options = , title = "Text Size", group = "Global Settings")
inp_ext = input.int(30, title = "Line Extension", group = "Global Settings")
text_size = inp_text_size == "Small" ? size.small : inp_text_size == "Normal" ? size.normal : size.large
open_line_style = inp_open_line_style == "Solid" ? line.style_solid : inp_open_line_style == "Dotted" ? line.style_dotted : line.style_dashed
high_line_style = inp_high_line_style == "Solid" ? line.style_solid : inp_high_line_style == "Dotted" ? line.style_dotted : line.style_dashed
low_line_style = inp_low_line_style == "Solid" ? line.style_solid : inp_low_line_style == "Dotted" ? line.style_dotted : line.style_dashed
eq_line_style = inp_eq_line_style == "Solid" ? line.style_solid : inp_eq_line_style == "Dotted" ? line.style_dotted : line.style_dashed
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
// }
// H4 and Prev H4
// -----------------------------------------------------------------------------
h4 = input.bool(true, title = "H4", group = "H4 Levels", inline = "1")
inp_show_H4_open = input.bool(true, title = "OPEN", group = "H4 Levels", inline = "1")
inp_show_H4_high = input.bool(false, title = "HIGH", group = "H4 Levels", inline = "1")
inp_show_H4_low = input.bool(false, title = "LOW", group = "H4 Levels", inline = "1")
inp_show_H4_eq = input.bool(false, title = "EQ", group = "H4 Levels", inline = "1")
inp_H4_col = input.color(color.teal, title = "color", group = "H4 Levels", inline = "2")
inp_H4_line_width =1// input.int(1, title = "Line width", minval = 1, group = "H4 Levels", inline = "2")
H4_ok = timeframe.isintraday and timeframe.multiplier < 240
f_create_level("open", new_H4, not new_H4, global_open_array, inp_H4_col, inp_H4_line_width, inp_ext, open_line_style, text_size, "H4-O", 0, inp_show_H4_open and H4_ok and h4 )
f_create_level("high", new_H4, not new_H4, global_high_array, inp_H4_col, inp_H4_line_width, inp_ext, high_line_style, text_size, "H4-H", 0, inp_show_H4_high and H4_ok and h4 )
f_create_level("low", new_H4, not new_H4, global_low_array, inp_H4_col, inp_H4_line_width, inp_ext, low_line_style, text_size, "H4-L", 0, inp_show_H4_low and H4_ok and h4 )
f_create_level("eq", new_H4, not new_H4, global_eq_array, inp_H4_col, inp_H4_line_width, inp_ext, eq_line_style, text_size, "H4-EQ", 0, inp_show_H4_eq and H4_ok and h4 )
prev_H4 = input.bool(true, title = "P-H4", group = "Prev H4 Levels", inline = "1")
inp_show_prev_H4_open = input.bool(true, title = "OPEN", group = "Prev H4 Levels", inline = "1")
inp_show_prev_H4_high = input.bool(false, title = "HIGH", group = "Prev H4 Levels", inline = "1")
inp_show_prev_H4_low = input.bool(false, title = "LOW", group = "Prev H4 Levels", inline = "1")
inp_show_prev_H4_eq = input.bool(false, title = "EQ", group = "Prev H4 Levels", inline = "1")
inp_prev_H4_col = input.color(color.olive, title = "color", group = "Prev H4 Levels", inline = "2")
inp_prev_H4_line_width =1// input.int(1, title = "Line width", minval = 1, group = "Prev H4 Levels", inline = "2")
f_create_level("open", new_H4, not new_H4, global_open_array, inp_prev_H4_col, inp_prev_H4_line_width, inp_ext, open_line_style, text_size, "P-H4-O", 1, inp_show_prev_H4_open and H4_ok and prev_H4)
f_create_level("high", new_H4, not new_H4, global_high_array, inp_prev_H4_col, inp_prev_H4_line_width, inp_ext, high_line_style, text_size, "P-H4-H", 1, inp_show_prev_H4_high and H4_ok and prev_H4)
f_create_level("low", new_H4, not new_H4, global_low_array, inp_prev_H4_col, inp_prev_H4_line_width, inp_ext, low_line_style, text_size, "P-H4-L", 1, inp_show_prev_H4_low and H4_ok and prev_H4)
f_create_level("eq", new_H4, not new_H4, global_eq_array, inp_prev_H4_col, inp_prev_H4_line_width, inp_ext, eq_line_style, text_size, "P-H4-EQ", 1, inp_show_prev_H4_eq and H4_ok and prev_H4)
// -----------------------------------------------------------------------------
// Daily and Prev Daily
// -----------------------------------------------------------------------------
daily = input.bool(true, title = "D", group = "Daily Levels", inline = "1")
inp_show_daily_open = input.bool(true, title = "OPEN", group = "Daily Levels", inline = "1")
inp_show_daily_high = input.bool(true, title = "HIGH", group = "Daily Levels", inline = "1")
inp_show_daily_low = input.bool(true, title = "LOW", group = "Daily Levels", inline = "1")
inp_show_daily_eq = input.bool(true, title = "EQ", group = "Daily Levels", inline = "1")
inp_daily_col = input.color(color.silver, title = "color", group = "Daily Levels", inline = "2")
inp_daily_line_width =1// input.int(1, title = "Line width", minval = 1, group = "Daily Levels", inline = "2")
daily_ok = timeframe.isintraday
f_create_level("open", new_day, not new_day, global_open_array, inp_daily_col, inp_daily_line_width, inp_ext, open_line_style, text_size, "DO", 0, inp_show_daily_open and daily_ok and daily)
f_create_level("high", new_day, not new_day, global_high_array, inp_daily_col, inp_daily_line_width, inp_ext, high_line_style, text_size, "DH", 0, inp_show_daily_high and daily_ok and daily)
f_create_level("low", new_day, not new_day, global_low_array, inp_daily_col, inp_daily_line_width, inp_ext, low_line_style, text_size, "DL", 0, inp_show_daily_low and daily_ok and daily)
f_create_level("eq", new_day, not new_day, global_eq_array, inp_daily_col, inp_daily_line_width, inp_ext, eq_line_style, text_size, "D-EQ", 0, inp_show_daily_eq and daily_ok and daily)
prev_daily = input.bool(true, title = "PD", group = "Prev Daily Levels", inline = "1")
inp_show_prev_daily_open = input.bool(true, title = "OPEN", group = "Prev Daily Levels", inline = "1")
inp_show_prev_daily_high = input.bool(true, title = "HIGH", group = "Prev Daily Levels", inline = "1")
inp_show_prev_daily_low = input.bool(true, title = "LOW", group = "Prev Daily Levels", inline = "1")
inp_show_prev_daily_eq = input.bool(false, title = "EQ", group = "Prev Daily Levels", inline = "1")
inp_prev_daily_col = input.color(color.gray, title = "color", group = "Prev Daily Levels", inline = "2")
inp_prev_daily_line_width = 1//input.int(1, title = "Line width", minval = 1, group = "Prev Daily Levels", inline = "2")
dd = input.int(1, title = "dayback", minval = 1,maxval=7, group = "Prev Daily Levels", inline = "2")
if dd >= 1
f_create_level("open", new_day, not new_day, global_open_array, inp_prev_daily_col, inp_prev_daily_line_width, inp_ext, open_line_style, text_size, "P-DO", 1, inp_show_prev_daily_open and daily_ok and prev_daily )
f_create_level("high", new_day, not new_day, global_high_array, inp_prev_daily_col, inp_prev_daily_line_width, inp_ext, high_line_style, text_size, "P-DH", 1 , inp_show_prev_daily_high and daily_ok and prev_daily )
f_create_level("low", new_day, not new_day, global_low_array, inp_prev_daily_col, inp_prev_daily_line_width, inp_ext, low_line_style, text_size, "P-DL", 1, inp_show_prev_daily_low and daily_ok and prev_daily )
f_create_level("eq", new_day, not new_day, global_eq_array, inp_prev_daily_col, inp_prev_daily_line_width, inp_ext, eq_line_style, text_size, "P-D-EQ", 1, inp_show_prev_daily_eq and daily_ok and prev_daily )
if dd >= 2
f_create_level("open", new_day, not new_day, global_open_array, inp_prev_daily_col, inp_prev_daily_line_width, inp_ext, open_line_style, text_size, "P-DO-2", 2, inp_show_prev_daily_open and daily_ok and prev_daily )
f_create_level("high", new_day, not new_day, global_high_array, inp_prev_daily_col, inp_prev_daily_line_width, inp_ext, high_line_style, text_size, "P-DH-2", 2 , inp_show_prev_daily_high and daily_ok and prev_daily )
f_create_level("low", new_day, not new_day, global_low_array, inp_prev_daily_col, inp_prev_daily_line_width, inp_ext, low_line_style, text_size, "P-DL-2", 2, inp_show_prev_daily_low and daily_ok and prev_daily )
f_create_level("eq", new_day, not new_day, global_eq_array, inp_prev_daily_col, inp_prev_daily_line_width, inp_ext, eq_line_style, text_size, "P-D-EQ-2", 2, inp_show_prev_daily_eq and daily_ok and prev_daily )
if dd >= 3
f_create_level("open", new_day, not new_day, global_open_array, inp_prev_daily_col, inp_prev_daily_line_width, inp_ext, open_line_style, text_size, "P-DO-3", dd, inp_show_prev_daily_open and daily_ok and prev_daily )
f_create_level("high", new_day, not new_day, global_high_array, inp_prev_daily_col, inp_prev_daily_line_width, inp_ext, high_line_style, text_size, "P-DH-3", dd , inp_show_prev_daily_high and daily_ok and prev_daily )
f_create_level("low", new_day, not new_day, global_low_array, inp_prev_daily_col, inp_prev_daily_line_width, inp_ext, low_line_style, text_size, "P-DL-3", dd, inp_show_prev_daily_low and daily_ok and prev_daily )
f_create_level("eq", new_day, not new_day, global_eq_array, inp_prev_daily_col, inp_prev_daily_line_width, inp_ext, eq_line_style, text_size, "P-D-EQ-3", dd, inp_show_prev_daily_eq and daily_ok and prev_daily )
// -----------------------------------------------------------------------------
// Weekly and Prev Weekly
// -----------------------------------------------------------------------------
weekly = input.bool(true, title = "W", group = "Weekly Levels", inline = "1")
inp_show_weekly_open = input.bool(true, title = "OPEN", group = "Weekly Levels", inline = "1")
inp_show_weekly_high = input.bool(true, title = "HIGH", group = "Weekly Levels", inline = "1")
inp_show_weekly_low = input.bool(true, title = "LOW", group = "Weekly Levels", inline = "1")
inp_show_weekly_eq = input.bool(false, title = "EQ", group = "Weekly Levels", inline = "1")
inp_weekly_col = input.color(color.aqua, title = "color", group = "Weekly Levels", inline = "2")
inp_weekly_line_width =1// input.int(1, title = "Line width", minval = 1, group = "Weekly Levels", inline = "2")
weekly_ok = timeframe.isintraday or timeframe.isdaily
f_create_level("open", new_week, not new_week, global_open_array, inp_weekly_col, inp_weekly_line_width, inp_ext, open_line_style, text_size, "WO", 0, inp_show_weekly_open and weekly_ok and weekly )
f_create_level("high", new_week, not new_week, global_high_array, inp_weekly_col, inp_weekly_line_width, inp_ext, high_line_style, text_size, "WH", 0, inp_show_weekly_high and weekly_ok and weekly )
f_create_level("low", new_week, not new_week, global_low_array, inp_weekly_col, inp_weekly_line_width, inp_ext, low_line_style, text_size, "WL", 0, inp_show_weekly_low and weekly_ok and weekly )
f_create_level("eq", new_week, not new_week, global_eq_array, inp_weekly_col, inp_weekly_line_width, inp_ext, eq_line_style, text_size, "W-EQ", 0, inp_show_weekly_eq and weekly_ok and weekly )
prev_weekly = input.bool(true, title = "PW", group = "Prev Weekly Levels", inline = "1")
inp_show_prev_weekly_open = input.bool(true, title = "OPEN", group = "Prev Weekly Levels", inline = "1")
inp_show_prev_weekly_high = input.bool(false, title = "HIGH", group = "Prev Weekly Levels", inline = "1")
inp_show_prev_weekly_low = input.bool(false, title = "LOW", group = "Prev Weekly Levels", inline = "1")
inp_show_prev_weekly_eq = input.bool(false, title = "EQ", group = "Prev Weekly Levels", inline = "1")
inp_prev_weekly_col = input.color(color.blue, title = "color", group = "Prev Weekly Levels", inline = "2")
inp_prev_weekly_line_width = 1//input.int(1, title = "Line width", minval = 1, group = "Prev Weekly Levels", inline = "2")
ww = input.int(1, title = "weekback", minval = 1,maxval=5, group = "Prev Weekly Levels", inline = "2")
f_create_level("open", new_week, not new_week, global_open_array, inp_prev_weekly_col, inp_prev_weekly_line_width, inp_ext, open_line_style, text_size, "P-WO", ww, inp_show_prev_weekly_open and weekly_ok and prev_weekly)
f_create_level("high", new_week, not new_week, global_high_array, inp_prev_weekly_col, inp_prev_weekly_line_width, inp_ext, high_line_style, text_size, "P-WH", ww, inp_show_prev_weekly_high and weekly_ok and prev_weekly)
f_create_level("low", new_week, not new_week, global_low_array, inp_prev_weekly_col, inp_prev_weekly_line_width, inp_ext, low_line_style, text_size, "P-WL", ww, inp_show_prev_weekly_low and weekly_ok and prev_weekly)
f_create_level("eq", new_week, not new_week, global_eq_array, inp_prev_weekly_col, inp_prev_weekly_line_width, inp_ext, eq_line_style, text_size, "P-W-EQ", ww, inp_show_prev_weekly_eq and weekly_ok and prev_weekly)
// Monday and Prev Monday
// -----------------------------------------------------------------------------
// Note : Monday range is a special case and is why the _active_condition is implemented in the function. We only want start on Monday, and ONLY update levels during monday.
monday_open = input.bool(false, title = "MonD", group = "Monday Levels", inline = "1")
inp_show_monday_open = input.bool(false, title = "OPEN", group = "Monday Levels", inline = "1")
inp_show_monday_high = input.bool(false, title = "HIGH", group = "Monday Levels", inline = "1")
inp_show_monday_low = input.bool(false, title = "LOW", group = "Monday Levels", inline = "1")
inp_show_monday_eq = input.bool(false, title = "EQ", group = "Monday Levels", inline = "1")
inp_monday_col = input.color(color.fuchsia, title = "color", group = "Monday Levels", inline = "2")
inp_monday_line_width = 1//input.int(1, title = "Line width", minval = 1, group = "Monday Levels", inline = "2")
monday_ok = timeframe.isintraday
f_create_level("open", new_week, is_monday, global_open_array, inp_monday_col, inp_monday_line_width, inp_ext, open_line_style, text_size, "M.Day-O", 0, inp_show_monday_open and monday_ok and monday_open)
f_create_level("high", new_week, is_monday, global_high_array, inp_monday_col, inp_monday_line_width, inp_ext, high_line_style, text_size, "M.Day-H", 0, inp_show_monday_high and monday_ok and monday_open)
f_create_level("low", new_week, is_monday, global_low_array, inp_monday_col, inp_monday_line_width, inp_ext, low_line_style, text_size, "M.Day-L", 0, inp_show_monday_low and monday_ok and monday_open)
f_create_level("eq", new_week, is_monday, global_eq_array, inp_monday_col, inp_monday_line_width, inp_ext, eq_line_style, text_size, "M.Day-EQ", 0, inp_show_monday_eq and monday_ok and monday_open)
prev_monday = input.bool(false, title = "p-mon", group = "Prev Monday Levels", inline = "1")
inp_show_prev_monday_open = input.bool(false, title = "OPEN", group = "Prev Monday Levels", inline = "1")
inp_show_prev_monday_high = input.bool(false, title = "HIGH", group = "Prev Monday Levels", inline = "1")
inp_show_prev_monday_low = input.bool(false, title = "LOW", group = "Prev Monday Levels", inline = "1")
inp_show_prev_monday_eq = input.bool(false, title = "EQ", group = "Prev Monday Levels", inline = "1")
inp_prev_monday_col = input.color(color.purple, title = "color", group = "Prev Monday Levels", inline = "2")
inp_prev_monday_line_width = 1//input.int(1, title = "Line width", minval = 1, group = "Prev Monday Levels", inline = "2")
f_create_level("open", new_week, is_monday, global_open_array, inp_prev_monday_col, inp_prev_monday_line_width, inp_ext, open_line_style, text_size, "P-M.Day-O", 1, inp_show_prev_monday_open and monday_ok and prev_monday and prev_monday)
f_create_level("high", new_week, is_monday, global_high_array, inp_prev_monday_col, inp_prev_monday_line_width, inp_ext, high_line_style, text_size, "P-M.Day-H", 1, inp_show_prev_monday_high and monday_ok and prev_monday and prev_monday)
f_create_level("low", new_week, is_monday, global_low_array, inp_prev_monday_col, inp_prev_monday_line_width, inp_ext, low_line_style, text_size, "P-M.Day-L", 1, inp_show_prev_monday_low and monday_ok and prev_monday and prev_monday)
f_create_level("eq", new_week, is_monday, global_eq_array, inp_prev_monday_col, inp_prev_monday_line_width, inp_ext, eq_line_style, text_size, "P-M.Day-EQ", 1, inp_show_prev_monday_eq and monday_ok and prev_monday and prev_monday)
// -----------------------------------------------------------------------------
// Monthly and Prev Monthly
// -----------------------------------------------------------------------------
monthly = input.bool(true, title = "M", group = "Monthly Levels", inline = "1")
inp_show_monthly_open = input.bool(true, title = "OPEN", group = "Monthly Levels", inline = "1")
inp_show_monthly_high = input.bool(true, title = "HIGH", group = "Monthly Levels", inline = "1")
inp_show_monthly_low = input.bool(true, title = "LOW", group = "Monthly Levels", inline = "1")
inp_show_monthly_eq = input.bool(false, title = "EQ", group = "Monthly Levels", inline = "1")
inp_monthly_col = input.color(color.lime, title = "color", group = "Monthly Levels", inline = "2")
inp_monthly_line_width = 1//input.int(1, title = "Line width", minval = 1 ,group = "Monthly Levels", inline = "2")
monthly_ok = timeframe.isintraday or timeframe.isdaily
f_create_level("open", new_month, not new_month, global_open_array, inp_monthly_col, inp_monthly_line_width, inp_ext, open_line_style, text_size, "MO", 0, inp_show_monthly_open and monthly_ok and monthly )
f_create_level("high", new_month, not new_month, global_high_array, inp_monthly_col, inp_monthly_line_width, inp_ext, high_line_style, text_size, "MH", 0, inp_show_monthly_high and monthly_ok and monthly )
f_create_level("low", new_month, not new_month, global_low_array, inp_monthly_col, inp_monthly_line_width, inp_ext, low_line_style, text_size, "ML", 0, inp_show_monthly_low and monthly_ok and monthly )
f_create_level("eq", new_month, not new_month, global_eq_array, inp_monthly_col, inp_monthly_line_width, inp_ext, eq_line_style, text_size, "M-EQ", 0, inp_show_monthly_eq and monthly_ok and monthly )
prev_monthly = input.bool(true, title = "PM", group = "Prev Monthly Levels", inline = "1")
inp_show_prev_monthly_open = input.bool(true, title = "OPEN", group = "Prev Monthly Levels", inline = "1")
inp_show_prev_monthly_high = input.bool(false, title = "HIGH", group = "Prev Monthly Levels", inline = "1")
inp_show_prev_monthly_low = input.bool(false, title = "LOW", group = "Prev Monthly Levels", inline = "1")
inp_show_prev_monthly_eq = input.bool(false, title = "EQ", group = "Prev Monthly Levels", inline = "1")
inp_prev_monthly_col = input.color(color.green, title = "color", group = "Prev Monthly Levels", inline = "2")
inp_prev_monthly_line_width =1// input.int(1, title = "Line width", minval = 1, group = "Prev Monthly Levels", inline = "2")
mm = input.int(1, title = "monthback", minval = 1,maxval=13, group = "Prev Monthly Levels", inline = "2")
f_create_level("open", new_month, not new_month, global_open_array, inp_prev_monthly_col, inp_prev_monthly_line_width, inp_ext, open_line_style, text_size, "P-MO", mm, inp_show_prev_monthly_open and monthly_ok and prev_monthly and prev_monthly )
f_create_level("high", new_month, not new_month, global_high_array, inp_prev_monthly_col, inp_prev_monthly_line_width, inp_ext, high_line_style, text_size, "P-MH", mm, inp_show_prev_monthly_high and monthly_ok and prev_monthly and prev_monthly )
f_create_level("low", new_month, not new_month, global_low_array, inp_prev_monthly_col, inp_prev_monthly_line_width, inp_ext, low_line_style, text_size, "P-ML", mm, inp_show_prev_monthly_low and monthly_ok and prev_monthly and prev_monthly )
f_create_level("eq", new_month, not new_month, global_eq_array, inp_prev_monthly_col, inp_prev_monthly_line_width, inp_ext, eq_line_style, text_size, "P-M-EQ", mm, inp_show_prev_monthly_eq and monthly_ok and prev_monthly and prev_monthly )
// -----------------------------------------------------------------------------
// Quarterly and Prev Quarterly
// -----------------------------------------------------------------------------
quarterly = input.bool(false, title = "Q", group = "Quarterly Levels", inline = "1")
inp_show_quarterly_open = input.bool(false, title = "OPEN", group = "Quarterly Levels", inline = "1")
inp_show_quarterly_high = input.bool(false, title = "HIGH", group = "Quarterly Levels", inline = "1")
inp_show_quarterly_low = input.bool(false, title = "LOW", group = "Quarterly Levels", inline = "1")
inp_show_quarterly_eq = input.bool(false, title = "EQ", group = "Quarterly Levels", inline = "1")
inp_quarterly_col = input.color(color.orange, title = "color", group = "Quarterly Levels", inline = "2")
inp_quarterly_line_width = 1//input.int(1, title = "Line width", minval = 1, group = "Quarterly Levels", inline = "2")
quarterly_ok = timeframe.isintraday or timeframe.isdaily or timeframe.isweekly
f_create_level("open", new_quarter, not new_quarter, global_open_array, inp_quarterly_col, inp_quarterly_line_width, inp_ext, open_line_style, text_size, "3M-O", 0, inp_show_quarterly_open and quarterly_ok and quarterly)
f_create_level("high", new_quarter, not new_quarter, global_high_array, inp_quarterly_col, inp_quarterly_line_width, inp_ext, high_line_style, text_size, "3M-H", 0, inp_show_quarterly_high and quarterly_ok and quarterly)
f_create_level("low", new_quarter, not new_quarter, global_low_array, inp_quarterly_col, inp_quarterly_line_width, inp_ext, low_line_style, text_size, "3M-L", 0, inp_show_quarterly_low and quarterly_ok and quarterly)
f_create_level("eq", new_quarter, not new_quarter, global_eq_array, inp_quarterly_col, inp_quarterly_line_width, inp_ext, eq_line_style, text_size, "3M-EQ", 0, inp_show_quarterly_eq and quarterly_ok and quarterly)
prev_quarterly = input.bool(false, title = "PQ", group = "Prev Quarterly Levels", inline = "1")
inp_show_prev_quarterly_open = input.bool(false, title = "OPEN", group = "Prev Quarterly Levels", inline = "1")
inp_show_prev_quarterly_high = input.bool(false, title = "HIGH", group = "Prev Quarterly Levels", inline = "1")
inp_show_prev_quarterly_low = input.bool(false, title = "LOW", group = "Prev Quarterly Levels", inline = "1")
inp_show_prev_quarterly_eq = input.bool(false, title = "EQ", group = "Prev Quarterly Levels", inline = "1")
inp_prev_quarterly_col = input.color(color.yellow, title = "color", group = "Prev Quarterly Levels", inline = "2")
inp_prev_quarterly_line_width = 1//input.int(1, title = "Line width", minval = 1, group = "Prev Quarterly Levels", inline = "2")
qq = input.int(1, title = "Quarterback", minval = 1,maxval=12, group = "Prev Quarterly Levels", inline = "2")
f_create_level("open", new_quarter, not new_quarter, global_open_array, inp_prev_quarterly_col, inp_prev_quarterly_line_width, inp_ext, open_line_style, text_size, "P 3MOpen", mm, inp_show_prev_quarterly_open and quarterly_ok and prev_quarterly and qq)
f_create_level("high", new_quarter, not new_quarter, global_high_array, inp_prev_quarterly_col, inp_prev_quarterly_line_width, inp_ext, high_line_style, text_size, "Prev 3MHIGH", mm, inp_show_prev_quarterly_high and quarterly_ok and prev_quarterly and qq)
f_create_level("low", new_quarter, not new_quarter, global_low_array, inp_prev_quarterly_col, inp_prev_quarterly_line_width, inp_ext, low_line_style, text_size, "P-3MLOW", mm, inp_show_prev_quarterly_low and quarterly_ok and prev_quarterly and qq)
f_create_level("eq", new_quarter, not new_quarter, global_eq_array, inp_prev_quarterly_col, inp_prev_quarterly_line_width, inp_ext, eq_line_style, text_size, "P-3M-EQ", mm, inp_show_prev_quarterly_eq and quarterly_ok and prev_quarterly and qq)
// -----------------------------------------------------------------------------
// Yearly & Prev Yearly
// -----------------------------------------------------------------------------
yearly = input.bool(false, title = "Y", group = "Yearly Levels", inline = "1")
inp_show_yearly_open = input.bool(false, title = "OPEN", group = "Yearly Levels", inline = "1")
inp_show_yearly_high = input.bool(false, title = "HIGH", group = "Yearly Levels", inline = "1")
inp_show_yearly_low = input.bool(false, title = "LOW", group = "Yearly Levels", inline = "1")
inp_show_yearly_eq = input.bool(false, title = "EQ", group = "Yearly Levels", inline = "1")
inp_yearly_col = input.color(color.red, title = "color", group = "Yearly Levels", inline = "2")
inp_yearly_line_width = input.int(1, title = "Line width", minval = 1, group = "Yearly Levels", inline = "2")
yearly_ok = timeframe.isintraday or timeframe.isdaily or timeframe.isweekly or (timeframe.ismonthly and timeframe.multiplier < 12)
f_create_level("open", new_year, not new_year, global_open_array, inp_yearly_col, inp_yearly_line_width, inp_ext, open_line_style, text_size, "YO", 0, inp_show_yearly_open and yearly_ok)
f_create_level("high", new_year, not new_year, global_high_array, inp_yearly_col, inp_yearly_line_width, inp_ext, high_line_style, text_size, "Yearly HIGH", 0, inp_show_yearly_high and yearly_ok)
f_create_level("low", new_year, not new_year, global_low_array, inp_yearly_col, inp_yearly_line_width, inp_ext, low_line_style, text_size, "Yearly LOW", 0, inp_show_yearly_low and yearly_ok)
f_create_level("eq", new_year, not new_year, global_eq_array, inp_yearly_col, inp_yearly_line_width, inp_ext, eq_line_style, text_size, "Yearly EQ", 0, inp_show_yearly_eq and yearly_ok)
prev_yearly = input.bool(false, title = "PY", group = "Prev Yearly Levels", inline = "1")
inp_show_prev_yearly_open = input.bool(false, title = "OPEN", group = "Prev Yearly Levels", inline = "1")
inp_show_prev_yearly_high = input.bool(false, title = "HIGH", group = "Prev Yearly Levels", inline = "1")
inp_show_prev_yearly_low = input.bool(false, title = "LOW", group = "Prev Yearly Levels", inline = "1")
inp_show_prev_yearly_eq = input.bool(false, title = "EQ", group = "Prev Yearly Levels", inline = "1")
inp_prev_yearly_col = input.color(color.maroon, title = "color", group = "Prev Yearly Levels", inline = "2")
inp_prev_yearly_line_width = input.int(1, title = "Line width", minval = 1, group = "Prev Yearly Levels", inline = "2")
yy = input.int(1, title = "yearback", minval = 1, maxval=2, group = "Prev Yearly Levels", inline = "2")
f_create_level("open", new_year, not new_year, global_open_array, inp_prev_yearly_col, inp_prev_yearly_line_width, inp_ext, open_line_style, text_size, "P-YO", yy, inp_show_prev_yearly_open and yearly_ok and prev_yearly)
f_create_level("high", new_year, not new_year, global_high_array, inp_prev_yearly_col, inp_prev_yearly_line_width, inp_ext, high_line_style, text_size, "Prev Yearly HIGH", yy, inp_show_prev_yearly_high and yearly_ok and prev_yearly)
f_create_level("low", new_year, not new_year, global_low_array, inp_prev_yearly_col, inp_prev_yearly_line_width, inp_ext, low_line_style, text_size, "Prev Yearly LOW", yy, inp_show_prev_yearly_low and yearly_ok and prev_yearly)
f_create_level("eq", new_year, not new_year, global_eq_array, inp_prev_yearly_col, inp_prev_yearly_line_width, inp_ext, eq_line_style, text_size, "Prev Yearly EQ", yy, inp_show_prev_yearly_eq and yearly_ok and prev_yearly)
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
//imbalance finder
color gray0 = color.new(color.gray, 0)
color yellow0 = color.new(#FFF700, 0)
bool showgreydiamond = input(defval=false, title='İmbalance back test helper' ,group='=== Information ===')
bool showib = input(defval=false, title='İmbalance bar' ,group='=== Information ===')
Imbcol = input.color(yellow0, 'Imbalance Color', inline="1" ,group='=== Information ===')
Dimcol = input.color(gray0, 'Imbalance back test diamond color', inline="1" ,group='=== Information ===')
TopImbalance = low <= open and high >= close
TopImbalancesize = low - high
if TopImbalance and showib and TopImbalancesize > 0
BOX1 = box.new(left=bar_index , top=low , right=bar_index , bottom=high )
box.set_bgcolor(BOX1, na)
box.set_border_color(BOX1, Imbcol )
//plot(TopImbalance and TopImbalancesize > 0 ? low : na , color=Imbcol)
//plot(TopImbalance and TopImbalancesize > 0 ? high : na , color=Imbcol)
BottomImbalance = high >= open and low <= close
BottomImbalancesize = low - high
if BottomImbalance and showib and BottomImbalancesize > 0
BOX2 = box.new(left=bar_index , top=low , right=bar_index , bottom=high )
box.set_bgcolor(BOX2, na )
box.set_border_color(BOX2, Imbcol )
//plot(BottomImbalance and BottomImbalancesize > 0 ? low : na , color=Imbcol)
//plot(BottomImbalance and BottomImbalancesize > 0 ? high : na , color=Imbcol)
DownImbalance = TopImbalance and TopImbalancesize > 0
plotshape(DownImbalance and showgreydiamond, style=shape.diamond, location=location.abovebar, color=Dimcol, size=size.tiny)
UpImbalance = BottomImbalance and BottomImbalancesize > 0
plotshape(UpImbalance and showgreydiamond, style=shape.diamond, location=location.belowbar, color=Dimcol, size=size.tiny)
alertcondition(DownImbalance , title='Down Imbalance', message='Down Imbalance')
alertcondition(UpImbalance , title='Up Imbalance', message='Up Imbalance')
alertcondition(DownImbalance or UpImbalance , title='Imbalance Present ', message='Imbalance Present')
// MBS
//indicator(title='Order Blocks', overlay=true)
bool msb_a_sv = input.bool (true, title='Alert MSB')
bool msb_sv = input.bool (true, title='Plot MSB lines')
color mbs_color1 = input.color(#00e1ff, title='MSB Color Bullish')
color mbs_color2 = input.color(#ff00bf, title='MSB Color Bearish')
bool box_sv = input.bool (false, title='Plot Orderblocks')
color u_s = input.color (color.rgb(255, 0, 0, 90), title='Untested Supply Color')
color t_s = input.color (color.rgb(192, 192, 192, 93), title='Tested Supply Color')
color u_d = input.color (color.rgb(0, 255, 0, 90), title='Untested Demand Color')
color t_d = input.color (color.rgb(192, 192, 192, 93), title='Tested Demand Color')
bool m_sv = input.bool (false, title='Plot Breakerblocks')
color u_b = input.color (color.new(color.blue, 90), title='Untested Breaker Color')
color t_b = input.color (color.rgb(192, 192, 192, 90), title='Tested Breaker Color')
bool ob_a_sv = input.bool (false, title='Alert Orderblock test')
bool bb_a_sv = input.bool (false, title='Alert Breakerblock test')
bool r_a_sv = input.bool (false, title='Alert New Range')
bool rt_a_sv = input.bool (false, title='Alert Range test')
var float pvh1_price = array.new_float (30, na) // high
var int pvh1_time = array.new_int (30, na)
var float pvl1_price = array.new_float (30, na) // low
var int pvl1_time = array.new_int (30, na)
var float pvh2_price = array.new_float (10, na) // higher high
var int pvh2_time = array.new_int (10, na)
var float pvl2_price = array.new_float (10, na) // lower low
var int pvl2_time = array.new_int (10, na)
var float htcmrll_price = na // high that created most recent ll
var int htcmrll_time = na
var float ltcmrhh_price = na // low that created most recent hh
var int ltcmrhh_time = na
var box long_boxes = array.new_box() // orderblocks
var box short_boxes = array.new_box()
var box m_long_boxes = array.new_box() // breakerblocks
var box m_short_boxes = array.new_box()
var line bull_bos_lines = array.new_line() // MSB lines
var line bear_bos_lines = array.new_line()
var line range_h_lines = array.new_line() // Range lines
var line range_25_lines = array.new_line()
var line range_m_lines = array.new_line()
var line range_75_lines = array.new_line()
var line range_l_lines = array.new_line()
var label la_ph2 = array.new_label() // 2nd order pivots
var label la_pl2 = array.new_label()
var float temp_pv_0 = na
var float temp_pv_1 = na
var float temp_pv_2 = na
var int temp_time = na
var float last_range_h = na
var float last_range_l = na
var line range_m = na
var line range_25 = na
var line range_75 = na
var float box_top = na
var float box_bottom = na
var int h_a_time = 0
var int l_a_time = 0
var int mh_a_time = 0
var int ml_a_time = 0
var int rh_a_time = 0
var int rl_a_time = 0
bool pvh = high < high and high > high
bool pvl = low > low and low < low
int pv1_time = bar_index
float pv1_high = high
float pv1_low = low
bool new_ph_2nd = false
bool new_pl_2nd = false
string alert = na
if barstate.isconfirmed
if pvh
array.pop(pvh1_price)
array.pop(pvh1_time)
array.unshift(pvh1_price, pv1_high)
array.unshift(pvh1_time, pv1_time)
if array.size(pvh1_price) > 2
temp_pv_0 := array.get(pvh1_price, 0)
temp_pv_1 := array.get(pvh1_price, 1)
temp_pv_2 := array.get(pvh1_price, 2)
if temp_pv_0 < temp_pv_1 and temp_pv_1 > temp_pv_2
array.pop(pvh2_price)
array.pop(pvh2_time)
array.unshift(pvh2_price, temp_pv_1)
array.unshift(pvh2_time, array.get(pvh1_time, 1))
new_ph_2nd := true
if temp_pv_1 > array.get(pvh2_price, 1)
for i = 0 to array.size(pvl2_time) - 1 by 1
temp_ltcmrhh_time = array.get(pvl2_time, i)
if temp_ltcmrhh_time < array.get(pvh2_time, 0)
ltcmrhh_price := array.get(pvl2_price, i)
ltcmrhh_time := temp_ltcmrhh_time
break
if temp_pv_0 < ltcmrhh_price
if msb_sv
array.push(bear_bos_lines, line.new(x1=ltcmrhh_time, y1=ltcmrhh_price, x2=bar_index, y2=ltcmrhh_price, color=mbs_color2, width=2))
box_top := array.get(pvh2_price, 0)
box_bottom := math.max(low , low )
array.push(short_boxes, box.new(left=array.get(pvh2_time, 0), top=box_top, right=bar_index, bottom=box_bottom, bgcolor= box_sv ? u_s : na , border_color=na, extend=extend.right))
if msb_a_sv
alert := alert + 'Bearish MSB @ ' + str.tostring(ltcmrhh_price) + ' ' + 'New Supply Zone : '+ str.tostring(box_top) + ' - ' + str.tostring(box_bottom) + ' '
ltcmrhh_price := na
if pvl
array.pop(pvl1_price)
array.pop(pvl1_time)
array.unshift(pvl1_price, pv1_low)
array.unshift(pvl1_time, pv1_time)
if array.size(pvl1_price) > 2
temp_pv_0 := array.get(pvl1_price, 0)
temp_pv_1 := array.get(pvl1_price, 1)
temp_pv_2 := array.get(pvl1_price, 2)
if temp_pv_0 > temp_pv_1 and temp_pv_1 < temp_pv_2
array.pop(pvl2_price)
array.pop(pvl2_time)
array.unshift(pvl2_price, temp_pv_1)
array.unshift(pvl2_time, array.get(pvl1_time, 1))
new_pl_2nd := true
if temp_pv_1 < array.get(pvl2_price, 1)
for i = 0 to array.size(pvh2_time) - 1 by 1
temp_htcmrll_time = array.get(pvh2_time, i)
if temp_htcmrll_time < array.get(pvl2_time, 0)
htcmrll_price := array.get(pvh2_price, i)
htcmrll_time := temp_htcmrll_time
break
if temp_pv_0 > htcmrll_price
if msb_sv
array.push(bull_bos_lines, line.new(x1=htcmrll_time, y1=htcmrll_price, x2=bar_index, y2=htcmrll_price, color=mbs_color1, width=2))
box_top := math.min(high , high )
box_bottom := array.get(pvl2_price, 0)
array.push(long_boxes, box.new(left=array.get(pvl2_time, 0), top=box_top, right=bar_index, bottom=box_bottom, bgcolor= box_sv ? u_d : na, border_color=na, extend=extend.right))
if msb_a_sv
alert := alert + 'Bullish MSB @ ' + str.tostring(htcmrll_price) + ' ' + 'New Demand Zone : '+ str.tostring(box_bottom) + ' - ' + str.tostring(box_top) + ' '
htcmrll_price := na
if array.size(short_boxes) > 0
for i = array.size(short_boxes) - 1 to 0 by 1
tbox = array.get(short_boxes, i)
top = box.get_top(tbox)
bottom = box.get_bottom(tbox)
ago = box.get_left(tbox)
if array.get(pvh1_price, 0) > bottom
if box_sv
box.set_bgcolor(tbox, t_s)
if ob_a_sv and close < bottom
if array.get(pvh1_time, 0) != h_a_time
h_a_time := array.get(pvh1_time, 0)
alert := alert + 'Supply Zone Test @ ' + str.tostring(array.get(pvh1_price, 0)) + ' (age = ' + str.tostring(bar_index-ago) + ' bars) '
if array.get(pvl1_price, 0) > top
if m_sv
box.set_bgcolor(tbox, u_b)
array.push(m_long_boxes, tbox)
else
box.delete(tbox)
array.remove(short_boxes, i)
if msb_sv
line.delete(array.get(bear_bos_lines, i))
array.remove(bear_bos_lines, i)
if array.size(long_boxes) > 0
for i = array.size(long_boxes) - 1 to 0 by 1
lbox = array.get(long_boxes, i)
top = box.get_top(lbox)
bottom = box.get_bottom(lbox)
ago = box.get_left(lbox)
if array.get(pvl1_price, 0) < top
if box_sv
box.set_bgcolor(lbox, t_d)
if ob_a_sv and close > top
if array.get(pvl1_time, 0) != l_a_time
l_a_time := array.get(pvl1_time, 0)
alert := alert + 'Demand Zone Test @ ' + str.tostring(array.get(pvl1_price, 0)) + ' (age = ' + str.tostring(bar_index-ago) + ' bars) '
if array.get(pvh1_price, 0) < bottom
if m_sv
box.set_bgcolor(lbox, u_b)
array.push(m_short_boxes, lbox)
else
box.delete(lbox)
array.remove(long_boxes, i)
if msb_sv
line.delete(array.get(bull_bos_lines, i))
array.remove(bull_bos_lines, i)
if array.size(m_short_boxes) > 0
for i = array.size(m_short_boxes) - 1 to 0 by 1
tbox = array.get(m_short_boxes, i)
top = box.get_top(tbox)
bottom = box.get_bottom(tbox)
ago = box.get_left(tbox)
if array.get(pvh1_price, 0) > bottom
box.set_bgcolor(tbox, t_b)
if bb_a_sv and close < bottom
if array.get(pvh1_time, 0) != mh_a_time
mh_a_time := array.get(pvh1_time, 0)
alert := alert + 'Breakerblock Test Up @ ' + str.tostring(array.get(pvh1_price, 0)) + ' (age = ' + str.tostring(bar_index-ago) + ' bars) '
if array.get(pvl1_price, 0) > top
box.delete(tbox)
array.remove(m_short_boxes, i)
if array.size(m_long_boxes) > 0
for i = array.size(m_long_boxes) - 1 to 0 by 1
lbox = array.get(m_long_boxes, i)
top = box.get_top(lbox)
bottom = box.get_bottom(lbox)
ago = box.get_left(lbox)
if array.get(pvl1_price, 0) < top
box.set_bgcolor(lbox, t_b)
if bb_a_sv and close > top
if array.get(pvl1_time, 0) != ml_a_time
ml_a_time := array.get(pvl1_time, 0)
alert := alert + 'Breakerblock Test Down @ ' + str.tostring(array.get(pvl1_price, 0)) + ' (age = ' + str.tostring(bar_index-ago) + ' bars) '
if array.get(pvh1_price, 0) < bottom
box.delete(lbox)
array.remove(m_long_boxes, i)
alert := not na(alert) ? (alert + 'Current price = ' + str.tostring(close) + ' ') : na
exec = not na(alert) ? true : false
if exec==true
alert(alert, alert.freq_once_per_bar_close)
Normalized MACD with RSI & Stoch RSI + SignalsNormalized MACD with RSI & Stoch RSI Indicator
Overview:
This indicator combines three popular momentum indicators (MACD, RSI, and Stochastic RSI) into a single cohesive, normalized view, making it easier for traders to interpret market momentum and potential buy/sell signals. It specifically addresses an important issue—the different scale ranges of indicators—by normalizing MACD values to match the 0–100 scale of RSI and Stochastic RSI.
Here’s a clear and concise description of your updated Pine Script indicator:
⸻
Normalized MACD with RSI & Stoch RSI Indicator
Overview:
This indicator combines three popular momentum indicators (MACD, RSI, and Stochastic RSI) into a single cohesive, normalized view, making it easier for traders to interpret market momentum and potential buy/sell signals. It specifically addresses an important issue—the different scale ranges of indicators—by normalizing MACD values to match the 0–100 scale of RSI and Stochastic RSI.
⸻
Key Components:
① MACD (Normalized):
• The Moving Average Convergence Divergence (MACD) originally has an unlimited numerical range.
• Normalization Method:
• Uses a custom tanh(x) function implemented directly in Pine Script:
\tanh(x) = \frac{e^{x}-e^{-x}}{e^{x}+e^{-x}}
• MACD values are scaled using this method to a range of 0–100, with the neutral line at exactly 50.
• Interpretation:
• Values above 50 indicate bullish momentum.
• Values below 50 indicate bearish momentum.
② RSI (Relative Strength Index):
• Measures market momentum on a 0–100 scale.
• Traditional RSI interpretation:
• Overbought conditions: RSI > 70–80.
• Oversold conditions: RSI < 30–20.
③ Stochastic RSI:
• Combines RSI and Stochastic Oscillator to give short-term, highly sensitive signals.
• Helps identify immediate market extremes:
• Above 80 → Short-term overbought.
• Below 20 → Short-term oversold.
⸻
How the Indicator Works:
• Visualization:
• All three indicators (Normalized MACD, RSI, Stochastic RSI) share the same 0–100 scale.
• Clear visual lines and reference levels:
• Midline at 50 indicates neutral momentum.
• Dashed lines at 20 and 80 clearly mark oversold/overbought zones.
• Trading Signals (Recommended approach):
• Bullish Signal (Potential Buy):
• Normalized MACD crosses above 50.
• RSI below or approaching oversold zone (below 30–20).
• Stochastic RSI below 20, indicating short-term oversold conditions.
• Bearish Signal (Potential Sell):
• Normalized MACD crosses below 50.
• RSI above or approaching overbought zone (above 70–80).
• Stochastic RSI above 80, indicating short-term overbought conditions.
⸻
Why Use This Indicator?
• Harmonized Signals:
Normalization of MACD significantly improves clarity and comparability with RSI and Stochastic RSI, providing a unified momentum picture.
• Intuitive Analysis:
Traders can rapidly and intuitively identify momentum shifts without needing multiple indicator windows.
• Improved Decision-Making:
Clear visual references and signals help reduce subjective interpretation, potentially improving trading outcomes.
⸻
Suggested Usage:
• Combine with traditional support
Z-Score Normalized Volatility IndicesVolatility is one of the most important measures in financial markets, reflecting the extent of variation in asset prices over time. It is commonly viewed as a risk indicator, with higher volatility signifying greater uncertainty and potential for price swings, which can affect investment decisions. Understanding volatility and its dynamics is crucial for risk management and forecasting in both traditional and alternative asset classes.
Z-Score Normalization in Volatility Analysis
The Z-score is a statistical tool that quantifies how many standard deviations a given data point is from the mean of the dataset. It is calculated as:
Z = \frac{X - \mu}{\sigma}
Where X is the value of the data point, \mu is the mean of the dataset, and \sigma is the standard deviation of the dataset. In the context of volatility indices, the Z-score allows for the normalization of these values, enabling their comparison regardless of the original scale. This is particularly useful when analyzing volatility across multiple assets or asset classes.
This script utilizes the Z-score to normalize various volatility indices:
1. VIX (CBOE Volatility Index): A widely used indicator that measures the implied volatility of S&P 500 options. It is considered a barometer of market fear and uncertainty (Whaley, 2000).
2. VIX3M: Represents the 3-month implied volatility of the S&P 500 options, providing insight into medium-term volatility expectations.
3. VIX9D: The implied volatility for a 9-day S&P 500 options contract, which reflects short-term volatility expectations.
4. VVIX: The volatility of the VIX itself, which measures the uncertainty in the expectations of future volatility.
5. VXN: The Nasdaq-100 volatility index, representing implied volatility in the Nasdaq-100 options.
6. RVX: The Russell 2000 volatility index, tracking the implied volatility of options on the Russell 2000 Index.
7. VXD: Volatility for the Dow Jones Industrial Average.
8. MOVE: The implied volatility index for U.S. Treasury bonds, offering insight into expectations for interest rate volatility.
9. BVIX: Volatility of Bitcoin options, a useful indicator for understanding the risk in the cryptocurrency market.
10. GVZ: Volatility index for gold futures, reflecting the risk perception of gold prices.
11. OVX: Measures implied volatility for crude oil futures.
Volatility Clustering and Z-Score
The concept of volatility clustering—where high volatility tends to be followed by more high volatility—is well documented in financial literature. This phenomenon is fundamental in volatility modeling and highlights the persistence of periods of heightened market uncertainty (Bollerslev, 1986).
Moreover, studies by Andersen et al. (2012) explore how implied volatility indices, like the VIX, serve as predictors for future realized volatility, underlining the relationship between expected volatility and actual market behavior. The Z-score normalization process helps in making volatility data comparable across different asset classes, enabling more effective decision-making in volatility-based strategies.
Applications in Trading and Risk Management
By using Z-score normalization, traders can more easily assess deviations from the mean in volatility, helping to identify periods when volatility is unusually high or low. This can be used to adjust risk exposure or to implement volatility-based trading strategies, such as mean reversion strategies. Research suggests that volatility mean-reversion is a reliable pattern that can be exploited for profit (Christensen & Prabhala, 1998).
References:
• Andersen, T. G., Bollerslev, T., Diebold, F. X., & Vega, C. (2012). Realized volatility and correlation dynamics: A long-run approach. Journal of Financial Economics, 104(3), 385-406.
• Bollerslev, T. (1986). Generalized autoregressive conditional heteroskedasticity. Journal of Econometrics, 31(3), 307-327.
• Christensen, B. J., & Prabhala, N. R. (1998). The relation between implied and realized volatility. Journal of Financial Economics, 50(2), 125-150.
• Whaley, R. E. (2000). Derivatives on market volatility and the VIX index. Journal of Derivatives, 8(1), 71-84.
EMA 34 Crossover with Break Even Stop LossEMA 34 Crossover with Break Even Stop Loss Strategy
This trading strategy is based on the 34-period Exponential Moving Average (EMA) and aims to enter long positions when the price crosses above the EMA 34. The strategy is designed to manage risk effectively with a dynamic stop loss and take-profit mechanism.
Key Features:
EMA 34 Crossover:
The strategy generates a long entry signal when the closing price of the current bar crosses above the 34-period EMA, with the condition that the previous closing price was below the EMA. This crossover indicates a potential upward trend.
Risk Management:
Upon entering a trade, the strategy sets a stop loss at the low of the previous bar. This helps in controlling the downside risk.
A take profit level is set at a 10:1 risk-to-reward ratio, meaning the potential profit is ten times the amount risked on the trade.
Break-even Stop Loss:
As the price moves in favor of the trade and reaches a 3:1 risk-to-reward ratio, the strategy moves the stop loss to the entry price (break-even). This ensures that no loss will be incurred if the market reverses, effectively protecting profits.
Exit Conditions:
The strategy exits the trade when either the stop loss is hit (if the price drops below the stop loss level) or the take profit target is reached (if the price rises to the take profit level).
If the price reaches the break-even level (entry price), the stop loss is adjusted to lock in profits and prevent any loss.
Visualization:
The stop loss and take profit levels are plotted on the chart for easy visualization, helping traders track the status of their trade.
Trade Management Summary:
Long Entry: When price crosses above the 34-period EMA.
Stop Loss: Set to the low of the previous candle.
Take Profit: Set to a 10:1 risk-to-reward ratio.
Break-even: Stop loss is moved to entry price when a 3:1 risk-to-reward ratio is reached.
Exit: The trade is closed either when the stop loss or take profit levels are hit.
This strategy is designed to minimize losses by employing a dynamic stop loss and to maximize gains by setting a favorable risk-to-reward ratio, making it suitable for traders who prefer a structured, automated approach to risk management and trend-following.
Multiple SMA Strategy with Trend Cloud5, 8, and 13 SMA with trend indicator, with easy to see colours for trends,
QT NY Session High/LowShows Asia & London High/Low which are key liquidity points price will react to.
You can also adjust the NY AM 6am - 12pm EST range to divide the time frames into 4 quarters
It delivers NY AM true open and the true day open
It gives you previous day high & previous day low