KaracaticaKaracatica Indicator - Dynamic Trend Following.
The Karacatica Indicator is designed for traders looking for a comprehensive approach to trend trading by combining directional movements and Average True Range (ATR).
Key Features: ATR-Based Trend Detection: The indicator uses Average True Range (ATR) to measure market volatility and integrates with price action to capture strong trend movements.
Directional Indicators (DI's): Calculates DI's (Positive Directional Index Di+ and Negative Directional Index Di-) to compare buying and selling pressure. This allows for more accurate trend identification, highlighting when buyers or sellers dominate.
Signal Generation: Buy Signal: Generated when price action is bullish (close is above the previous period's close) and DI+ exceeds DI-, indicating that buyers are in control.
Sell Signal: Triggered when price action is bearish (close is below the previous period’s close) and DI- exceeds DI+, showing that sellers dominate the market.
Visual Signals: Green triangle (▲) indicating a buy opportunity, plotted below the bar.
Fuchsia triangle (▼) signaling a sell opportunity, plotted above the bar.
Customizable Inputs: The indicator allows users to adjust the ATR period, DI length, and ADX smoothing parameters, giving it the flexibility to suit different trading styles and timeframes.
Why should you use it?
This indicator simplifies the process of analyzing the combination market direction and trend strength. It is especially useful for traders who like strong directional movements and want clear, visually represented entry signals. The Karacatica Indicator can generate good buy or sell signals in trading and can be used on multiple assets and timeframes, making it adaptable to different market conditions.
Settings Overview: ATR Period: Sets the period for calculating ATR, used to determine market volatility.
DI Length: The length of the lookback period for DI+ and DI- calculations.
ADX Smoothing: Smooths the ADX (Average Directional Index) to reduce noise.
Feel free to experiment with this indicator, share feedback, and adapt it to your trading strategy. Good trading!
Indicators and strategies
Statistical ArbitrageThe Statistical Arbitrage Strategy, also known as pairs trading, is a quantitative trading method that capitalizes on price discrepancies between two correlated assets. The strategy assumes that over time, the prices of these two assets will revert to their historical relationship. The core idea is to take advantage of mean reversion, a principle suggesting that asset prices will revert to their long-term average after deviating significantly.
Strategy Mechanics:
1. Selection of Correlated Assets:
• The strategy focuses on two historically correlated assets (e.g., equity index futures like Dow Jones Mini and S&P 500 Mini). These assets tend to move in the same direction due to similar underlying fundamentals, such as overall market conditions. By tracking their relative prices, the strategy seeks to exploit temporary mispricings.
2. Spread Calculation:
• The spread is the difference between the prices of the two assets. This spread represents the relationship between the assets and serves as the basis for determining when to enter or exit trades.
3. Mean and Standard Deviation:
• The historical average (mean) of the spread is calculated using a Simple Moving Average (SMA) over a chosen period. The strategy also computes the standard deviation (volatility) of the spread, which measures how far the spread has deviated from the mean over time. This allows the strategy to define statistically significant price deviations.
4. Entry Signal (Mean Reversion):
• A buy signal is triggered when the spread falls below the mean by a multiple (e.g., two) of the standard deviation. This indicates that one asset is temporarily undervalued relative to the other, and the strategy expects the spread to revert to its mean, generating profits as the prices converge.
5. Exit Signal:
• The strategy exits the trade when the spread reverts to the mean. At this point, the mispricing has been corrected, and the profit from the mean reversion is realized.
Academic Support:
Statistical arbitrage has been widely studied in finance and economics. Gatev, Goetzmann, and Rouwenhorst’s (2006) landmark study on pairs trading demonstrated that this strategy could generate excess returns in equity markets. Their research found that by focusing on historically correlated stocks, traders could identify pricing anomalies and profit from their eventual correction.
Additionally, Avellaneda and Lee (2010) explored statistical arbitrage in different asset classes and found that exploiting deviations in price relationships can offer a robust, market-neutral trading strategy. In these studies, the strategy’s success hinges on the stability of the relationship between the assets and the timely execution of trades when deviations occur.
Risks of Statistical Arbitrage:
1. Correlation Breakdown:
• One of the primary risks is the breakdown of correlation between the two assets. Statistical arbitrage assumes that the historical relationship between the assets will hold in the future. However, market conditions, company fundamentals, or external shocks (e.g., macroeconomic changes) can cause these assets to deviate permanently, leading to potential losses.
• For instance, if two equity indices historically move together but experience divergent economic conditions or policy changes, their prices may no longer revert to the expected mean.
2. Execution Risk:
• This strategy relies on efficient execution and tight spreads. In volatile or illiquid markets, the actual price at which trades are executed may differ significantly from expected prices, leading to slippage and reduced profits.
3. Market Risk:
• Although statistical arbitrage is designed to be market-neutral (i.e., not dependent on the overall market direction), it is not entirely risk-free. Systematic market shocks, such as financial crises or sudden shifts in market sentiment, can affect both assets simultaneously, causing the spread to widen rather than revert to the mean.
4. Model Risk:
• The assumptions underlying the strategy, particularly regarding mean reversion, may not always hold true. The model assumes that asset prices will return to their historical averages within a certain timeframe, but the timing and magnitude of mean reversion can be uncertain. Misestimating this timeframe can lead to extended drawdowns or unrealized losses.
5. Overfitting:
• Over-reliance on historical data to fine-tune the strategy parameters (e.g., the lookback period or standard deviation thresholds) may result in overfitting. This means that the strategy works well on past data but fails to perform in live markets due to changing conditions.
Conclusion:
The Statistical Arbitrage Strategy offers a systematic and quantitative approach to trading that capitalizes on temporary price inefficiencies between correlated assets. It has been proven to generate returns in academic studies and is widely used by hedge funds and institutional traders for its market-neutral characteristics. However, traders must be aware of the inherent risks, including correlation breakdown, execution risks, and the potential for prolonged deviations from the mean. Effective risk management, diversification, and constant monitoring are essential for successfully implementing this strategy in live markets.
$TUBR: 7-25-99 Moving Average7, 25, and 99 Period Moving Averages
This indicator plots three moving averages: the 7-period, 25-period, and 99-period Simple Moving Averages (SMA). These moving averages are widely used to smooth out price action and help traders identify trends over different time frames. Let's break down the significance of these specific moving averages from both supply and demand perspectives and a price action perspective.
1. Supply and Demand Perspective:
- 7-period Moving Average (Short-Term) :
The 7-period moving average represents the short-term sentiment in the market. It captures the rapid fluctuations in price and is heavily influenced by recent supply and demand changes. Traders often look to the 7-period SMA for immediate price momentum, with price moving above or below this line signaling short-term strength or weakness.
- Bullish Supply/Demand : When price is above the 7-period SMA, it suggests that buyers are currently in control and demand is higher than supply. Conversely, price falling below this line indicates that supply is overpowering demand, leading to a short-term downtrend.
Is current price > average price in past 7 candles (depending on timeframe)? This will tell you how aggressive buyers are in short term.
- Key Supply/Demand Zones : The 7-period SMA often acts as dynamic support or resistance in a trending market, where traders might use it to enter or exit positions based on how price interacts with this level.
- 25-period Moving Average (Medium-Term) :
The 25-period SMA smooths out more of the noise compared to the 7-period, providing a more stable indication of intermediate trends. This moving average is often used to gauge the market's supply and demand balance over a broader timeframe than the short-term 7-period SMA.
- Supply/Demand Balance : The 25-period SMA reflects the medium-term equilibrium between supply and demand. A crossover between the price and the 25-period SMA may indicate a shift in this balance. When price sustains above the 25-period SMA, it shows that demand is strong enough to maintain an upward trend. Conversely, if the price stays below it, supply is likely exceeding demand.
Is current price > average price in past 25 candles (depending on timeframe)? This will tell you how aggressive buyers are in mid term.
- Momentum Shift : Crossovers between the 7-period and 25-period SMAs can indicate momentum shifts between short-term and medium-term demand. For example, if the 7-period crosses above the 25-period, it often signifies growing short-term demand relative to the medium-term trend, signaling potential buy opportunities. What this crossover means is that if 7MA > 25MA that means in past 7 candles average price is more than past 25 candles.
- 99-period Moving Average (Long-Term):
The 99-period SMA represents the long-term trend and reflects the market's supply and demand over an extended period. This moving average filters out short-term fluctuations and highlights the market's overall trajectory.
- Long-Term Supply/Demand Dynamics : The 99-period SMA is slower to react to changes in supply and demand, providing a more stable view of the market's overall trend. Price staying above this line shows sustained demand dominance, while price consistently staying below reflects ongoing supply pressure.
Is current price > average price in past 99 candles (depending on timeframe)? This will tell you how aggressive buyers are in long term.
- Market Trend Confirmation : When both the 7-period and 25-period SMAs are above the 99-period SMA, it signals a strong bullish trend with demand outweighing supply across all timeframes. If all three SMAs are below the 99-period SMA, it points to a bear market where supply is overpowering demand in both the short and long term.
2. Price Action Perspective :
- 7-period Moving Average (Short-Term Trends):
The 7-period moving average closely tracks price action, making it highly responsive to quick shifts in price. Traders often use it to confirm short-term reversals or continuations in price action. In an uptrend, price typically stays above the 7-period SMA, whereas in a downtrend, price stays below it.
- Short-Term Price Reversals : Crossovers between the price and the 7-period SMA often indicate short-term reversals. When price breaks above the 7-period SMA after staying below it, it suggests a potential bullish reversal. Conversely, a price breakdown below the 7-period SMA could signal a bearish reversal.
- 25-period Moving Average (Medium-Term Trends) :
The 25-period SMA helps identify the medium-term price action trend. It balances short-term volatility and longer-term stability, providing insight into the more persistent trend. Price pullbacks to the 25-period SMA during an uptrend can act as a buying opportunity for trend traders, while pullbacks during a downtrend may offer shorting opportunities.
- Pullback and Continuation: In trending markets, price often retraces to the 25-period SMA before continuing in the direction of the trend. For instance, if the price is in a bullish trend, traders may look for support at the 25-period SMA for potential continuation trades.
- 99-period Moving Average (Long-Term Trend and Market Sentiment ):
The 99-period SMA is the most critical for identifying the overall market trend. Price consistently trading above the 99-period SMA indicates long-term bullish momentum, while price staying below the 99-period SMA suggests bearish sentiment.
- Trend Confirmation : Price action above the 99-period SMA confirms long-term upward momentum, while price action below it confirms a downtrend. The space between the shorter moving averages (7 and 25) and the 99-period SMA gives a sense of the strength or weakness of the trend. Larger gaps between the 7 and 99 SMAs suggest strong bullish momentum, while close proximity indicates consolidation or potential reversals.
- Price Action in Trending Markets : Traders often use the 99-period SMA as a dynamic support/resistance level. In strong trends, price tends to stay on one side of the 99-period SMA for extended periods, with breaks above or below signaling major changes in market sentiment.
Why These Numbers Matter:
7-Period MA : The 7-period moving average is a popular choice among short-term traders who want to capture quick momentum changes. It helps visualize immediate market sentiment and is often used in conjunction with price action to time entries or exits.
- 25-Period MA: The 25-period MA is a key indicator for swing traders. It balances sensitivity and stability, providing a clearer picture of the intermediate trend. It helps traders stay in trades longer by filtering out short-term noise, while still being reactive enough to detect reversals.
- 99-Period MA : The 99-period moving average provides a broad view of the market's direction, filtering out much of the short- and medium-term noise. It is crucial for identifying long-term trends and assessing whether the market is bullish or bearish overall. It acts as a key reference point for longer-term trend followers, helping them stay with the broader market sentiment.
Conclusion:
From a supply and demand perspective, the 7, 25, and 99-period moving averages help traders visualize shifts in the balance between buyers and sellers over different time horizons. The price action interaction with these moving averages provides valuable insight into short-term momentum, intermediate trends, and long-term market sentiment. Using these three MAs together gives a more comprehensive understanding of market conditions, helping traders align their strategies with prevailing trends across various timeframes.
------------- RULE BASED SYSTEM ---------------
Overview of the Rule-Based System:
This system will use the following moving averages:
7-period MA: Represents short-term price action.
25-period MA: Represents medium-term price action.
99-period MA: Represents long-term price action.
1. Trend Identification Rules:
Bullish Trend:
The 7-period MA is above the 25-period MA, and the 25-period MA is above the 99-period MA.
This structure shows that short, medium, and long-term trends are aligned in an upward direction, indicating strong bullish momentum.
Bearish Trend:
The 7-period MA is below the 25-period MA, and the 25-period MA is below the 99-period MA.
This suggests that the market is in a downtrend, with bearish momentum dominating across timeframes.
Neutral/Consolidation:
The 7-period MA and 25-period MA are flat or crossing frequently with the 99-period MA, and they are close to each other.
This indicates a sideways or consolidating market where there’s no strong trend direction.
2. Entry Rules:
Bullish Entry (Buy Signals):
Primary Buy Signal:
The price crosses above the 7-period MA, AND the 7-period MA is above the 25-period MA, AND the 25-period MA is above the 99-period MA.
This indicates the start of a new upward trend, with alignment across the short, medium, and long-term trends.
Pullback Buy Signal (for trend continuation):
The price pulls back to the 25-period MA, and the 7-period MA remains above the 25-period MA.
This indica
tes that the pullback is a temporary correction in an uptrend, and buyers may re-enter the market as price approaches the 25-period MA.
You can further confirm the signal by waiting for price action (e.g., bullish candlestick patterns) at the 25-period MA level.
Breakout Buy Signal:
The price crosses above the 99-period MA, and the 7-period and 25-period MAs are also both above the 99-period MA.
This confirms a strong bullish breakout after consolidation or a long-term downtrend.
Bearish Entry (Sell Signals):
Primary Sell Signal:
The price crosses below the 7-period MA, AND the 7-period MA is below the 25-period MA, AND the 25-period MA is below the 99-period MA.
This indicates the start of a new downtrend with alignment across the short, medium, and long-term trends.
Pullback Sell Signal (for trend continuation):
The price pulls back to the 25-period MA, and the 7-period MA remains below the 25-period MA.
This indicates that the pullback is a temporary retracement in a downtrend, providing an opportunity to sell as price meets resistance at the 25-period MA.
Breakdown Sell Signal:
The price breaks below the 99-period MA, and the 7-period and 25-period MAs are also below the 99-period MA.
This confirms a strong bearish breakdown after consolidation or a long-term uptrend reversal.
3. Exit Rules:
Bullish Exit (for long positions):
Short-Term Exit:
The price closes below the 7-period MA, and the 7-period MA starts crossing below the 25-period MA.
This indicates weakening momentum in the uptrend, suggesting an exit from the long position.
Stop-Loss Trigger:
The price falls below the 99-period MA, signaling the breakdown of the long-term trend.
This can act as a final exit signal to minimize losses if the long-term uptrend is invalidated.
Bearish Exit (for short positions):
Short-Term Exit:
The price closes above the 7-period MA, and the 7-period MA starts crossing above the 25-period MA.
This indicates a potential weakening of the downtrend and signals an exit from the short position.
Stop-Loss Trigger:
The price breaks above the 99-period MA, invalidating the bearish trend.
This signals that the market may be reversing to the upside, and exiting short positions would be prudent.
Swing Breakout Sequence [LuxAlgo]The Swing Breakout Sequence tool enables traders to identify a directional price action scalping sequence comprising two unsuccessful breakouts in the same direction, with the expectation of a third.
🔶 USAGE
This sequence looks for pressure on one side of a swing zone.
The market tried to break out of the zone twice but failed. This led to a pullback into the zone after each attempt. Once a reversal inside the zone is identified, the sequence is complete. It is expected that the market will move from the final reversal within the zone to the final breakout attempt outside the zone.
The sequence of price action is as follows:
Point 1: Breakout attempt out of the swing zone
Point 2: Pullback into the zone
Point 3: Breakout attempt out of Point 1
Point 4: Pullback into the zone, tapping into Point 2 liquidity
Point 5: Reversal structure with Point 4 in the form of a double top or double bottom
This sequence assumes traders will be caught off-guard when they try to capitalize on the initial breakout at Point 1, which is likely to result in a loss. If the breakout at Point 3 fails, all traders will be caught out and switch positions.
If there is enough pressure in the swing zone to cause a reversal at Point 5, the trapped traders could be the start of the next breakout attempt.
🔹 Sequence Detection
Traders can define sequence behavior and adjust detection with three parameters from the Settings panel.
Disabling Points 4 and 5 will detect the most uncompleted sequences.
🔹 Showing/Hiding Elements
Traders can change the look of sequences by showing or hiding their parts using the Style settings.
🔶 SETTINGS
Swing Length: Number of candles to confirm a swing high or swing low. A higher number detects larger swings.
Internal Length: Number of candles to confirm a internal high or internal low. A lower number detects smaller swings. It must be the same size or smaller than the swing length.
🔹 Detection
Point 4 Beyond Point 2: It only detects sequences where Point 4 is beyond Point 2.
Show Point 5: Enable/disable Point 5 detection.
Require Equal H/L at Point 5: Enable/Disable double top/bottom detection at Point 5 within a given threshold. A bigger value detects more sequences.
🔹 Style
Show Sequence Path: Enable/disable a line between sequence points.
Show Boxes: Enable/disable colored boxes for each sequence.
Show Lines: Enable/disable horizontal lines from each point of the sequence.
Default Color: Define the color or enable/disable auto color.
Value at Risk [OmegaTools]The "Value at Risk" (VaR) indicator is a powerful financial risk management tool that helps traders estimate the potential losses in a portfolio over a specified period of time, given a certain level of confidence. VaR is widely used by financial institutions, traders, and risk managers to assess the probability of portfolio losses in both normal and volatile market conditions. This TradingView script implements a comprehensive VaR calculation using several models, allowing users to visualize different risk scenarios and adjust their trading strategies accordingly.
Concept of Value at Risk
Value at Risk (VaR) is a statistical technique used to measure the likelihood of losses in a portfolio or financial asset due to market risks. In essence, it answers the question: "What is the maximum potential loss that could occur in a given portfolio over a specific time horizon, with a certain confidence level?" For instance, if a portfolio has a one-day 95% VaR of $10,000, it means that there is a 95% chance the portfolio will not lose more than $10,000 in a single day. Conversely, there is a 5% chance of losing more than $10,000. VaR is a key risk management tool for portfolio managers and traders because it quantifies potential losses in monetary terms, allowing for better-informed decision-making.
There are several ways to calculate VaR, and this indicator script incorporates three of the most commonly used models:
Historical VaR: This approach uses historical returns to estimate potential losses. It is based purely on past price data, assuming that the past distribution of returns is indicative of future risks.
Variance-Covariance VaR: This model assumes that asset returns follow a normal distribution and that the risk can be summarized using the mean and standard deviation of past returns. It is a parametric method that is widely used in financial risk management.
Exponentially Weighted Moving Average (EWMA) VaR: In this model, recent data points are given more weight than older data. This dynamic approach allows the VaR estimation to react more quickly to changes in market volatility, which is particularly useful during periods of market stress. This model uses the Exponential Weighted Moving Average Volatility Model.
How the Script Works
The script starts by offering users a set of customizable input settings. The first input allows the user to choose between two main calculation modes: "All" or "OCT" (Only Current Timeframe). In the "All" mode, the script calculates VaR using all available methodologies—Historical, Variance-Covariance, and EWMA—providing a comprehensive risk overview. The "OCT" mode narrows the calculation to the current timeframe, which can be particularly useful for intraday traders who need a more focused view of risk.
The next input is the lookback window, which defines the number of historical periods used to calculate VaR. Commonly used lookback periods include 21 days (approximately one month), 63 days (about three months), and 252 days (roughly one year), with the script supporting up to 504 days for more extended historical analysis. A longer lookback period provides a more comprehensive picture of risk but may be less responsive to recent market conditions.
The confidence level is another important setting in the script. This represents the probability that the loss will not exceed the VaR estimate. Standard confidence levels are 90%, 95%, and 99%. A higher confidence level results in a more conservative risk estimate, meaning that the calculated VaR will reflect a more extreme loss scenario.
In addition to these core settings, the script allows users to customize the visual appearance of the indicator. For example, traders can choose different colors for "Bullish" (Risk On), "Bearish" (Risk Off), and "Neutral" phases, as well as colors for highlighting "Breaks" in the data, where returns exceed the calculated VaR. These visual cues make it easy to identify periods of heightened risk at a glance.
The actual VaR calculation is broken down into several models, starting with the Historical VaR calculation. This is done by computing the logarithmic returns of the asset's closing prices and then using linear interpolation to determine the percentile corresponding to the desired confidence level. This percentile represents the potential loss in the asset over the lookback period.
Next, the script calculates Variance-Covariance VaR using the mean and standard deviation of the historical returns. The standard deviation is multiplied by a z-score corresponding to the chosen confidence level (e.g., 1.645 for 95% confidence), and the resulting value is subtracted from the mean return to arrive at the VaR estimate.
The EWMA VaR model uses the EWMA for the sigma parameter, the standard deviation, obtaining a specific dynamic in the volatility. It is particularly useful in volatile markets where recent price behavior is more indicative of future risk than older data.
For traders interested in intraday risk management, the script provides several methods to adjust VaR calculations for lower timeframes. By using intraday returns and scaling them according to the chosen timeframe, the script provides a dynamic view of risk throughout the trading day. This is especially important for short-term traders who need to manage their exposure during high-volatility periods within the same day. The script also incorporates an EWMA model for intraday data, which gives greater weight to the most recent intraday price movements.
In addition to calculating VaR, the script also attempts to detect periods where the asset's returns exceed the estimated VaR threshold, referred to as "Breaks." When the returns breach the VaR limit, the script highlights these instances on the chart, allowing traders to quickly identify periods of extreme risk. The script also calculates the average of these breaks and displays it for comparison, helping traders understand how frequently these high-risk periods occur.
The script further visualizes the risk scenario using a risk phase classification system. Depending on the level of risk, the script categorizes the market as either "Risk On," "Risk Off," or "Risk Neutral." In "Risk On" mode, the market is considered bullish, and the indicator displays a green background. In "Risk Off" mode, the market is bearish, and the background turns red. If the market is neither strongly bullish nor bearish, the background turns neutral, signaling a balanced risk environment.
Traders can customize whether they want to see this risk phase background, along with toggling the display of the various VaR models, the intraday methods, and the break signals. This flexibility allows traders to tailor the indicator to their specific needs, whether they are day traders looking for quick intraday insights or longer-term investors focused on historical risk analysis.
The "Risk On" and "Risk Off" phases calculated by this Value at Risk (VaR) script introduce a novel approach to market risk assessment, offering traders an advanced toolset to gauge market sentiment and potential risk levels dynamically. These risk phases are built on a combination of traditional VaR methodologies and proprietary logic to create a more responsive and intuitive way to manage exposure in both normal and volatile market conditions. This method of classifying market conditions into "Risk On," "Risk Off," or "Risk Neutral" is not something that has been traditionally associated with VaR, making it a groundbreaking addition to this indicator.
How the "Risk On" and "Risk Off" Phases Are Calculated
In typical VaR implementations, the focus is on calculating the potential losses at a given confidence level without providing an overall market outlook. This script, however, introduces a unique risk classification system that takes the output of various VaR models and translates it into actionable signals for traders, marking whether the market is in a Risk On, Risk Off, or Risk Neutral phase.
The Risk On and Risk Off phases are primarily determined by comparing the current returns of the asset to the average VaR calculated across several different methods, including Historical VaR, Variance-Covariance VaR, and EWMA VaR. Here's how the process works:
1. Threshold Setting and Effect Calculation: The script first computes the average VaR using the selected models. It then checks whether the current returns (expressed as a negative value to signify loss) exceed the average VaR value. If the current returns surpass the calculated VaR threshold, this indicates that the actual market risk is higher than expected, signaling a potential shift in market conditions.
2. Break Analysis: In addition to monitoring whether returns exceed the average VaR, the script counts the number of instances within the lookback period where this breach occurs. This is referred to as the "break effect." For each period in the lookback window, the script checks whether the returns surpass the calculated VaR threshold and increments a counter. The percentage of periods where this breach occurs is then calculated as the "effect" or break percentage.
3. Dual Effect Check (if "Double" Risk Scenario is selected): When the user chooses the "Double" risk scenario mode, the script performs two layers of analysis. First, it calculates the effect of returns exceeding the VaR threshold for the current timeframe. Then, it calculates the effect for the lower intraday timeframe as well. Both effects are compared to the user-defined confidence level (e.g., 95%). If both effects exceed the confidence level, the market is deemed to be in a high-risk situation, thus triggering a Risk Off phase. If both effects fall below the confidence level, the market is classified as Risk On.
4. Risk Phases Determination: The final risk phase is determined by analyzing these effects in relation to the confidence level:
- Risk On: If the calculated effect of breaks is lower than the confidence level (e.g., fewer than 5% of periods show returns exceeding the VaR threshold for a 95% confidence level), the market is considered to be in a relatively safe state, and the script signals a "Risk On" phase. This is indicative of bullish conditions where the potential for extreme loss is minimal.
- Risk Off: If the break effect exceeds the confidence level (e.g., more than 5% of periods show returns breaching the VaR threshold), the market is deemed to be in a high-risk state, and the script signals a "Risk Off" phase. This indicates bearish market conditions where the likelihood of significant losses is higher.
- Risk Neutral: If the break effect hovers near the confidence level or if there is no clear trend indicating a shift toward either extreme, the market is classified as "Risk Neutral." In this phase, neither bulls nor bears are dominant, and traders should remain cautious.
The phase color that the script uses helps visualize these risk phases. The background will turn green in Risk On conditions, red in Risk Off conditions, and gray in Risk Neutral phases, providing immediate visual feedback on market risk. In addition to this, when the "Double" risk scenario is selected, the background will only turn green or red if both the current and intraday timeframes confirm the respective risk phase. This double-checking process ensures that traders are only given a strong signal when both longer-term and short-term risks align, reducing the likelihood of false signals.
A New Way of Using Value at Risk
This innovative Risk On/Risk Off classification, based on the interaction between VaR thresholds and market returns, represents a significant departure from the traditional use of Value at Risk as a pure risk measurement tool. Typically, VaR is employed as a backward-looking measure of risk, providing a static estimate of potential losses over a given timeframe with no immediate actionable feedback on current market conditions. This script, however, dynamically interprets VaR results to create a forward-looking, real-time signal that informs traders whether they are operating in a favorable (Risk On) or unfavorable (Risk Off) environment.
By incorporating the "break effect" analysis and allowing users to view the VaR breaches as a percentage of past occurrences, the script adds a predictive element that can be used to time market entries and exits more effectively. This **dual-layer risk analysis**, particularly when using the "Double" scenario mode, adds further granularity by considering both current timeframe and intraday risks. Traders can therefore make more informed decisions not just based on historical risk data, but on how the market is behaving in real-time relative to those risk benchmarks.
This approach transforms the VaR indicator from a risk monitoring tool into a decision-making system that helps identify favorable trading opportunities while alerting users to potential market downturns. It provides a more holistic view of market conditions by combining both statistical risk measurement and intuitive phase-based market analysis. This level of integration between VaR methodologies and real-time signal generation has not been widely seen in the world of trading indicators, marking this script as a cutting-edge tool for risk management and market sentiment analysis.
I would like to express my sincere gratitude to @skewedzeta for his invaluable contribution to the final script. From generating fresh ideas to applying his expertise in reviewing the formula, his support has been instrumental in refining the outcome.
RSI from Rolling VWAP [CHE]Introducing the RSI from Rolling VWAP Indicator
Elevate your trading strategy with the RSI from Rolling VWAP —a cutting-edge indicator designed to provide unparalleled insights and enhance your decision-making on TradingView. This advanced tool seamlessly integrates the Relative Strength Index (RSI) with a Rolling Volume-Weighted Average Price (VWAP) to deliver precise and actionable trading signals.
Why Choose RSI from Rolling VWAP ?
- Clear Trend Detection: Our enhanced algorithms ensure accurate identification of bullish and bearish trends, allowing you to capitalize on market movements with confidence.
- Customizable Time Settings: Tailor the time window in days, hours, and minutes to align perfectly with your unique trading strategy and market conditions.
- Flexible Moving Averages: Select from a variety of moving average types—including SMA, EMA, WMA, and more—to smooth the RSI, providing clearer trend analysis and reducing market noise.
- Threshold Alerts: Define upper and lower RSI thresholds to effortlessly spot overbought or oversold conditions, enabling timely and informed trading decisions.
- Visual Enhancements: Enjoy a visually intuitive interface with color-coded RSI lines, moving averages, and background fills that make interpreting market data straightforward and efficient.
- Automatic Signal Labels: Receive immediate bullish and bearish labels directly on your chart, signaling potential trading opportunities without the need for constant monitoring.
Key Features
- Inspired by Proven Tools: Building upon the robust foundation of TradingView's Rolling VWAP, our indicator offers enhanced functionality and greater precision.
- Volume-Weighted Insights: By incorporating volume into the VWAP calculation, gain a deeper understanding of price movements and market strength.
- User-Friendly Configuration: Easily adjust settings to match your trading preferences, whether you're a novice trader or an experienced professional.
- Hypothesis-Driven Analysis: Utilize hypothetical results to backtest strategies, understanding that past performance does not guarantee future outcomes.
How It Works
1. Data Integration: Utilizes the `hlc3` (average of high, low, and close) as the default data source, with customization options available to suit your trading needs.
2. Dynamic Time Window: Automatically calculates the optimal time window based on an auto timeframe or allows for fixed time periods, ensuring flexibility and adaptability.
3. Rolling VWAP Calculation: Accurately computes the Rolling VWAP by balancing price and volume over the specified time window, providing a reliable benchmark for price action.
4. RSI Analysis: Measures momentum through RSI based on Rolling VWAP changes, smoothed with your chosen moving average for enhanced trend clarity.
5. Actionable Signals: Detects and labels bullish and bearish conditions when RSI crosses predefined thresholds, offering clear indicators for potential market entries and exits.
Seamless Integration with Your TradingView Experience
Adding the RSI from Rolling VWAP to your TradingView charts is straightforward:
1. Add to Chart: Simply copy the Pine Script code into TradingView's Pine Editor and apply it to your desired chart.
2. Customize Settings: Adjust the Source Settings, Time Settings, RSI Settings, MA Settings, and Color Settings to align with your trading strategy.
3. Monitor Signals: Watch for RSI crossings above or below your set thresholds, accompanied by clear labels indicating bullish or bearish trends.
4. Optimize Your Trades: Leverage the visual and analytical strengths of the indicator to make informed buy or sell decisions, maximizing your trading potential.
Disclaimer:
The content provided, including all code and materials, is strictly for educational and informational purposes only. It is not intended as, and should not be interpreted as, financial advice, a recommendation to buy or sell any financial instrument, or an offer of any financial product or service. All strategies, tools, and examples discussed are provided for illustrative purposes to demonstrate coding techniques and the functionality of Pine Script within a trading context.
Any results from strategies or tools provided are hypothetical, and past performance is not indicative of future results. Trading and investing involve high risk, including the potential loss of principal, and may not be suitable for all individuals. Before making any trading decisions, please consult with a qualified financial professional to understand the risks involved.
By using this script, you acknowledge and agree that any trading decisions are made solely at your discretion and risk.
Get Started Today
Transform your trading approach with the RSI from Rolling VWAP indicator. Experience the synergy of momentum and volume-based analysis, and unlock the potential for more accurate and profitable trades.
Download now and take the first step towards a more informed and strategic trading journey!
For further inquiries or support, feel free to contact
Best regards
Chervolino
Inspired by the acclaimed Rolling VWAP by TradingView
Z-Scored Moving Average Suite [KFB Quant]Z-Scored Moving Average Suite
This indicator combines several types of moving averages—Simple, Exponential, and Weighted—with a Z-Score calculation to give a clearer understanding of price trends in relation to their historical averages. It is used to detect overbought (OB) and oversold (OS) conditions, allowing you to see when an asset is deviating significantly from its mean.
Key Components:
Moving Averages: The suite includes Simple (SMA), Exponential (EMA), and Weighted (WMA) Moving Averages. For each, a single, double, and triple version is calculated to smooth out noise.
Z-Score: The Z-Score measures how far the current price is from its moving average in terms of standard deviations, helping to highlight unusual price behavior.
Overbought and Oversold Levels:
- When the Z-Score crosses above a predefined threshold (1.5 by default), the asset is considered Overbought (OB).
- When the Z-Score drops below a certain level (-1.5 by default), the asset is seen as Oversold (OS).
Visualization:
- The histogram represents the average Z-Score of all the moving averages combined, colored based on bullish (blue) or bearish (brown) trends.
- Individual Z-Scores for each moving average type (SMA, EMA, WMA) are also plotted, providing further insight into the momentum and direction.
Signals:
- The table in the chart shows a summary of Z-Scores for each type of moving average. It also provides a quick glance at whether the asset is in a bullish or bearish phase, if the Z-Scores are rising or falling, and whether the asset is overbought or oversold.
This tool is highly customizable, with adjustable lengths for the moving averages and Z-Scores, making it a flexible addition to any trading strategy that relies on mean-reversion or trend analysis.
Disclaimer: This tool is provided for informational and educational purposes only and should not be considered as financial advice. Always conduct your own research and consult with a licensed financial advisor before making any investment decisions.
OBV based on MADescription:
This indicator calculates On-Balance Volume (OBV) based on the direction of a Simple Moving Average (SMA). Instead of using price movements, this OBV adds or subtracts volume depending on whether the SMA is rising or falling.
SMA-based OBV: When the SMA rises, the volume is added to the OBV. When the SMA falls, the volume is subtracted from the OBV. This allows traders to observe cumulative volume in relation to the wave patterns created by the SMA.
SMA Period: The period of the SMA can be customized, allowing traders to adjust it according to the wave size they want to observe.
While the cumulative volume indicator already exists, traders who analyze volume patterns can use this indicator to more easily conduct volume analysis across different wave sizes.
Inputs:
SMA Period: Defines the lookback period for calculating the Simple Moving Average (default is 25).
Ideal for:
Traders who want to analyze volume flow relative to moving average trends, rather than price movements. This can help identify underlying strength or weakness in market trends.
説明:
このインジケーターは、単純移動平均(SMA)の方向に基づいてオンバランス・ボリューム(OBV)を計算します。価格の動きではなく、SMAが上昇しているときは出来高を加算し、SMAが下降しているときは出来高を減算します。
SMA基準のOBV: SMAが上昇している場合はOBVに出来高が加算され、SMAが下降している場合は出来高が減算されます。これにより、SMAが作る波形に即した累積出来高を観察することができます。
SMA期間: トレーダーが見たい波のサイズ感に応じて、SMAの期間をカスタマイズできます。
既に累積出来高(Cumulative Volume)というインジケーターは存在しますが、波形を基に出来高を分析しているトレーダーは、このインジケーターを使うことで、様々なサイズの波形に即した出来高分析をより簡単に行うことができます。
入力項目:
SMA期間: 単純移動平均の計算に使用される期間を定義します(デフォルトは25)。
適しているトレーダー:
より波形に即した累積出来高分析を重視するトレーダーに最適です。
MB - Currency Strength ROCCurrency Strength ROC Enhanced is a technical indicator designed to measure and visualize the relative strength of different currencies in the foreign exchange market. Using a Rate of Change (ROC) approach and moving averages, this indicator provides valuable insights into the dynamics of currency strengths.
Key Features:
Relative Strength Measurement:
Calculates the strength of each currency relative to others, allowing you to identify which currencies are appreciating or depreciating.
Strength Histogram:
Presents normalized strength in a histogram format, making it easy to quickly see areas of positive (green) and negative (red) strength
Moving Averages:
Includes moving averages of normalized strength and trend, providing a clear view of the overall direction of strength over time.
Overbought and Oversold Zones:
Highlights critical levels of strength through horizontal lines, allowing traders to identify potential trend reversals.
Volume Trend Swing Points | viResearchVolume Trend Swing Points | viResearch
Conceptual Foundation and Innovation
The "Volume Trend Swing Points" script is designed to identify pivotal swing points in market trends by leveraging the Price Volume Trend (PVT) indicator. This unique approach combines price and volume movements to highlight moments when a market may experience a significant trend reversal. By detecting the highest and lowest points of the PVT over customizable periods, this script aims to provide traders with valuable insights into potential bullish or bearish market behavior.
The simplicity of the script, combined with its use of the PVT, offers an effective way for traders to anticipate key market swings based on both price and volume momentum.
Technical Composition and Calculation
The core of the "Volume Trend Swing Points" script is built around the Price Volume Trend (PVT) indicator, which adjusts price changes according to trading volume. The script focuses on identifying the highest and lowest values of the PVT over user-defined lookback periods:
Price Volume Trend (PVT): The PVT is used to calculate the momentum of price movements, taking volume into account. By incorporating both price and volume, the PVT offers a more dynamic and responsive indicator of trend direction compared to price alone.
Swing Point Detection: The script identifies the highest and lowest PVT values over user-defined lookback periods (x for highs and y for lows). When the current PVT matches either the highest or lowest value, it signals a potential trend reversal or continuation, depending on whether the high or low is detected.
Entry and Exit Signals: A long signal (bullish) is generated when the current PVT matches the highest value over the lookback period, while a short signal (bearish) is generated when the current PVT matches the lowest value. These signals can be visualized with alerts and background colors.
Features and User Inputs
The "Volume Trend Swing Points" script allows traders to customize several parameters to better suit their trading strategies and market conditions:
Lookback Periods (x and y): The script allows for two customizable lookback periods—one for detecting the highest PVT and another for the lowest. Adjusting these values can help refine the sensitivity of the swing points.
Bar Coloring: The script includes an optional setting to color the bars based on detected bullish or bearish trends, making it easier to visualize potential market shifts.
Background Colors: The background color changes dynamically based on whether a high or low swing point is detected, providing traders with a clear visual indication of potential trend reversals.
Alerts: The script includes alert conditions for both long and short signals, enabling traders to set notifications for when potential swing points are detected.
Practical Applications
The "Volume Trend Swing Points" script is ideal for traders who focus on price and volume dynamics when making trading decisions. Its application is particularly useful in the following scenarios:
Detecting Trend Reversals: By identifying the highest and lowest PVT values over a given period, the script can help traders spot potential reversal points, allowing for more timely entries or exits.
Confirming Trend Continuations: When the PVT continues to match the highest or lowest values, it may indicate that the trend is likely to continue, helping traders maintain their positions with greater confidence.
Volume-Based Trend Analysis: Since the script uses the PVT, it is particularly effective in markets where volume plays a significant role in driving price movements, offering insights that go beyond simple price-based indicators.
Advantages and Strategic Value
This script enhances traditional trend analysis by incorporating both price and volume through the PVT, providing a more comprehensive view of market momentum. The customizable lookback periods allow traders to adapt the script to different assets and timeframes, making it a versatile tool for swing trading and trend-following strategies.
The visual cues provided by bar coloring and background shading help traders quickly identify potential market shifts, improving decision-making speed and accuracy.
Summary and Usage Tips
The "Volume Trend Swing Points" script is a straightforward yet powerful tool for identifying market reversals and trend continuations based on both price and volume. By adjusting the lookback periods, traders can fine-tune the script to better suit their trading style and the assets they are monitoring. The visual and alert features further enhance the script's usability, making it easy to incorporate into a trading strategy.
Remember to backtest the script across various market conditions to better understand its performance. Past performance is not necessarily indicative of future results, so using this script in conjunction with other technical tools is recommended for optimal decision-making.
(MA-EWMA) with ChannelsHamming Windowed Volume-Weighted Bidirectional Momentum-Adaptive Exponential Weighted Moving Average
This script is an advanced financial indicator that calculates a Hamming Windowed Volume-Weighted Bidirectional Momentum-Adaptive Exponential Weighted Moving Average (MA-EWMA). It adapts dynamically to market conditions, adjusting key parameters like lookback period, momentum length, and volatility sensitivity based on price volatility.
Key Components:
Dynamic Adjustments: The indicator adjusts its lookback and momentum length using the ATR (Average True Range), making it more responsive to volatile markets.
Volume Weighting: It incorporates volume data, weighting the moving average based on the volume activity, adding further sensitivity to price movement.
Bidirectional Momentum: It calculates upward and downward momentum separately, using these values to determine the directional weighting of the moving average.
Hamming Window: This technique smooths the price data by applying a Hamming window, which helps to reduce noise in the data and enhances the accuracy of the moving average.
Channels: Instead of plotting a single line, the script creates dynamic channels, providing more context for support and resistance levels based on the market's behavior.
The result is a highly adaptive and sophisticated moving average indicator that responds dynamically to both price momentum and volume trends.
VIDYA with Dynamic Length Based on ICPThis script is a Pine Script-based indicator that combines two key concepts: the Instantaneous Cycle Period (ICP) from Dr. John Ehlers and the Variable Index Dynamic Average (VIDYA). Here's an overview of how the script works:
Components:
Instantaneous Cycle Period (ICP):
This part of the indicator uses Dr. John Ehlers' approach to detect the market cycle length dynamically. It calculates the phase of price movement by computing the in-phase and quadrature components of the price detrended over a specific period.
The ICP helps adjust the smoothing length dynamically, giving a real-time estimate of the dominant cycle in price action. The script uses a phase calculation, adjusts it for cycle dynamics, and smoothes it for more reliable readings.
VIDYA (Variable Index Dynamic Average):
VIDYA is a moving average that dynamically adjusts its smoothing length based on the market conditions, in this case, using the RSI (Relative Strength Index) as a weight.
The length of VIDYA is determined by the dynamically calculated ICP, allowing it to adapt to changing market cycles.
This indicator performs several recursive layers of VIDYA smoothing (applying VIDYA multiple times) to provide a more refined result.
Key Features:
Dynamic Length: The length for the VIDYA calculation is derived from the smoothed ICP value, meaning that the smoothing adapts to the detected cycle length in real-time, making the indicator more responsive to market conditions.
Multiple VIDYA Layers: The script applies multiple layers of VIDYA smoothing (up to 5 iterations), further refining the output to smooth out market noise while maintaining responsiveness.
Plotting: The final smoothed VIDYA value and the smoothed ICP length are plotted. Additionally, overbought (70) and oversold (30) horizontal lines are provided for visual reference.
Application:
This indicator helps identify trends, smooths out price data, and adapts dynamically to market cycles. It's useful for detecting shifts in momentum and trends, and traders can use it to identify overbought or oversold conditions based on dynamically calculated thresholds.
Optimized WaveletsThe script, High-Resolution Volume-Price Pressure Indicator with Wavelets, utilizes wavelet transforms and high-resolution data to analyze market pressure based on volume and price dynamics. The approach combines volume data from smaller timeframes (1 second) with non-linear transformation techniques to generate a refined view of market conditions. Here’s a detailed breakdown of how it works:
Key Components:
Wavelet Transform:
A wavelet function is applied to the price and volume data to capture patterns over a set time period. This technique helps identify underlying structures in the data that might be missed with traditional moving averages.
High-Resolution Data:
The indicator fetches 1-second high-resolution data for price movements and volume. This allows the strategy to capture granular price and volume changes, crucial for short-term trading decisions.
Normalized Difference:
The script calculates the normalized difference in price and volume data. By comparing changes over the selected length, it standardizes these movements to help detect sudden shifts in market pressure.
Sigmoid Transformation:
After combining the price and volume wavelet data, a sigmoid function is applied to smooth out the resulting values. This non-linear transformation helps highlight significant moves while filtering out minor fluctuations.
Volume-Price Pressure:
The up and down volume differences, together with price movements, are combined to create a "Volume-Price Pressure Score." The final indicator reflects the pressure exerted on the market by both buyers and sellers.
Indicator Plot:
The final transformed score is plotted, showing how price and volume dynamics, combined through wavelet transformation, interact. The indicator can be used to identify potential market turning points or pressure buildups based on volume and price movement patterns.
This approach is well-suited for traders looking for advanced signal detection based on high-frequency data and can provide insight into areas where typical indicators may lag or overlook short-term volatility.
Sweep + MSS# Sweep + MSS Indicator
This indicator identifies market sweeps and Market Structure Shifts (MSS) to help traders recognize potential trend changes and market manipulations.
How it works:
1. Sweep Detection:
- Identifies when price briefly moves beyond a recent high/low (pivot point) and then reverses.
- Bullish sweep: Price drops below a recent low, then closes above it.
- Bearish sweep: Price rises above a recent high, then closes below it.
2. Market Structure Shift (MSS):
- Occurs when price action invalidates a previous sweep level.
- Bullish MSS: Price closes above a bearish sweep level.
- Bearish MSS: Price closes below a bullish sweep level.
Key Features:
- Customizable pivot lookback length for sweep detection
- Minimum bar requirement after a sweep before MSS can trigger
- One MSS per sweep level to avoid multiple signals
- Visual representation with lines connecting sweep points to MSS triggers
- Emoji labels for easy identification (🐂-MSS for bullish, 🐻-MSS for bearish)
Logic Behind MSS:
The MSS aims to identify potential trend changes by recognizing when the market invalidates a previous sweep level. This often indicates a shift in market structure, suggesting that the previous trend may be weakening or reversing.
- A bullish MSS occurs when the price closes above a bearish sweep level, potentially signaling a shift from bearish to bullish sentiment.
- A bearish MSS occurs when the price closes below a bullish sweep level, potentially signaling a shift from bullish to bearish sentiment.
By requiring a minimum number of bars between the sweep and the MSS, the indicator helps filter out noise and focuses on more significant structural changes in the market.
This indicator can be a valuable tool for traders looking to identify potential trend changes and entry/exit points based on market structure analysis.
UtilityLibrary "Utility"
A utility library for various trading tools such as signal generation, custom indicators, and multi-condition crossovers.
multiCrossover(source1, source2, threshold1, threshold2)
multiCrossover
@description Detects multi-condition crossovers between two sources with threshold filters.
Parameters:
source1 (float) : The first data series to compare.
source2 (float) : The second data series to compare.
threshold1 (float) : A value that source1 must exceed to trigger the crossover.
threshold2 (float) : A value that source2 must exceed to trigger the crossunder.
Returns: A tuple: (crossUp, crossDown) where crossUp is a boolean for upward crossover, and crossDown is for downward crossover.
macdCustom(source, fastLength, slowLength, signalLength, macdThresh)
macdCustom
@description Calculates custom MACD signals based on thresholds.
Parameters:
source (float) : The price data or input series.
fastLength (simple int) : The length of the fast EMA.
slowLength (simple int) : The length of the slow EMA.
signalLength (simple int) : The signal line length.
macdThresh (float) : A threshold for the MACD line to confirm buy/sell signals.
Returns: A tuple: (macdBuySignal, macdSellSignal) where macdBuySignal is true when MACD crosses above, and macdSellSignal is true when MACD crosses below the signal line.
combinedMacdRsi(source, fastLength, slowLength, signalLength, rsiLength, macdThresh, rsiThresh)
combinedMacdRsi
@description Generates combined signals from MACD and RSI indicators.
Parameters:
source (float) : The price data or input series.
fastLength (simple int) : The length of the fast EMA for MACD.
slowLength (simple int) : The length of the slow EMA for MACD.
signalLength (simple int) : The signal line length for MACD.
rsiLength (simple int) : The length of the RSI calculation.
macdThresh (float) : The threshold for MACD signals.
rsiThresh (float) : The threshold for RSI signals.
Returns: A tuple: (buySignal, sellSignal) where buySignal is generated when MACD is positive and RSI is below the threshold, and sellSignal when MACD is negative and RSI is above the threshold.
movingAverageCrossover(source, shortLength, longLength)
movingAverageCrossover
@description Detects crossovers between short-term and long-term moving averages.
Parameters:
source (float) : The price data or input series.
shortLength (int) : The length of the short-term moving average.
longLength (int) : The length of the long-term moving average.
Returns: A tuple: (crossUp, crossDown) where crossUp is true when the short-term MA crosses above the long-term MA, and crossDown when the reverse occurs.
BTC ETF Flow Trading SignalsTracks large money flows (500M+) across major Bitcoin ETFs (IBIT, BTCO, FBTC, ARKB, BITB)
Generates long/short signals based on institutional money movement
Shows flow trends and strength of movements
This script provides a foundation for comparing ETF inflows and Bitcoin price. The effectiveness of the analysis depends on the quality of the data and your interpretation of the results. Key levels of 500M and 350M Inflow/Outflow Enjoy
Collaboration with Vivid Vibrations
Enjoy & improve!
Highest Single-Day Percentage Change (Close to Close)This Pine Script is designed to calculate and display the largest percentage change in stock price between consecutive days' closing prices. Here's a high-level breakdown of what the script does:
Daily Percentage Change Calculation:
It calculates how much the stock price changed from the previous day's close to the current day's close. The change is expressed as a percentage of the previous day's closing price.
Tracking the Highest Change:
The script keeps track of the largest percentage increase or decrease it has encountered in the dataset (from previous close to current close). It updates the value if a new day exceeds the current largest recorded percentage change.
Visual Representation:
The daily percentage changes are plotted as a line graph, allowing you to see how the stock's price fluctuates from one day to the next.
A separate line is drawn to represent the highest percentage change detected so far.
If a day's price change matches the highest recorded change, a label appears on the chart to highlight that specific point.
Dynamic Updates:
The script is dynamic, meaning it continually updates as new data comes in. So, as new days are added to the chart, the script checks if the percentage change exceeds the previously highest recorded value.
Why This Is Useful:
For traders and investors: It provides a quick way to identify which day saw the most significant price movement, helping to spot major market events or volatility.
For historical analysis: You can quickly find the most extreme single-day price swings in a stock's historical data, which might be useful for understanding past market behavior or making predictions about future moves.
Saturn Retrograde PeriodsSaturn Retrograde Periods Visualizer for TradingView
This Pine Script visualizes all Saturn retrograde periods since 2009, including the current retrograde ending on November 15, 2024. The script overlays yellow boxes on your TradingView chart to highlight the exact periods of Saturn retrograde. It's a great tool for astrologically-inclined traders or those interested in market timing based on astrological events.
Key Features:
Full Historical Coverage: Displays Saturn retrograde periods from 2009 (the inception of Bitcoin) to the current retrograde ending in November 2024.
Customizable Appearance: You can easily adjust the color and opacity of the boxes directly from the script's settings window, making it flexible for various chart styles.
Visual Clarity: The boxes span the full vertical range of your chart, ensuring the retrograde periods are clearly visible over any asset, timeframe, or price action.
How to Use:
Add the script to your TradingView chart.
Adjust the color and opacity in the settings to suit your preferences.
View all relevant Saturn retrograde periods and analyze how these astrological events may align with price movements in your selected asset.
This script is perfect for traders and analysts who want to combine astrology with financial market analysis!
scripted by chat.gpt - version 1.0
[EmreKb] Combined CandlesThis script combines multiple candlestick patterns into a single, unified candle when they are of the same type (bullish or bearish). Instead of displaying every individual candle on the chart, it merges consecutive candles based on their direction to simplify the visual analysis of price movements.
What It Does:
Combines Candles: If two or more consecutive candles are bullish (close price higher than open price) or bearish (close price lower than open price), the script merges them into a single candle, adjusting the high, low, and close values accordingly.
Displays Merged Candles: The merged candles are drawn on the chart. A green bar represents a bullish period, while a red bar represents a bearish period.
How It Works:
The script tracks whether each candle is bullish or bearish.
If a candle is the same type as the previous one, it updates the combined candle (adjusting the high, low, and close values).
When the type changes (from bullish to bearish or vice versa), it finalizes the current combined candle and starts a new one.
The merged candles are displayed on the chart at the end of the data series.
Use Case:
This script simplifies price action by grouping similar candles together, making it easier to identify trends and spot periods of sustained buying or selling pressure. It can help traders focus on the overall direction of the market rather than being distracted by small fluctuations between individual candles.
Wave Anchor IndicatorThe Wave Anchor Indicator is designed to mark the crossing of overbought and oversold levels of higher time frame momentum waves, based on the VuManChu Cipher B+Divergences Wave Trend Indicator. This tool is inspired by the TP Mint trading strategy, which relies heavily on the momentum waves of Market Cipher B or VuManChu Cipher B for identifying optimal entry and exit points.
Key Concept: Anchored Waves
In the TP Mint strategy, momentum waves in overbought (above 60) or oversold (below -60) conditions on higher time frames are considered "anchored." These anchored waves provide strong signals for entries and take-profit points when viewed on lower time frames. The Wave Anchor Indicator focuses on these anchor conditions to help traders make informed decisions by seeing higher time frame anchor states directly on the entry time frame chart.
How It Works
Labeling Signals:
- On lower time frames, such as the 15-minute chart, the indicator shows labels when higher
time frame momentum waves (1-hour and 4-hour) cross the overbought or oversold levels.
- Labels above price indicate overbought conditions, with green labels when the wave crosses
upward and red labels when crossing downward.
- Labels below price signal oversold conditions, with red for a downward cross and green for an
upward cross.
- Each label displays the time frame of the crossing momentum wave, providing context for
traders at a glance.
Time Frame Pairings:
- On the 15-minute time frame, the indicator tracks anchor conditions from the 1-hour and 4-
hour time frames.
- On the 1-hour chart, it monitors 4-hour and daily time frame anchor conditions.
Customization and Alerts
Flexible Display Options : Users can choose to display none, one, or both of the grouped higher time frame labels, depending on their strategy and preferences.
Alerts : The indicator also allows for custom alerts when a label appears, helping traders stay on top of key market movements without constantly monitoring the chart.
Use Cases
This indicator is ideal for traders who use momentum-based strategies across multiple time frames. It simplifies the process of identifying key entry and exit points by focusing on the anchor conditions from higher time frames, making it easier to execute the TP Mint strategy or similar methods.
Thank you to VuManChu and LazyBear for mamking the momentum wave code open source and allowing it’s use in this indicator.
Time Vertical LinesVLines - Time-Based Vertical Lines with Zones
This PineScript indicator creates vertical time lines with customizable zones between them. Perfect for marking trading sessions, key market times, or any time-based analysis.
Key Features:
- 5 configurable time lines
- 3 customizable zones (between lines 1-2, 2-3, and 4-5)
- Each zone features:
- Background shading
- Horizontal lines at high/low points
- Independent color controls
- Adjustable line styles and widths
- Time zone offset adjustment
- Option to show/hide historical lines
Installation Instructions:
1. Open TradingView's Pine Script Editor
2. Create a new script
3. Copy and paste the entire code
4. Add to Chart
Setup Guide:
1. Time Zone Adjustment:
- Find the "Time Zone Offset (Hours)" setting
- Adjust if lines appear at wrong times
- Example: If lines appear 3 hours early, set offset to 3
2. Basic Time Lines (1-3):
- Each line has settings for:
- Hour (0-23)
- Minute (0-59)
- Color
- Show/Hide toggle
3. Session Lines (4-5):
- Special lines typically used for session marking
- Same settings as basic lines
- Default red color to distinguish from other lines
4. Zone Customization:
Three separate zones are available:
- Zone 1-2 (between first and second lines)
- Zone 2-3 (between second and third lines)
- Zone 4-5 (between fourth and fifth lines)
Each zone can be customized with:
- Background color and transparency
- Horizontal line color
- Line style (Solid/Dashed/Dotted)
- Line width
- Individual show/hide toggles for zone and lines
5. Additional Settings:
- "Show Historical Lines" - toggle to show/hide lines on previous days
- Global line style and width settings for vertical lines
Suggested Uses:
1. Mark pre-market, market, and post-market sessions
2. Highlight specific trading windows
3. Track time-based support/resistance levels
4. Monitor price ranges during specific time periods
Tips:
- Start by setting just one zone to get familiar with the controls
- Use different colors for different sessions/time periods
- Adjust transparency to maintain chart visibility
- Use the show/hide toggles to focus on specific times
- The horizontal lines automatically mark the high/low range between time points
Daily Volume Metrics BoxDaily Volume Metrics Box
A powerful tool for monitoring intraday trading metrics in real-time. This indicator provides a clean, customizable display of key market statistics that reset daily.
🔑 Key Features:
- Daily Volume Distribution - Track positive and negative volume separately
- Net Volume Analysis - Monitor the balance of buying vs selling volume
- Average Candle Size - Dynamic calculation of recent price movement magnitude
- Flexible Positioning - Place the metrics box in any corner of your chart
- Auto-Reset - All metrics automatically reset at the start of each trading day
- Current Date Display - Always know which day's data you're viewing
📊 Metrics Explained:
1. Avg Size: Average candle size over your specified lookback period
2. Pos Vol: Accumulated volume from up-moves during the current day
3. Neg Vol: Accumulated volume from down-moves during the current day
4. Net Vol: The difference between positive and negative volume (Pos Vol - Neg Vol)
⚙️ Customization Options:
- Number of candles for average (1-∞)
- Background color and transparency
- Text color
- Box position (Top/Bottom, Left/Right)
- Distance from chart edge (1-5 bars)
📌 Usage Tips:
- Use larger lookback periods for more stable average candle size
- Position the box where it won't interfere with your chart analysis
- Monitor net volume for potential trend strength confirmation
- Compare positive and negative volume for insight into price momentum
🔄 Daily Reset:
All volume metrics reset at the start of each trading day, ensuring you're always looking at current day data only.
Perfect for day traders, swing traders, and anyone who wants to monitor intraday market dynamics with clean, organized metrics.
Note: This indicator works best on intraday timeframes where volume data is available.
Fluid Dynamics-Inspired Indicator with Bidirectional ScalingThe "Enhanced Fluid Dynamics-Inspired Indicator with Bidirectional Scaling" is a sophisticated technical analysis tool that draws inspiration from the principles of fluid dynamics to measure both upward and downward price movements, while also incorporating volatility and momentum into its calculations. The indicator aims to provide traders with a clear understanding of market dynamics by analyzing "streamflow" (price and volume movements) in both directions, enhanced with adaptive scaling techniques.
Key Features:
Bidirectional Price Momentum:
The indicator separately calculates positive and negative momentum using the price's rate of change. This allows for independent analysis of upward and downward price movements, providing a balanced view of the market's direction.
Streamflow Model:
The "streamflow" is calculated by multiplying volume flow with price momentum. This approach treats the market as a fluid system, where the momentum and volume of trades influence the flow of prices in both upward and downward directions. Streamflow is calculated independently for each direction.
Adaptive Volatility Scaling:
Volatility is dynamically calculated using the Average True Range (ATR) and is weighted to adjust to varying market conditions. An adaptive logarithmic scaling factor is applied to the volatility to capture the dynamic nature of market environments.
DRMA (Displaced Rolling Moving Average):
The indicator uses the DRMA function to smooth out price and volume data, improving the accuracy of its measurements. This allows the indicator to capture longer-term trends while still being responsive to short-term fluctuations.
Non-Linear Scaling and Normalization:
To ensure that the output values are within a usable range, the indicator employs a sigmoid-based non-linear scaling function. This helps normalize the composite output, making it easier to interpret overbought and oversold conditions.
Visual Representation:
The indicator plots two separate lines for upward and downward market movements, making it easy to distinguish between bullish and bearish trends. Background colors are also used to highlight periods of strong upward or downward momentum, as well as high volatility.
Overbought/Oversold Conditions:
Upper and lower thresholds are used to signal potential overbought and oversold conditions. Alerts are triggered when the market moves into extreme levels, helping traders identify potential entry and exit points.
Usage:
This indicator is designed for traders who are looking for a more nuanced and dynamic tool to measure both bullish and bearish trends. By using bidirectional scaling, it provides clearer signals for market direction, while adaptive volatility and momentum adjustments ensure the indicator responds to different market environments. The alert conditions make it especially useful for timing trades in highly volatile conditions or when price movements reach extreme levels.