AiTrend Pattern Matrix for kNN Forecasting (AiBitcoinTrend)The AiTrend Pattern Matrix for kNN Forecasting (AiBitcoinTrend) is a cutting-edge indicator that combines advanced mathematical modeling, AI-driven analytics, and segment-based pattern recognition to forecast price movements with precision. This tool is designed to provide traders with deep insights into market dynamics by leveraging multivariate pattern detection and sophisticated predictive algorithms.
👽 Core Features
Segment-Based Pattern Recognition
At its heart, the indicator divides price data into discrete segments, capturing key elements like candle bodies, high-low ranges, and wicks. These segments are normalized using ATR-based volatility adjustments to ensure robustness across varying market conditions.
AI-Powered k-Nearest Neighbors (kNN) Prediction
The predictive engine uses the kNN algorithm to identify the closest historical patterns in a multivariate dictionary. By calculating the distance between current and historical segments, the algorithm determines the most likely outcomes, weighting predictions based on either proximity (distance) or averages.
Dynamic Dictionary of Historical Patterns
The indicator maintains a rolling dictionary of historical patterns, storing multivariate data for:
Candle body ranges, High-low ranges, Wick highs and lows.
This dynamic approach ensures the model adapts continuously to evolving market conditions.
Volatility-Normalized Forecasting
Using ATR bands, the indicator normalizes patterns, reducing noise and enhancing the reliability of predictions in high-volatility environments.
AI-Driven Trend Detection
The indicator not only predicts price levels but also identifies market regimes by comparing current conditions to historically significant highs, lows, and midpoints. This allows for clear visualizations of trend shifts and momentum changes.
👽 Deep Dive into the Core Mathematics
👾 Segment-Based Multivariate Pattern Analysis
The indicator analyzes price data by dividing each bar into distinct segments, isolating key components such as:
Body Ranges: Differences between the open and close prices.
High-Low Ranges: Capturing the full volatility of a bar.
Wick Extremes: Quantifying deviations beyond the body, both above and below.
Each segment contributes uniquely to the predictive model, ensuring a rich, multidimensional understanding of price action. These segments are stored in a rolling dictionary of patterns, enabling the indicator to reference historical behavior dynamically.
👾 Volatility Normalization Using ATR
To ensure robustness across varying market conditions, the indicator normalizes patterns using Average True Range (ATR). This process scales each component to account for the prevailing market volatility, allowing the algorithm to compare patterns on a level playing field regardless of differing price scales or fluctuations.
👾 k-Nearest Neighbors (kNN) Algorithm
The AI core employs the kNN algorithm, a machine-learning technique that evaluates the similarity between the current pattern and a library of historical patterns.
Euclidean Distance Calculation:
The indicator computes the multivariate distance across four distinct dimensions: body range, high-low range, wick low, and wick high. This ensures a comprehensive and precise comparison between patterns.
Weighting Schemes: The contribution of each pattern to the forecast is either weighted by its proximity (distance) or averaged, based on user settings.
👾 Prediction Horizon and Refinement
The indicator forecasts future price movements (Y_hat) by predicting logarithmic changes in the price and projecting them forward using exponential scaling. This forecast is smoothed using a user-defined EMA filter to reduce noise and enhance actionable clarity.
👽 AI-Driven Pattern Recognition
Dynamic Dictionary of Patterns: The indicator maintains a rolling dictionary of N multivariate patterns, continuously updated to reflect the latest market data. This ensures it adapts seamlessly to changing market conditions.
Nearest Neighbor Matching: At each bar, the algorithm identifies the most similar historical pattern. The prediction is based on the aggregated outcomes of the closest neighbors, providing confidence levels and directional bias.
Multivariate Synthesis: By combining multiple dimensions of price action into a unified prediction, the indicator achieves a level of depth and accuracy unattainable by single-variable models.
Visual Outputs
Forecast Line (Y_hat_line):
A smoothed projection of the expected price trend, based on the weighted contribution of similar historical patterns.
Trend Regime Bands:
Dynamic high, low, and midlines highlight the current market regime, providing actionable insights into momentum and range.
Historical Pattern Matching:
The nearest historical pattern is displayed, allowing traders to visualize similarities
👽 Applications
Trend Identification:
Detect and follow emerging trends early using dynamic trend regime analysis.
Reversal Signals:
Anticipate market reversals with high-confidence predictions based on historically similar scenarios.
Range and Momentum Trading:
Leverage multivariate analysis to understand price ranges and momentum, making it suitable for both breakout and mean-reversion strategies.
Disclaimer: This information is for entertainment purposes only and does not constitute financial advice. Please consult with a qualified financial advisor before making any investment decisions.
Трендовый анализ
Option vs Index Performance**Indicator Name:** Option vs Index Performance
**Description:**
This indicator helps traders analyze the relative performance of options compared to their underlying index (e.g., Nifty 50). It evaluates and highlights zones based on two key metrics:
1. **Bar-to-Bar Performance:** Compares the percentage movement of the option price against the index movement on a bar-by-bar basis.
- **Green Zone**: Option outperforms the index.
- **Yellow Zone**: Option moves in sync with the index.
- **Red Zone**: Option underperforms the index.
2. **Swing Alignment:** Tracks the swing structure of the index (higher highs, higher lows) and compares it with the option chart. The indicator checks if the option's swings align with or deviate from the index's swing pattern.
The final output combines both conditions, providing clear visual zones below the chart:
- **Green**: Overperformance and alignment with the index.
- **Yellow**: Neutral performance or partial alignment.
- **Red**: Underperformance or misalignment with the index.
Use this tool on option charts to quickly identify opportunities and assess whether the option's movement is in line with the broader market trend.
VWAP Trend with Standard Deviation & MidlinesThis indicator is a sophisticated VWAP (Volume Weighted Average Price) tool with multiple features:
Core Functionality:
1. Calculates a primary VWAP line that changes color based on trend direction (green when rising, red when falling)
2. Creates multiple standard deviation bands around the VWAP at customizable distances
3. Resets calculations at either:
- New York session start time (configurable, default 9:30 AM)
- Daily start time
- Can be hidden on daily/weekly/monthly timeframes if desired
Band Structure:
- Band 1 (innermost): ±1 standard deviation
- Band 2 (middle): ±2 standard deviations
- Band 3 (outermost): ±3 standard deviations
- Midlines at 0.5σ intervals between bands
- All bands can be individually enabled/disabled
Customization Options:
1. Band calculation modes:
- Standard Deviation based
- Percentage based
2. Visual settings:
- Customizable colors for all elements
- Adjustable line widths
- Optional labels with configurable size
- Optional extension lines
- Label position adjustment
3. Source data selection (default: HLC3 - High, Low, Close average)
Common Uses:
- Identifying potential support/resistance levels
- Measuring price volatility
- Spotting mean reversion opportunities
- Trading range analysis
- Trend direction confirmation
The indicator essentially creates a dynamic support/resistance structure that adapts to market volatility and volume, making it useful for both intraday and swing trading strategies.
300-Candle Weighted Average Zones w/50 EMA SignalsThis indicator is designed to deliver a more nuanced view of price dynamics by combining a custom, weighted price average with a volatility-based zone and a trend filter (in this case, a 50-period exponential moving average). The core concept revolves around capturing the overall price level over a relatively large lookback window (300 candles) but with an intentional bias toward recent market activity (the most recent 20 candles), thereby offering a balance between long-term context and short-term responsiveness. By smoothing this weighted average and establishing a “zone” of standard deviation bands around it, the indicator provides a refined visualization of both average price and its recent volatility envelope. Traders can then look for confluence with a standard trend filter, such as the 50 EMA, to identify meaningful crossover signals that may represent trend shifts or opportunities for entry and exit.
What the Indicator Does:
Weighted Price Average:
Instead of using a simple or exponential moving average, this indicator calculates a custom weighted average price over the past 300 candles. Most historical candles receive a base weight of 1.0, but the most recent 20 candles are assigned a higher weight (for example, a weight of 2.0). This weighting scheme ensures that the calculation is not simply a static lookback average; it actively emphasizes current market conditions. The effect is to generate an average line that is more sensitive to the most recent price swings while still maintaining the historical context of the previous 280 candles.
Smoothing of the Weighted Average:
Once the raw weighted average is computed, an exponential smoothing function (EMA) is applied to reduce noise and produce a cleaner, more stable average line. This smoothing helps traders avoid reacting prematurely to minor price fluctuations. By stabilizing the average line, traders can more confidently identify actual shifts in market direction.
Volatility Zone via Standard Deviation Bands:
To contextualize how far price can deviate from this weighted average, the indicator uses standard deviation. Standard deviation is a statistical measure of volatility—how spread out the price values are around the mean. By adding and subtracting one standard deviation from the smoothed weighted average, the indicator plots an upper band and a lower band, creating a zone or channel. The area between these bands is filled, often with a semi-transparent color, highlighting a volatility corridor within which price and the EMA might oscillate.
This zone is invaluable in visualizing “normal” price behavior. When the 50 EMA line and the weighted average line are both within this volatility zone, it indicates that the market’s short- to mid-term trend and its average pricing are aligned well within typical volatility bounds.
Incorporation of a 50-Period EMA:
The inclusion of a commonly used trend filter, the 50 EMA, adds another layer of context to the analysis. The 50 EMA, being a widely recognized moving average length, is often considered a baseline for intermediate trend bias. It reacts faster than a long-term average (like a 200 EMA) but is still stable enough to filter out the market “chop” seen in very short-term averages.
By overlaying the 50 EMA on this custom weighted average and the surrounding volatility zone, the trader gains a dual-dimensional perspective:
Trend Direction: If the 50 EMA is generally above the weighted average, the short-term trend is gaining bullish momentum; if it’s below, the short-term trend has a bearish tilt.
Volatility Normalization: The bands, constructed from standard deviations, provide a sense of whether the price and the 50 EMA are operating within a statistically “normal” range. If the EMA crosses the weighted average within this zone, it signals a potential trend initiation or meaningful shift, as opposed to a random price spike outside normal volatility boundaries.
Why a Trader Would Want to Use This Indicator:
Contextualized Price Level:
Standard MAs may not fully incorporate the most recent price dynamics in a large lookback window. By weighting the most recent candles more heavily, this indicator ensures that the trader is always anchored to what the market is currently doing, not just what it did 100 or 200 candles ago.
Reduced Whipsaw with Smoothing:
The smoothed weighted average line reduces noise, helping traders filter out inconsequential price movements. This makes it easier to spot genuine changes in trend or sentiment.
Visual Volatility Gauge:
The standard deviation bands create a visual representation of “normal” price movement. Traders can quickly assess if a breakout or breakdown is statistically significant or just another oscillation within the expected volatility range.
Clear Trade Signals with Confirmation:
By integrating the 50 EMA and designing signals that trigger only when the 50 EMA crosses above or below the weighted average while inside the zone, the indicator provides a refined entry/exit criterion. This avoids chasing breakouts that occur in abnormal volatility conditions and focuses on those crossovers likely to have staying power.
How to Use It in an Example Strategy:
Imagine you are a swing trader looking to identify medium-term trend changes. You apply this indicator to a chart of a popular currency pair or a leading tech stock. Over the past few days, the 50 EMA has been meandering around the weighted average line, both confined within the standard deviation zone.
Bullish Example:
Suddenly, the 50 EMA crosses decisively above the weighted average line while both are still hovering within the volatility zone. This might be your cue: you interpret this crossover as the 50 EMA acknowledging the recent upward shift in price dynamics that the weighted average has highlighted. Since it occurred inside the normal volatility range, it’s less likely to be a head-fake. You place a long position, setting an initial stop just below the lower band to protect against volatility.
If the price continues to rise and the EMA stays above the average, you have confirmation to hold the trade. As the price moves higher, the weighted average may follow, reinforcing your bullish stance.
Bearish Example:
On the flip side, if the 50 EMA crosses below the weighted average line within the zone, it suggests a subtle but meaningful change in trend direction to the downside. You might short the asset, placing your protective stop just above the upper band, expecting that the statistically “normal” level of volatility will contain the price action. If the price does break above those bands later, it’s a sign your trade may not work out as planned.
Other Indicators for Confluence:
To strengthen the reliability of the signals generated by this weighted average zone approach, traders may want to combine it with other technical studies:
Volume Indicators (e.g., Volume Profile, OBV):
Confirm that the trend crossover inside the volatility zone is supported by volume. For instance, an uptrend crossover combined with increasing On-Balance Volume (OBV) or volume spikes on up candles signals stronger buying pressure behind the price action.
Momentum Oscillators (e.g., RSI, Stochastics):
Before taking a crossover signal, check if the RSI is above 50 and rising for bullish entries, or if the Stochastics have turned down from overbought levels for bearish entries. Momentum confirmation can help ensure that the trend change is not just an isolated random event.
Market Structure Tools (e.g., Pivot Points, Swing High/Low Analysis):
Identify if the crossover event coincides with a break of a previous pivot high or low. A bullish crossover inside the zone aligned with a break above a recent swing high adds further strength to your conviction. Conversely, a bearish crossover confirmed by a breakdown below a previous swing low can make a short trade setup more compelling.
Volume-Weighted Average Price (VWAP):
Comparing where the weighted average zone lies relative to VWAP can provide institutional insight. If the bullish crossover happens while the price is also holding above VWAP, it can mean that the average participant in the market is in profit and that the trend is likely supported by strong hands.
This indicator serves as a tool to balance long-term perspective, short-term adaptability, and volatility normalization. It can be a valuable addition to a trader’s toolkit, offering enhanced clarity and precision in detecting meaningful shifts in trend, especially when combined with other technical indicators and robust risk management principles.
Bitcoin: Mayer MultipleMayer Multiple Indicator
The Mayer Multiple is a powerful tool designed to help traders assess market conditions and identify optimal buying or selling opportunities. It calculates the ratio between the current price and its 200-day simple moving average (SMA), visualizing key thresholds that indicate value zones, caution areas, and overheated markets.
Key Features:
Dynamic Market Zones: Clearly marked levels like "Smash Buy," "Boost DCA," and "Extreme Euphoria" to guide your trading decisions.
Customizable Input: Adjust the SMA length to fit your strategy.
Color-Coded Signals: Intuitive visualization of market sentiment for quick analysis.
Comprehensive Thresholds: Historical insights into price behavior with plotted reference levels based on probabilities.
This indicator is ideal for traders aiming to enhance their long-term strategies and improve decision-making in volatile markets. Use it to gain an edge in identifying potential turning points and managing risk effectively.
Trend Condition [TradersPro]
OVERVIEW
The Trend Condition Indicator measures the strength of the bullish or bearish trend by using a ribbon pattern of exponential moving averages and scoring system. Trend cycles naturally expand and contract as a normal part of the cycle. It is the rhythm of the market. Perpetual expansion and contraction of trend.
As trend cycles develop the indicator shows a compression of the averages. These compression zones are key locations as trends typically expand from there. The expansion of trend can be up or down.
As the trend advances the ribbon effect of the indicator can be seen as each average expands with the price action. Once they have “fanned” the probability of the current trend slowing is high.
This can be used to recognize a powerful trend may be concluding. Traders can tighten stops, exit positions or utilize other prudent strategies.
CONCEPTS
Each line will display green if it is higher than the prior period and red if it is lower than the prior period. If the average is green it is considered bullish and will score one point in the bullish display. Red lines are considered bearish and will score one point in the bearish display.
The indicator can then be used at a quick glance to see the number of averages that are bullish and the number that are bearish.
A trader may use these on any tradable instrument. They can be helpful in stock portfolio management when used with an index like the S&P 500 to determine the strength of the current market trend. This may affect trade decisions like possession size, stop location and other risk factors.
Tomas' Financial Conditions Z Score"The indicator is a composite z-score comprised of the following four components (equally-weighted):
Credit spreads - ICE BofA High Yield Option Adjusted Spread (BAMLH0A0HYM2) and ICE BofA Corporate Index Option Adjusted Spread (BAMLC0A0CM)
Volatility indexes - VIX (S&P 500 implied volatility) and MOVE (US Treasury bond implied volatility)
I've got it set to a 160-day lookback period, which I think is roughly the best setting after some tinkering.
When the z-score is above zero, it throws a red signal - and when the z-score is below zero, it throws a green signal.
This indicator is a follow-on from the "traffic light financial conditions indicator" that I wrote a thread about a couple of months ago.
I moved on from that previous indicator because it is based on the Federal Reserve's NFCI, which is regularly revised, but I didn't take that into account at the time.
So not a great real-time indicator, if the signal can be subsequently revised in the opposite direction weeks later.
This new indicator is based on real-time market data, so there's no revisions, and it also updates daily, as opposed to weekly for the NFCI"
Custom EMA (v4) [MacroGlide]Custom EMA (v4) is an easy-to-use tool designed for traders who want a clear and reliable way to analyze market trends. By using multiple Exponential Moving Averages (EMAs), this indicator helps you visualize the market's direction and momentum in a straightforward way. Whether you're tracking short-term movements or looking for long-term patterns, Custom EMA makes it simple to spot trends and trading opportunities.
Key Features:
• Multi-EMA System: Plots up to four EMAs on the chart with customizable lengths and colors, providing flexibility to analyze trends over different timeframes.
• Dynamic Trend Cloud: A visually intuitive cloud is generated between the fastest and slowest EMA. The cloud changes color based on market trends:
• Green Cloud: Indicates a bullish trend when shorter EMAs are above longer EMAs.
• Red Cloud: Indicates a bearish trend when shorter EMAs are below longer EMAs.
• Highlighting Zones: Background shading helps distinguish bullish and bearish conditions, further clarifying the prevailing trend in the market.
How to Use:
• Add the Indicator: Load the indicator onto your chart and customize the EMA lengths to suit your trading style.
• Interpret the Cloud: Observe the color of the trend cloud to identify bullish (green) or bearish (red) market conditions.
• Combine with Highlighting Zones: Use the background shading in conjunction with the cloud to confirm trend strength and direction.
• Customize to Fit Your Strategy: Adjust the lengths and colors of the EMAs to align with your preferred analysis timeframe.
Methodology:
This indicator leverages a layered EMA approach, using up to four EMAs to calculate the trend cloud and define market conditions. By comparing the relative positions of the EMAs, it identifies bullish and bearish trends and visually represents them with a color-coded cloud. The inclusion of highlighting zones enhances the trader's ability to quickly grasp market sentiment.
Originality and Usefulness:
Custom EMA (v4) sets itself apart by integrating a trend cloud that adapts dynamically to EMA positions, providing traders with a clean and intuitive way to visualize market trends. The combination of multi-EMA plotting, background shading, and trend cloud offers comprehensive insight into both short-term and long-term market movements.
Charts:
The indicator plots four customizable EMAs alongside a trend cloud that visually captures market direction. Whether you're monitoring short-term price action or identifying long-term trends, the Custom EMA (v4) provides clarity and simplicity for traders at all levels.
Enjoy the game!
Relative PerformanceSimple relative performance of a token compared to BTC, with display of normalized performance velocity line.
Rolling VWAP with Optional Kalman FilterThis script provides an advanced and customizable Rolling VWAP (Volume-Weighted Average Price) indicator, designed for traders who want to refine their trend analysis and improve decision-making. With a unique option to apply a Kalman Filter, you can smooth out VWAP values to reduce noise in volatile markets, making it easier to identify actionable trends.
Key Features:
Dynamic Rolling VWAP:
Choose the rolling window size (number of bars) to match your trading style, whether you’re an intraday scalper or a swing trader.
Kalman Filter Toggle:
Enable the Kalman filter to smooth VWAP values and eliminate market noise.
Adjustable Kalman Gain to control the level of smoothing, making it suitable for both fast and slow markets.
Price Source Flexibility:
Use the Typical Price ((H+L+C)/3) or the Close Price as the basis for VWAP calculation.
Visual Enhancements:
Background shading highlights whether the price is above (bullish) or below (bearish) the VWAP, helping traders make quick visual assessments.
A legend dynamically updates the current VWAP value.
Dual View Option:
Compare the raw Rolling VWAP and the Kalman-filtered VWAP when the filter is enabled, giving you deeper insight into market trends.
Use Cases:
Intraday Traders: Identify key price levels for re-entry or exits using a short rolling window and responsive filtering.
Swing Traders: Analyze broader trends with a longer rolling window and smoother VWAP output.
Volatile Markets: Use the Kalman filter to reduce noise and avoid false signals during high market volatility.
How to Use:
Adjust the Rolling Window to set the number of bars for VWAP calculation.
Toggle Kalman Filter on/off depending on your preference for raw or smoothed VWAP values.
Fine-tune the Kalman Gain for the desired level of smoothing.
Use the shading to quickly assess whether the price is trading above or below the VWAP for potential entry/exit signals.
Alerts and symbolswhat is "Alerts and symbols"?
It is an indicator that allows you to watch more trading pairs and add alarms to them.
what it does?
It allows you to set a total of 20 different intersection alarms, 2 in each pair, for 10 different trading pairs at the same time.
It draws the candlestick chart of a pair you choose among 10 trading pairs and the alarm lines you created for this trading pair on the chart.
It also allows you to see the prices of 10 different trading pairs at the same time, thanks to the table it creates.
how to use it?
First, select the alarm pairs you want to use, for example, BTCUSDT pair is the default value for "pair 1". You can choose 10 different trading pairs as you wish. Just below each trading pair, there are two different sections titled "line 1" and "line 2" so that you can set an alarm. Type here the price levels at which you want to be alerted in case of a price crossover.
You can use the "candle source" section to examine the candlestick charts of trading pairs. The indicator draws the candle chart of the trading pair selected in the "candle source" section.
Check the "show alert lines on chart" box to see the levels you have set an alarm for.
When everything is ready, first click on the three dots next to the indicator's name and then on the clock icon. then create an alarm and that's it.
Candled LWMA (Loacally Weighted MA)The Locally Weighted Moving Average (LWMA) is a type of moving average that emphasizes recent data points by assigning them higher weights compared to older values. Unlike the Simple Moving Average (SMA), which treats all data points equally, or the Exponential Moving Average (EMA), which uses a fixed weighting factor, the LWMA applies a linear weighting scheme. This means that the most recent prices contribute more significantly to the average, making the LWMA more responsive to price changes while retaining a smooth curve.
In trading, the LWMA is particularly useful for identifying trends and detecting price reversals with reduced lag. By giving more importance to the latest prices, it provides a clearer picture of the current market dynamics. Traders often use the LWMA in combination with other indicators to confirm trends or spot potential entry and exit points. The adjustable length parameter allows for fine-tuning the indicator to match different market conditions and trading styles. Its ability to adapt to recent price behavior makes it a valuable tool for both short-term and long-term traders.
Adjustable Color Changing WMA by Slope Degree30 weighted moving average that changes colors based upon degree of slope. Consider it a green light for buying/selling pullbacks to the wma. You can adjust the colors and the threshold for the degree of slope.
Smoothed Source Weighted EMAThe Smoothed Source EMA is a tool designed to help traders identify potential buying and selling opportunities in the market. It combines two key elements: price smoothing (using standard deviation) and an Exponential Moving Average (EMA). The purpose is to filter out the day-to-day price fluctuations and create clearer buy and sell signals.
Key Concepts Behind the Indicator:
Price Smoothing (Standard Deviation):
To make the price action easier to follow, the indicator first "smooths" the price. This is done by looking at how much the price tends to move up and down (known as standard deviation).
It then creates two "bands" around the current price—one above and one below. These bands represent a smoothed version of the price and help filter out the noise caused by small, random price movements.
Exponential Moving Average (EMA):
The indicator also uses an Exponential Moving Average (EMA), which is a line that represents the average price over a certain period of time (but gives more weight to recent prices). The EMA helps capture the general trend of the price.
The indicator uses this EMA to compare the current price with the overall trend.
How Does the Indicator Work?
Once the indicator calculates the smoothed price bands and the EMA, it looks for specific conditions to trigger a buy or sell signal:
Long (Buy) Signal:
A buy signal happens when the smoothed price (the lower band) is above the EMA. In simple terms, the price is moving up, and the indicator is telling you it's a good time to buy.
The more "weight" or influence you give to the EMA, the slower this buy signal will appear, meaning it’ll only trigger when there’s a strong enough upward movement.
Short (Sell) Signal:
A sell signal occurs when the smoothed price (the upper band) is below the EMA. This suggests the price is moving down, and the indicator signals that it might be time to sell.
Again, the more "weight" you put on the EMA, the slower the sell signal will appear, as the indicator waits for a clearer downtrend.
Why is this Useful for Traders?
Smoothing the Price: Many traders struggle with the noise of price fluctuations, where the price moves up and down quickly without a clear trend. By smoothing the price, this indicator helps traders focus on the bigger picture and avoid reacting to every small movement.
Clear Buy and Sell Signals: The indicator generates easy-to-understand buy and sell signals based on the relationship between the smoothed price and the EMA. If the price is above the smoothed level and EMA, it’s a signal to buy. If it’s below, it’s a signal to sell.
Customizable Sensitivity: The indicator lets traders adjust how sensitive the buy and sell signals are. By changing certain settings, such as the smoothing length and the weight of the EMA, traders can make the indicator react faster or slower depending on how quickly they want to catch changes in the market.
How the Indicator Appears on the Chart:
EMA Line: A line that represents the trend of the price.
Upper and Lower Smoothed Bands: Two bands above and below the price that help identify when the price is moving up or down relative to the trend.
Buy and Sell Arrows: Small arrows on the chart show where the indicator suggests buying or selling.
Colored Bars: The bars on the chart may change color to visually indicate whether the indicator suggests a buy (green) or a sell (red).
In Summary:
The Smoothed Source EMA helps you identify trends by smoothing out price movements using standard deviation, then comparing these smoothed prices with the Exponential Moving Average (EMA).
When the smoothed price moves above or below the EMA, it gives you a signal: a buy when the smoothed price is above the EMA, and a sell when it’s below.
You can adjust how quickly or slowly these signals appear by modifying the settings, giving you control over how sensitive the indicator is to changes in the market.
This indicator is useful for traders who want to reduce noise and focus on the overall trend, using clear, visually simple signals to guide their trading decisions.
Intraday Trend CandlesThe Intraday Trend Candles (ITC) indicator is a Pine Script-based tool designed for traders seeking to visualize market trends effectively. Using a combination of the Look Back Period, a multiplier for true range, and linearly weighted moving averages (LWMA), this indicator calculates dynamic trend limits that adapt to price movements. It identifies key trend shifts by comparing the current price to these dynamic thresholds, resulting in a visually intuitive display of market bias directly on the chart. The indicator is particularly well-suited for intraday trading, as it provides responsive insights tailored to short-term price action.
The ITC plots color-coded candles, highlighting bullish trends in blue and bearish trends in yellow, with gray indicating indecision or trend continuation. This color-coded approach makes it easy to identify reversals and trend dynamics at a glance. Additionally, a trend line is plotted to enhance clarity, signaling whether the price is favoring the upper or lower threshold of the calculated range. With built-in alerts for trend reversals, traders can stay informed about critical market shifts without constantly monitoring the chart. This combination of visual cues and alerts makes the ITC a versatile and powerful tool for traders focusing on momentum and trend-following strategies.
Optimal MA FinderIntroduction to the "Optimal MA Finder" Indicator
The "Optimal MA Finder" is a powerful and versatile tool designed to help traders optimize their moving average strategies. This script combines flexibility, precision, and automation to identify the most effective moving average (MA) length for your trading approach. Whether you're aiming to improve your long-only strategy or implement a buy-and-sell methodology, the "Optimal MA Finder" is your go-to solution for enhanced decision-making.
What Does It Do?
The script evaluates a wide range of moving average lengths, from 10 to 500, to determine which one produces the best results based on historical data. By calculating critical metrics such as the total number of trades and the profit factor for each MA length, it identifies the one that maximizes profitability. It supports both simple moving averages (SMA) and exponential moving averages (EMA), allowing you to tailor the analysis to your preferred method.
The logic works by backtesting each MA length against the price data and assessing the performance under two strategies:
Buy & Sell: Includes both long and short trades.
Long Only: Focuses solely on long positions for more conservative strategies.
Once the optimal MA length is identified, the script overlays it on the chart, highlighting periods when the price crosses over or under the optimal MA, helping traders identify potential entry and exit points.
Why Is It Useful?
This indicator stands out for its ability to automate a task that is often labor-intensive and subjective: finding the best MA length. By providing a clear, data-driven answer, it saves traders countless hours of manual testing while significantly enhancing the accuracy of their strategies. For example, instead of guessing whether a 50-period EMA is more effective than a 200-period SMA, the "Optimal MA Finder" will pinpoint the exact length and type of MA that has historically yielded the best results for your chosen strategy.
Key Benefits:
Precision: Identifies the MA length with the highest profit factor for maximum profitability.
Automation: Conducts thorough backtesting without manual effort.
Flexibility: Adapts to your preferred MA type (SMA or EMA) and trading strategy (Buy & Sell or Long Only).
Real-Time Feedback: Provides actionable insights by plotting the optimal MA directly on your chart and highlighting relevant trading periods.
Example of Use: Imagine you're trading a volatile stock and want to optimize your long-only strategy. By applying the "Optimal MA Finder," you discover that a 120-period EMA results in the highest profit factor. The indicator plots this EMA on your chart, showing you when to consider entering or exiting positions based on price movements relative to the EMA.
In short, the "Optimal MA Finder" empowers traders by delivering data-driven insights and improving the effectiveness of trading strategies. Its clear logic, combined with robust automation, makes it an invaluable tool for both novice and experienced traders seeking consistent results.
Max/Min LevelsHighlights highs and lows that match the search criteria. A high is considered to be broken if the candlestick breaks through its shadow
A three-candlestick pattern will match the parameters:
Candle before - 1
Candle after - 1
A five-candlestick pattern will match the parameters:
Candle before - 2
Candle after - 2
Hidden SMT Divergence ICT 01 [TradingFinder] HSMT SMC Technique🔵 Introduction
Hidden SMT Divergence, an advanced concept within the Smart Money Technique (SMT), identifies discrepancies between correlated assets by focusing on their closing prices.
Unlike the standard SMT Divergence, which uses high and low prices for analysis, Hidden SMT Divergence uncovers subtle signals by examining divergences based on the assets' closing values.
These divergences often highlight potential reversals or trend continuations, making this technique a valuable tool for traders aiming to anticipate market movements.
This approach applies across various markets and asset classes, including :
Commodities : CAPITALCOM:GOLD vs. CAPITALCOM:SILVER or BLACKBULL:BRENT vs. BLACKBULL:WTI .
Indices : NASDAQ:NDX vs. TVC:SPX vs. FX:US30 .
FOREX : FX:EURUSD vs. OANDA:GBPUSD vs. TVC:DXY (US Dollar Index).
Cryptocurrencies : BITSTAMP:BTCUSD vs. COINBASE:ETHUSD vs. KUCOIN:SOLUSDT vs. CRYPTOCAP:TOTAL3 .
Volatility Measures : FOREXCOM:XAUUSD vs. TVC:VIX (Volatility Index).
By identifying divergences within these asset groups, traders can gain actionable insights into potential market reversals or shifts in trend direction. Hidden SMT Divergence is particularly effective for pinpointing subtle market signals that traditional methods may overlook.
Bullish Hidden SMT Divergence : This divergence emerges when one asset forms a higher low, while the correlated asset creates a lower low in terms of their closing prices. It often signals weakening downward momentum and a potential reversal to the upside.
Bearish Hidden SMT Divergence : This occurs when one asset establishes a higher high, while the correlated asset forms a lower high based on their closing prices. It typically reflects declining upward momentum and a probable shift to the downside.
🔵 How to Use
The Hidden SMT Divergence indicator provides traders with a systematic approach to identify market reversals or trend continuations through divergences in closing prices between two correlated assets.
🟣 Bullish Hidden SMT Divergence
Bullish Hidden SMT Divergence occurs when the closing price of the primary asset forms a higher low, while the correlated asset creates a lower low. This pattern indicates weakening downward momentum and signals a potential reversal to the upside.
After identifying the divergence, confirm it using additional tools like support levels, volume trends, or indicators such as RSI and MACD. Enter a buy position as the price shows signs of reversal near support zones, ensuring proper risk management by placing a stop-loss below the support level.
Bearish Hidden SMT Divergence
Bearish Hidden SMT Divergence is identified when the closing price of the primary asset forms a higher high, while the correlated asset creates a lower high. This divergence suggests a weakening uptrend and a likely reversal to the downside.
Validate the signal by examining resistance levels, declining volume, or complementary indicators. Consider entering a sell position as the price starts declining from resistance levels, and set a stop-loss above the resistance zone to limit potential losses.
🔵 Setting
Second Symbol : Select the secondary asset to compare with the primary asset. By default, "XAUUSD" (Gold) is used, but it can be customized to any stock, cryptocurrency, or currency pair.
Divergence Fractal Periods : Defines the number of past candles considered for identifying divergences. The default value is 2, but traders can adjust it for greater precision.
Bullish Divergence Line : Displays a dashed line connecting the points of bullish divergence.
Bearish Divergence Line : Shows a similar line for bearish divergence points.
Bullish Divergence Label : Marks areas of bullish divergence with a "+SMT" label.
Bearish Divergence Label : Highlights bearish divergences with a "-SMT" label.
Chart Type : Choose between Line or Candle charts for enhanced visualization.
🔵 Conclusion
Hidden SMT Divergence offers traders a refined method for identifying market reversals by analyzing closing price discrepancies between correlated assets. Its ability to uncover subtle divergences makes it an essential tool for traders who aim to stay ahead of market trends.
By integrating this technique with other technical analysis tools and sound risk management, traders can enhance their decision-making process and capitalize on market opportunities with greater confidence.
Hidden SMT Divergence’s focus on closing prices ensures more precise signals, helping traders refine their strategies across various markets, including Forex, commodities, indices, and cryptocurrencies.
Its open-source nature allows for customization and verification, providing transparency and flexibility to suit diverse trading needs. Hidden SMT Divergence stands as a powerful addition to the arsenal of any trader seeking to unlock hidden opportunities in dynamic financial markets.
Advanced MA and MACD PercentageIntroduction
The "Advanced MA and MACD Percentage" indicator is a powerful and innovative tool designed to help traders analyze financial markets with ease and precision. This indicator combines Moving Averages (MA) with the MACD indicator to assess the market’s overall trend and calculate the percentage of buy and sell signals based on current data.
Features
Multi-Timeframe Analysis:
Allows selecting your preferred timeframe for trend analysis, such as minute, hourly, daily, or weekly charts.
Support for Multiple Moving Average Types:
Offers the option to use either Simple Moving Average (SMA) or Exponential Moving Average (EMA), based on user preference.
Comprehensive MACD Analysis:
Analyzes the relationship between multiple moving averages (e.g., 20/50, 50/100) using MACD to provide deeper insights into market dynamics.
Calculation of Buy and Sell Percentages:
Computes the percentage of indicators signaling buy or sell conditions, providing a clear summary to assist trading decisions.
Intuitive Visual Interface:
Displays buy and sell percentages as two visible lines (green and red) on the chart.
Includes reference lines to clarify the range of percentages (100% to 0%).
How It Works
Moving Averages Calculation:
Calculates moving averages (20, 50, 100, 150, and 200) for the selected timeframe.
MACD Pair Analysis:
Computes the MACD to compare the performance between various moving average pairs, such as (20/50) and (50/100).
Identifying Buy and Sell Signals:
Counts the number of indicators signaling buy (price above MAs or positive MACD histogram).
Converts the count into percentages for both buy and sell signals.
Visual Representation:
Plots buy and sell percentages as clear lines (green for buy, red for sell).
Adds reference lines (100% and 0%) for easier interpretation.
How to Use the Indicator?
Settings:
Choose the type of moving average (SMA or EMA).
Select the timeframe that suits your strategy (e.g., 15 minutes, 1 hour, or daily).
Reading the Results:
If the buy percentage (green line) is above 50%, the overall trend is bullish (buy).
If the sell percentage (red line) is above 50%, the overall trend is bearish (sell).
Integrating Into Your Strategy:
Combine it with other indicators to confirm entry and exit signals.
Use it to quickly understand the market’s overall trend without needing complex manual analysis.
Benefits of the Indicator
Simplified Analysis: Provides a straightforward summary of the market's overall trend.
Adaptable to All Timeframes: Works perfectly on all timeframes.
Customizable: Allows users to adjust settings according to their needs.
Important Notes
This indicator does not provide direct buy or sell signals. Instead, it offers a summary of the market’s condition based on a combination of indicators.
It is recommended to use it alongside other technical analysis tools for precise trading signals.
Conclusion
The "Advanced MA and MACD Percentage" indicator is an ideal tool for traders who want to analyze the market using a combination of Moving Averages and MACD. It gives you a comprehensive overview of the overall trend, helping you make informed and quick trading decisions. Try it now and see the difference!
Alternative Price [OmegaTools]The Alternative Price script is a sophisticated and flexible indicator designed to redefine how traders visualize and interpret price data. By offering multiple unique charting modes, robust customization options, and advanced features, this tool provides a comprehensive alternative to traditional price charts. It is particularly useful for identifying market trends, detecting patterns, and simplifying complex data into actionable insights.
This script is highly versatile, allowing users to choose from five distinct charting modes: Candles, Line, Channel, Renko, and Bubbles. Each mode serves a unique purpose and presents price information in an innovative way. When using this script, it is strongly recommended to hide the platform’s default price candles or chart data. Doing so will eliminate redundancy and provide a clearer and more focused view of the alternative price visualization.
The Candles mode offers a traditional candlestick charting style but with added flexibility. Users can choose to enable smoothed opens or smoothed closes, which adjust the way the open and close prices are calculated. When smoothed opens are enabled, the opening price is computed as the average of the actual open price and the closing prices of the previous two bars. This creates a more gradual representation of price transitions, particularly useful in markets prone to sudden spikes or irregularities. Similarly, smoothed closes modify the closing price by averaging it with the previous close, the high-low midpoint, and an exponential moving average of the high-low-close mean. This technique filters out noise, making trends and price momentum easier to identify.
In the Line mode, the script displays a simple line chart that connects the smoothed closing prices. This mode is ideal for traders who prefer minimalism or need to focus on the overall trend without the distraction of individual bar details. The Channel mode builds upon this by plotting additional lines representing the highs and lows of each bar. The resulting visualization resembles a price corridor that helps identify support and resistance zones or price compression areas.
The Renko mode introduces a more advanced and noise-filtering method of visualizing price movements. Renko charts, constructed using the ATR (Average True Range) as a baseline, display blocks that represent a specific price range. The script dynamically calculates the size of these blocks based on ATR, with separate thresholds for upward and downward movements. This makes Renko mode particularly effective for identifying sustained trends while ignoring minor price fluctuations. Additionally, the open and close values of Renko blocks can be smoothed to further refine the visualization.
The Bubbles mode represents price activity using circles or bubbles whose size corresponds to relative volume. This mode provides a quick and intuitive way to assess market participation at different price levels. Larger bubbles indicate higher trading volumes, while smaller bubbles highlight periods of lower activity. This visualization is particularly valuable in understanding the relationship between price movements and market liquidity.
The coloring of candles and other chart elements is a core feature of this script. Users can select between two color modes: Normal and Volume. In Normal mode, bullish candles are displayed in the user-defined bullish color, while bearish candles use the bearish color. Neutral elements, such as midpoints or undecided price movements, are shaded with a neutral color. In Volume mode, the candle colors are dynamically adjusted based on trading volume. A gradient color scale is applied, where the intensity of the bullish or bearish colors reflects the volume for that particular bar. This feature allows traders to visually identify periods of heightened activity and associate them with specific price movements.
Engulfing patterns, a popular technical analysis tool, are automatically detected and marked on the chart when the corresponding setting is enabled. The script identifies long engulfing patterns, where the current bar's range completely encompasses the previous bar’s range and indicates a potential bullish reversal. Similarly, short engulfing patterns are identified where the current bar fully engulfs the previous bar in the opposite direction, suggesting a bearish reversal. These patterns are visually highlighted with circular markers to draw the trader’s attention.
Each feature and mode is highly customizable. The colors for bullish, bearish, and neutral movements can be personalized, and the thresholds for patterns or smoothing can be fine-tuned to match specific trading strategies. The script's ability to toggle between various modes makes it adaptable to different market conditions and analysis preferences.
In summary, the Alternative Price script is a comprehensive tool that redefines the way traders view price charts. By offering multiple visualization modes, customizable features, and advanced detection algorithms, it provides a powerful way to uncover market trends, volume relationships, and significant patterns. The recommendation to hide default chart elements ensures that the focus remains on this innovative tool, enhancing its usability and clarity. This script empowers traders to gain deeper insights into market behavior and make informed trading decisions, all while maintaining a clean and visually appealing chart layout.
Keep in mind that some of the modes of this indicator might not reflect the actual closing price of the underlying asset, before opening a trade, check carefully the actual price!
DonAlt - Smart Money Toolkit [BigBeluga]DonAlt - Smart Money Toolkit is inspired by the analytical insights of popular crypto influencer DonAlt.
This advanced toolkit integrates smart money concepts with key technical analysis elements to enhance your trading decisions.
🔵 KEY FEATURES:
SUPPORT AND RESISTANCE LEVELS Automatically identifies critical market turning points with significant volume. Levels turn green when the price is above them and red when below, providing a visual cue for key market thresholds.
ORDER BLOCKS: Highlights significant price zones preceding major price movements.
- If the move is down , it searches for the last bullish candle and plots a block from its body.
- If the move is up , it searches for the last bearish candle and creates a block from its body.
These blocks help identify areas of institutional interest and potential reversals.
TRENDLINES: Automatically plots trendlines to identify breakout zones or price accumulation areas.
• Bullish trendlines accumulation form when the current low is higher than the previous low.
• Bearish trendlines accumulation emerge when the current high is lower than the previous high.
• Bullish trendlines Breakout form when the price break above it.
• Bearish trendlines Breakout form when the price break below it.
Volatility Integration: The levels incorporate normalized volatility to ensure only significant zones are highlighted, filtering noise and emphasizing meaningful data.
🔵 WHEN TO USE:
This toolkit is ideal for traders seeking to align with "smart money" strategies by identifying key areas of institutional activity, strong support and resistance zones, and potential breakout setups.
🔵 CUSTOMIZATION:
Toggle the visibility of levels, order blocks, or trendlines to match your trading style and focus.
Colors of the Bull and Bear key features
Extend trendline
RSI to Price RatioThe RSI to Price Ratio is a technical indicator designed to provide traders with a unique perspective by analyzing the relationship between the Relative Strength Index (RSI) and the underlying asset's price. Unlike traditional RSI, which is viewed on a scale from 0 to 100, this indicator normalizes the RSI by dividing it by the price, resulting in a dynamic ratio that adjusts to price movements. The histogram format makes it easy to visualize fluctuations, with distinct color coding for overbought (red), oversold (green), and neutral (blue) conditions.
This indicator excels in helping traders identify potential reversal zones and trend continuation signals. Overbought and oversold levels are dynamically adjusted using the price source, making the indicator more adaptive to market conditions. Additionally, the ability to plot these OB/OS thresholds as lines on the histogram ensures traders can quickly assess whether the market is overstretched in either direction. By combining RSI’s momentum analysis with price normalization, this tool is particularly suited for traders who value precision and nuanced insights into market behavior. It can be used as a standalone indicator or in conjunction with other tools to refine entry and exit strategies.
Hybrid Adaptive Double Exponential Smoothing🙏🏻 This is HADES (Hybrid Adaptive Double Exponential Smoothing) : fully data-driven & adaptive exponential smoothing method, that gains all the necessary info directly from data in the most natural way and needs no subjective parameters & no optimizations. It gets applied to data itself -> to fit residuals & one-point forecast errors, all at O(1) algo complexity. I designed it for streaming high-frequency univariate time series data, such as medical sensor readings, orderbook data, tick charts, requests generated by a backend, etc.
The HADES method is:
fit & forecast = a + b * (1 / alpha + T - 1)
T = 0 provides in-sample fit for the current datum, and T + n provides forecast for n datapoints.
y = input time series
a = y, if no previous data exists
b = 0, if no previous data exists
otherwise:
a = alpha * y + (1 - alpha) * a
b = alpha * (a - a ) + (1 - alpha) * b
alpha = 1 / sqrt(len * 4)
len = min(ceil(exp(1 / sig)), available data)
sig = sqrt(Absolute net change in y / Sum of absolute changes in y)
For the start datapoint when both numerator and denominator are zeros, we define 0 / 0 = 1
...
The same set of operations gets applied to the data first, then to resulting fit absolute residuals to build prediction interval, and finally to absolute forecasting errors (from one-point ahead forecast) to build forecasting interval:
prediction interval = data fit +- resoduals fit * k
forecasting interval = data opf +- errors fit * k
where k = multiplier regulating intervals width, and opf = one-point forecasts calculated at each time t
...
How-to:
0) Apply to your data where it makes sense, eg. tick data;
1) Use power transform to compensate for multiplicative behavior in case it's there;
2) If you have complete data or only the data you need, like the full history of adjusted close prices: go to the next step; otherwise, guided by your goal & analysis, adjust the 'start index' setting so the calculations will start from this point;
3) Use prediction interval to detect significant deviations from the process core & make decisions according to your strategy;
4) Use one-point forecast for nowcasting;
5) Use forecasting intervals to ~ understand where the next datapoints will emerge, given the data-generating process will stay the same & lack structural breaks.
I advise k = 1 or 1.5 or 4 depending on your goal, but 1 is the most natural one.
...
Why exponential smoothing at all? Why the double one? Why adaptive? Why not Holt's method?
1) It's O(1) algo complexity & recursive nature allows it to be applied in an online fashion to high-frequency streaming data; otherwise, it makes more sense to use other methods;
2) Double exponential smoothing ensures we are taking trends into account; also, in order to model more complex time series patterns such as seasonality, we need detrended data, and this method can be used to do it;
3) The goal of adaptivity is to eliminate the window size question, in cases where it doesn't make sense to use cumulative moving typical value;
4) Holt's method creates a certain interaction between level and trend components, so its results lack symmetry and similarity with other non-recursive methods such as quantile regression or linear regression. Instead, I decided to base my work on the original double exponential smoothing method published by Rob Brown in 1956, here's the original source , it's really hard to find it online. This cool dude is considered the one who've dropped exponential smoothing to open access for the first time🤘🏻
R&D; log & explanations
If you wanna read this, you gotta know, you're taking a great responsability for this long journey, and it gonna be one hell of a trip hehe
Machine learning, apprentissage automatique, машинное обучение, digital signal processing, statistical learning, data mining, deep learning, etc., etc., etc.: all these are just artificial categories created by the local population of this wonderful world, but what really separates entities globally in the Universe is solution complexity / algorithmic complexity.
In order to get the game a lil better, it's gonna be useful to read the HTES script description first. Secondly, let me guide you through the whole R&D; process.
To discover (not to invent) the fundamental universal principle of what exponential smoothing really IS, it required the review of the whole concept, understanding that many things don't add up and don't make much sense in currently available mainstream info, and building it all from the beginning while avoiding these very basic logical & implementation flaws.
Given a complete time t, and yet, always growing time series population that can't be logically separated into subpopulations, the very first question is, 'What amount of data do we need to utilize at time t?'. Two answers: 1 and all. You can't really gain much info from 1 datum, so go for the second answer: we need the whole dataset.
So, given the sequential & incremental nature of time series, the very first and basic thing we can do on the whole dataset is to calculate a cumulative , such as cumulative moving mean or cumulative moving median.
Now we need to extend this logic to exponential smoothing, which doesn't use dataset length info directly, but all cool it can be done via a formula that quantifies the relationship between alpha (smoothing parameter) and length. The popular formulas used in mainstream are:
alpha = 1 / length
alpha = 2 / (length + 1)
The funny part starts when you realize that Cumulative Exponential Moving Averages with these 2 alpha formulas Exactly match Cumulative Moving Average and Cumulative (Linearly) Weighted Moving Average, and the same logic goes on:
alpha = 3 / (length + 1.5) , matches Cumulative Weighted Moving Average with quadratic weights, and
alpha = 4 / (length + 2) , matches Cumulative Weighted Moving Average with cubic weghts, and so on...
It all just cries in your shoulder that we need to discover another, native length->alpha formula that leverages the recursive nature of exponential smoothing, because otherwise, it doesn't make sense to use it at all, since the usual CMA and CMWA can be computed incrementally at O(1) algo complexity just as exponential smoothing.
From now on I will not mention 'cumulative' or 'linearly weighted / weighted' anymore, it's gonna be implied all the time unless stated otherwise.
What we can do is to approach the thing logically and model the response with a little help from synthetic data, a sine wave would suffice. Then we can think of relationships: Based on algo complexity from lower to higher, we have this sequence: exponential smoothing @ O(1) -> parametric statistics (mean) @ O(n) -> non-parametric statistics (50th percentile / median) @ O(n log n). Based on Initial response from slow to fast: mean -> median Based on convergence with the real expected value from slow to fast: mean (infinitely approaches it) -> median (gets it quite fast).
Based on these inputs, we need to discover such a length->alpha formula so the resulting fit will have the slowest initial response out of all 3, and have the slowest convergence with expected value out of all 3. In order to do it, we need to have some non-linear transformer in our formula (like a square root) and a couple of factors to modify the response the way we need. I ended up with this formula to meet all our requirements:
alpha = sqrt(1 / length * 2) / 2
which simplifies to:
alpha = 1 / sqrt(len * 8)
^^ as you can see on the screenshot; where the red line is median, the blue line is the mean, and the purple line is exponential smoothing with the formulas you've just seen, we've met all the requirements.
Now we just have to do the same procedure to discover the length->alpha formula but for double exponential smoothing, which models trends as well, not just level as in single exponential smoothing. For this comparison, we need to use linear regression and quantile regression instead of the mean and median.
Quantile regression requires a non-closed form solution to be solved that you can't really implement in Pine Script, but that's ok, so I made the tests using Python & sklearn:
paste.pics
^^ on this screenshot, you can see the same relationship as on the previous screenshot, but now between the responses of quantile regression & linear regression.
I followed the same logic as before for designing alpha for double exponential smoothing (also considered the initial overshoots, but that's a little detail), and ended up with this formula:
alpha = sqrt(1 / length) / 2
which simplifies to:
alpha = 1 / sqrt(len * 4)
Btw, given the pattern you see in the resulting formulas for single and double exponential smoothing, if you ever want to do triple (not Holt & Winters) exponential smoothing, you'll need len * 2 , and just len * 1 for quadruple exponential smoothing. I hope that based on this sequence, you see the hint that Maybe 4 rounds is enough.
Now since we've dealt with the length->alpha formula, we can deal with the adaptivity part.
Logically, it doesn't make sense to use a slower-than-O(1) method to generate input for an O(1) method, so it must be something universal and minimalistic: something that will help us measure consistency in our data, yet something far away from statistics and close enough to topology.
There's one perfect entity that can help us, this is fractal efficiency. The way I define fractal efficiency can be checked at the very beginning of the post, what matters is that I add a square root to the formula that is not typically added.
As explained in the description of my metric QSFS , one of the reasons for SQRT-transformed values of fractal efficiency applied in moving window mode is because they start to closely resemble normal distribution, yet with support of (0, 1). Data with this interesting property (normally distributed yet with finite support) can be modeled with the beta distribution.
Another reason is, in infinitely expanding window mode, fractal efficiency of every time series that exhibits randomness tends to infinitely approach zero, sqrt-transform kind of partially neutralizes this effect.
Yet another reason is, the square root might better reflect the dimensional inefficiency or degree of fractal complexity, since it could balance the influence of extreme deviations from the net paths.
And finally, fractals exhibit power-law scaling -> measures like length, area, or volume scale in a non-linear way. Adding a square root acknowledges this intrinsic property, while connecting our metric with the nature of fractals.
---
I suspect that, given analogies and connections with other topics in geometry, topology, fractals and most importantly positive test results of the metric, it might be that the sqrt transform is the fundamental part of fractal efficiency that should be applied by default.
Now the last part of the ballet is to convert our fractal efficiency to length value. The part about inverse proportionality is obvious: high fractal efficiency aka high consistency -> lower window size, to utilize only the last data that contain brand new information that seems to be highly reliable since we have consistency in the first place.
The non-obvious part is now we need to neutralize the side effect created by previous sqrt transform: our length values are too low, and exponentiation is the perfect candidate to fix it since translating fractal efficiency into window sizes requires something non-linear to reflect the fractal dynamics. More importantly, using exp() was the last piece that let the metric shine, any other transformations & formulas alike I've tried always had some weird results on certain data.
That exp() in the len formula was the last piece that made it all work both on synthetic and on real data.
^^ a standalone script calculating optimal dynamic window size
Omg, THAT took time to write. Comment and/or text me if you need
...
"Versace Pip-Boy, I'm a young gun coming up with no bankroll" 👻
∞