Trading Capital Management for Option SellingTrading Capital Management for Option Selling
This Pine Script indicator helps manage trading capital allocation for option selling strategies based on price percentile ranking. It provides dynamic allocation recommendations for index options (NIFTY and BANKNIFTY) and individual stock positions.
Key Features:
- Dynamic buying power (BP) allocation based on close price percentile
- Flexible index allocation between NIFTY and BANKNIFTY
- Automated calculation of recommended number of stock positions
- Risk management through position size limits
- Real-time INDIA VIX monitoring
Main Parameters:
1. Window Length: Period for percentile calculation (default: 252 days)
2. Thresholds: Low (30%) and High (70%) percentile thresholds
3. Capital Settings:
- Trading Capital: Total capital available
- Max BP% per Stock: Maximum allocation per stock position
4. Buying Power Range:
- Low Percentile BP%: Base BP usage at low percentile
- High Percentile BP%: Maximum BP usage at high percentile
5. Index Allocation:
- NIFTY/BANKNIFTY split ratio
- Minimum and maximum allocation thresholds
Display:
The indicator shows two tables:
1. Common Metrics:
- Total BP Usage with percentage
- Current INDIA VIX value
- Current Close Price Percentile
2. Capital Allocation:
- Index-wise BP allocation (NIFTY and BANKNIFTY)
- Stock allocation pool
- Recommended number of stock positions with BP per stock
Usage:
This indicator helps traders:
1. Scale positions based on market conditions using price percentile
2. Maintain balanced exposure between indices and stocks
3. Optimize capital utilization while managing risk
4. Adjust position sizing dynamically with market volatility
Indicators and strategies
Volume Pro Indicator## Volume Pro Indicator
A powerful volume indicator that visualizes volume distribution across different price levels. This tool helps you easily identify where trading activity concentrates within the price range.
### Key Features:
- **Volume visualization by price levels**: Green (lower zone), Magenta (middle zone), Cyan (upper zone)
- **VPOC (Volume Point of Control)**: Shows the price level with the highest volume concentration
- **High and Low lines**: Highlights the extreme levels of the analyzed price range
- **Customizable historical analysis**: Configurable number of days for calculation
### How to use it:
- Colored volumes show where trading activity concentrates within the price range
- The VPOC helps identify the most significant price levels
- Different colors allow you to quickly visualize volume distribution in different price areas
Customizable with numerous options, including analysis period, calculation resolution, colors, and visibility of different components.
### Note:
This indicator works best on higher timeframes (1H, 4H, 1D) and liquid markets. It's a visual analysis tool that enhances your understanding of market structure.
#volume #vpoc #distribution #volumeprofile #trading #analysis #indicator #professional #pricelevels #volumedistribution
Currency Futures vs USD Basket ComparisonCurrency Futures vs USD Basket
An indicator that normalizes and compares the USD Basket (DXY) vs futures for other currencies.
volume profile ranking indicator📌 Introduction
This script implements a volume profile ranking indicato for TradingView. It is designed to visualize the distribution of traded volume over price levels within a defined historical window. Unlike TradingView’s built-in Volume Profile, this script gives full customization of the profile drawing logic, binning, color gradient, and the ability to anchor the profile to a specific date.
⚙️ How It Works (Logic)
1. Inputs
➤POC Lookback Days (lookback): Defines how many bars (days) to look back from a selected point to calculate the volume distribution.
➤Bin Count (bin_count): Determines how many price bins (horizontal levels) the price range will be divided into.
➤Use Custom Lookback Date (useCustomDate): Enables/disables manually selecting a backtest start date.
➤Custom Lookback Date (customDate): When enabled, the profile will calculate volume based on this date instead of the most recent bar.
2. Target Bar Determination
➤If a custom date is selected, the script searches for the bar closest to that date within 1000 bars.
➤If not, it defaults to the latest bar (bar_index).
➤The profile is drawn only when the current bar is close to the target bar (within ±2 bars), to avoid unnecessary recalculations and performance issues.
3. Volume Binning
➤The price range over the lookback window is divided into bin_count segments.
➤For each bar within the lookback window, its volume is added to the appropriate bin based on price.
➤If the price falls outside the expected range, it is clamped to the first or last bin.
4. Ranking and Sorting
➤A bubble sort ranks each bin by total volume.
➤The most active bin (POC, or Point of Control) is highlighted with a thicker bar.
5. Rendering
➤Horizontal bars (line.new) represent volume intensity in each price bin.
➤Each bar is color-coded by volume heat: more volume = more intense color.
➤Labels (label.new) show:
➤Total volume
➤Rank
➤Percentage of total volume
➤Price range of the bin
🧑💻 How to Use
1. Add the Script to Your Chart
➤Copy the code into TradingView’s Pine Script editor and add it to your chart.
2. Set Lookback Period
➤Default is 252 bars (about one year for daily charts), but can be changed via the input.
3. (Optional) Use Custom Date
●Toggle "Use Custom Lookback Date" to true.
➤Pick a date in the "Custom Lookback Date" input to anchor the profile.
4. Analyze the Volume Distribution
➤The longest (thickest) red/orange bar represents the Point of Control (POC) — the price with the most volume traded.
➤Other bars show volume distribution across price.
➤Labels display useful metrics to evaluate areas of high/low interest.
✅ Features
🔶 Customizable anchor point (custom date).
🔶Adjustable bin count and lookback length.
🔶 Clear visualization with heatmap coloring.
🔶 Lightweight and performance-optimized (especially with the shouldDrawProfile filter)
Advanced Trading Metrics DashboardThe Advanced Trading Metrics Dashboard provides traders with a comprehensive set of key market metrics in an elegant, easy-to-read format. This professional-grade indicator combines five critical trading metrics into one unified dashboard:
ADX (14): Measures trend strength with color-coded ratings
Volatility: Displays ATR as a percentage with visual classification
Volume Ratio: Analyzes buy/sell volume balance with bullish/bearish indicators
Trend: Evaluates overall market trend using EMA alignment, RSI, and MACD
Breakout: Detects and rates potential breakout opportunities
Each metric includes a visual bar chart, precise value, and qualitative rating to help you make informed trading decisions at a glance. The indicator features both a detailed data table and plot lines with appropriate scaling.
Perfect for day traders, swing traders, and technical analysts who need a quick overview of market conditions without cluttering their charts.
Customize colors and thresholds to match your trading strategy. Built with optimized Pine Script code for reliable performance.
TREND and ZL FLOWHow It Helps Traders
Trend Identification with T3 Moving Average
The script calculates a T3 moving average using a smoother version of traditional moving averages, reducing lag and providing a clearer view of trend direction.
A histogram is plotted, where green bars indicate an uptrend and red bars signal a downtrend. This helps traders visually confirm the market trend and avoid false signals.
Zero Lag Moving Average (ZLMA) for Faster Reversals
The ZLMA is designed to react more quickly to price changes while minimizing lag. It helps traders spot trend reversals sooner than traditional moving averages.
The line color changes green for bullish momentum and red for bearish momentum, making it easier to spot shifts in direction.
Overall, this indicator is useful for trend-following traders who want to capture momentum shifts efficiently. It can be particularly helpful for day traders and swing traders looking for early trend confirmation and automated trade signals.
Bitcoin Power LawThis is the main body version of the script. The Oscillator version can be found here .
Firstly, we would like to give credit to @apsk32 and @x_X_77_X_x as part of the code originates from their work. Additionally, @apsk32 is widely credited with applying the Power Law concept to Bitcoin and popularizing this model within the crypto community. Additionally, the visual layout is fully inspired by @apsk32's designs, and we think it looks amazing. So much so that we had to turn it into a TradingView script. Thank you!
Understanding the Bitcoin Power Law Model
Also called the Long-Term Bitcoin Power Law Model. The Bitcoin Power Law model tries to capture and predict Bitcoin's price growth over time. It assumes that Bitcoin's price follows an exponential growth pattern, where the price increases over time according to a mathematical relationship.
By fitting a power law to historical data, the model creates a trend line that represents this growth. It then generates additional parallel lines (support and resistance lines) to show potential price boundaries, helping to visualize where Bitcoin’s price could move within certain ranges.
In simple terms, the model helps us understand Bitcoin's general growth trajectory and provides a framework to visualize how its price could behave over the long term.
The Bitcoin Power Law has the following function:
Power Law = 10^(a + b * log10(d))
Consisting of the following parameters:
a: Power Law Intercept (default: -17.668).
b: Power Law Slope (default: 5.926).
d: Number of days since a reference point(calculated by counting bars from the reference point with an offset).
Explanation of the a and b parameters:
Roughly explained, the optimal values for the a and b parameters are determined through a process of linear regression on a log-log scale (after applying a logarithmic transformation to both the x and y axes). On this log-log scale, the power law relationship becomes linear, making it possible to apply linear regression. The best fit for the regression is then evaluated using metrics like the R-squared value, residual error analysis, and visual inspection. This process can be quite complex and is beyond the scope of this post.
Applying vertical shifts to generate the other lines:
Once the initial power-law is created, additional lines are generated by applying a vertical shift . This shift is achieved by adding a specific number of days (or years in case of this script) to the d-parameter. This creates new lines perfectly parallel to the initial power law with an added vertical shift, maintaining the same slope and intercept.
In the case of this script, shifts are made by adding +365 days, +2 * 365 days, +3 * 365 days, +4 * 365 days, and +5 * 365 days, effectively introducing one to five years of shifts. This results in a total of six Power Law lines, as outlined below (From lowest to highest):
Base Power Law Line (no shift)
1-year shifted line
2-year shifted line
3-year shifted line
4-year shifted line
5-year shifted line
The six power law lines:
Bitcoin Power Law Oscillator
This publication also includes the oscillator version of the Bitcoin Power Law. This version applies a logarithmic transformation to the price, Base Power Law Line, and 5-year shifted line using the formula log10(x) .
The log-transformed price is then normalized using min-max normalization relative to the log-transformed Base Power Law Line and 5-year shifted line with the formula:
normalized price = log(close) - log(Base Power Law Line) / log(5-year shifted line) - log(Base Power Law Line)
Finally, the normalized price was multiplied by 5 to map its value between 0 and 5, aligning with the shifted lines.
Interpretation of the Bitcoin Power Law Model:
The shifted Power Law lines provide a framework for predicting Bitcoin's future price movements based on historical trends. These lines are created by applying a vertical shift to the initial Power Law line, with each shifted line representing a future time frame (e.g., 1 year, 2 years, 3 years, etc.).
By analyzing these shifted lines, users can make predictions about minimum price levels at specific future dates. For example, the 5-year shifted line will act as the main support level for Bitcoin’s price in 5 years, meaning that Bitcoin’s price should not fall below this line, ensuring that Bitcoin will be valued at least at this level by that time. Similarly, the 2-year shifted line will serve as the support line for Bitcoin's price in 2 years, establishing that the price should not drop below this line within that time frame.
On the other hand, the 5-year shifted line also functions as an absolute resistance , meaning Bitcoin's price will not exceed this line prior to the 5-year mark. This provides a prediction that Bitcoin cannot reach certain price levels before a specific date. For example, the price of Bitcoin is unlikely to reach $100,000 before 2021, and it will not exceed this price before the 5-year shifted line becomes relevant. After 2028, however, the price is predicted to never fall below $100,000, thanks to the support established by the shifted lines.
In essence, the shifted Power Law lines offer a way to predict both the minimum price levels that Bitcoin will hit by certain dates and the earliest dates by which certain price points will be reached. These lines help frame Bitcoin's potential future price range, offering insight into long-term price behavior and providing a guide for investors and analysts. Lets examine some examples:
Example 1:
In Example 1 it can be seen that point A on the 5-year shifted line acts as major resistance . Also it can be seen that 5 years later this price level now corresponds to the Base Power Law Line and acts as a major support (Note: Vertical yearly grid lines have been added for this purpose👍).
Example 2:
In Example 2, the price level at point C on the 3-year shifted line becomes a major support three years later at point C, now aligning with the Base Power Law Line.
Finally, let's explore some future price predictions, as this script provides projections on the weekly timeframe :
Example 3:
In Example 3, the Bitcoin Power Law indicates that Bitcoin's price cannot surpass approximately $808K before 2030 as can be seen at point E, while also ensuring it will be at least $224K by then (point F).
Bitcoin Power Law OscillatorThis is the oscillator version of the script. The main body of the script can be found here .
Firstly, we would like to give credit to @apsk32 and @x_X_77_X_x as part of the code originates from their work. Additionally, @apsk32 is widely credited with applying the Power Law concept to Bitcoin and popularizing this model within the crypto community. Additionally, the visual layout is fully inspired by @apsk32's designs, and we think it looks amazing. So much so that we had to turn it into a TradingView script. Thank you!
Understanding the Bitcoin Power Law Model
Also called the Long-Term Bitcoin Power Law Model. The Bitcoin Power Law model tries to capture and predict Bitcoin's price growth over time. It assumes that Bitcoin's price follows an exponential growth pattern, where the price increases over time according to a mathematical relationship.
By fitting a power law to historical data, the model creates a trend line that represents this growth. It then generates additional parallel lines (support and resistance lines) to show potential price boundaries, helping to visualize where Bitcoin’s price could move within certain ranges.
In simple terms, the model helps us understand Bitcoin's general growth trajectory and provides a framework to visualize how its price could behave over the long term.
The Bitcoin Power Law has the following function:
Power Law = 10^(a + b * log10(d))
Consisting of the following parameters:
a: Power Law Intercept (default: -17.668).
b: Power Law Slope (default: 5.926).
d: Number of days since a reference point(calculated by counting bars from the reference point with an offset).
Explanation of the a and b parameters:
Roughly explained, the optimal values for the a and b parameters are determined through a process of linear regression on a log-log scale (after applying a logarithmic transformation to both the x and y axes). On this log-log scale, the power law relationship becomes linear, making it possible to apply linear regression. The best fit for the regression is then evaluated using metrics like the R-squared value, residual error analysis, and visual inspection. This process can be quite complex and is beyond the scope of this post.
Applying vertical shifts to generate the other lines:
Once the initial power-law is created, additional lines are generated by applying a vertical shift . This shift is achieved by adding a specific number of days (or years in case of this script) to the d-parameter. This creates new lines perfectly parallel to the initial power law with an added vertical shift, maintaining the same slope and intercept.
In the case of this script, shifts are made by adding +365 days, +2 * 365 days, +3 * 365 days, +4 * 365 days, and +5 * 365 days, effectively introducing one to five years of shifts. This results in a total of six Power Law lines, as outlined below (From lowest to highest):
Base Power Law Line (no shift)
1-year shifted line
2-year shifted line
3-year shifted line
4-year shifted line
5-year shifted line
The six power law lines:
Bitcoin Power Law Oscillator
This publication also includes the oscillator version of the Bitcoin Power Law. This version applies a logarithmic transformation to the price, Base Power Law Line, and 5-year shifted line using the formula log10(x) .
The log-transformed price is then normalized using min-max normalization relative to the log-transformed Base Power Law Line and 5-year shifted line with the formula:
normalized price = log(close) - log(Base Power Law Line) / log(5-year shifted line) - log(Base Power Law Line)
Finally, the normalized price was multiplied by 5 to map its value between 0 and 5, aligning with the shifted lines.
Interpretation of the Bitcoin Power Law Model:
The shifted Power Law lines provide a framework for predicting Bitcoin's future price movements based on historical trends. These lines are created by applying a vertical shift to the initial Power Law line, with each shifted line representing a future time frame (e.g., 1 year, 2 years, 3 years, etc.).
By analyzing these shifted lines, users can make predictions about minimum price levels at specific future dates. For example, the 5-year shifted line will act as the main support level for Bitcoin’s price in 5 years, meaning that Bitcoin’s price should not fall below this line, ensuring that Bitcoin will be valued at least at this level by that time. Similarly, the 2-year shifted line will serve as the support line for Bitcoin's price in 2 years, establishing that the price should not drop below this line within that time frame.
On the other hand, the 5-year shifted line also functions as an absolute resistance , meaning Bitcoin's price will not exceed this line prior to the 5-year mark. This provides a prediction that Bitcoin cannot reach certain price levels before a specific date. For example, the price of Bitcoin is unlikely to reach $100,000 before 2021, and it will not exceed this price before the 5-year shifted line becomes relevant. After 2028, however, the price is predicted to never fall below $100,000, thanks to the support established by the shifted lines.
In essence, the shifted Power Law lines offer a way to predict both the minimum price levels that Bitcoin will hit by certain dates and the earliest dates by which certain price points will be reached. These lines help frame Bitcoin's potential future price range, offering insight into long-term price behavior and providing a guide for investors and analysts. Lets examine some examples:
Example 1:
In Example 1 it can be seen that point A on the 5-year shifted line acts as major resistance . Also it can be seen that 5 years later this price level now corresponds to the Base Power Law Line and acts as a major support (Note: Vertical yearly grid lines have been added for this purpose👍).
Example 2:
In Example 2, the price level at point C on the 3-year shifted line becomes a major support three years later at point C, now aligning with the Base Power Law Line.
Finally, let's explore some future price predictions, as this script provides projections on the weekly timeframe :
Example 3:
In Example 3, the Bitcoin Power Law indicates that Bitcoin's price cannot surpass approximately $808K before 2030 as can be seen at point E, while also ensuring it will be at least $224K by then (point F).
52-Week Breakout w/10%SL - Created by Sai DhakshinThis plots the 52 week high and entry on breakout keeping the 10% stoploss that is market below the LTP of the asset and the breakout of the 52 week high
Bitcoin Polynomial Regression ModelThis is the main version of the script. Click here for the Oscillator part of the script.
💡Why this model was created:
One of the key issues with most existing models, including our own Bitcoin Log Growth Curve Model , is that they often fail to realistically account for diminishing returns. As a result, they may present overly optimistic bull cycle targets (hence, we introduced alternative settings in our previous Bitcoin Log Growth Curve Model).
This new model however, has been built from the ground up with a primary focus on incorporating the principle of diminishing returns. It directly responds to this concept, which has been briefly explored here .
📉The theory of diminishing returns:
This theory suggests that as each four-year market cycle unfolds, volatility gradually decreases, leading to more tempered price movements. It also implies that the price increase from one cycle peak to the next will decrease over time as the asset matures. The same pattern applies to cycle lows and the relationship between tops and bottoms. In essence, these price movements are interconnected and should generally follow a consistent pattern. We believe this model provides a more realistic outlook on bull and bear market cycles.
To better understand this theory, the relationships between cycle tops and bottoms are outlined below:https://www.tradingview.com/x/7Hldzsf2/
🔧Creation of the model:
For those interested in how this model was created, the process is explained here. Otherwise, feel free to skip this section.
This model is based on two separate cubic polynomial regression lines. One for the top price trend and another for the bottom. Both follow the general cubic polynomial function:
ax^3 +bx^2 + cx + d.
In this equation, x represents the weekly bar index minus an offset, while a, b, c, and d are determined through polynomial regression analysis. The input (x, y) values used for the polynomial regression analysis are as follows:
Top regression line (x, y) values:
113, 18.6
240, 1004
451, 19128
655, 65502
Bottom regression line (x, y) values:
103, 2.5
267, 211
471, 3193
676, 16255
The values above correspond to historical Bitcoin cycle tops and bottoms, where x is the weekly bar index and y is the weekly closing price of Bitcoin. The best fit is determined using metrics such as R-squared values, residual error analysis, and visual inspection. While the exact details of this evaluation are beyond the scope of this post, the following optimal parameters were found:
Top regression line parameter values:
a: 0.000202798
b: 0.0872922
c: -30.88805
d: 1827.14113
Bottom regression line parameter values:
a: 0.000138314
b: -0.0768236
c: 13.90555
d: -765.8892
📊Polynomial Regression Oscillator:
This publication also includes the oscillator version of the this model which is displayed at the bottom of the screen. The oscillator applies a logarithmic transformation to the price and the regression lines using the formula log10(x) .
The log-transformed price is then normalized using min-max normalization relative to the log-transformed top and bottom regression line with the formula:
normalized price = log(close) - log(bottom regression line) / log(top regression line) - log(bottom regression line)
This transformation results in a price value between 0 and 1 between both the regression lines. The Oscillator version can be found here.
🔍Interpretation of the Model:
In general, the red area represents a caution zone, as historically, the price has often been near its cycle market top within this range. On the other hand, the green area is considered an area of opportunity, as historically, it has corresponded to the market bottom.
The top regression line serves as a signal for the absolute market cycle peak, while the bottom regression line indicates the absolute market cycle bottom.
Additionally, this model provides a predicted range for Bitcoin's future price movements, which can be used to make extrapolated predictions. We will explore this further below.
🔮Future Predictions:
Finally, let's discuss what this model actually predicts for the potential upcoming market cycle top and the corresponding market cycle bottom. In our previous post here , a cycle interval analysis was performed to predict a likely time window for the next cycle top and bottom:
In the image, it is predicted that the next top-to-top cycle interval will be 208 weeks, which translates to November 3rd, 2025. It is also predicted that the bottom-to-top cycle interval will be 152 weeks, which corresponds to October 13th, 2025. On the macro level, these two dates align quite well. For our prediction, we take the average of these two dates: October 24th 2025. This will be our target date for the bull cycle top.
Now, let's do the same for the upcoming cycle bottom. The bottom-to-bottom cycle interval is predicted to be 205 weeks, which translates to October 19th, 2026, and the top-to-bottom cycle interval is predicted to be 259 weeks, which corresponds to October 26th, 2026. We then take the average of these two dates, predicting a bear cycle bottom date target of October 19th, 2026.
Now that we have our predicted top and bottom cycle date targets, we can simply reference these two dates to our model, giving us the Bitcoin top price prediction in the range of 152,000 in Q4 2025 and a subsequent bottom price prediction in the range of 46,500 in Q4 2026.
For those interested in understanding what this specifically means for the predicted diminishing return top and bottom cycle values, the image below displays these predicted values. The new values are highlighted in yellow:
And of course, keep in mind that these targets are just rough estimates. While we've done our best to estimate these targets through a data-driven approach, markets will always remain unpredictable in nature. What are your targets? Feel free to share them in the comment section below.
TREND and ZL - TFTTREND and ZL - TFT
How It Helps Traders
Trend Identification with T3 Moving Average
The script calculates a T3 moving average using an 8-period length and a volume factor of 0.7. The T3 MA is a smoother version of traditional moving averages, reducing lag and providing a clearer view of trend direction.
A histogram is plotted, where green bars indicate an uptrend and red bars signal a downtrend. This helps traders visually confirm the market trend and avoid false signals.
Zero Lag Moving Average (ZLMA) for Faster Reversals
The ZLMA is designed to react more quickly to price changes while minimizing lag. It helps traders spot trend reversals sooner than traditional moving averages.
The line color changes green for bullish momentum and red for bearish momentum, making it easier to spot shifts in direction.
Overall, this indicator is useful for trend-following traders who want to capture momentum shifts efficiently. It can be particularly helpful for day traders and swing traders looking for early trend confirmation and automated trade signals.
Bitcoin Polynomial Regression OscillatorThis is the oscillator version of the script. Click here for the other part of the script.
💡Why this model was created:
One of the key issues with most existing models, including our own Bitcoin Log Growth Curve Model , is that they often fail to realistically account for diminishing returns. As a result, they may present overly optimistic bull cycle targets (hence, we introduced alternative settings in our previous Bitcoin Log Growth Curve Model).
This new model however, has been built from the ground up with a primary focus on incorporating the principle of diminishing returns. It directly responds to this concept, which has been briefly explored here .
📉The theory of diminishing returns:
This theory suggests that as each four-year market cycle unfolds, volatility gradually decreases, leading to more tempered price movements. It also implies that the price increase from one cycle peak to the next will decrease over time as the asset matures. The same pattern applies to cycle lows and the relationship between tops and bottoms. In essence, these price movements are interconnected and should generally follow a consistent pattern. We believe this model provides a more realistic outlook on bull and bear market cycles.
To better understand this theory, the relationships between cycle tops and bottoms are outlined below:https://www.tradingview.com/x/7Hldzsf2/
🔧Creation of the model:
For those interested in how this model was created, the process is explained here. Otherwise, feel free to skip this section.
This model is based on two separate cubic polynomial regression lines. One for the top price trend and another for the bottom. Both follow the general cubic polynomial function:
ax^3 +bx^2 + cx + d.
In this equation, x represents the weekly bar index minus an offset, while a, b, c, and d are determined through polynomial regression analysis. The input (x, y) values used for the polynomial regression analysis are as follows:
Top regression line (x, y) values:
113, 18.6
240, 1004
451, 19128
655, 65502
Bottom regression line (x, y) values:
103, 2.5
267, 211
471, 3193
676, 16255
The values above correspond to historical Bitcoin cycle tops and bottoms, where x is the weekly bar index and y is the weekly closing price of Bitcoin. The best fit is determined using metrics such as R-squared values, residual error analysis, and visual inspection. While the exact details of this evaluation are beyond the scope of this post, the following optimal parameters were found:
Top regression line parameter values:
a: 0.000202798
b: 0.0872922
c: -30.88805
d: 1827.14113
Bottom regression line parameter values:
a: 0.000138314
b: -0.0768236
c: 13.90555
d: -765.8892
📊Polynomial Regression Oscillator:
This publication also includes the oscillator version of the this model which is displayed at the bottom of the screen. The oscillator applies a logarithmic transformation to the price and the regression lines using the formula log10(x) .
The log-transformed price is then normalized using min-max normalization relative to the log-transformed top and bottom regression line with the formula:
normalized price = log(close) - log(bottom regression line) / log(top regression line) - log(bottom regression line)
This transformation results in a price value between 0 and 1 between both the regression lines.
🔍Interpretation of the Model:
In general, the red area represents a caution zone, as historically, the price has often been near its cycle market top within this range. On the other hand, the green area is considered an area of opportunity, as historically, it has corresponded to the market bottom.
The top regression line serves as a signal for the absolute market cycle peak, while the bottom regression line indicates the absolute market cycle bottom.
Additionally, this model provides a predicted range for Bitcoin's future price movements, which can be used to make extrapolated predictions. We will explore this further below.
🔮Future Predictions:
Finally, let's discuss what this model actually predicts for the potential upcoming market cycle top and the corresponding market cycle bottom. In our previous post here , a cycle interval analysis was performed to predict a likely time window for the next cycle top and bottom:
In the image, it is predicted that the next top-to-top cycle interval will be 208 weeks, which translates to November 3rd, 2025. It is also predicted that the bottom-to-top cycle interval will be 152 weeks, which corresponds to October 13th, 2025. On the macro level, these two dates align quite well. For our prediction, we take the average of these two dates: October 24th 2025. This will be our target date for the bull cycle top.
Now, let's do the same for the upcoming cycle bottom. The bottom-to-bottom cycle interval is predicted to be 205 weeks, which translates to October 19th, 2026, and the top-to-bottom cycle interval is predicted to be 259 weeks, which corresponds to October 26th, 2026. We then take the average of these two dates, predicting a bear cycle bottom date target of October 19th, 2026.
Now that we have our predicted top and bottom cycle date targets, we can simply reference these two dates to our model, giving us the Bitcoin top price prediction in the range of 152,000 in Q4 2025 and a subsequent bottom price prediction in the range of 46,500 in Q4 2026.
For those interested in understanding what this specifically means for the predicted diminishing return top and bottom cycle values, the image below displays these predicted values. The new values are highlighted in yellow:
And of course, keep in mind that these targets are just rough estimates. While we've done our best to estimate these targets through a data-driven approach, markets will always remain unpredictable in nature. What are your targets? Feel free to share them in the comment section below.
Master Litecoin Miner Sell PressureBrief Description:
Purpose: The indicator overlays on a chart to highlight periods of high miner sell pressure for Litecoin.
Data Sources:
miner_out: Fetches daily Litecoin miner outflows (amount of LTC moved out by miners) using the INTOTHEBLOCK:LTC_MINEROUTFLOWS dataset.
miner_res: Fetches daily Litecoin miner reserves (amount of LTC held by miners) using the INTOTHEBLOCK:LTC_MINERRESERVES dataset.
Calculation:
Computes a ratio m by taking the 14-day sum of miner outflows and dividing it by the 14-day simple moving average (SMA) of miner reserves.
Calculates Bollinger Bands around m:
bbl: Lower band (200-day SMA of m minus 1 standard deviation).
bbu: Upper band (200-day SMA of m plus 1 standard deviation).
Visualization:
If the ratio m exceeds the upper Bollinger Band (bbu), the background is colored blue with 30% opacity, indicating potential high sell pressure from miners.
Short-Term Volume + MACD Trend Indicator
### How It Works
1. **VROC (Volume Rate of Change)**:
- Tracks short-term volume momentum (5-bar default).
- Positive VROC (>5%) supports uptrends; negative VROC (<-5%) supports downtrends.
2. **VMA (Volume Moving Average)**:
- 10-period SMA of volume.
- Volume > VMA confirms trend strength; volume ≤ VMA leans toward sideways.
3. **MACD**:
- Uses faster settings (9, 21, 5) for short-term responsiveness (vs. standard 12, 26, 9).
- `macdLine > signalLine` signals bullish momentum; `macdLine < signalLine` signals bearish momentum.
4. **Trend Logic**:
- **Uptrend (Green)**: MACD bullish (macdLine > signalLine) + volume > VMA + VROC > 5% → Strong buying momentum.
- **Downtrend (Red)**: MACD bearish (macdLine < signalLine) + volume > VMA + VROC < -5% → Strong selling momentum.
- **Sideways (Gray)**: Any condition where uptrend or downtrend criteria aren’t fully met (e.g., MACD flat, volume low, or VROC neutral).
5. **Visualization**:
- Plots volume, VMA, VROC, and MACD histogram for reference.
- Background colors (green, red, gray) highlight trends.
---
### Why This Improves Signals
- **MACD Filter**: Adds momentum confirmation, reducing false signals from volume alone (e.g., a volume spike without price movement won’t trigger an uptrend).
- **Volume Confirmation**: Ensures trends have participation (volume > VMA), filtering out weak MACD signals.
- **Short-Term Focus**: Faster MACD settings (9, 21, 5) and short VROC (5 bars) align with 1-minute or 5-minute chart dynamics.
---
### How to Use It
1. **Setup**:
- Paste the code into TradingView’s Pine Editor, save, and add to a 1-minute or 5-minute chart.
2. **Interpretation**:
- **Green (Uptrend)**: Look for long entries, especially if price breaks resistance or aligns with a fast EMA (e.g., 9-period).
- **Red (Downtrend)**: Consider shorts or exits, particularly on support breaks.
- **Gray (Sideways)**: Avoid trend trades; wait for a breakout or use range strategies.
3. **Confirmation**:
- Pair with price action (e.g., candlestick patterns) or a 9-EMA for stronger signals.
- Example: Green + price above 9-EMA = high-probability uptrend.
---
### Customization
- **1-Minute Scalping**:
- Set `vrocLength = 3`, `macdFast = 5`, `macdSlow = 13`, `macdSignal = 3` for ultra-fast signals.
- **5-Minute Trading**:
- Keep defaults or increase `vrocThreshold` to 10% for stricter momentum.
- **Sensitivity**:
- Lower `vmaLength` to 5 for quicker volume response; raise `vrocThreshold` to 8% for stronger trends.
---
### Example (5-Minute Chart)
- **Uptrend**: Price rises, MACD crosses above signal, volume > VMA, VROC at 7% → Green background.
- **Downtrend**: Price drops, MACD below signal, volume > VMA, VROC at -8% → Red background.
- **Sideways**: Price flattens, MACD near signal, volume < VMA, VROC at 2% → Gray background.
This combo gives you a robust short-term indicator with better signal quality. Test it on your chart, and let me know if you want tweaks—like adding buy/sell volume separation or adjusting thresholds!
Pairs Trading Pétrole-OrPair between gold and oil. When the blue line passes below the lowest green line, oil becomes undervalued relative to gold and a long on oil would become interesting until the blue line goes back over the orange line. The logic is the same for the opposite.
Master Global Liquidity Shifted 75 DaysThe Global Liquidity Index is a Pine Script (version 5) technical indicator designed to measure and visualize global financial liquidity by aggregating data from various central bank balance sheets and money supply metrics. The indicator is plotted as an overlay on the price chart using the left scale, with the entire line shifted left by 75 days.
Key features:
Data Sources: Incorporates balance sheet data from major central banks including the Federal Reserve (FED), European Central Bank (ECB), People's Bank of China (PBC), Bank of Japan (BOJ), and other central banks, along with optional M2 money supply data from various countries.
Components: Includes options to toggle specific liquidity factors such as FED balance sheet, Treasury General Account (TGA), Reverse Repurchase Agreements (RRP), and regional M2 money supplies, all converted to USD.
75-Day Shift: The indicator's output is shifted left by 75 days on the chart, aligning historical liquidity data with earlier price action, with this shift period adjustable via the "Shift Days Left" input.
Calculations:
Computes a total liquidity value by summing enabled central bank and M2 data (adjusted for RRP and TGA as drains)
Scales the total by dividing by 1 trillion (10^12)
Applies a Simple Moving Average (SMA) and Rate of Change (ROC) with user-defined periods
Final output is either the SMA of ROC or SMA alone, depending on ROC length
Visualization: Plots the shifted result as a yellow line with a linewidth of 2.
EMA Crossover with MACD and RSI Bar ColoringEMA Crossover with MACD and RSI Bar Coloring
This Pine Script (v5) indicator combines Exponential Moving Averages (EMAs), MACD, and RSI to analyze price trends and visualize them through bar coloring on TradingView charts. It features:
EMA Crossovers: Uses 5 and 8-period EMAs (always calculated) to detect uptrends (5 > 8) and downtrends (5 < 8), with optional visibility via a toggle. A 50-period EMA is included with a separate toggle for both calculation and display, preventing scale distortion when disabled.
Volume Surge: Signals EMA crossovers (triangles) only when volume exceeds a user-defined threshold relative to a lookback period.
MACD and RSI Conditions: Enhances trend strength by integrating MACD (fast/slow/signal lengths customizable) and RSI (with MA or threshold modes), both optional via toggles.
Bar Coloring: Colors bars based on trend strength:
Uptrends: Purple (very strong: EMA+MACD+RSI), Blue (strong: EMA+MACD or RSI), Green (basic: EMA only).
Downtrends: Red (very strong), Pink (strong), Orange (basic), with bearish coloring optional.
Neutral (gray) when conditions aren’t met.
Convergence/Divergence: Detects and labels Conv/Div for EMA, MACD, and RSI, indicating trend strengthening (Div) or weakening (Conv).
Visuals:
A top-right table shows EMA, MACD, and RSI trend direction, strength, Conv/Div, and bullish/bearish state.
A middle-right legend explains bar colors.
A trend label (toggleable) appears above the current bar, positioned high for clarity.
Customization: Inputs allow tweaking lengths, thresholds, and toggles for all components.
This indicator is designed for traders to quickly assess trend direction and strength while maintaining chart clarity through flexible display options.
CyclePulse MomentumCyclePulse Momentum
Overview
CyclePulse Momentum is a powerful, adaptable indicator designed to identify momentum shifts and cyclic reversals across any asset—stocks, forex, cryptocurrencies, and more. By integrating a Cyclic Smoothed RSI (cRSI) with an innovative auto-detected dominant cycle, this tool delivers precise, market-tuned signals for traders seeking to capitalize on price and volume dynamics.
How It Works
Momentum Signals (Green/Red Triangles)
Green Triangles (Below Bars): Signal bullish momentum when volume exceeds a dynamic threshold (default 1.5x the 10-period average) and price rises significantly (default ≥1.5%) or volume momentum spikes (>20% over 5 bars).
Red Triangles (Above Bars): Signal bearish momentum under the same conditions with a price drop.
These highlight high-impact moves driven by volume and price surges.
cRSI Band Crossovers (Diamonds)
Light Turquoise Diamonds (Below Bars): cRSI crosses up through the low band, indicating a potential bullish reversal from oversold territory.
Light Purple Diamonds (Above Bars): cRSI crosses down through the high band, suggesting a bearish reversal from overbought levels.
Bands adapt dynamically to market conditions, enhancing reversal precision.
cRSI 25% Level Signals (Yellow X and Circle)
Yellow X (Above Bars): cRSI crosses below the 25% level under the high band, marking an early bearish pullback.
Yellow Circle (Below Bars): cRSI crosses above the 25% level over the low band, signaling an early bullish recovery.
These provide early warnings of momentum shifts within the cycle.
Auto Dominant Cycle Advantage
The standout feature is the auto-detected dominant cycle length, which adjusts between 10 and 40 bars based on real-time peak and trough analysis (50-bar lookback). Unlike fixed-cycle indicators, this adapts to each asset’s unique rhythm, making triggers—triangles, diamonds, and X’s/circles—significantly more accurate by aligning with the market’s natural tempo. A white number (e.g., "18") appears above bars when the cycle changes, keeping you informed without clutter.
Usage Tips
Momentum Trading: Use green/red triangles to catch strong trends or reversals.
Cycle Timing: Leverage turquoise/purple diamonds for high-probability reversal points, enhanced by the auto-cycle’s precision.
Early Entries: Yellow X’s and circles offer advance signals for momentum shifts.
Customization: Adjust thresholds for your asset—lower (e.g., 1.0) for stocks, higher (e.g., 2.0) for volatile crypto. Pair with support/resistance for confirmation.
Settings
Use Auto Dominant Cycle Length: Enable (default) for adaptive, accurate triggers; disable for a fixed cycle (default 20).
Base Volume Threshold: Default 1.5—tweak for signal frequency.
Base Price Change % Threshold: Default 1.5%—adjust to asset volatility.
Volume Momentum Lookback: Default 5—shorten for faster signals, lengthen for smoother ones.
Show cRSI Band Crossovers: Enable (default) for cRSI signals; disable for simplicity.
Why It Stands Out
The auto dominant cycle sets CyclePulse Momentum apart by dynamically syncing with market waves, ensuring triggers hit when they matter most. Whether you’re scalping on 15M or swinging on 1D, this indicator adapts to deliver sharper, more reliable insights.
Fourier Trend Energy (Prototype)Fourier Trend Energy (Prototype)
This indicator brings the logic of Fourier-based trend analysis into Pine Script.
It estimates two key components:
Low-Frequency Energy — representing the strength of the underlying trend
High-Frequency Energy — representing noise, volatility, or deviation from the trend
🔹 Green line → trend strength
🔸 Orange line → short-term noise
🟩🟥 Background color → shows whether trend energy is increasing or decreasing
You can use it to:
Detect early trend formation
Filter fakeouts during consolidation
Spot momentum shifts based on energy crossovers
This is not a traditional oscillator — it’s a frequency-inspired tool to help you understand when the market is charging for a move.
EMA & RSI Signal IndicatorThis TradingView Pine Script creates a signal indicator based on Exponential Moving Averages (EMA) and Relative Strength Index (RSI).
1. User Inputs (Customizable)
Three EMAs (Default: 10, 50, 200 periods)
RSI period (Default: 14)
Checkboxes to enable/disable Buy or Sell signals
2. Indicator Calculations
EMA 10, EMA 50, and EMA 200 are calculated.
RSI (Relative Strength Index) is calculated.
3. Signal Conditions
Buy Signal:
EMA 10 is above EMA 50
RSI is below 20 (oversold condition)
Plots a green upward arrow (below the bar)
Sell Signal:
EMA 10 is below EMA 50
RSI is above 20
Plots a red downward arrow (above the bar)
4. Customization
Users can toggle Buy and Sell signals using checkboxes.
This indicator helps traders spot potential trend continuation or reversal points based on EMA & RSI conditions. 🚀
50 EMA Strategy with RSI & MACD**50 EMA Strategy with RSI & MACD**
This Pine Script indicator is designed to identify high-probability trade setups using the **50 EMA**, **RSI**, and **MACD**. The strategy generates **buy and sell signals** based on price interactions with the 50 EMA, combined with momentum confirmation from RSI and MACD.
### **Key Features:**
✅ **50 EMA as Trend Filter** – Determines whether price is in an uptrend or downtrend.
✅ **RSI Confirmation** – Ensures momentum aligns with trade direction (**RSI > 40 for buys, RSI < 60 for sells**).
✅ **MACD Confirmation** – Filters trades with MACD crossovers (**bullish for buys, bearish for sells**).
✅ **Buy Signals** – Triggered when price crosses **above** the 50 EMA, RSI confirms strength, and MACD makes a bullish crossover.
✅ **Sell Signals** – Triggered when price crosses **below** the 50 EMA, RSI confirms weakness, and MACD makes a bearish crossover.
✅ **Alerts & Visual Markers** – Buy and sell signals are plotted on the chart with labels, and alerts are set for easy trade execution.
Would you like me to refine the script to improve accuracy or match your specific trading conditions better?
Volume Weighted RSI (VW RSI)The Volume Weighted RSI (VW RSI) is a momentum oscillator designed for TradingView, implemented in Pine Script v6, that enhances the traditional Relative Strength Index (RSI) by incorporating trading volume into its calculation. Unlike the standard RSI, which measures the speed and change of price movements based solely on price data, the VW RSI weights its analysis by volume, emphasizing price movements backed by significant trading activity. This makes the VW RSI particularly effective for identifying bullish or bearish momentum, overbought/oversold conditions, and potential trend reversals in markets where volume plays a critical role, such as stocks, forex, and cryptocurrencies.
Key Features
Volume-Weighted Momentum Calculation:
The VW RSI calculates momentum by comparing the volume associated with upward price movements (up-volume) to the volume associated with downward price movements (down-volume).
Up-volume is the volume on bars where the closing price is higher than the previous close, while down-volume is the volume on bars where the closing price is lower than the previous close.
These volumes are smoothed over a user-defined period (default: 14 bars) using a Running Moving Average (RMA), and the VW RSI is computed using the formula:
\text{VW RSI} = 100 - \frac{100}{1 + \text{VoRS}}
where
\text{VoRS} = \frac{\text{Average Up-Volume}}{\text{Average Down-Volume}}
.
Oscillator Range and Interpretation:
The VW RSI oscillates between 0 and 100, with a centerline at 50.
Above 50: Indicates bullish volume momentum, suggesting that volume on up bars dominates, which may signal buying pressure and a potential uptrend.
Below 50: Indicates bearish volume momentum, suggesting that volume on down bars dominates, which may signal selling pressure and a potential downtrend.
Overbought/Oversold Levels: User-defined thresholds (default: 70 for overbought, 30 for oversold) help identify potential reversal points:
VW RSI > 70: Overbought, indicating a possible pullback or reversal.
VW RSI < 30: Oversold, indicating a possible bounce or reversal.
Visual Elements:
VW RSI Line: Plotted in a separate pane below the price chart, colored dynamically based on its value:
Green when above 50 (bullish momentum).
Red when below 50 (bearish momentum).
Gray when at 50 (neutral).
Centerline: A dashed line at 50, optionally displayed, serving as the neutral threshold between bullish and bearish momentum.
Overbought/Oversold Lines: Dashed lines at the user-defined overbought (default: 70) and oversold (default: 30) levels, optionally displayed, to highlight extreme conditions.
Background Coloring: The background of the VW RSI pane is shaded red when the indicator is in overbought territory and green when in oversold territory, providing a quick visual cue of potential reversal zones.
Alerts:
Built-in alerts for key events:
Bullish Momentum: Triggered when the VW RSI crosses above 50, indicating a shift to bullish volume momentum.
Bearish Momentum: Triggered when the VW RSI crosses below 50, indicating a shift to bearish volume momentum.
Overbought Condition: Triggered when the VW RSI crosses above the overbought threshold (default: 70), signaling a potential pullback.
Oversold Condition: Triggered when the VW RSI crosses below the oversold threshold (default: 30), signaling a potential bounce.
Input Parameters
VW RSI Length (default: 14): The period over which the up-volume and down-volume are smoothed to calculate the VW RSI. A longer period results in smoother signals, while a shorter period increases sensitivity.
Overbought Level (default: 70): The threshold above which the VW RSI is considered overbought, indicating a potential reversal or pullback.
Oversold Level (default: 30): The threshold below which the VW RSI is considered oversold, indicating a potential reversal or bounce.
Show Centerline (default: true): Toggles the display of the 50 centerline, which separates bullish and bearish momentum zones.
Show Overbought/Oversold Lines (default: true): Toggles the display of the overbought and oversold threshold lines.
How It Works
Volume Classification:
For each bar, the indicator determines whether the price movement is upward or downward:
If the current close is higher than the previous close, the bar’s volume is classified as up-volume.
If the current close is lower than the previous close, the bar’s volume is classified as down-volume.
If the close is unchanged, both up-volume and down-volume are set to 0 for that bar.
Smoothing:
The up-volume and down-volume are smoothed using a Running Moving Average (RMA) over the specified period (default: 14 bars) to reduce noise and provide a more stable measure of volume momentum.
VW RSI Calculation:
The Volume Relative Strength (VoRS) is calculated as the ratio of smoothed up-volume to smoothed down-volume.
The VW RSI is then computed using the standard RSI formula, but with volume data instead of price changes, resulting in a value between 0 and 100.
Visualization and Alerts:
The VW RSI is plotted with dynamic coloring to reflect its momentum direction, and optional lines are drawn for the centerline and overbought/oversold levels.
Background coloring highlights overbought and oversold conditions, and alerts notify the trader of significant crossings.
Usage
Timeframe: The VW RSI can be used on any timeframe, but it is particularly effective on intraday charts (e.g., 1-hour, 4-hour) or daily charts where volume data is reliable. Shorter timeframes may require a shorter length for increased sensitivity, while longer timeframes may benefit from a longer length for smoother signals.
Markets: Best suited for markets with significant and reliable volume data, such as stocks, forex, and cryptocurrencies. It may be less effective in markets with low or inconsistent volume, such as certain futures contracts.
Trading Strategies:
Trend Confirmation:
Use the VW RSI to confirm the direction of a trend. For example, in an uptrend, look for the VW RSI to remain above 50, indicating sustained bullish volume momentum, and consider buying on pullbacks when the VW RSI dips but stays above 50.
In a downtrend, look for the VW RSI to remain below 50, indicating sustained bearish volume momentum, and consider selling on rallies when the VW RSI rises but stays below 50.
Overbought/Oversold Conditions:
When the VW RSI crosses above 70, the market may be overbought, suggesting a potential pullback or reversal. Consider taking profits on long positions or preparing for a short entry, but confirm with price action or other indicators.
When the VW RSI crosses below 30, the market may be oversold, suggesting a potential bounce or reversal. Consider entering long positions or covering shorts, but confirm with additional signals.
Divergences:
Look for divergences between the VW RSI and price to spot potential reversals. For example, if the price makes a higher high but the VW RSI makes a lower high, this bearish divergence may signal an impending downtrend.
Conversely, if the price makes a lower low but the VW RSI makes a higher low, this bullish divergence may signal an impending uptrend.
Momentum Shifts:
A crossover above 50 can signal the start of bullish momentum, making it a potential entry point for long trades.
A crossunder below 50 can signal the start of bearish momentum, making it a potential entry point for short trades or an exit for long positions.
Example
On a 4-hour SOLUSDT chart:
During an uptrend, the VW RSI might rise above 50 and stay there, confirming bullish volume momentum. If it approaches 70, it may indicate overbought conditions, as seen near a price peak of 145.08, suggesting a potential pullback.
During a downtrend, the VW RSI might fall below 50, confirming bearish volume momentum. If it drops below 30 near a price low of 141.82, it may indicate oversold conditions, suggesting a potential bounce, as seen in a slight recovery afterward.
A bullish divergence might occur if the price makes a lower low during the downtrend, but the VW RSI makes a higher low, signaling a potential reversal.
Limitations
Lagging Nature: Like the traditional RSI, the VW RSI is a lagging indicator because it relies on smoothed data (RMA). It may not react quickly to sudden price reversals, potentially missing the start of new trends.
False Signals in Ranging Markets: In choppy or ranging markets, the VW RSI may oscillate around 50, generating frequent crossovers that lead to false signals. Combining it with a trend filter (e.g., ADX) can help mitigate this.
Volume Data Dependency: The VW RSI relies on accurate volume data, which may be inconsistent or unavailable in some markets (e.g., certain forex pairs or futures contracts). In such cases, the indicator’s effectiveness may be reduced.
Overbought/Oversold in Strong Trends: During strong trends, the VW RSI can remain in overbought or oversold territory for extended periods, leading to premature exit signals. Use additional confirmation to avoid exiting too early.
Potential Improvements
Smoothing Options: Add options to use different smoothing methods (e.g., EMA, SMA) instead of RMA for the up/down volume calculations, allowing users to adjust the indicator’s responsiveness.
Divergence Detection: Include logic to detect and plot bullish/bearish divergences between the VW RSI and price, providing visual cues for potential reversals.
Customizable Colors: Allow users to customize the colors of the VW RSI line, centerline, overbought/oversold lines, and background shading.
Trend Filter: Integrate a trend strength filter (e.g., ADX > 25) to ensure signals are generated only during strong trends, reducing false signals in ranging markets.
The Volume Weighted RSI (VW RSI) is a powerful tool for traders seeking to incorporate volume into their momentum analysis, offering a unique perspective on market dynamics by emphasizing price movements backed by significant trading activity. It is best used in conjunction with other indicators and price action analysis to confirm signals and improve trading decisions.
Dynamic Trend Indicator (DTI) - VWAP FilterThe Dynamic Trend Indicator (DTI) with VWAP Filter is a trend-following indicator.
It aims to identify and follow market trends while minimizing false signals in choppy or ranging markets.
The DTI combines a dynamically adjusted Exponential Moving Average (EMA) with a daily Volume Weighted Average Price (VWAP) confirmation filter and a cooldown mechanism to enhance signal reliability. This indicator is particularly useful for traders on intraday timeframes (e.g., 4-hour charts) who want to align their trades with the broader daily trend while avoiding whipsaws.
Key Features:
Dynamic Trend Line:
The core of the DTI is a trend line calculated using a custom EMA that adjusts its period dynamically based on market conditions.
The period of the EMA is determined by a combination of volatility (measured via ATR) and trend strength (measured via price momentum). In strong trends, the period shortens for faster responsiveness; in weak or ranging markets, it lengthens to reduce noise.
An optional smoothing EMA can be applied to the dynamic trend line to further reduce noise, with a user-defined smoothing length.
Daily VWAP Confirmation Filter:
A daily VWAP is calculated to provide a higher-timeframe trend bias. VWAP represents the average price paid for an asset during the day, weighted by volume, and is often used as a benchmark by institutional traders.
Buy signals are only generated when the price is above the daily VWAP (indicating a bullish daily bias), and sell signals are only generated when the price is below the VWAP (indicating a bearish daily bias).
The VWAP resets at the start of each day, ensuring it reflects the current day’s trading activity.
Cooldown Mechanism:
To prevent rapid signal reversals (whipsaws), the indicator includes a cooldown period between signals. After a buy or sell signal is generated, no new signals can be generated for a user-defined number of bars (default: 5 bars).
This helps filter out noise in choppy markets, ensuring signals are spaced out and more likely to align with significant trend changes.
Visual Elements:
Trend Line: Plotted on the chart, colored green when the price is above (uptrend) and red when below (downtrend). A gray color indicates a neutral trend.
Buy/Sell Signals: Displayed as green triangles below the bar for buy signals and red triangles above the bar for sell signals.
Background Coloring: The chart background is shaded green during uptrends and red during downtrends, providing a quick visual cue of the trend direction.
Daily VWAP Line: Optionally plotted as a purple step line, allowing traders to see the VWAP level and its relationship to the price.
Alerts:
The indicator includes built-in alerts for buy and sell signals, triggered when the price crosses the trend line and satisfies the VWAP filter and cooldown conditions.
Alert messages specify whether the signal is a buy or sell and confirm that the VWAP condition was met (e.g., "DTI Buy Signal: Price crossed above trend line and VWAP").
Input Parameters
Base Length (default: 14): The base period for calculating volatility and trend strength, used to adjust the dynamic EMA period.
Volatility Multiplier (default: 1.5): Adjusts the sensitivity of the dynamic period to market volatility (via ATR).
Trend Threshold (default: 0.5): Controls the sensitivity of the dynamic period to trend strength (via price momentum).
Use Smoothing (default: true): Enables/disables smoothing of the trend line with an additional EMA.
Smoothing Length (default: 3): The period for the smoothing EMA, if enabled.
Cooldown Bars (default: 5): The minimum number of bars between consecutive signals, reducing signal frequency in choppy markets.
Show Daily VWAP (default: true): Toggles the display of the daily VWAP line on the chart.
How It Works
Dynamic Trend Line Calculation:
Volatility is measured using the Average True Range (ATR) over the base length, scaled by the volatility multiplier.
Trend strength is calculated as the absolute price momentum (change in price over the base length) divided by the volatility factor.
The dynamic EMA period is adjusted based on the trend strength: stronger trends result in a shorter period (faster response), while weaker trends result in a longer period (more stability). The period is constrained between 5 and 50 to avoid extreme values.
A custom EMA function is used to handle the dynamic period, as Pine Script’s built-in ta.ema() requires a fixed length. The trend line is optionally smoothed with a secondary EMA.
Signal Generation:
A buy signal is generated when the price crosses above the trend line, the price is above the daily VWAP, and the cooldown period has elapsed.
A sell signal is generated when the price crosses below the trend line, the price is below the daily VWAP, and the cooldown period has elapsed.
The cooldown mechanism ensures that signals are not generated too frequently, reducing false signals in ranging markets.
Daily VWAP Calculation:
The VWAP is calculated by accumulating the price-volume product (close * volume) and total volume for the day, resetting at the start of each new day.
The VWAP is then computed as the cumulative price-volume divided by the cumulative volume, providing a volume-weighted average price for the day.
Usage
Timeframe: Best suited for intraday timeframes (e.g., 1-hour, 4-hour) where the daily VWAP provides a higher-timeframe trend bias. It can also be used on daily charts with adjustments to the cooldown period.
Markets: Works well in trending markets (e.g., forex, crypto, stocks) where the dynamic trend line can capture sustained price movements. The VWAP filter helps align signals with the daily trend, making it effective for assets with clear daily biases.
Trading Strategy:
Buy: Enter a long position when a green triangle (buy signal) appears, indicating the price has crossed above the trend line and is above the daily VWAP.
Sell: Enter a short position (or exit a long) when a red triangle (sell signal) appears, indicating the price has crossed below the trend line and is below the daily VWAP.
Use the trend line and VWAP as dynamic support/resistance levels to set stop-losses or take-profit targets.
Backtesting: Use TradingView’s strategy tester to evaluate the indicator’s performance on your chosen market and timeframe, adjusting parameters like cooldown_bars and volatility_mult to optimize for profitability.
Example
On a 4-hour SOLUSDT chart, the DTI with VWAP Filter might show:
An uptrend with the price above the green trend line and above the daily VWAP, generating buy signals as the price continues to rise.
A downtrend where the price falls below the red trend line and the daily VWAP, generating sell signals that align with the bearish daily bias.
During choppy periods, the cooldown mechanism and VWAP filter reduce false signals, ensuring trades are taken only when the price aligns with the daily trend.
Limitations
Lagging Nature: Like all trend-following indicators, the DTI may lag during sharp price reversals, as the dynamic EMA needs time to adjust.
Ranging Markets: While the VWAP filter and cooldown mechanism reduce whipsaws, the indicator may still generate some false signals in strongly ranging markets. Combining it with a trend strength filter (e.g., ADX) can help.
VWAP Dependency: The effectiveness of the VWAP filter depends on the market’s respect for the daily VWAP as a support/resistance level. In markets with low volume or erratic price action, the VWAP may be less reliable.
Potential Improvements
VWAP Buffer: Add a percentage buffer around the VWAP (e.g., require the price to be 1% above/below) to further reduce noise.
Multi-Timeframe VWAP: Incorporate a weekly VWAP for additional trend confirmation on longer timeframes.
Trend Strength Filter: Add an ADX filter to ensure signals are generated only during strong trends (e.g., ADX > 25).