PnF Fibonacci Levels with AlertsMy Pine Script indicator, "PnF Fibonacci Levels with Alerts," overlays on a trading chart to generate alerts based on Fibonacci levels in Point and Figure (PnF) charts.
Key Features:
Inputs and Initialization:
It uses a customizable Fibonacci level (set at 0.236) and initializes variables for tracking the high and low of O and X columns.
O Column Logic:
When the current column is identified as an O column (when the close is less than the open), it calculates the Fibonacci level based on the high and low of that column, drawing a line on the chart.
Buy Alert:
If the closing price of the previous bar is above the Fibonacci level of the O column, a buy alert is triggered.
X Column Logic:
If the current column is an X column and the close is above the previous O column's low, it captures the current high and low, calculates the Fibonacci level, and draws it on the chart.
Sell Alert:
A sell alert is triggered if the closing price of the X column is at or below the specified Fibonacci level.
This indicator aids traders by highlighting critical Fibonacci levels and providing timely alerts for potential buy and sell opportunities.
Pine utilities
PnF Bullish & Bearish Trend Line Indicator with Proximity AlertThis Pine Script indicator, "PnF Bullish and Bearish Trend line Proximity Alert," overlays on a trading chart to monitor and alert users about interactions with bullish and bearish trend lines derived from Point and Figure (PnF) charting.
Key Features:
Inputs: Users can set parameters such as box size, bullish and bearish angles (in degrees), and a proximity threshold for detecting touches.
Slope Calculation: The script calculates the slopes for bullish and bearish trendlines using the tangent of the specified angles.
Trendline Management:
It initializes and updates trend lines based on price interactions, adjusting their starting points and positions as conditions change.
Proximity Detection: The indicator checks if the current price is close enough to the trend lines and sets conditions for alerts.
Alerts: Users receive alerts when both trend lines are touched, enhancing decision-making for trading strategies.
Visual Feedback: It highlights areas where both trend lines are touched and plots the trend lines in distinct colors for clarity.
This indicator provides an effective way to track key price levels and potential trend reversals in the market.
ADX + Volume Strategy### Strategy Description: ADX and Volume-Based Trading Strategy
This strategy is designed to identify strong market trends using the **Average Directional Index (ADX)** and confirm trading signals with **Volume**. The idea behind the strategy is to enter trades only when the market shows a strong trend (as indicated by ADX) and when the price movement is supported by high trading volume. This combination helps filter out weaker signals and provides more reliable entries into positions.
### Key Indicators:
1. **ADX (Average Directional Index)**:
- **Purpose**: ADX is a technical indicator that measures the strength of a trend, regardless of its direction (up or down).
- **Usage**: The strategy uses ADX to determine whether the market is trending strongly. If ADX is above a certain threshold (default is 25), it indicates that a strong trend is present.
- **Directional Indicators**:
- **DI+ (Directional Indicator Plus)**: Indicates the strength of the upward price movement.
- **DI- (Directional Indicator Minus)**: Indicates the strength of the downward price movement.
- ADX does not indicate the direction of the trend but confirms that a trend exists. DI+ and DI- are used to determine the direction.
2. **Volume**:
- **Purpose**: Volume is a key indicator for confirming the strength of a price movement. High volume suggests that a large number of market participants are supporting the movement, making it more likely to continue.
- **Usage**: The strategy compares the current volume to the 20-period moving average of the volume. The trade signal is confirmed if the current volume is greater than the average volume by a specified **Volume Multiplier** (default multiplier is 1.5). This ensures that the trade is supported by strong market participation.
### Strategy Logic:
#### **Entry Conditions:**
1. **Long Position** (Buy):
- **ADX** is above the threshold (default is 25), indicating a strong trend.
- **DI+ > DI-**, signaling that the market is trending upward.
- The **current volume** is greater than the 20-period average volume multiplied by the **Volume Multiplier** (e.g., 1.5), indicating that the upward price movement is backed by sufficient market activity.
2. **Short Position** (Sell):
- **ADX** is above the threshold (default is 25), indicating a strong trend.
- **DI- > DI+**, signaling that the market is trending downward.
- The **current volume** is greater than the 20-period average volume multiplied by the **Volume Multiplier** (e.g., 1.5), indicating that the downward price movement is backed by strong selling activity.
#### **Exit Conditions**:
- Positions are closed when the opposite signal appears:
- **For long positions**: Close when the short conditions are met (ADX still above the threshold, DI- > DI+, and the volume condition holds).
- **For short positions**: Close when the long conditions are met (ADX still above the threshold, DI+ > DI-, and the volume condition holds).
### Parameters:
- **ADX Period**: The period used to calculate ADX (default is 14). This controls how sensitive the ADX is to price movements.
- **ADX Threshold**: The minimum ADX value required for the strategy to consider the market trend as strong (default is 25). Higher values focus on stronger trends.
- **Volume Multiplier**: This parameter adjusts how much higher the current volume needs to be compared to the 20-period moving average for the signal to be valid. A value of 1.5 means the current volume must be 50% higher than the average volume.
### Example Trade Flow:
1. **Long Trade Example**:
- ADX > 25, confirming a strong trend.
- DI+ > DI-, confirming that the trend direction is upward.
- The current volume is 50% higher than the 20-period average volume (multiplied by 1.5).
- **Action**: Enter a long position.
2. **Short Trade Example**:
- ADX > 25, confirming a strong trend.
- DI- > DI+, confirming that the trend direction is downward.
- The current volume is 50% higher than the 20-period average volume.
- **Action**: Enter a short position.
### Strengths of the Strategy:
- **Trend Filtering**: The strategy ensures that trades are only taken when the market is trending strongly (confirmed by ADX) and that the price movement is supported by high volume, reducing the likelihood of false signals.
- **Volume Confirmation**: Using volume as confirmation provides an additional layer of reliability, as volume spikes often accompany sustained price moves.
- **Dual Signal Confirmation**: Both trend strength (ADX) and volume conditions must be met for a trade, making the strategy more robust.
### Weaknesses of the Strategy:
- **Limited Effectiveness in Range-Bound Markets**: Since the strategy relies on strong trends, it may underperform in sideways or non-trending markets where ADX stays below the threshold.
- **Lagging Nature of ADX**: ADX is a lagging indicator, which means that it may confirm the trend after it has already begun, potentially leading to late entries.
- **Volume Requirement**: In low-volume markets, the volume multiplier condition may not be met often, leading to fewer trade opportunities.
### Customization:
- **Adjust the ADX Threshold**: You can raise the threshold if you want to focus only on very strong trends, or lower it to capture moderate trends.
- **Adjust the Volume Multiplier**: You can change the multiplier to be more or less strict. A higher multiplier (e.g., 2.0) will require a stronger volume spike to confirm the signal, while a lower multiplier (e.g., 1.2) will allow more trades with weaker volume confirmation.
### Summary:
This ADX and Volume strategy is ideal for traders who want to follow strong trends while ensuring that the trend is supported by high trading volume. By combining a trend strength filter (ADX) and volume confirmation, the strategy aims to increase the probability of entering profitable trades while reducing the number of false signals. However, it may underperform in range-bound markets or in markets with low volume.
WSITEEE Imbalance/FVG (FAIR VALUE GAP)Imbalance/FVG (Fair Value Gap) refers to a price imbalance, representing a range on the chart where little liquidity was provided.
Imbalance implies a strong impulsive movement of a candle, which the price almost always returns to cover.
The best analogy would be to imagine painting a wall with a roller. If you move the roller from top to bottom, what remains on the wall? That’s right, gaps that need to be filled. How do you fill them? Exactly, by moving the roller from bottom to top. The same principle applies to imbalance.
How do you correctly mark an Imbalance?
The first thing we need to find on the chart is three candles, one of which should be impulsive. Next, using the “Fibonacci Retracement” tool, we stretch it from the wick of the first candle to the wick of the last candle.
Imbalance can be used both for determining context and as an entry model. On a higher timeframe, it acts as a point of interest (POI), within which you can look for factors to build a position.
This Pine Script is designed for Smart Money traders who work with Fair Value Gaps (FVG). FVGs are three-candle patterns where the third candle does not fully overlap the first, leaving a gap on the second candle. The script helps to automatically detect these gaps and highlight them on the chart with different colors based on their status and type.
It allows for the visualization of imbalances on the chart, highlighting key zones that can serve as important levels for decision-making. With flexible color and label settings, the script can be tailored to individual needs, enhancing data visualization on the chart.
bar_index inspectorThis is a tool for developers who are working with index based plots and find themselves adding the bar_index to their indicators on a regular basis during development and debugging.
What it does:
shows the bar_index in the status line and data window.
plots optional labels (bar index + time) into the chart every 10 bars
Crossover CounterExplanation:
Crossover Detection: We detect the crossover of the 20-period and 50-period moving averages using ta.crossover().
Tracking Price Movement: After the crossover, we start tracking the price to check if it moves up or down by 2%. If an up movement occurs before a down movement, we increment the positive counter. If a down movement occurs first, we increment the negative counter.
Reset Condition: Once either a 2% up or down move is detected, we stop tracking until the next crossover.
Table Display: A table shows the counts of positive and negative events.
BT Assistant
BT Assistant - Economic Events Calendar Overlay
BT Assistant is a powerful TradingView indicator designed to help traders stay on top of economic events that impact the market. This script overlays key upcoming events directly onto your chart, providing real-time visibility of scheduled economic releases and announcements.
Features:
Economic Event Overlay: Visualize important economic events right on your chart, such as GDP announcements, jobs reports, and interest rate decisions.
All-Day Event Support: Highlight full-day events like public holidays or major economic updates, ensuring you never miss market-moving events.
Customizable Event Lines: Choose from solid, dashed, or dotted lines to mark events on your chart and differentiate between their importance.
Event Titles: Display the names of the events at the exact timestamps, making it easier to identify and plan trades around them.
Adjustable Colors: Customize background, text, and border colors to fit your chart's style and make the events more visible.
Real-Time Updates: Automatically update the display as the market moves closer to event times, providing constant awareness of the market's potential turning points.
Day Bounds for All-Day Events: Clearly marks the start and end of all-day events for better tracking and visualization.
How to Use: Enable the indicator by turning on the "Enable" option in the settings.
Input event data in the following format: year/month/day/hour/minute:EVENT_NAME;etc.
Example: 2024/09/26/08/30:Durable Goods Orders;2024/09/26/08/30:GDP
Customize the display with colors and line styles to match your preference.
Monitor the chart for upcoming events and adjust your trading strategies accordingly.
BT Assistant is a must-have tool for traders who rely on economic data to make informed decisions. Stay updated, plan ahead, and never miss a market-moving event again.
High/Low Breakout Statistical Analysis StrategyThis Pine Script strategy is designed to assist in the statistical analysis of breakout systems on a monthly, weekly, or daily timeframe. It allows the user to select whether to open a long or short position when the price breaks above or below the respective high or low for the chosen timeframe. The user can also define the holding period for each position in terms of bars.
Core Functionality:
Breakout Logic:
The strategy triggers trades based on price crossing over (for long positions) or crossing under (for short positions) the high or low of the selected period (daily, weekly, or monthly).
Timeframe Selection:
A dropdown menu enables the user to switch between the desired timeframe (monthly, weekly, or daily).
Trade Direction:
Another dropdown allows the user to select the type of trade (long or short) depending on whether the breakout occurs at the high or low of the timeframe.
Holding Period:
Once a trade is opened, it is automatically closed after a user-defined number of bars, making it useful for analyzing how breakout signals perform over short-term periods.
This strategy is intended exclusively for research and statistical purposes rather than real-time trading, helping users to assess the behavior of breakouts over different timeframes.
Relevance of Breakout Systems:
Breakout trading systems, where trades are executed when the price moves beyond a significant price level such as the high or low of a given period, have been extensively studied in financial literature for their potential predictive power.
Momentum and Trend Following:
Breakout strategies are a form of momentum-based trading, exploiting the tendency of prices to continue moving in the direction of a strong initial movement after breaching a critical support or resistance level. According to academic research, momentum strategies, including breakouts, can produce returns above average market returns when applied consistently. For example, Jegadeesh and Titman (1993) demonstrated that stocks that performed well in the past 3-12 months continued to outperform in the subsequent months, suggesting that price continuation patterns, like breakouts, hold value .
Market Efficiency Hypothesis:
While the Efficient Market Hypothesis (EMH) posits that markets are generally efficient, and it is difficult to outperform the market through technical strategies, some studies show that in less liquid markets or during specific times of market stress, breakout systems can capitalize on temporary inefficiencies. Taylor (2005) and other researchers have found instances where breakout systems can outperform the market under certain conditions.
Volatility and Breakouts:
Breakouts are often linked to periods of increased volatility, which can generate trading opportunities. Coval and Shumway (2001) found that periods of heightened volatility can make breakouts more significant, increasing the likelihood that price trends will follow the breakout direction. This correlation between volatility and breakout reliability makes it essential to study breakouts across different timeframes to assess their potential profitability .
In summary, this breakout strategy offers an empirical way to study price behavior around key support and resistance levels. It is useful for researchers and traders aiming to statistically evaluate the effectiveness and consistency of breakout signals across different timeframes, contributing to broader research on momentum and market behavior.
References:
Jegadeesh, N., & Titman, S. (1993). Returns to Buying Winners and Selling Losers: Implications for Stock Market Efficiency. Journal of Finance, 48(1), 65-91.
Fama, E. F., & French, K. R. (1996). Multifactor Explanations of Asset Pricing Anomalies. Journal of Finance, 51(1), 55-84.
Taylor, S. J. (2005). Asset Price Dynamics, Volatility, and Prediction. Princeton University Press.
Coval, J. D., & Shumway, T. (2001). Expected Option Returns. Journal of Finance, 56(3), 983-1009.
Shifted Symbol Overlay with OffsetThe Shifted Symbol Overlay Indicator is a custom TradingView indicator designed to overlay the price data of one stock or asset over another, allowing for direct visual comparison. This is particularly useful for comparing the performance of two assets over different time periods. The indicator enables you to shift the data from one asset either forward or backward in time, making it easier to compare historical data from one stock with more recent data from another. The indicator supports shifting both to the right (future periods) and to the left (earlier periods), helping traders and analysts explore correlations or divergences between two financial instruments.
The indicator also includes a normalization option that adjusts the scale of the two assets, so you can compare them even if they have vastly different price levels. This is useful when you're interested in relative performance rather than the absolute price values.
Simplified Gap Strategy with SMA FilterThe Simplified Gap Strategy leverages price gaps as a trading signal, focusing on their significance in market behavior. Gaps occur when the opening price of a security differs significantly from the previous closing price, often signaling potential continuation or reversal patterns.
Key Features:
Gap Threshold:
This strategy requires a minimum percentage gap (defined by the user) to qualify for trading signals.
Directional Trading:
Users can select from various gap types, including "Long Up Gap" and "Short Down Gap," allowing for tailored trading approaches.
SMA Filter:
An optional Simple Moving Average (SMA) filter helps refine trade entries based on trend direction, increasing the probability of successful trades.
Hold Duration:
Positions can be held for a user-defined duration, providing flexibility in trade management.
Statistical Significance of Gaps:
Research has shown that gaps can provide insights into future price movements. According to studies such as those by Hutton and Jiang (2008), price gaps are often followed by momentum in the direction of the gap, indicating that they can serve as reliable indicators for traders. The "Gap Theory" suggests that gaps are filled approximately 90% of the time, emphasizing their relevance in market dynamics (Nikkinen, Sahlström, & Kinnunen, 2006).
Important Note:
This strategy is designed solely for statistical analysis and should not be construed as financial advice. Users are encouraged to conduct their own research and analysis before applying this strategy in live trading scenarios.
By understanding the underlying mechanisms of price gaps and their statistical significance, traders can enhance their decision-making processes and potentially improve trading outcomes.
References:
Hutton, A. W., & Jiang, W. (2008). "Price Gaps: A Guide to Trading Gaps."
Nikkinen, J., Sahlström, P., & Kinnunen, J. (2006). "The Gaps in Financial Markets: An Empirical Study."
This description provides an overview of the strategy while emphasizing its analytical purpose and backing it with relevant academic insights.
Streak-Based Trading StrategyThe strategy outlined in the provided script is a streak-based trading strategy that focuses on analyzing winning and losing streaks. It’s important to emphasize that this strategy is not intended for actual trading but rather for statistical analysis of streak series.
How the Strategy Works
1. Parameter Definition:
• Trade Direction: Users can choose between “Long” (buy) and “Short” (sell).
• Streak Threshold: Defines how many consecutive wins or losses are needed to trigger a trade.
• Hold Duration: Specifies how many periods the position will be held.
• Doji Threshold: Determines the sensitivity for Doji candles, which indicate market uncertainty.
2. Streak Calculation:
• The script identifies Doji candles and counts winning and losing streaks based on the closing price compared to the previous closing price.
• Streak counting occurs only when no position is currently held.
3. Trade Conditions:
• If the loss streak reaches the defined threshold and the trade direction is “Long,” a buy position is opened.
• If the win streak is met and the trade direction is “Short,” a sell position is opened.
• The position is held for the specified duration.
4. Visualization:
• Winning and losing streaks are plotted as histograms to facilitate analysis.
Scientific Basis
The concept of analyzing streaks in financial markets is well-documented in behavioral economics and finance. Studies have shown that markets often exhibit momentum and trend-following behavior, meaning the likelihood of consecutive winning or losing periods can be higher than what random statistics would suggest (see, for example, “The Behavior of Stock-Market Prices” by Eugene Fama).
Additionally, empirical research indicates that investors often make decisions based on psychological factors influenced by streaks. This can lead to irrational behavior, as they may focus on past wins or losses (see “Behavioral Finance: Psychology, Decision-Making, and Markets” by R. M. F. F. Thaler).
Overall, this strategy serves as a tool for statistical analysis of streak series, providing deeper insights into market behavior and trends rather than being directly used for trading decisions.
Price Movement > Custom Points with Day of WeekThe code is a TradingView Pine Script indicator designed to track and visualize price movements in a financial market (like stocks or cryptocurrencies) based on a specific point threshold. Here’s a breakdown of its functionality:
Purpose of the Code:
Price Movement Calculation: It calculates the difference between the closing price and the opening price of each bar (or candle) to determine if the price has moved significantly.
Threshold Input: The user can set a threshold (e.g., 500 points) to determine what constitutes a significant movement.
Movement Conditions:
Positive Movement: If the price movement is greater than the threshold, it’s marked as a positive movement.
Negative Movement: If the price movement is less than the negative threshold (i.e., below -500 points), it’s marked as a negative movement.
Day of the Week Identification: The script identifies the day of the week for each bar (Monday through Sunday).
Visual Output:
It plots shapes (like labels) on the chart:
For positive movements, it shows "YES" in green, indicating the movement exceeded the threshold for that day.
For negative movements, it shows "YES" in red, indicating the movement fell below the negative threshold for that day.
Use Cases:
Traders: It helps traders quickly identify days where significant price movements occurred, allowing them to analyze trends and make informed trading decisions.
Market Analysis: The indicator can be used for backtesting strategies based on significant price movements.
Overall, this code serves as a visual tool for analyzing price volatility in a market based on user-defined thresholds and day-based observations. If you have any specific questions or need further clarification about any part of it, feel free to ask!
Currency Futures StatisticsThe "Currency Futures Statistics" indicator provides comprehensive insights into the performance and characteristics of various currency futures. This indicator is crucial for portfolio management as it combines multiple metrics that are instrumental in evaluating currency futures' risk and return profiles.
Metrics Included:
Historical Volatility:
Definition: Historical volatility measures the standard deviation of returns over a specified period, scaled to an annual basis.
Importance: High volatility indicates greater price fluctuations, which translates to higher risk. Investors and portfolio managers use volatility to gauge the stability of a currency future and to make informed decisions about risk management and position sizing (Hull, J. C. (2017). Options, Futures, and Other Derivatives).
Open Interest:
Definition: Open interest represents the total number of outstanding futures contracts that are held by market participants.
Importance: High open interest often signifies liquidity in the market, meaning that entering and exiting positions is less likely to impact the price significantly. It also reflects market sentiment and the degree of participation in the futures market (Black, F., & Scholes, M. (1973). The Pricing of Options and Corporate Liabilities).
Year-over-Year (YoY) Performance:
Definition: YoY performance calculates the percentage change in the futures contract's price compared to the same week from the previous year.
Importance: This metric provides insight into the long-term trend and relative performance of a currency future. Positive YoY performance suggests strengthening trends, while negative values indicate weakening trends (Fama, E. F. (1991). Efficient Capital Markets: II).
200-Day Simple Moving Average (SMA) Position:
Definition: This metric indicates whether the current price of the currency future is above or below its 200-day simple moving average.
Importance: The 200-day SMA is a widely used trend indicator. If the price is above the SMA, it suggests a bullish trend, while being below indicates a bearish trend. This information is vital for trend-following strategies and can help in making buy or sell decisions (Bollinger, J. (2001). Bollinger on Bollinger Bands).
Why These Metrics are Important for Portfolio Management:
Risk Assessment: Historical volatility and open interest provide essential information for assessing the risk associated with currency futures. Understanding the volatility helps in estimating potential price swings, which is crucial for managing risk and setting appropriate stop-loss levels.
Liquidity and Market Participation: Open interest is a critical indicator of market liquidity. Higher open interest usually means tighter bid-ask spreads and better liquidity, which facilitates smoother trading and better execution of trades.
Trend Analysis: YoY performance and the SMA position help in analyzing long-term trends. This analysis is crucial for making strategic investment decisions and adjusting the portfolio based on changing market conditions.
Informed Decision-Making: Combining these metrics allows for a holistic view of the currency futures market. This comprehensive view helps in making informed decisions, balancing risks and returns, and optimizing the portfolio to align with investment goals.
In summary, the "Currency Futures Statistics" indicator equips investors and portfolio managers with valuable data points that are essential for effective risk management, liquidity assessment, trend analysis, and overall portfolio optimization.
Pseudo-Renko Stabilized (Val)█ CALCULATE PSEUDO-RENKO VALUE
Calculates and returns the Pseudo-Renko Stabilized value (or close price) based on a given input value, along with the direction of the current Renko brick. This function adapts the traditional Renko brick size dynamically based on the volatility of the input value using a combination of SMA and EMA calculations. The calculated price represents the closing price of the most recent Pseudo-Renko brick, while the direction indicates the trend ( 1 for uptrend, -1 for downtrend).
Parameters:
* `val` :
* Type: ` float `
* Description: The input value upon which the Pseudo-Renko calculations are performed. You can use any price series or custom value as input.
* `sensitivity` :
* Type: ` float `
* Default Value: ` 1.0 `
* Description: Controls the sensitivity of the brick size to the volatility of the `val`. Higher values lead to larger bricks, resulting in a smoother Renko chart. Lower values produce smaller bricks, leading to a more reactive chart.
* Possible Values: Any positive float.
* `length` :
* Type: ` int `
* Default Value: ` 7 `
* Description: The length used for calculating the EMA and SMA in the dynamic brick size calculation. It influences how quickly the brick size adapts to changing volatility of the `val`.
* Possible Values: Any positive integer.
Return Values:
* `lastRenkoClose` :
* Type: ` float `
* Description: The closing price of the last completed Pseudo-Renko brick based on the `val`.
* `renkoDirection` :
* Type: ` int `
* Description: The direction of the current Pseudo-Renko brick based on the `val`:
* ` 1 `: Uptrend
* ` -1 `: Downtrend
* ` 0 `: No change (initially, or no brick change since the previous bar)
Example Usage:
//@version=5
indicator("Pseudo-Renko Stabilized (Val)", overlay=true)
// Get user inputs
sensitivityInput = input.float(0.1, "Sensitivity",0.01,step=0.01)
lengthInput = input.int(5, "Length",2)
// Example usage with the 'close' price as the input value
= pseudo_renko(math.avg(close,open), sensitivityInput, lengthInput)
// Plot the Renko close price
plot(renkoClose, "Renko Close", renkoDirection>0?color.aqua:color.orange,2)
// You can also use other values as input, such as:
// = pseudo_renko(high, sensitivityInput, lengthInput)
// = pseudo_renko(low, sensitivityInput, lengthInput)
This example demonstrates how to use the `pseudo_renko` function within an indicator. It takes user inputs for `sensitivity` and `length`, then calculates the Pseudo-Renko values using the average of the `close` and `open` prices as the `val`. The resulting `renkoClose` price is plotted on the chart, with a color change based on the `renkoDirection`. It also illustrates how you can use other values, like `high` and `low`, as input to the function.
Note: The Pseudo-Renko algorithm is based on adapting the Renko brick size dynamically based on the input `val`. This provides more flexibility compared to the normal, but is experimental. The `sensitivity` and `length` parameters, along with the choice of the `val`, offer further customization to tune the algorithm's behavior to your preference and trading style.
Sinc MAKaiser Windowed Sinc Moving Average Indicator
The Kaiser Windowed Sinc Moving Average is an advanced technical indicator that combines the sinc function with the Kaiser window to create a highly customizable finite impulse response (FIR) filter for financial time series analysis.
Sinc Function: The Ideal Low-Pass Filter
At the core of this indicator is the sinc function, which represents the impulse response of an ideal low-pass filter. In signal processing and technical analysis, the sinc function is crucial because it allows for the creation of filters with precise frequency cutoff characteristics. When applied to financial data, this means the ability to separate long-term trends from short-term fluctuations with remarkable accuracy.
The primary advantage of using a sinc-based filter is the independent control over two critical parameters: the cutoff frequency and the number of samples used. The cutoff frequency, analogous to the "length" in traditional moving averages, determines which price movements are considered significant (low frequency) and which are treated as noise (high frequency). By adjusting the cutoff, analysts can fine-tune the filter to respond to specific market cycles or timeframes of interest.
The number of samples used in the filter doesn't affect the cutoff frequency but instead influences the filter's accuracy and steepness. Increasing the sample size results in a better approximation of the ideal low-pass filter, leading to sharper transitions between passed and attenuated frequencies. This allows for more precise trend identification and noise reduction without changing the fundamental frequency response characteristics.
Kaiser Window: Optimizing the Sinc Filter
While the sinc function provides excellent frequency domain characteristics, it has infinite length in the time domain, which is impractical for real-world applications. This is where the Kaiser window comes into play. By applying the Kaiser window to the sinc function, we create a finite-length filter that approximates the ideal response while minimizing unwanted oscillations (known as the Gibbs phenomenon) in the frequency domain.
The Kaiser window introduces an additional parameter, alpha, which controls the trade-off between the main-lobe width and side-lobe levels in the frequency response. This parameter allows users to fine-tune the filter's behavior, balancing between sharp cutoffs and minimal ripple effects.
Customizable Parameters
The Kaiser Windowed Sinc Moving Average offers several key parameters for customization:
Cutoff: Controls the filter's cutoff frequency, determining the divide between trends and noise.
Length: Sets the number of samples used in the FIR filter calculation, affecting the filter's accuracy and computational complexity.
Alpha: Influences the shape of the Kaiser window, allowing for fine-tuning of the filter's frequency response characteristics.
Centered and Non-Centered Modes
The indicator provides two operational modes:
Non-Centered (Real-time) Mode: Uses half of the windowed sinc function, suitable for real-time analysis and current market conditions.
Centered Mode: Utilizes the full windowed sinc function, resulting in a zero-phase filter. This mode introduces a delay but offers the most accurate trend identification for historical analysis.
Visualization Features
To enhance the analytical value of the indicator, several visualization options are included:
Gradient Coloring: Offers a range of color schemes to represent trend direction and strength.
Glow Effect: An optional visual enhancement for improved line visibility.
Background Fill: Highlights the area between the moving average and price, aiding in trend visualization.
Applications in Technical Analysis
The Kaiser Windowed Sinc Moving Average is particularly useful for precise trend identification, cycle analysis, and noise reduction in financial time series. Its ability to create custom low-pass filters with independent control over cutoff and filter accuracy makes it a powerful tool for analyzing various market conditions and timeframes.
Compared to traditional moving averages, this indicator offers superior frequency response characteristics and reduced lag in trend identification when properly tuned. It provides greater flexibility in filter design, allowing analysts to create moving averages tailored to specific trading strategies or market behaviors.
Conclusion
The Kaiser Windowed Sinc Moving Average represents an advanced approach to price smoothing and trend identification in technical analysis. By making the ideal low-pass filter characteristics of the sinc function practically applicable through Kaiser windowing, this indicator provides traders and analysts with a sophisticated tool for examining price trends and cycles.
Its implementation in Pine Script contributes to the TradingView community by making advanced signal processing techniques accessible for experimentation and further development in technical analysis. This indicator serves not only as a practical tool for market analysis but also as an educational resource for those interested in the intersection of signal processing and financial markets.
Related script:
Thai Gold 96.5%Gold 96.5% Price Display (Test Version)
This Pine Script indicator is a test version designed to display the current price of Thai gold (96.5%) in a customizable table on your TradingView chart. The script calculates the gold price using the latest values for XAU/USD and USD/THB, reflecting the price of gold in Thai Baht (THB) with a purity adjustment.
Features:
- Price Calculation: Computes the Thai gold price by multiplying the XAU/USD price with USD/THB and adjusting for gold purity (0.49 * 0.965).
- Customizable Display: Adjust text size, text color, background color, and table position (Top Right, Top Left, Bottom Right, Bottom Left).
- Formatted Output: Gold price is formatted with commas for better readability.
Inputs:
- Text Size: Choose from tiny, small, normal, large, or huge.
- Text Color: Customize the text color.
- Background Color: Select a background color for the table.
- Table Position: Choose the table position on the chart.
Usage:
Add this test script to your TradingView chart to see the current Thai gold price displayed in a table format. This version is for testing purposes and may be updated based on feedback.
Feel free to test and customize the script further!
Kaiser Window MAKaiser Window Moving Average Indicator
The Kaiser Window Moving Average is a technical indicator that implements the Kaiser window function in the context of a moving average. This indicator serves as an example of applying the Kaiser window and the modified Bessel function of the first kind in technical analysis, providing an open-source implementation of these functions in the TradingView Pine Script ecosystem.
Key Components
Kaiser Window Implementation
This indicator incorporates the Kaiser window, a parameterized window function with certain frequency response characteristics. By making this implementation available in Pine Script, it allows for exploration and experimentation with the Kaiser window in the context of financial time series analysis.
Modified Bessel Function of the First Kind
The indicator includes an implementation of the modified Bessel function of the first kind, which is integral to the Kaiser window calculation. This mathematical function is now accessible within TradingView, potentially useful for other custom indicators or studies.
Customizable Alpha Parameter
The indicator features an adjustable alpha parameter, which directly influences the shape of the Kaiser window. This parameter allows for experimentation with the indicator's behavior:
Lower alpha values: The indicator's behavior approaches that of a Simple Moving Average (SMA)
Moderate alpha values: The behavior becomes more similar to a Weighted Moving Average (WMA)
Higher alpha values: Increases the weight of more recent data points
In signal processing terms, the alpha parameter affects the trade-off between main-lobe width and side lobe level in the frequency domain.
Centered and Non-Centered Modes
The indicator offers two operational modes:
Non-Centered (Real-time) Mode: Uses half of the Kaiser window, starting from the peak. This mode operates similarly to traditional moving averages, suitable for real-time analysis.
Centered Mode: Utilizes the full Kaiser window, resulting in a phase-correct filter. This mode introduces a delay equal to half the window size, with the plot automatically offset to align with the correct time points.
Visualization Options
The indicator includes several visualization features to aid in analysis:
Gradient Coloring: Offers three gradient options:
• Three-color gradient: Includes a neutral color
• Two-color gradient: Traditional up/down color scheme
• Solid color: For a uniform appearance
Glow Effect: An optional visual enhancement for the moving average line.
Background Fill: An option to fill the area between the moving average and the price.
Use Cases
The Kaiser Window Moving Average can be applied similarly to other moving averages. Its primary value lies in providing an example implementation of the Kaiser window and modified Bessel function in TradingView. It serves as a starting point for traders and analysts interested in exploring these mathematical concepts in the context of technical analysis.
Conclusion
The Kaiser Window Moving Average indicator demonstrates the application of the Kaiser window function in a moving average calculation. By providing open-source implementations of the Kaiser window and the modified Bessel function of the first kind, this indicator contributes to the expansion of available mathematical tools in the TradingView Pine Script environment, potentially facilitating further experimentation and development in technical analysis.
Fisher Divergence Overlay [BackQuant]Fisher Divergence Overlay
You can find the other Fisher Script Here !
Overlay Adaptation The Fisher Divergence Overlay is a newly enhanced version of the original Fisher Transformation indicator, designed specifically to be plotted directly on price charts. This adaptation allows traders to visualize Fisher Transform signals, divergences, and trend shifts directly over the price action, offering a more intuitive way to monitor market trends and potential reversals without the need for separate indicator windows. The overlay structure is particularly useful for spotting divergences and shifts in momentum as they relate to key price levels.
Why Turn the Fisher into an Overlay?
By transforming the Fisher Divergence indicator into an overlay, traders gain a more direct view of the relationship between price movements and the Fisher Transformation's signals. Divergences and midline crossovers, key components of the Fisher strategy, can now be clearly seen relative to the current price action. The decision to integrate this functionality as an overlay allows for a cleaner and more insightful trading experience, helping traders make quicker, more informed decisions based on market dynamics.
Midline Cross Signals : The overlay makes it easy to see when the Fisher Transform crosses above or below the midline, a critical signal for potential trend reversals.
Divergence Signals : Both regular and hidden divergences are plotted directly over price bars, offering immediate visual confirmation of potential trend shifts.
Key Features of the Overlay Version
Kaufman Adaptive Moving Average (KAMA): The Fisher Transformation in this overlay version can be adapted using Kaufman’s Adaptive Moving Average (KAMA). This enhances the Fisher's responsiveness to current market volatility, smoothing out price data while maintaining the accuracy of trend signals.
Divergence Detection: The overlay includes both regular and hidden bullish and bearish divergence detection, with these divergences plotted directly on the price chart. This visual feedback makes it easier for traders to spot when the momentum of the Fisher Transform deviates from the actual price movement, often signaling potential reversals.
Dynamic Bar Coloring: The bars are color-coded based on either the Fisher trend or divergences, allowing traders to visually interpret market sentiment without additional analysis. Green bars signal an upward trend or bullish divergence, while red bars indicate a downward trend or bearish divergence.
Take Profit Hues: In conjunction with a normalized RSI, the overlay includes background hues for overbought and oversold conditions, providing additional context for exit points or potential reversals.
How to Use the Fisher Overlay Traders can use this overlay to streamline their workflow by having both the Fisher signals and price action in the same visual space. The key signals include:
Midline Cross Signals: A crossover of the Fisher Transform above the midline often indicates a shift toward bullish momentum, while a cross below suggests bearish momentum.
Divergences: Regular and hidden divergences, displayed directly on the chart, help traders identify moments when the momentum of the Fisher Transform is in contrast with price movements, signaling potential reversals.
RSI Confluence: Overbought and oversold signals, provided by the integrated RSI, give further insight into potential exhaustion points in the market, marked by background color changes on the chart.
Strategic Value of the Fisher Divergence Overlay
This overlay offers a streamlined, efficient way to interpret Fisher Transform signals, divergences, and confluence signals like RSI in real-time. The visual integration of these signals with price action enhances decision-making by providing immediate context, making it easier to spot high-probability trade setups.
Trend Confirmation: The overlay version helps confirm trends by visually aligning Fisher Transform signals with price levels. Traders can use this feature to strengthen their conviction before entering or exiting a trade.
Adaptability: With the option to use KAMA for adaptive price smoothing, this overlay remains responsive across different market environments, making it suitable for both trending and volatile markets.
Summary and Interpretation Tips
It enhances the traditional Fisher Transform with visual elements like divergence detection, RSI confluence, and midline cross signals. By overlaying these elements directly on the price chart, traders can quickly interpret key signals and make better trading decisions.
Use this indicator to identify trend shifts and potential reversals by focusing on midline crossovers and divergences. The visual cues—bar colors, divergence labels, and background hues—make it easy to spot actionable moments without cluttering the chart. For best results, combine this overlay with other trend-following tools to confirm your trades and maximize the utility of Fisher Transform signals.
Matrix Glitch | FractalystThe Matrix Glitch indicator is a visually engaging tool for traders, inspired by the iconic Matrix movie effects. It overlays price charts with dynamic, multi-colored glitches that sync with market data, creating a striking, almost surreal visual experience.
The indicator uses characters from various languages (e.g., Japanese, Chinese, Russian, English) to mimic the digital rain effect from the movies. Users can select a language, which activates a corresponding array of characters. These characters are randomly picked from the chosen array and displayed on the chart.
Underlying Calculations and Logic
Arrays in the Indicator
1- Character Management:
The script uses arrays to store sets of characters representing different symbols or alphabets. These arrays allow the indicator to dynamically select and update characters for display. Each element in these arrays corresponds to a specific character that will be used to populate the grid.
2- Current and Previous States:
Arrays are employed to keep track of the current state of characters that are displayed on the grid. Simultaneously, another set of arrays records the previous state of these characters. This dual-state management allows the script to smoothly transition between updates, handling changes in characters and visual effects like fading.
3- Transparency Control:
Transparency levels for each character in the grid are managed through arrays. These arrays store the opacity values, ensuring that each character has the appropriate level of transparency. By comparing the current and previous transparency states, the script can create effects like gradual fading or intensifying visibility.
4- Rain Effect Simulation:
To create the "rain" effect, the script maintains arrays that simulate the falling text by continuously updating the position and visibility of characters. As new characters enter the top of the grid, older ones are removed from the bottom, with their transparency levels adjusted to simulate movement.
5- Operational Flow:
Initialization : Arrays are initialized to manage both the characters and their transparency. This setup allows the script to handle the dynamic display efficiently.
Updates : During each cycle, new characters are selected and old characters are shifted accordingly. The arrays ensure that both the content and appearance of the grid are updated seamlessly.
Rendering : The arrays dictate how characters and their transparency are rendered on the grid, ensuring a cohesive and visually appealing effect.
Here's how to use the indicator step-by-step:
1- Apply the Indicator to Your Charts:
Begin by adding the indicator to your chart. This will activate the visual effect on your selected trading instrument or time frame.
Select Your Preferred Language of the Matrix Characters:
In the settings, choose the language or symbol set you want the matrix characters to display. This could be anything from traditional matrix-style characters to different alphabets or custom symbols.
2- Choose the Matrix Effect (Rain, Burst):
Decide on the type of visual effect you prefer. You can select from options like the classic "rain" effect, where characters fall from the top of the screen, or a "burst" effect, where characters explode outward or appear in a different dynamic pattern.
3- Adjust the Color According to Your Preference:
Customize the color of the matrix characters to suit your aesthetic or chart theme. You can select from a range of colors or even set up a gradient for more complex visual effects.
4- Adjust the Width and Height of the Matrix According to Your Screen:
Fine-tune the dimensions of the matrix display. Set the width and height so that the matrix fits perfectly on your screen, ensuring that it aligns well with other chart elements and doesn't obstruct your view.
------
What Makes the Matrix Glitch Indicator Unique?
Language Selection:
Customizable Language: Unlike many indicators that might offer static or limited visual elements, the Matrix Glitch Indicator allows users to choose from a variety of languages for the characters displayed. This feature not only personalizes the user experience but also adds a cultural or linguistic element to trading charts. Users can select languages like Japanese, Chinese, Russian, or English, and many more.
This flexibility ensures that traders from different backgrounds can feel a connection with their charts through familiar or exotic scripts.
Dynamic Effects:
Effect Modes: The indicator offers two distinct modes - Rain Mode and Burst Mode. In Rain Mode, characters fall from the top of the chart, mimicking the iconic digital rain from the Matrix films.
In Burst Mode, characters radiate outward from a central point, creating a unique visual effect that can be synchronized with market volatility.
This dual-mode functionality allows traders to choose how they want their data to be visually represented, providing both aesthetic variety and potentially different insights into market behavior.
Color Customization:
Full Color Control: The ability to fully customize the color of the characters is a standout feature. Traders can match the indicator's colors to their trading platform's theme, their mood, or even specific market conditions (e.g., red for downturns, green for upturns). This level of customization not only aids in creating a personalized trading environment but can also serve as a visual cue for different market states.
Universal Display Compatibility:
Adjustability for All Displays: The indicator is designed to be fully adjustable for various screen resolutions and sizes. This ensures that whether you're trading on a high-resolution monitor, a laptop, or even a mobile device, the Matrix Glitch effect remains clear and impactful without compromising on the functionality of the trading chart. This adaptability is crucial in an era where trading can happen anywhere, making the indicator a versatile tool for traders on the go or in a static setup.
------
Terms and Conditions | Disclaimer
Our charting tools are provided for informational and educational purposes only and should not be construed as financial, investment, or trading advice. They are not intended to forecast market movements or offer specific recommendations. Users should understand that past performance does not guarantee future results and should not base financial decisions solely on historical data.
Built-in components, features, and functionalities of our charting tools are the intellectual property of @Fractalyst use, reproduction, or distribution of these proprietary elements is prohibited.
By continuing to use our charting tools, the user acknowledges and accepts the Terms and Conditions outlined in this legal disclaimer and agrees to respect our intellectual property rights and comply with all applicable laws and regulations.
Break of High/Low with Volume, MACD, and MAsHow It Works:
Sessions:
The London session is defined between 8:00 and 16:00 UTC.
The New York session is defined between 13:00 and 21:00 UTC.
Previous High/Low:
The script identifies the highest high and lowest low from the previous bar using ta.highest(high, 1) and ta.lowest(low, 1) .
Candle Body Size:
The script calculates the size of the current candle's body and checks if it is at least double the size of the previous candle's body.
Volume Check:
A high volume threshold is set as 1.5 times the 50-period SMA of the volume.
MACD Crossover:
The script calculates the MACD and its signal line and checks for bullish (buy) or bearish (sell) crossovers.
Signals:
A long signal (buy) is generated if the price breaks the previous high with a large body candle, high volume, and a bullish MACD crossover during the specified sessions.
A short signal (sell) is generated if the price breaks the previous low with a large body candle, high volume, and a bearish MACD crossover during the specified sessions.
Plotting:
The 50-period and 200-period moving averages, previous high, and previous low are plotted on the chart.
If a long condition is met, a "BUY" label is displayed below the bar. If a short condition is met, a "SELL" label is displayed above the bar.
Alerts:
Alerts are triggered whenever the conditions for a long or short trade are met.
Customization:
Feel free to adjust the session times, volume threshold, MACD settings, or moving averages based on your trading strategy or the specific asset you are trading.
Asset Overlay with Lag [CubeT]Asset Overlay with Lag
This indicator allows you to overlay a secondary asset on your main chart with a customizable lag. It's perfect for traders who want to analyze the relationship between the current asset and another asset with a time-shifted perspective. The secondary asset’s price data can be lagged by any number of bars, helping you spot leading or lagging behaviors between assets.
Features:
Overlay a secondary asset on your current chart.
Adjust the lag of the secondary asset to visually compare time-shifted movements.
Easily customize the lag amount directly within the settings.
How to Use:
Add the Indicator: Apply the indicator to your chart in TradingView.
Select the Secondary Asset: Choose the asset you wish to overlay (e.g., "BTC") from the indicator settings.
Set the Lag: Adjust the lag amount in bars (e.g., 7 bars for a 1-week lag on a daily chart).
Adjust Price Scale (Right-click on plotted secondary asset line > Select "Pin to scale" and choose "Pin to new left scale" to separate the scales for clearer comparison.
GC Strategy with Trend Filter and Sudden Move Profit TakingBYBIT:BTCUSDT.P 15M
Situation Assessment with Three Moving Averages
The strategy uses the crossover of the 5SMA and 25SMA as entry signals.
Additionally, the 75SMA is used as a filter. Long entries are only allowed when the price is above the 75SMA, and short entries are only allowed when the price is below the 75SMA.
ADX Filter
The Average Directional Index (ADX) is used to check the strength of the trend. Entry signals are only activated when the ADX is above 20. This ensures that trades are only executed when the trend is strong.
Sudden Move Detection
The strategy detects sudden price movements. If a sudden move occurs, the position is closed to lock in profits.
Entry
Long Entry: When the 5SMA crosses above the 25SMA, the price is above the 75SMA, and the ADX is above 20.
Short Entry: When the 5SMA crosses below the 25SMA, the price is below the 75SMA, and the ADX is above 20.
Exit
Positions are closed if a sudden move occurs. Positions are also closed if an opposing entry signal is generated.
This strategy aims to confirm the strength of the trend using moving average crossovers and ADX and to lock in profits based on sudden price movements.
3本の移動平均線による状況判断
5SMAと25SMA のクロスオーバーをエントリーシグナルとして使用します。
さらに、75SMAをフィルターとして使用し、価格が75SMAの上にある場合のみロングエントリーを許可し、75SMAの下にある場合のみショートエントリーを許可します。
ADXフィルター
ADX(平均方向性指数)を使ってトレンドの強さを確認します。
ADXが20より大きい場合のみ、エントリーシグナルを有効にします。これにより、トレンドが強い時にのみ取引を行うことができます。
急激な変動検知
価格の急激な変動を検出します。
急激な変動があった場合には、ポジションをクローズして利益を確定します。
エントリー
ロングエントリー
5SMAが25SMAを上にクロスし、価格が75SMAの上にあり、ADXが20を超えているとき。
ショートエントリー
5SMAが25SMAを下にクロスし、価格が75SMAの下にあり、ADXが20を超えているとき。
エグジット
急激な変動があった場合、ポジションをクローズします。
反対のエントリーシグナルが発生した場合にも、ポジションをクローズします。
このストラテジーは、移動平均のクロスオーバーとADXを使ってトレンドの強さを確認し、急激な変動に基づいて利益を確定することを目的としています。
Fibonacci Retracements & Trend Following Strategy V2This Pine Script strategy generates trading signals using Fibonacci levels and trend-following indicators.
1. Strategy Summary
This strategy analyzes price movements using a combination of Fibonacci levels and trend-following indicators, providing potential trading signals. The strategy includes Fibonacci levels as well as EMA (Exponential Moving Average) and ADX (Average Directional Index) indicators.
2. Indicators and Parameters
Fibonacci Levels
Fibonacci Level 1, Level 2, Level 3, Level 4: Used as Fibonacci retracement levels. These levels are typically set at 0.236, 0.382, 0.618, and 0.786. Users can adjust these values according to their preferences.
Trend-Following Indicator
Trend Length: The period for calculating the EMA used as the trend-following indicator. For example, if set to 20, the EMA will be calculated over 20 periods.
ADX (Average Directional Index)
ADX Length: The period for calculating the ADX. ADX measures the strength of the price trend and is usually set to 14 periods.
ADX Threshold: A threshold value for the ADX. This value determines when trading signals will be activated.
3. Usage Steps
Displaying the Indicator on the Chart:
On the TradingView platform, paste the code into the Pine Editor and click the "Add to Chart" button to add it to the chart.
Analyzing the Indicators:
Fibonacci Levels: Show retracement levels of price movements. When the price reaches one of these levels, potential reversals may occur.
Trend-Following Indicator: EMAs determine the direction of the trend. Green EMA represents an uptrend, while red EMA represents a downtrend.
ADX: Measures the strength of the trend. When ADX surpasses the threshold value, it indicates a strong trend.
Trading Signals:
Long Signal: Generated when the price is above the second Fibonacci level and the trend is upward. Additionally, the ADX value must be above the set threshold.
Short Signal: Generated when the price is below the second Fibonacci level and the trend is downward. Additionally, the ADX value must be above the set threshold.
Target Prices:
Long Targets: Determines upward targets based on Fibonacci levels. These targets indicate expected prices if the price reverses from Fibonacci levels.
Short Targets: Determines downward targets based on Fibonacci levels. These targets indicate expected prices if the price reverses from Fibonacci levels.
4. Chart Displays
Trend Up (Green Line): Shows the rising EMA.
Trend Down (Red Line): Shows the falling EMA.
Fibonacci Levels (Blue Lines): Shows Fibonacci retracement levels.
Long Targets (Green Circles): Shows targets for long positions.
Short Targets (Red Circles): Shows targets for short positions.
Long Signal (Green Label): Buy signal.
Short Signal (Red Label): Sell signal.
5. Important Notes
Retracement and Target Levels: Fibonacci levels can act as potential retracement or support/resistance levels. However, they should always be used in conjunction with other technical analysis tools.
Trend and ADX: ADX is used to determine the strength of the trend. Be aware that when ADX is low, trends may be weak.
6. Example Scenarios
Example 1: If the trend is upward (green EMA) and the price is above the second Fibonacci level, you may receive a long position signal. If the ADX value is above the threshold, the signal may be stronger.
Example 2: If the trend is downward (red EMA) and the price is below the second Fibonacci level, you may receive a short position signal. If the ADX value is above the threshold, the signal may be stronger.
This updated version contains significant improvements in both technical aspects and user experience. Innovations such as ADX calculations and dynamic Fibonacci levels make the strategy more robust and flexible. The code's readability and comprehensibility have been enhanced, and errors have been corrected.
This guide will help you understand the basic operation of the strategy. It is always recommended to conduct your own research and test the strategy before using it.
GOOD LUCK. // halilvarol