Cari dalam skrip untuk "momentum"
TrapTradingBuy on dips and sell into rallies. Simple as that.
- Short line (green)
- Base line (white)
- Long line (red)
When the market price touches the white or the red(green) lines, buy(sell) orders are generated.
The exit points are 2 lines above(below) the entries.
Parameters
- Period: It affects the value of Base line and the spacing of each line.
- Multiple: Specify the spacing between each line.
Frosted 12 EMA WIDTHThis is a complementary indicator for the 12 EMAs indicator ()
This width indicator shows the fanning width of each fan (shorter MAs and longer MAs).
To make things easier to see:
You can turn off one of the histograms to view just one of the widths (and add a 2nd instance of this indicator, turning off the other width).
B3 Directional Trend IndexB3 Directional Trend Index ~ All about the trend! William Blau is the designer of this gem, and IMHO it is the best trend finder of all the lagging indicators out there I have tested. It is important to pay attention to the slope and thickness of the line, and its relationship to zero. A reversion to the zero may look momentous, but in fact it could reverse when it reaches mean, only to turn back around. You can see this in March and April of this silver futures daily chart. Makes for a great instrument on anything you consider trendy, like crude oil for example. The default user inputs are set to my liking, as I find them to be great on all charts and resolutions. You may read around to find more about this on the internet, or its mentioned in Krausz's work. Also, imprtant to remember when no trend, trend finders like this sufffer, so be wise as to what market condition you are in. Rangy and within Range = no, On the Move = yes.
UCS_Momentum OscillatorI am not sure if someone else has already thought about it. But this is something I use to measure the meaningful oversold and overbought level, provided the stock is in a trend. I will add a Trend Indicator along with this in the next version.
I have added RSI, ROC, Stoch to compare. From the code below, i am using Stochastic, but the idea is same, if you use RSI. Experiment with your own comfortable time frames.
This is not a holy grail, The oversold and overbought in a trend transition period could be misleading. But over all, Its a good measure to trade overbought and oversold region
List of All my Indicators - www.tradingview.com
MACD with Bollinger Band Signal + Histogram🔄 MACD with Bollinger Band Signal + Histogram
This advanced indicator is a unique variation of the classic MACD. Instead of using a traditional signal line, it overlays Bollinger Bands directly on the MACD line, allowing for a more dynamic and volatility-aware momentum analysis. It also includes a histogram that visualizes the divergence between the MACD line and the BB midline.
✅ Key Features:
Custom MACD Line: Based on user-defined fast and slow EMA periods.
Bollinger Band Signal:
Applied directly to the MACD line (not price).
Customizable period, standard deviation, color, and fill opacity.
Highlights volatility around the MACD to identify expansion and contraction phases.
Histogram:
Measures the difference between the MACD line and the BB midline.
Helps identify bullish or bearish momentum shifts.
Color-coded for clarity (green = bullish, red = bearish).
📌 Use Cases:
Identify momentum breakouts when MACD moves outside the BB envelope.
Spot trend weakening or reversal when MACD reverts to the BB basis.
Use histogram direction and color to confirm trend strength and momentum bias.
A powerful upgrade to the standard MACD for more volatility-sensitive signals.
ETI IndicatorThe Ensemble Technical Indicator (ETI) is a script that combines multiple established indicators into one single powerful indicator. Specifically, it takes a number of technical indicators and then converts them into +1 to represent a bullish trend, or a -1 to represent a bearish trend. It then adds these values together and takes the running sum over the past 20 days.
The ETI is composed of the following indicators and converted to +1 or -1 using the following criteria:
Simple Moving Average (10 days) : When the price is above the 10-day simple moving averaging, +1, when below -1
Weighted Moving Average (10 days) : Similar to the SMA 10, when the the price is above the 10-day weighted moving average, +1, when below -1
Stochastic K% : If the current Stochastic K% is greater than the previous value, then +1, else -1.
Stochastic D% : Similar to the Stochastic K%, when the current Stochastic D% is greater than the previous value, +1, else -1.
MACD Difference : First subtract the MACD signal (i.e. the moving average) from the MACD value and if the current value is higher than the previous value, then +1, else -1.
William's R% : If the current William's R% is greater than the previous one, then +1, else -1.
William's Accumulation/Distribution : If the current William's AD value is greater than the previous value, then +1, else -1.
Commodity Channel Index : If the Commodity Channel Index is greater than 200 (overbought), then -1, if it is less than -200 (oversold) then +1. When it is between those values, if the current value is greater than the previous value then +1, else -1.
Relative Strength Index : If the Relative Strength Index is over 70 (overbought) then -1 and if under 30 (oversold) then +1. If the Relative Strength Indicator is between those values then if the current value is higher than the previous value +1, else -1.
Momentum (9 days) : If the momentum value is greater than 0, then +1, else -1.
Again, once these values have been calculated and converted, they are added up to produce a single value. This single value is then summed across the previous 20 candles to produce a running sum.
By coalescing multiple technical indicators into a single value across time, traders can better understand how multiple inter-related indicators are behaving at once; high scores indicate that numerous indicators are showing bullish signals indicating a potential or ongoing uptrend (and vice-versa with low scores).
Additional Features
Numerous smoothing transformations have also been added (e.g. gaussian smoothing) to remove some of the noise might exist.
Suggested Use
It is recommended that stocks are shorted when the cross below 0, and are bought when the ETI crosses above -40. Arrows can be shown on the indicator to show these points. However feel free to use levels that work best for you.
Traditionally, I have treated values above +50 as overbought and below -40 as undersold (with -80 indicating extremely oversold); however these levels could also indicate either upwards and downwards momentum so taking a position based on where the ETI is (rather than crossing levels) should be done with caution.
Double Smoothed MomentaDouble Smoothed Momenta was created by William Blau (Stocks & Commodities V. 9:5 (202-205)). His original indicator didn't use a signal period so I added one to notify you when to buy or sell. Buy when the indicator goes over the signal line and sell when it is falls below the signal line.
Let me know what other indicators you would like me to write scripts for!
RSI Missmatch(Divergence) OSC. by Neo_ with Missmatch Alert█ Definition
A divergence or missmatch occurs when an asset’s price is moving opposite to a specific technical indicator or is moving in a different direction from other relevant data. The divergence indicator warns traders and technical analysts of changes in a price trend, oftentimes that it is weakening or changing direction.
Divergence or missmatch can be either positive, signifying the possibility of a move that is higher in the asset’s price, or it can be negative, signifying the possibility of a move that is lower in the asset’s price.
█ Takeaways
Divergence or missmatch often works with other indicators and data. It is usually used by technical analysts and traders when the asset’s price is moving counter to the direction of another indicator.
As mentioned above, positive divergence or missmatch indicates that the price could start rising and usually occurs when the price is moving lower, but while another indicator counters this direction by moving higher. In other words, showing bullish signals.
Negative divergence or missmatch indicates that the price could start declining and usually occurs when the price is moving higher, while another indicator moves lower as well. In other words, showing bearish signals.
█ What to look for
Divergence or missmatch is most often used to track and analyze the momentum in an asset’s price and the odds of a price reversal within the current trend. While using divergence, traders and analysts can decide on whether or not they would like to exit the position or set a stop loss in the case the divergence is negative and prices begin to fall.
█ Limitations
It is best to use divergence or missmatch with the aid of other indicators and analysis tools in order to help identify and confirm trend reversals and major market patterns. Divergence should not be relied on by itself to tell you the pertinent information you need to know as an investor. Risk control is key in your analysis and the fact that divergence is not always present in price reversals should definitely be what pushes you to combine it with other tools and indicators.
Additionally, divergence or missmatch can reflect long-term or short-term changes. When making snap decisions, acting on divergence alone could prove detrimental to your trading. Make sure you have other risk factors applied to your charting and general market analysis.
█ What exactly is RSI Missmatches discrepancies using a lookback period in trading?
In trading, lookback period is the number of periods of historical data used for observation and calculation. It is how far into the past the system looks when trying to calculate the variable under consideration. The concept was based on the fact that history can provide information about the future, and my aim was to predict the periods when trend changes would begin within these periods with the RSI oscillator. But this is only true if you're locked back far enough, not locked any further or less!
We already use the idea of looking back in different aspects of our lives, and even in the world of financial trading it can be used in various ways. Of course you will want to learn more about the concept, so in this article we will cover the following topics:
█ What kind of hindsight is this?
The aim here is to check whether trends will change in certain cycles, so we chose the High + Low / 2 formula as the source. Because no matter how much the prices swing up or down, sometimes the rebound can go further. The aim here is to notice the points where the price leaves a needle at the levels where it oscillates and the slowdown in momentum.
█ What does look-back period mean in trade?
To understand what a lookback period means in trading, you need to ask yourself: What is a lookback period in trading? In financial trading, period refers to the duration of a particular trading session. For example, a one-week period means one full week of trading sessions or five trading days. In 5 trading days, the average time is 120 hours in FX markets and 40 hours in stock markets. Regardless of what happens in these cycles, I prefer to choose a time period of 55 periods. Because I noticed that in all the charts I examined, the cycles generally changed during this time period.
█ Let's talk about the meaning of catching Missmatches
As you know, technical indicators are all a mathematical calculation using historical market data (price, volume, or a combination of both). It shows the behavior of the price better and helps in the analysis of price movement. But the indicator can only serve your intended purpose if you get the lookback time right. What we mean here is the setting parameter that determines how much historical data it will use in its calculation. In other words, it is the retrospective review period.
For example, on the RSI indicator you can set this period to 13 periods (default setting) or even 2 periods. The period you choose can determine what the indicator tells you, which in turn determines the strategy you can create with the indicator. The 13- period RSI gives you information about price momentum, so you can effectively use it to create a momentum strategy. On the other hand, the 2-periods RSI can be used to create a mean reversion strategy. To catch any incompatibilities, I set this period to 55 periods. Nothing more, nothing less!
█ Summary
The missmatch indicator helps traders assess changes in the price trend and indicates when price will move with or against the direction of another indicator. It can be either positive or negative, but it is important to note its limitations and that it should be used with other indicators that can also monitor price trends.
We wish you to identify these incompatibilities in the market in the best way possible... Good luck.
█ Tanım
Bir varlığın fiyatı belirli bir teknik göstergenin tersi yönünde hareket ettiğinde veya diğer ilgili verilerden farklı bir yönde hareket ettiğinde bir sapma veya uyumsuzluk meydana gelir. Farklılık göstergesi, tüccarları ve teknik analistleri fiyat eğilimindeki değişiklikler konusunda uyarır; çoğu zaman zayıflıyor veya yön değiştiriyor.
Farklılık veya uyumsuzluk, varlığın fiyatında daha yüksek bir hareket olasılığını işaret ederek pozitif olabilir veya varlığın fiyatında daha düşük bir hareket olasılığını işaret ederek negatif olabilir.
█ Çıkarımlar
Farklılık veya uyumsuzluk çoğu zaman diğer göstergeler ve verilerle de çalışır. Genellikle teknik analistler ve yatırımcılar tarafından varlığın fiyatı başka bir göstergenin yönünün tersine hareket ettiğinde kullanılır.
Yukarıda bahsedildiği gibi pozitif sapma veya uyumsuzluk, fiyatın yükselmeye başlayabileceğini gösterir ve genellikle fiyat düşerken meydana gelir, ancak başka bir gösterge bu yöne yükselerek karşı koyar. Başka bir deyişle yükseliş sinyalleri veriyor.
Negatif sapma veya uyumsuzluk, fiyatın düşmeye başlayabileceğini gösterir ve genellikle fiyat yükselirken başka bir gösterge de düşerken meydana gelir. Başka bir deyişle düşüş sinyalleri veriyor.
█ Nelere bakılmalı
Farklılık veya uyumsuzluk çoğunlukla bir varlığın fiyatındaki momentumu ve mevcut trend içinde fiyatın tersine dönme olasılığını izlemek ve analiz etmek için kullanılır. Farklılaşmayı kullanırken tüccarlar ve analistler, sapmanın negatif olması ve fiyatların düşmeye başlaması durumunda pozisyondan çıkmak isteyip istemeyeceklerine veya zararı durdurma kararı verip veremeyeceklerine karar verebilirler.
█ Sınırlamalar
Trend dönüşlerini ve ana piyasa modellerini tanımlamaya ve doğrulamaya yardımcı olmak için diğer göstergeler ve analiz araçlarının yardımıyla sapmayı veya uyumsuzluğu kullanmak en iyisidir. Bir yatırımcı olarak bilmeniz gereken ilgili bilgileri size söylemesi için farklılığa tek başına güvenilmemelidir. Risk kontrolü analizinizin anahtarıdır ve fiyat dönüşlerinde farklılığın her zaman mevcut olmaması gerçeği kesinlikle sizi onu diğer araç ve göstergelerle birleştirmeye iten şey olmalıdır.
Ek olarak, farklılık veya uyumsuzluk uzun vadeli veya kısa vadeli değişiklikleri yansıtabilir. Ani kararlar verirken yalnızca farklılıklara göre hareket etmek ticaretinize zarar verebilir. Grafiğinize ve genel piyasa analizinize başka risk faktörlerinin uygulandığından emin olun.
█ Ticarette yeniden inceleme dönemi kullanan RSI Missmatches tutarsızlıkları tam olarak nedir?
Ticarette yeniden inceleme süresi, gözlem ve hesaplama için kullanılan geçmiş verilerin dönemlerinin sayısıdır. Söz konusu değişkeni hesaplamaya çalışırken sistemin ne kadar geçmişe baktığıdır. Konsept tarihin geleceğe dair bilgi verebileceği gerçeği üzerine kuruluydu ve amacım RSI osilatörü ile bu dönemler içerisinde trend değişimlerinin başlayacağı dönemleri tahmin etmekti. Ancak bu yalnızca yeterince geriye kilitlenmişseniz geçerlidir, daha fazla veya daha az kilitlenmemişseniz!
Geriye bakma fikrini hayatımızın farklı yönlerinde zaten kullanıyoruz ve hatta finansal ticaret dünyasında bile bu fikir çeşitli şekillerde kullanılabilir. Elbette konsept hakkında daha fazla bilgi edinmek isteyeceksiniz, bu nedenle bu yazıda aşağıdaki konuları ele alacağız:
█ Bu nasıl bir sonradan görmedir?
Burada amaç belli döngülerde trendlerin değişip değişmeyeceğini kontrol etmek olduğundan kaynak olarak Yüksek + Düşük / 2 formülünü seçtik. Çünkü fiyatlar ne kadar yukarı veya aşağı hareket ederse etsin bazen toparlanma daha da ileri gidebiliyor. Burada amaç fiyatın salınım yaptığı seviyelerde iğne bıraktığı noktaları ve momentumdaki yavaşlamayı fark etmektir.
█ Ticarette geriye bakma süresi ne anlama geliyor?
Ticarette yeniden inceleme süresinin ne anlama geldiğini anlamak için kendinize şu soruyu sormanız gerekir: Ticarette yeniden inceleme süresi nedir? Finansal ticarette dönem, belirli bir ticaret seansının süresini ifade eder. Örneğin, bir haftalık dönem, bir tam haftalık işlem seansı veya beş işlem günü anlamına gelir. 5 işlem gününde ortalama süre döviz piyasalarında 120 saat, borsalarda ise 40 saattir. Bu döngülerde ne olursa olsun 55 periyotluk bir zaman dilimini seçmeyi tercih ediyorum. Çünkü incelediğim tüm grafiklerde bu zaman diliminde döngülerin genel olarak değiştiğini fark ettim.
█ Kaçak Eşleşmeleri yakalamanın anlamı hakkında konuşalım
Bildiğiniz gibi teknik göstergeler, geçmiş piyasa verileri (fiyat, hacim veya her ikisinin birleşimi) kullanılarak yapılan matematiksel hesaplamalardır. Fiyatın davranışını daha iyi gösterir ve fiyat hareketinin analizine yardımcı olur. Ancak gösterge yalnızca yeniden inceleme süresini doğru yaparsanız amacınıza hizmet edebilir. Burada kast ettiğimiz, hesaplamasında ne kadar geçmiş veri kullanacağını belirleyen ayar parametresidir. Bir başka deyişle geriye dönük inceleme dönemidir.
Örneğin RSI göstergesinde bu süreyi 13 döneme (varsayılan ayar) ve hatta 2 döneme ayarlayabilirsiniz. Seçeceğiniz dönem, göstergenin size ne söyleyeceğini belirleyebilir ve bu da gösterge ile oluşturabileceğiniz stratejiyi belirler. 13 dönemlik RSI size fiyat momentumu hakkında bilgi verir, böylece onu bir momentum stratejisi oluşturmak için etkili bir şekilde kullanabilirsiniz. Öte yandan, ortalamaya dönüş stratejisi oluşturmak için 2 dönemlik RSI kullanılabilir. Herhangi bir uyumsuzluğu yakalamak için bu periyodu 55 periyoda ayarladım. Ne fazla ne eksik!
█ Özet
Uyumsuzluk göstergesi, yatırımcıların fiyat eğilimindeki değişiklikleri değerlendirmesine yardımcı olur ve fiyatın ne zaman başka bir göstergenin yönüne göre veya ona karşı hareket edeceğini gösterir. Olumlu ya da olumsuz olabilir, ancak sınırlamalarına dikkat etmek ve fiyat eğilimlerini de izleyebilecek diğer göstergelerle birlikte kullanılması gerektiğini unutmamak önemlidir.
Piyasadaki bu uyumsuzlukları en iyi şekilde tespit etmenizi dileriz... Bol Kazançlar.
GOLDEN RSI by @thejamiulGOLDEN RSI thejamiul is a versatile Relative Strength Index (RSI)-based tool designed to provide enhanced visualization and additional insights into market trends and potential reversal points. This indicator improves upon the traditional RSI by integrating gradient fills for overbought/oversold zones and divergence detection features, making it an excellent choice for traders who seek precise and actionable signals.
Source of this indicator : This indicator is based on @TradingView original RSI indicator with a little bit of customisation to enhance overbought and oversold identification.
Key Features
1. Customizable RSI Settings:
RSI Length: Adjust the RSI calculation period to suit your trading style (default: 14).
Source Selection: Choose the price source (e.g., close, open, high, low) for RSI calculation.
2. Gradient-Filled RSI Zones:
Overbought Zone (80-100): Gradient fill with shades of green to indicate strong bullish conditions.
Oversold Zone (0-20): Gradient fill with shades of red to highlight strong bearish conditions.
3. Support and Resistance Levels:
Upper Band: 80
Middle Bands: 60 (bullish) and 40 (bearish)
Lower Band: 20
These levels help identify overbought, oversold, and neutral zones.
4. Divergence Detection:
Bullish Divergence: Detects lower lows in price with corresponding higher lows in RSI, signaling potential upward reversals.
Bearish Divergence: Detects higher highs in price with corresponding lower highs in RSI, indicating potential downward reversals.
Visual Indicators:
Bullish divergence is marked with green labels and line plots.
Bearish divergence is marked with red labels and line plots.
5. Alert Functionality:
Custom Alerts: Set up alerts for bullish or bearish divergences to stay notified of potential trading opportunities without constant chart monitoring.
6. Enhanced Chart Visualization:
RSI Plot: A smooth and visually appealing RSI curve.
Color Coding: Gradient and fills for better distinction of trading zones.
Pivot Labels: Clear identification of divergence points on the RSI plot.
Vigilant Asset Allocation G4 Backtesting EngineThis script was based off of an idea that @CubanEmissary had so the description and some of the code that @CubanEmissary built on TradingView was used.
Vigilant Asset Allocation G4 (VAA G4) is a dual-momentum based investment strategy that aggressively monitors the market and reallocates portfolio funds based on the relative momentums of user-defined risk assets and safety assets. It was created by Wouter Keller and JW Keuning, based on their paper "Breadth Momentum and Vigilant Asset Allocation." In contrast to traditional dual momentum strategies, VAA G4 monitors the market itself through the two asset types. When all risk assets have positive momentum, the portfolio is allocated entirely into the risk asset with the strongest momentum At any other time, the portfolio is allocated entirely into the safety asset with the strongest momentum. The combination of breadth momentum with a very defensive reallocation trigger results in a strategy which captures alpha consistently.
The Strategy Rules:
1. Calculate each asset's momentum score on each monthly close:
momentumScore = (12*(currentMonthlyClose/lastMonthlyClose))+(4*(currentMonthlyClose/thirdLastMonthlyClose))+(2*(currentMonthlyClose/sixthLastMonthlyClose))+(currentMonthlyClose/twelvethLastMonthlyClose)-19
2. If all risk asset momentums are positive, allocate entire portfolio to the risk asset with the strongest momentum.
3. If any risk asset's momentum is negative, allocate entire portfolio to the safety asset with the strongest momentum.
4. Reevaluate at the end of each month.
Caveats:
1. It seems like TradingView only has limited price data for these tickers that are listed in the strategy. So it is best to start the strategy when they all have ample data (~ June 2nd, 2008)
2. This backtesting engine is basic and doesn't account for slippage and trading fees. So I implemented a basic "trading fee" input that will subtract a trading fee whenever the strategy makes a trade at the end of the month.
3. It is assumed in this engine that the trades will be made the exact second a new monthly bar opens up.
4. MUST USE ON MONTHLY CHART. It is hard-coded to work on monthly chart, if you open it on a daily chart , the Sharpe, Sortino, & CAGR calculations might not be right as well as the momentum score
Volume Weighted RSI (VW RSI)The Volume Weighted RSI (VW RSI) is a momentum oscillator designed for TradingView, implemented in Pine Script v6, that enhances the traditional Relative Strength Index (RSI) by incorporating trading volume into its calculation. Unlike the standard RSI, which measures the speed and change of price movements based solely on price data, the VW RSI weights its analysis by volume, emphasizing price movements backed by significant trading activity. This makes the VW RSI particularly effective for identifying bullish or bearish momentum, overbought/oversold conditions, and potential trend reversals in markets where volume plays a critical role, such as stocks, forex, and cryptocurrencies.
Key Features
Volume-Weighted Momentum Calculation:
The VW RSI calculates momentum by comparing the volume associated with upward price movements (up-volume) to the volume associated with downward price movements (down-volume).
Up-volume is the volume on bars where the closing price is higher than the previous close, while down-volume is the volume on bars where the closing price is lower than the previous close.
These volumes are smoothed over a user-defined period (default: 14 bars) using a Running Moving Average (RMA), and the VW RSI is computed using the formula:
\text{VW RSI} = 100 - \frac{100}{1 + \text{VoRS}}
where
\text{VoRS} = \frac{\text{Average Up-Volume}}{\text{Average Down-Volume}}
.
Oscillator Range and Interpretation:
The VW RSI oscillates between 0 and 100, with a centerline at 50.
Above 50: Indicates bullish volume momentum, suggesting that volume on up bars dominates, which may signal buying pressure and a potential uptrend.
Below 50: Indicates bearish volume momentum, suggesting that volume on down bars dominates, which may signal selling pressure and a potential downtrend.
Overbought/Oversold Levels: User-defined thresholds (default: 70 for overbought, 30 for oversold) help identify potential reversal points:
VW RSI > 70: Overbought, indicating a possible pullback or reversal.
VW RSI < 30: Oversold, indicating a possible bounce or reversal.
Visual Elements:
VW RSI Line: Plotted in a separate pane below the price chart, colored dynamically based on its value:
Green when above 50 (bullish momentum).
Red when below 50 (bearish momentum).
Gray when at 50 (neutral).
Centerline: A dashed line at 50, optionally displayed, serving as the neutral threshold between bullish and bearish momentum.
Overbought/Oversold Lines: Dashed lines at the user-defined overbought (default: 70) and oversold (default: 30) levels, optionally displayed, to highlight extreme conditions.
Background Coloring: The background of the VW RSI pane is shaded red when the indicator is in overbought territory and green when in oversold territory, providing a quick visual cue of potential reversal zones.
Alerts:
Built-in alerts for key events:
Bullish Momentum: Triggered when the VW RSI crosses above 50, indicating a shift to bullish volume momentum.
Bearish Momentum: Triggered when the VW RSI crosses below 50, indicating a shift to bearish volume momentum.
Overbought Condition: Triggered when the VW RSI crosses above the overbought threshold (default: 70), signaling a potential pullback.
Oversold Condition: Triggered when the VW RSI crosses below the oversold threshold (default: 30), signaling a potential bounce.
Input Parameters
VW RSI Length (default: 14): The period over which the up-volume and down-volume are smoothed to calculate the VW RSI. A longer period results in smoother signals, while a shorter period increases sensitivity.
Overbought Level (default: 70): The threshold above which the VW RSI is considered overbought, indicating a potential reversal or pullback.
Oversold Level (default: 30): The threshold below which the VW RSI is considered oversold, indicating a potential reversal or bounce.
Show Centerline (default: true): Toggles the display of the 50 centerline, which separates bullish and bearish momentum zones.
Show Overbought/Oversold Lines (default: true): Toggles the display of the overbought and oversold threshold lines.
How It Works
Volume Classification:
For each bar, the indicator determines whether the price movement is upward or downward:
If the current close is higher than the previous close, the bar’s volume is classified as up-volume.
If the current close is lower than the previous close, the bar’s volume is classified as down-volume.
If the close is unchanged, both up-volume and down-volume are set to 0 for that bar.
Smoothing:
The up-volume and down-volume are smoothed using a Running Moving Average (RMA) over the specified period (default: 14 bars) to reduce noise and provide a more stable measure of volume momentum.
VW RSI Calculation:
The Volume Relative Strength (VoRS) is calculated as the ratio of smoothed up-volume to smoothed down-volume.
The VW RSI is then computed using the standard RSI formula, but with volume data instead of price changes, resulting in a value between 0 and 100.
Visualization and Alerts:
The VW RSI is plotted with dynamic coloring to reflect its momentum direction, and optional lines are drawn for the centerline and overbought/oversold levels.
Background coloring highlights overbought and oversold conditions, and alerts notify the trader of significant crossings.
Usage
Timeframe: The VW RSI can be used on any timeframe, but it is particularly effective on intraday charts (e.g., 1-hour, 4-hour) or daily charts where volume data is reliable. Shorter timeframes may require a shorter length for increased sensitivity, while longer timeframes may benefit from a longer length for smoother signals.
Markets: Best suited for markets with significant and reliable volume data, such as stocks, forex, and cryptocurrencies. It may be less effective in markets with low or inconsistent volume, such as certain futures contracts.
Trading Strategies:
Trend Confirmation:
Use the VW RSI to confirm the direction of a trend. For example, in an uptrend, look for the VW RSI to remain above 50, indicating sustained bullish volume momentum, and consider buying on pullbacks when the VW RSI dips but stays above 50.
In a downtrend, look for the VW RSI to remain below 50, indicating sustained bearish volume momentum, and consider selling on rallies when the VW RSI rises but stays below 50.
Overbought/Oversold Conditions:
When the VW RSI crosses above 70, the market may be overbought, suggesting a potential pullback or reversal. Consider taking profits on long positions or preparing for a short entry, but confirm with price action or other indicators.
When the VW RSI crosses below 30, the market may be oversold, suggesting a potential bounce or reversal. Consider entering long positions or covering shorts, but confirm with additional signals.
Divergences:
Look for divergences between the VW RSI and price to spot potential reversals. For example, if the price makes a higher high but the VW RSI makes a lower high, this bearish divergence may signal an impending downtrend.
Conversely, if the price makes a lower low but the VW RSI makes a higher low, this bullish divergence may signal an impending uptrend.
Momentum Shifts:
A crossover above 50 can signal the start of bullish momentum, making it a potential entry point for long trades.
A crossunder below 50 can signal the start of bearish momentum, making it a potential entry point for short trades or an exit for long positions.
Example
On a 4-hour SOLUSDT chart:
During an uptrend, the VW RSI might rise above 50 and stay there, confirming bullish volume momentum. If it approaches 70, it may indicate overbought conditions, as seen near a price peak of 145.08, suggesting a potential pullback.
During a downtrend, the VW RSI might fall below 50, confirming bearish volume momentum. If it drops below 30 near a price low of 141.82, it may indicate oversold conditions, suggesting a potential bounce, as seen in a slight recovery afterward.
A bullish divergence might occur if the price makes a lower low during the downtrend, but the VW RSI makes a higher low, signaling a potential reversal.
Limitations
Lagging Nature: Like the traditional RSI, the VW RSI is a lagging indicator because it relies on smoothed data (RMA). It may not react quickly to sudden price reversals, potentially missing the start of new trends.
False Signals in Ranging Markets: In choppy or ranging markets, the VW RSI may oscillate around 50, generating frequent crossovers that lead to false signals. Combining it with a trend filter (e.g., ADX) can help mitigate this.
Volume Data Dependency: The VW RSI relies on accurate volume data, which may be inconsistent or unavailable in some markets (e.g., certain forex pairs or futures contracts). In such cases, the indicator’s effectiveness may be reduced.
Overbought/Oversold in Strong Trends: During strong trends, the VW RSI can remain in overbought or oversold territory for extended periods, leading to premature exit signals. Use additional confirmation to avoid exiting too early.
Potential Improvements
Smoothing Options: Add options to use different smoothing methods (e.g., EMA, SMA) instead of RMA for the up/down volume calculations, allowing users to adjust the indicator’s responsiveness.
Divergence Detection: Include logic to detect and plot bullish/bearish divergences between the VW RSI and price, providing visual cues for potential reversals.
Customizable Colors: Allow users to customize the colors of the VW RSI line, centerline, overbought/oversold lines, and background shading.
Trend Filter: Integrate a trend strength filter (e.g., ADX > 25) to ensure signals are generated only during strong trends, reducing false signals in ranging markets.
The Volume Weighted RSI (VW RSI) is a powerful tool for traders seeking to incorporate volume into their momentum analysis, offering a unique perspective on market dynamics by emphasizing price movements backed by significant trading activity. It is best used in conjunction with other indicators and price action analysis to confirm signals and improve trading decisions.
MTF Squeeze Analyzer - [tradeviZion]MTF Squeeze Analyzer
Multi-Timeframe Squeeze Pro Analyzer Tool
Overview:
The MTF Squeeze Analyzer is a comprehensive tool designed to help traders monitor the TTM Squeeze indicator across multiple timeframes in a streamlined and efficient manner. Built with Pine Script™ version 5, this indicator enhances your market analysis by providing detailed insights into squeeze conditions and momentum shifts, enabling you to make more informed trading decisions.
Key Features:
1. Multi-Timeframe Monitoring:
Comprehensive Coverage: Track squeeze conditions across multiple timeframes, including 1-minute, 5-minute, 15-minute, 30-minute, 1-hour, 2-hour, 4-hour, and daily charts.
Squeeze Counts: Keep count of the number of consecutive bars the price has been within each squeeze level (low, mid, high), helping you assess the strength and duration of consolidation periods.
2. Dynamic Table Display:
Customizable Appearance: Adjust table position, text size, and colors to suit your preferences.
Color-Coded Indicators: Easily identify squeeze levels and momentum shifts with intuitive color schemes.
Message Integration: Features rotating messages to keep you engaged and informed.
3. Alerts for Key Market Events:
Squeeze Start and Fire Alerts: Receive notifications when a squeeze starts or fires on your selected timeframes.
Custom Squeeze Count Alerts: Set thresholds for squeeze counts and get alerted when these levels are reached, allowing you to anticipate potential breakouts.
Fully Customizable: Choose which alerts you want to receive and tailor them to your trading strategy.
4. Momentum Analysis:
Momentum Oscillator: Visualize momentum using a histogram that changes color based on momentum shifts.
Detailed Insights: Determine whether momentum is increasing or decreasing to make more strategic trading decisions.
How It Works:
The indicator is based on the TTM Squeeze concept, which identifies periods of low volatility where the market is "squeezing" before a potential breakout. It analyzes the relationship between Bollinger Bands and Keltner Channels to determine squeeze conditions and uses linear regression to calculate momentum.
1. Squeeze Levels:
No Squeeze (Green): Market is not in a squeeze.
Low Compression Squeeze (Gray): Mild consolidation, potential for a breakout.
Mid Compression Squeeze (Red): Moderate consolidation, higher breakout potential.
High Compression Squeeze (Orange): Strong consolidation, significant breakout potential.
2. Squeeze Counts:
Tracks the number of consecutive bars in each squeeze condition.
Helps identify how long the market has been consolidating, providing clues about potential breakout timing.
3. Momentum Histogram:
Upward Momentum: Shown in aqua or blue, indicating increasing or decreasing upward momentum.
Downward Momentum: Displayed in red or yellow, representing increasing or decreasing downward momentum.
Using Alerts:
Stay ahead of market movements with customizable alerts:
1. Enable Alerts in Settings:
Squeeze Start Alert: Get notified when a new squeeze begins.
Squeeze Fire Alert: Be alerted when a squeeze ends, signaling a potential breakout.
Squeeze Count Alert: Set a specific number of bars for a squeeze condition, and receive an alert when this count is reached.
2. Set Up Alerts on Your Chart:
Click on the indicator name and select " Add Alert on MTF Squeeze Analyzer ".
Choose your desired alert conditions and customize the notification settings.
Click " Create " to activate the alerts.
How to Set It Up:
1. Add the Indicator to Your Chart:
Search for " MTF Squeeze Analyzer " in the TradingView Indicators library.
Add it to your chart.
2. Customize Your Settings:
Table Display:
Choose whether to show the table and select its position on the chart.
Adjust text size and colors to enhance readability.
Timeframe Selection:
Select the timeframes you want to monitor.
Enable or disable specific timeframes based on your trading strategy.
Colors & Styles:
Customize colors for different squeeze levels and momentum shifts.
Adjust header and text colors to match your chart theme.
Alert Settings:
Enable alerts for squeeze start, squeeze fire, and squeeze counts.
Set your preferred squeeze type and count threshold for alerts.
3. Interpret the Data:
Table Information:
The table displays the squeeze status and counts for each selected timeframe.
Colors indicate the type of squeeze, making it easy to assess market conditions at a glance.
Momentum Histogram:
Use the histogram to gauge the strength and direction of market momentum.
Observe color changes to identify shifts in momentum.
Why Use MTF Squeeze Analyzer ?
Enhanced Market Insight:
Gain a deeper understanding of market dynamics by monitoring multiple timeframes simultaneously.
Identify potential breakout opportunities by analyzing squeeze durations and momentum shifts.
Customizable and User-Friendly:
Tailor the indicator to fit your trading style and preferences.
Easily adjust settings without needing to delve into the code.
Time-Efficient:
Save time by viewing all relevant squeeze information in one place.
Reduce the need to switch between different charts and timeframes.
Stay Informed with Alerts:
Never miss a critical market movement with fully customizable alerts.
Focus on other tasks while the indicator monitors the market for you.
Acknowledgment:
This tool builds upon the foundational work of John Carter , who developed the TTM Squeeze concept. It also incorporates enhancements from LazyBear and Makit0 , providing a more versatile and powerful indicator. MTF Squeeze Analyzer extends these concepts by adding multi-timeframe analysis, squeeze counting, and advanced alerting features, offering traders a comprehensive solution for market analysis.
Note: Always practice proper risk management and test the indicator thoroughly to ensure it aligns with your trading strategy. Past performance is not indicative of future results.
Trade smarter with TradeVizion—unlock your trading potential today!
lib_momentumLibrary "lib_momentum"
This library calculates the momentum, derived from a sample range of prior candles. Depending on set MomentumType it either deduces the momentum from the price, volume, or a product of both. If price/product are selected, you can choose from SampleType if only candle body, full range from high to low or a combination of both (body counts full, wicks half for each direction) should be used. Optional: You can choose to normalize the results, dividing each value by its average (normalization_ma_length, normalization_ma). This will allow comparison between different instruments. For the normalization Moving Average you can choose any currently supported in my lib_no_delay.
get_momentum(momentum_type, sample_type, sample_length, normalization_ma_length, normalization_ma)
Parameters:
momentum_type (series MomentumType) : select one of MomentumType. to sample the price, volume or a product of both
sample_type (series SampleType) : select one of SampleType. to sample the body, total range from high to low or a combination of both (body count full, wicks half for each direction)
sample_length (simple int) : how many candles should be sampled (including the current)
normalization_ma_length (simple int) : if you want to normalize results (momentum / momentum average) this sets the period for the average. (default = 0 => no normalization)
normalization_ma (simple MovingAverage enum from robbatt/lib_no_delay/9) : is the type of moving average to normalize / compare with
Returns: returns the current momentum where the total line is not just (up - down) but also sampled over the sample_length and can therefore be used as trend indicator. If up/down fail to reach total's level it's a sign of decreasing momentum, if up/down exceed total the trend it's a sign of increasing momentum.
MomentumSignal Kit RSI-MACD-ADX-CCI-CMF-TSI-EStoch// ----------------------------------------
// Description:
// ----------------------------------------
// MomentumKit RSI/MACD-ADX-CCI-CMF-TSI-EStoch Suite is a comprehensive momentum indicator suite designed to provide robust buy and sell signals through the consensus of multiple normalized momentum indicators. This suite integrates the following indicators:
// - **Relative Strength Index (RSI)**
// - **Stochastic RSI**
// - **Moving Average Convergence Divergence (MACD)** with enhanced logic
// - **True Strength Index (TSI)**
// - **Commodity Channel Index (CCI)**
// - **Chaikin Money Flow (CMF)**
// - **Average Directional Index (ADX)**
// - **Ehlers' Stochastic**
//
// **Key Features:**
// 1. **Normalization:** Each indicator is normalized to a consistent scale, facilitating easier comparison and interpretation across different momentum metrics. This uniform scaling allows traders to seamlessly analyze multiple indicators simultaneously without the confusion of differing value ranges.
//
// 2. **Consensus-Based Signals:** By combining multiple indicators, MomentumKit generates buy and sell signals based on the agreement among various momentum measurements. This multi-indicator consensus approach enhances signal reliability and reduces the likelihood of false positives.
//
// 3. **Overlap Analysis:** The normalization process aids in identifying overlapping signals, where multiple indicators point towards a potential change in price or momentum. Such overlaps are strong indicators of significant market movements, providing traders with timely and actionable insights.
//
// 4. **Enhanced Logic for MACD:** The MACD component within MomentumKit utilizes enhanced logic to improve its responsiveness and accuracy in detecting trend changes.
//
// 5. **Debugging Features:** MomentumKit includes advanced debugging tools that display individual buy and sell signals generated by each indicator. These features are intended for users with technical and programming skills, allowing them to:
// - **Visualize Signal Generation:** See real-time buy and sell signals for each integrated indicator directly on the chart.
// - **Adjust Signal Thresholds:** Modify the criteria for what constitutes a buy or sell signal for each indicator, enabling tailored analysis based on specific trading strategies.
// - **Filter and Manipulate Signals:** Enable or disable specific indicators' contributions to the overall buy and sell signals, providing flexibility in signal generation.
// - **Monitor Indicator Behavior:** Utilize debug plots and labels to understand how each indicator reacts to market movements, aiding in strategy optimization.
//
// **Work in Progress:**
// MomentumKit is continuously evolving, with ongoing enhancements to its algorithms and user interface. Current debugging features are designed to offer deep insights for technically adept users, allowing for extensive customization and fine-tuning. Future updates aim to introduce more user-friendly interfaces and automated optimization tools to cater to a broader audience.
//
// **Usage Instructions:**
// - **Visibility Controls:** Users can toggle the visibility of individual indicators to focus on specific momentum metrics as needed.
// - **Parameter Adjustments:** Each indicator comes with customizable parameters, allowing traders to fine-tune the suite according to their trading strategies and market conditions.
// - **Debugging Features:** Enable the debugging mode to visualize individual indicator signals and adjust their contribution to the overall buy/sell signals. This requires a basic understanding of the underlying indicators and their operational thresholds.
//
// **Benefits:**
// - **Simplified Analysis:** Normalization simplifies the process of analyzing multiple indicators, making it easier to identify consistent signals across different momentum measurements.
// - **Improved Decision-Making:** Consensus-based signals backed by multiple normalized indicators provide a higher level of confidence in trading decisions.
// - **Versatility:** Suitable for various trading styles and market conditions, MomentumKit offers a versatile toolset for both novice and experienced traders.
//
// **Technical Requirements:**
// - **Programming Knowledge:** To fully leverage the debugging and signal manipulation features, users should possess a foundational understanding of Pine Script and the mechanics of momentum indicators.
// - **Customization Skills:** Ability to adjust indicator parameters and debug filters to align with specific trading strategies.
//
// **Disclaimer:**
// This indicator suite is intended for educational and analytical purposes only and does not constitute financial advice. Trading involves significant risk, and past performance is not indicative of future results. Always conduct your own analysis or consult a qualified financial advisor before making trading decisions.
Composite Indicator (Donchian + OBV)Composite Indicator (Donchian + OBV)
The Composite Indicator (Donchian + OBV) is a powerful tool designed to evaluate the strength of market breakouts and momentum trends , offering traders a comprehensive perspective on price action. This indicator combines the Donchian Channel with On-Balance Volume (OBV) to create a dynamic and easy-to-interpret metric scaled between -1 and 1 .
Key Features
Breakout Strength Analysis:
- The indicator assesses the strength of price breakouts relative to the upper and lower bounds of the Donchian Channel.
- Positive values close to 1 indicate a strong bullish breakout.
- Negative values close to -1 indicate a strong bearish breakout.
Momentum Detection with OBV:
- On-Balance Volume (OBV) tracks the cumulative buying and selling volume to gauge market momentum.
- The smoothed OBV trend ensures the momentum component aligns with price action, reducing noise.
Integrated Composite Value:
- Combines breakout strength and OBV momentum into a single metric for enhanced clarity.
- The final composite value highlights whether the market is bullish, bearish, or neutral.
Divergence Detection:
- Spot bullish divergences when the indicator rises while price falls, suggesting a potential upward reversal.
- Identify bearish divergences when the indicator falls while price rises, hinting at a potential downward reversal.
How It Works
Donchian Channel Analysis:
- Calculates the highest high and lowest low over a user-defined period to establish the upper and lower channels .
- Breakouts beyond these channels contribute to the breakout strength component.
OBV Momentum:
- Measures cumulative volume trends to validate price movements.
- Momentum is derived from the rate of change in smoothed OBV values.
Composite Calculation:
- Combines breakout strength and OBV momentum, normalized and scaled to -1 to 1 for clarity.
How to Use
Bullish Breakout:
- When the indicator value approaches 1 , it signals a strong upward breakout supported by positive OBV momentum.
- Example Action: Consider a Buy if price breaks the upper Donchian Channel with increasing OBV.
Bearish Breakout:
- When the indicator value approaches -1 , it indicates a strong downward breakout supported by negative OBV momentum.
- Example Action: Consider a Sell if price breaks the lower Donchian Channel with decreasing OBV.
Neutral Market:
- When the value is near 0 , the market is likely balanced with no significant breakout or momentum detected.
Divergence Opportunities:
- Bullish Divergence: Price makes lower lows, but the indicator trends upward → Potential upward reversal.
- Bearish Divergence: Price makes higher highs, but the indicator trends downward → Potential downward reversal.
Customization Options
Donchian Channel Length: Adjust the period for the upper and lower bounds.
OBV Smoothing Length: Modify the smoothing period for OBV to fine-tune momentum detection.
Scaling Adjustments: The composite value is automatically normalized for consistency across timeframes.
Ideal Use Cases
Breakout Trading: Identify and confirm strong breakouts in volatile markets.
Momentum Confirmation: Validate price movements with volume-based momentum.
Reversal Detection: Leverage divergences to spot potential market reversals.
Example Applications
Strong Bullish Signal:
- Price breaks the upper channel , and OBV shows increasing volume → Composite value near 1 .
- Action: Enter a Buy position and set a Stop Loss below the upper channel.
Strong Bearish Signal:
- Price breaks the lower channel , and OBV shows decreasing volume → Composite value near -1 .
- Action: Enter a Sell position and set a Stop Loss above the lower channel.
Neutral Market:
- Composite value near 0 suggests indecision or consolidation. Wait for a breakout.
Limitations
Best used alongside additional tools like RSI or MACD for filtering noise and improving decision-making.
Requires careful parameter tuning based on the asset and timeframe.
Final Thoughts
The Composite Indicator (Donchian + OBV) offers traders a versatile tool to navigate complex markets. By blending breakout analysis with volume-based momentum, this indicator provides an actionable edge for identifying high-probability opportunities and potential reversals.
simple swing indicator-KTRNSE:NIFTY
1. Pivot High/Low as Lines:
Purpose: Identifies local peaks (pivot highs) and troughs (pivot lows) in price and draws horizontal lines at these levels.
How it Works:
A pivot high occurs when the price is higher than the surrounding bars (based on the pivotLength parameter).
A pivot low occurs when the price is lower than the surrounding bars.
These pivots are drawn as horizontal lines at the price level of the pivot.
Visualization:
Pivot High: A red horizontal line is drawn at the price level of the pivot high.
Pivot Low: A green horizontal line is drawn at the price level of the pivot low.
Example:
Imagine the price is trending up, and at some point, it forms a peak. The script identifies this peak as a pivot high and draws a red line at the price of that peak. Similarly, if the price forms a trough, the script will draw a green line at the low point.
2. Moving Averages (20-day and 50-day):
Purpose: Plots the 20-day and 50-day simple moving averages (SMA) on the chart.
How it Works:
The 20-day SMA smooths the closing price over the last 20 days.
The 50-day SMA smooths the closing price over the last 50 days.
These lines provide an overview of short-term and long-term price trends.
Visualization:
20-day SMA: A blue line showing the 20-day moving average.
50-day SMA: An orange line showing the 50-day moving average.
Example:
When the price is above both moving averages, it indicates an uptrend. If the price crosses below these averages, it might signal a downtrend.
3. Supertrend:
Purpose: The Supertrend is an indicator based on the Average True Range (ATR) and is used to track the market trend.
How it Works:
When the market is in an uptrend, the Supertrend line will be green.
When the market is in a downtrend, the Supertrend line will be red.
Visualization:
Uptrend: The Supertrend line will be plotted in green.
Downtrend: The Supertrend line will be plotted in red.
Example:
If the price is above the Supertrend, the market is considered to be in an uptrend, and if the price is below the Supertrend, the market is in a downtrend.
4. Momentum (Rate of Change):
Purpose: Measures the rate at which the price changes over a set period, showing if the momentum is positive or negative.
How it Works:
The Rate of Change (ROC) measures how much the price has changed over a certain number of periods (e.g., 14).
Positive ROC indicates upward momentum, and negative ROC indicates downward momentum.
Visualization:
Positive ROC: A purple line is plotted above the zero line.
Negative ROC: A purple line is plotted below the zero line.
Example:
If the ROC line is above zero, it means the price is increasing, suggesting bullish momentum. If the ROC is below zero, it indicates bearish momentum.
5. Volume:
Purpose: Displays the volume of traded assets, giving insight into the strength of price movements.
How it Works:
The script will color the volume bars based on whether the price closed higher or lower than the previous bar.
Green bars indicate bullish volume (closing price higher than the previous bar), and red bars indicate bearish volume (closing price lower than the previous bar).
Visualization:
Bullish Volume: Green volume bars when the price closes higher.
Bearish Volume: Red volume bars when the price closes lower.
Example:
If you see a green volume bar, it suggests that the market is participating in an uptrend, and the price has closed higher than the previous period. Red bars indicate a downtrend or selling pressure.
6. MACD (Moving Average Convergence Divergence):
Purpose: The MACD is a trend-following momentum indicator that shows the relationship between two moving averages of the price.
How it Works:
The MACD Line is the difference between the 12-period EMA (Exponential Moving Average) and the 26-period EMA.
The Signal Line is the 9-period EMA of the MACD Line.
The MACD Histogram shows the difference between the MACD line and the Signal line.
Visualization:
MACD Line: A blue line representing the difference between the 12-period and 26-period EMAs.
Signal Line: An orange line representing the 9-period EMA of the MACD line.
MACD Histogram: A red or green histogram that shows the difference between the MACD line and the Signal line.
Example:
When the MACD line crosses above the Signal line, it’s considered a bullish signal. When the MACD line crosses below the Signal line, it’s considered a bearish signal.
Full Chart Example:
Imagine you're looking at a price chart with all the indicators:
Pivot High/Low Lines are drawn as red and green horizontal lines.
20-day and 50-day SMAs are plotted as blue and orange lines, respectively.
Supertrend shows a green or red line indicating the trend.
Momentum (ROC) is shown as a purple line oscillating around zero.
Volume bars are green or red based on whether the close is higher or lower.
MACD appears as a blue line and orange line, with a red or green histogram showing the MACD vs. Signal line difference.
How the Indicators Work Together:
Trend Confirmation: If the price is above the Supertrend line and both SMAs are trending up, it indicates a strong bullish trend.
Momentum: If the ROC is positive and the MACD line is above the Signal line, it further confirms bullish momentum.
Volume: Increasing volume, especially with green bars, suggests that the trend is being supported by active participation.
By using these combined indicators, you can get a comprehensive view of the market's trend, momentum, and potential reversal points (via pivot highs and lows).
Savitzky-Golay Z-Score [BackQuant]Savitzky-Golay Z-Score
The Savitzky-Golay Z-Score is a powerful trading indicator that combines the precision of the Savitzky-Golay filter with the statistical strength of the Z-Score. This advanced indicator is designed to detect trend shifts, identify overbought or oversold conditions, and highlight potential divergences in the market, providing traders with a unique edge in detecting momentum changes and trend reversals.
Core Concept: Savitzky-Golay Filter
The Savitzky-Golay filter is a widely-used smoothing technique that preserves important signal features such as peak detection while filtering out noise. In this indicator, the filter is applied to price data (default set to HLC3) to smooth out volatility and produce a cleaner trend line. By specifying the window size and polynomial degree, traders can fine-tune the degree of smoothing to match their preferred trading style or market conditions.
Z-Score: Measuring Deviation
The Z-Score is a statistical measure that indicates how far the current price is from its mean in terms of standard deviations. In trading, the Z-Score can be used to identify extreme price moves that are likely to revert or continue trending. A positive Z-Score means the price is above the mean, while a negative Z-Score indicates the price is below the mean.
This script calculates the Z-Score based on the Savitzky-Golay filtered price, enabling traders to detect moments when the price is diverging from its typical range and may present an opportunity for a trade.
Long and Short Conditions
The Savitzky-Golay Z-Score generates clear long and short signals based on the Z-Score value:
Long Signals : When the Z-Score is positive, indicating the price is above its smoothed mean, a long signal is generated. The color of the bars turns green, signaling upward momentum.
Short Signals : When the Z-Score is negative, indicating the price is below its smoothed mean, a short signal is generated. The bars turn red, signaling downward momentum.
These signals allow traders to follow the prevailing trend with confidence, using statistical backing to avoid false signals from short-term volatility.
Standard Deviation Levels and Extreme Levels
This indicator includes several features to help visualize overbought and oversold conditions:
Standard Deviation Levels: The script plots horizontal lines at +1, +2, -1, and -2 standard deviations. These levels provide a reference for how far the current price is from the mean, allowing traders to quickly identify when the price is moving into extreme territory.
Extreme Levels: Additional extreme levels at +3 and +4 (and their negative counterparts) are plotted to highlight areas where the price is highly likely to revert. These extreme levels provide important insight into market conditions that are far outside the norm, signaling caution or potential reversal zones.
The indicator also adapts the color shading of these extreme zones based on the Z-Score’s strength. For example, the area between +3 and +4 is shaded with a stronger color when the Z-Score approaches these values, giving a visual representation of market pressure.
Divergences: Detecting Hidden and Regular Signals
A key feature of the Savitzky-Golay Z-Score is its ability to detect bullish and bearish divergences, both regular and hidden:
Regular Bullish Divergence: This occurs when the price makes a lower low while the Z-Score forms a higher low. It signals that bearish momentum is weakening, and a bullish reversal could be near.
Hidden Bullish Divergence: This divergence occurs when the price makes a higher low while the Z-Score forms a lower low. It signals that bullish momentum may continue after a temporary pullback.
Regular Bearish Divergence: This occurs when the price makes a higher high while the Z-Score forms a lower high, signaling that bullish momentum is weakening and a bearish reversal may be near.
Hidden Bearish Divergence: This divergence occurs when the price makes a lower high while the Z-Score forms a higher high, indicating that bearish momentum may continue after a temporary rally.
These divergences are plotted directly on the chart, making it easier for traders to spot when the price and momentum are out of sync and when a potential reversal may occur.
Customization and Visualization
The Savitzky-Golay Z-Score offers a range of customization options to fit different trading styles:
Window Size and Polynomial Degree: Adjust the window size and polynomial degree of the Savitzky-Golay filter to control how much smoothing is applied to the price data.
Z-Score Lookback Period: Set the lookback period for calculating the Z-Score, allowing traders to fine-tune the sensitivity to short-term or long-term price movements.
Display Options: Choose whether to display standard deviation levels, extreme levels, and divergence labels on the chart.
Bar Color: Color the price bars based on trend direction, with green for bullish trends and red for bearish trends, allowing traders to easily visualize the current momentum.
Divergences: Enable or disable divergence detection, and adjust the lookback periods for pivots used to detect regular and hidden divergences.
Alerts and Automation
To ensure you never miss an important signal, the indicator includes built-in alert conditions for the following events:
Positive Z-Score (Long Signal): Triggers an alert when the Z-Score crosses above zero, indicating a potential buying opportunity.
Negative Z-Score (Short Signal): Triggers an alert when the Z-Score crosses below zero, signaling a potential short opportunity.
Shifting Momentum: Alerts when the Z-Score is shifting up or down, providing early warning of changing market conditions.
These alerts can be configured to notify you via email, SMS, or app notification, allowing you to stay on top of the market without having to constantly monitor the chart.
Trading Applications
The Savitzky-Golay Z-Score is a versatile tool that can be applied across multiple trading strategies:
Trend Following: By smoothing the price and calculating the Z-Score, this indicator helps traders follow the prevailing trend while avoiding false signals from short-term volatility.
Mean Reversion: The Z-Score highlights moments when the price is far from its mean, helping traders identify overbought or oversold conditions and capitalize on potential reversals.
Divergence Trading: Regular and hidden divergences between the Z-Score and price provide early warning of trend reversals, allowing traders to enter trades at opportune moments.
Final Thoughts
The Savitzky-Golay Z-Score is an advanced statistical tool designed to provide a clearer view of market trends and momentum. By applying the Savitzky-Golay filter and Z-Score analysis, this indicator reduces noise and highlights key areas where the market may reverse or accelerate, giving traders a significant edge in understanding price behavior.
Whether you’re a trend follower or a reversal trader, this indicator offers the flexibility and insights you need to navigate complex markets with confidence.