Enhanced 3-Month Reversal Strategy v6 (TSLA)### **Strategy Overview: Enhanced 3-Month Reversal Strategy v6 for TSLA**
This custom-designed strategy is tailored specifically for **Tesla Inc. (TSLA)**, incorporating a multi-factor scoring model to capture short-term mean-reversion opportunities within a broader trend-aware framework.
---
### **Methodology**
The strategy blends **technical reversal signals** with **trend filtering** and **volatility-adjusted risk management**. It assigns dynamic weights to six core technical indicators for both long and short entries:
- **RSI (7-period):** Identifies overbought/oversold conditions based on percentile ranks.
- **MACD (8/17/9):** Captures short-term momentum shifts with trend confirmation.
- **ADX (14):** Ensures trades are taken only in strong trending environments.
- **Volume Spike:** Confirms breakout or reversal intensity.
- **SMA Crossovers (20 & 50):** Filters trend direction on a medium scale.
- **Implied Volatility Rank (126-period HV proxy):** Measures relative volatility levels to confirm timing.
All inputs are scored based on weighted signals, and trades are only entered when the composite score exceeds a defined threshold.
---
### **Features**
- ✅ **Volatility-based dynamic stop-loss and take-profit** for adaptive risk management.
- ✅ **Intraday trading window filter** to restrict trades to regular market hours (default: 9AM–4PM EST).
- ✅ **Trend filter (200-SMA)** to allow long trades only in bullish markets.
- ✅ **Score threshold parameters** are fully adjustable for optimization.
- ✅ **Individual trade P&L tracking** via chart annotations.
---
### **Backtest Summary**
- **Time period:** Backtested on TSLA from **January 2022 to March 2025**.
- **Data granularity:** 15-minute and 1-hour timeframes show best performance consistency.
- **Market regime:** Performs well in both trending and volatile mean-reversion phases.
---
### **Best Input Parameters (from hyperparameter tuning)**
**Long Entry Weights:**
- RSI: `0.35`
- IV Rank: `0.10`
- MACD: `0.15`
- SMA Condition: `0.25`
- ADX: `0.15`
- Volume Spike: `0.25`
**Short Entry Weights:**
- RSI: `0.20`
- IV Rank: `0.15`
- MACD: `0.30`
- SMA Condition: `0.00`
- ADX: `0.15`
- Volume Spike: `0.30`
**Other Settings:**
- MACD Signal Period: `9`
- RSI Length: `7`
- IV Period: `126`
- SMA Periods: `20 & 50`
- Trend Filter SMA: `200`
- Stop Loss / Take Profit: `1.0 × HV` multiplier
---
--- Optuna 优化完成 ---
最佳 Trial 编号: 29
最佳 Total Return : 17927.75678703037
最佳参数:
rsi_length: 13
iv_length: 140
macd_fast: 7
macd_slow: 30
adx_length: 25
sma_short_period: 21
sma_long_period: 78
volume_ma_period: 14
rsi_low_percentile: 21
rsi_high_percentile: 60
iv_low_percentile: 11
iv_high_percentile: 89
take_profit_mult: 4.0
stop_loss_mult: 5.0
bullish_threshold: 0.65
bearish_threshold: 0.9
rsi_bull_weight: 0.5
iv_bull_weight: 0.25
macd_bull_weight: 0.30000000000000004
sma_bull_weight: 0.1
adx_bull_weight: 0.0
volume_bull_weight: 0.3
rsi_bear_weight: 0.5
iv_bear_weight: 0.2
macd_bear_weight: 0.15000000000000002
sma_bear_weight: 0.1
adx_bear_weight: 0.1
volume_bear_weight: 0.15000000000000002
macd_signal: 9
Osciladores
DAMA OSC - Directional Adaptive MA OscillatorOverview:
The DAMA OSC (Directional Adaptive MA Oscillator) is a highly customizable and versatile oscillator that analyzes the delta between two moving averages of your choice. It detects trend progression, regressions, rebound signals, MA cross and critical zone crossovers to provide highly contextual trading information.
Designed for trend-following, reversal timing, and volatility filtering, DAMA OSC adapts to market conditions and highlights actionable signals in real-time.
Features:
Support for 11 custom moving average types (EMA, DEMA, TEMA, ALMA, KAMA, etc.)
Customizable fast & slow MA periods and types
Histogram based on percentage delta between fast and slow MA
Trend direction coloring with “Green”, “Blue”, and “Red” zones
Rebound detection using close or shadow logic
Configurable thresholds: Overbought, Oversold, Underbought, Undersold
Optional filters: rebound validation by candle color or flat-zone filter
Full visual overlay: MA lines, crossover markers, rebound icons
Complete alert system with 16 preconfigured conditions
How It Works:
Histogram Logic:
The histogram measures the percentage difference between the fast and slow MA:
hist_value = ((FastMA - SlowMA) / SlowMA) * 100
Trend State Logic (Green / Blue / Red):
Green_Up = Bullish acceleration
Blue_Up (or Red_Up, depending the display settings) = Bullish deceleration
Blue_Down (or Green_Down, depending the display settings) = Bearish deceleration
Red_Down = Bearish acceleration
Rebound Logic:
A rebound is detected when price:
Crosses back over a selected MA (fast or slow)
After being away for X candles (rebound_backstep)
Optional: filtered by histogram zones or candle color
Inputs:
Display Options:
Show/hide MA lines
Show/hide MA crosses
Show/hide price rebounds
Enable/disable blue deceleration zones
DAMA Settings:
Fast/Slow MA type and length
Source input (close by default)
Overbought/Oversold levels
Underbought/Undersold levels
Rebound Settings:
Use Close and/or Shadow
Rebound MA (Fast/Slow)
Candle color validation
Flat zone filter rebounds (between UnderSold and UnderBought)
Available MA type:
SMA (Simple MA)
EMA (Exponential MA)
DEMA (Double EMA)
TEMA (Triple EMA)
WMA (Weighted MA)
HMA (Hull MA)
VWMA (Volume Weighted MA)
Kijun (Ichimoku Baseline)
ALMA (Arnaud Legoux MA)
KAMA (Kaufman Adaptive MA)
HULLMOD (Modified Hull MA, Same as HMA, tweaked for Pine v6 constraints)
Notes:
**DEMA/TEMA** reduce lag compared to EMA, useful for faster reaction in trending markets.
**KAMA/ALMA** are better suited to noisy or volatile environments (e.g., BTC).
**VWMA** reacts strongly to volume spikes.
**HMA/HULLMOD** are great for visual clarity in fast moves.
Alerts Included (Fully Configurable):
Golden Cross:
Fast MA crosses above Slow MA
Death Cross:
Fast MA crosses below Slow MA
Bullish Rebound:
Rebound from below MA in uptrend
Bearish Rebound:
Rebound from above MA in downtrend
Bull Progression:
Transition into Green_Up with positive delta
Bear Progression:
Transition into Red_Down with negative delta
Bull Regression:
Exit from Red_Down into Blue/Green with negative delta
Bear Regression:
Exit from Green_Up into Blue/Red with positive delta
Crossover Overbought:
Histogram crosses above Overbought
Crossunder Overbought:
Histogram crosses below Overbought
Crossover Oversold:
Histogram crosses above Oversold
Crossunder Oversold:
Histogram crosses below Oversold
Crossover Underbought:
Histogram crosses above Underbought
Crossunder Underbought:
Histogram crosses below Underbought
Crossover Undersold:
Histogram crosses above Undersold
Crossunder Undersold:
Histogram crosses below Undersold
Credits:
Created by Eff_Hash. This code is shared with the TradingView community and full free. do not hesitate to share your best settings and usage.
DMI, RSI, ATR Combo// Usage:
// 1. Add this script to your TradingView chart.
// 2. The ADX line helps determine trend strength.
// 3. The +DI and -DI lines indicate bullish or bearish movements.
// 4. The RSI shows momentum and potential overbought/oversold conditions.
// 5. The ATR measures volatility, helping traders assess risk.
Momentum Based RSIThe Momentum Based RSI is an enhancement to the RSI. it incorporates 2 sections:
MA Ratio (Fast/Slow)
RSI
at the end both of those are multiplied to create a more responsive RSI which reacts fast to market moves while still providing a whip ressistant tool.
Momentum Calculation
The "MA Ratio" as i like to call it results from comparing 2 MAs (both can be set to whatever type you like) against eachother, which, in the end, provides a Ratio that visualizes the difference. It is simple yet effective
RSI
An Old yet popular tool which dates back to 1978. In and out of itself it is a great tool, however it still can be enhanced.
The Combination
The RSI and the MARatio are multiplied together, which results in an RSI that is ampliefied by the speed of the market movements.
This proves highly effective, since the MA Ratio is hovering around at the same level. However during trends, it picks up speed in either of both directions which marginally increases the RSI's response the said movement.
Why its Creative, New and Good
While it is a super simple concept, it still holds a lot of power relative to its sophistication. Traders may use it like they used the Vanilla RSI (e.g Trend following, Mean-reversion or other).
Unlike RSI with momentum overlays, this indicator actively uses an MA Ratio multiplier for simplicity and responsiveness.
At last, Its primary goal is to detect trends faster while not creating more noise & false signals.
What not to do
if youre using this indicator, please do NOT change the Fast MA to be slower than to Slow MA or vice versa, since you'll be getting broken & noise induced signals which may not align with your goals.
Great inventions require great Care
As with anything, you should not use this tool without any other confluence. As great as the backtests may be, you dont know what the future holds, be careful!
This indicator is not a guaranteed predicition tool. If youre going to use it for investment decisions, please use it in coherence with other tools.
Thank you for reading!
Adv EMA Cloud v6 (ADX, Alerts)Summary:
This indicator provides a multi-faceted view of market trends using Exponential Moving Averages (EMAs) arranged in visually intuitive clouds, enhanced with an optional ADX-based range filter and configurable alerts for key market conditions. It aims to help traders quickly gauge trend alignment across short, medium, and long timeframes while filtering signals during potentially choppy market conditions.
Key Features:
Multiple EMAs: Displays 10-period (Fast), 20-period (Mid), and 50-period (Slow) EMAs.
Long-Term Trend Filter: Includes a 200-period EMA to provide context for the overall dominant trend direction.
Dual EMA Clouds:
Fast/Mid Cloud (10/20 EMA): Fills the area between the 10 and 20 EMAs. Defaults to Green when 10 > 20 (bullish short-term momentum) and Red when 10 < 20 (bearish short-term momentum).
Mid/Slow Cloud (20/50 EMA): Fills the area between the 20 and 50 EMAs. Defaults to Aqua when 20 > 50 (bullish mid-term trend) and Fuchsia when 20 < 50 (bearish mid-term trend).
Optional ADX Range Filter: Uses the Average Directional Index (ADX) to identify potentially non-trending or choppy markets. When enabled and ADX falls below a user-defined threshold, the EMA clouds will turn grey, visually warning that trend-following signals may be less reliable.
Configurable Alerts: Provides several built-in alert conditions using Pine Script's alertcondition function:
Confluence Condition: Triggers when a 10/20 EMA crossover occurs while both EMA clouds show alignment (both bullish/green/aqua or both bearish/red/fuchsia) and price respects the 200 EMA filter and the ADX filter indicates a trend (if filters are enabled).
MA Filter Cross: Triggers when price crosses above or below the 200 EMA filter line.
Full Alignment Start: Triggers on the first bar where full bullish or bearish alignment occurs (both clouds aligned + MA filter respected + ADX trending, if filters are enabled).
How It Works:
EMA Calculation: Standard Exponential Moving Averages are calculated for the 10, 20, 50, and 200 periods based on the closing price.
Cloud Creation: The fill() function visually shades the area between the 10 & 20 EMAs and the 20 & 50 EMAs.
Cloud Coloring: The color of each cloud is determined by the relationship between the two EMAs that define it (e.g., if EMA 10 is above EMA 20, the first cloud is bullish-colored).
ADX Filter Logic: The script calculates the ADX value. If the "Use ADX Trend Filter?" input is checked and the calculated ADX is below the specified "ADX Trend Threshold", the script considers the market potentially ranging.
ADX Visual Effect: During detected ranging periods (if the ADX filter is active), the plotCloud12Color and plotCloud23Color variables are assigned a neutral grey color instead of their normal bullish/bearish colors before being passed to the fill() function.
Alert Logic: Boolean variables track the specific conditions (crossovers, cloud alignment, filter positions, ADX state). The alertcondition() function creates triggerable alerts based on these pre-defined conditions.
Potential Interpretation (Not Financial Advice):
Trend Alignment: When both clouds share the same directional color (e.g., both bullish - Green & Aqua) and price is on the corresponding side of the 200 EMA filter, it may suggest a stronger, more aligned trend. Conversely, conflicting cloud colors may indicate indecision or transition.
Dynamic Support/Resistance: The EMA lines themselves (especially the 20, 50, and 200) can sometimes act as dynamic levels where price might react.
Range Warning: Greyed-out clouds (when ADX filter is enabled) serve as a visual warning that trend-based strategies might face increased difficulty or whipsaws.
Confluence Alerts: The specific confluence alerts signal moments where multiple conditions align (crossover + cloud agreement + filters), which some traders might view as higher-probability setups.
Customization:
All EMA lengths (10, 20, 50, 200) are adjustable via the Inputs menu.
The ADX length and threshold are configurable.
The MA Trend Filter and ADX Trend Filter can be independently enabled or disabled.
Disclaimer:
This indicator is provided for informational and educational purposes only. Trading financial markets involves significant risk. Past performance is not indicative of future results. Always conduct your own thorough analysis and consider your risk tolerance before making any trading decisions. This indicator should be used in conjunction with other analysis methods and tools. Do not trade based solely on the signals or visuals provided by this indicator.
RSI + MFI Momentum Mapper - CoffeeKillerRSI + MFI Momentum Mapper - CoffeeKiller Indicator Guide
Welcome traders! This guide will walk you through the RSI + MFI Momentum Mapper indicator, an innovative market analysis tool developed by CoffeeKiller that combines two powerful oscillators to create a comprehensive momentum visualization system.
🔔 **Warning: This Is Not a Standard RSI or MFI Indicator** 🔔 This indicator combines and normalizes RSI and MFI data to create a unified momentum representation with boundary detection and peak signaling features.
Core Concept: Combined Momentum Analysis
The foundation of this indicator lies in merging the strengths of two complementary oscillators - Relative Strength Index (RSI) and Money Flow Index (MFI) - to provide a more robust momentum signal that accounts for both price action and volume.
Directional Columns: Momentum Strength
- Positive Green Columns: Bullish momentum
- Negative Red Columns: Bearish momentum
- Color intensity varies based on momentum strength
- Special coloring for new high/low boundaries
Marker Lines: Dynamic Support/Resistance
- High Marker Line (Magenta): Tracks the highest point reached during a bullish phase
- Low Marker Line (Cyan): Tracks the lowest point reached during a bearish phase
- Creates visual boundaries showing momentum extremes
Peak Detection System:
- Triangular markers identify significant local maxima and minima
- Background highlighting shows important momentum peaks
- Helps identify potential reversal points and momentum exhaustion
Reference Lines:
- Zero Line (Gray): Divides bullish from bearish momentum
- High Line (+1): Upper threshold for extremely bullish conditions
- Low Line (-1): Lower threshold for extremely bearish conditions
Core Components
1. Oscillator Normalization
- RSI and MFI values centered around zero
- Values scaled to create consistent visualization
- Normalized range typically between -1 and +1
- Combination of indicators for signal reliability
2. Boundary Tracking System
- Automatic detection of highest values in bullish phases
- Automatic detection of lowest values in bearish phases
- Step-line visualization of boundaries
- Color-coded for easy identification
3. Peak Detection System
- Identification of local maxima and minima
- Background highlighting of significant peaks
- Triangle markers for peak visualization
- Zero-line cross detection for trend changes
4. Signal Smoothing
- Signal line calculation via SMA
- Helps filter noise and identify trends
- Provides confirmation of momentum direction
Main Features
Oscillator Settings
- Customizable RSI length for sensitivity control
- Customizable MFI length for sensitivity control
- Normalized display for consistent visualization
- Signal smoothing for clearer readings
Visual Elements
- Color-coded columns showing momentum direction and strength
- Dynamic marker lines for momentum boundaries
- Peak triangles for significant turning points
- Background highlighting for peak identification
- Reference lines for momentum threshold levels
Signal Generation
- Zero-line crosses for trend change signals
- Boundary breaks for momentum strength
- Peak formation for potential reversals
- Color changes for momentum direction and acceleration
Customization Options
- RSI and MFI length parameters
- Marker line visibility and colors
- Peak marker color selection
- Peak background display options
Trading Applications
1. Trend Identification
- Directional line crossing above zero: bullish trend beginning
- Directional line crossing below zero: bearish trend beginning
- Column color: indicates momentum direction
- Column height: indicates momentum strength
2. Reversal Detection
- Peak triangles after extended trend: potential exhaustion
- Background highlighting: significant reversal points
- Directional line approaching marker lines: potential trend change
- Color shifts from bright to muted: decreasing momentum
3. Momentum Analysis
- Breaking above previous high boundary: accelerating bullish momentum
- Breaking below previous low boundary: accelerating bearish momentum
- Special coloring (magenta/cyan): boundary breaks indicating strength
- Approaching +1/-1 lines: extreme momentum conditions
4. Market Structure Assessment
- Consecutive higher peaks: strengthening bullish structure
- Consecutive lower troughs: strengthening bearish structure
- Peak comparisons: relative strength of momentum phases
- Boundary line steps: market structure levels
Optimization Guide
1. Oscillator Settings
- RSI Length: Default 14 provides balanced signals
- Lower values (7-10): More responsive, potentially noisier
- Higher values (20-30): Smoother, fewer false signals
- MFI Length: Default 14 provides balanced signals
- Lower values: More responsive to volume changes
- Higher values: Less sensitive to short-term volume spikes
2. Visual Customization
- Marker Line Colors: Adjust for visibility on your chart
- Peak Marker Color: Default yellow provides good contrast
- Enable/disable background highlights based on preference
- Consider chart background when selecting colors
3. Signal Interpretation
- Stronger signals: When directional line approaches +1/-1
- Confirmation: When peaks form after extended momentum
- Early warnings: When color intensity changes before direction
- Trend strength: Distance between zero line and current reading
4. Reference Line Usage
- Zero line: Primary trend divider
- +1/-1 lines: Extreme momentum thresholds
- Marker lines: Dynamic support/resistance levels
- Distance from reference: Momentum strength measure
Best Practices
1. Signal Confirmation
- Wait for zero-line crosses to confirm trend changes
- Look for peak formations to identify potential reversals
- Check for boundary breaks to confirm strong momentum
- Use with price action for entry/exit precision
2. Timeframe Selection
- Lower timeframes: more signals, potential noise
- Higher timeframes: cleaner signals, less frequent
- Multiple timeframes: confirm signals across time horizons
- Match to your trading style and holding period
3. Market Context
- Strong bullish phase: positive columns breaking above marker line
- Strong bearish phase: negative columns breaking below marker line
- Columns approaching zero: potential trend change
- Columns approaching +1/-1: extreme conditions, potential reversal
4. Combining with Other Indicators
- Use with trend indicators for confirmation
- Pair with other oscillators for divergence detection
- Combine with volume analysis for validation
- Consider support/resistance levels with boundary lines
Advanced Trading Strategies
1. Boundary Break Strategy
- Enter long when directional line breaks above previous high marker line
- Enter short when directional line breaks below previous low marker line
- Use zero-line as initial stop-loss reference
- Take profits at formation of opposing peaks
2. Peak Trading Strategy
- Identify significant peaks with triangular markers
- Look for consecutive lower peaks in bullish phases for shorting opportunities
- Look for consecutive higher troughs in bearish phases for buying opportunities
- Use zero-line crosses as confirmation
3. Extreme Reading Strategy
- Look for directional line approaching +1/-1 lines
- Watch for color changes and peak formations
- Enter counter-trend positions after confirmed peaks
- Use tight stops due to extreme momentum conditions
4. Column Color Strategy
- Enter long when columns turn bright green (increasing momentum)
- Enter short when columns turn bright red (increasing momentum)
- Exit when color intensity fades (decreasing momentum)
- Use marker lines as dynamic support/resistance
Practical Analysis Examples
Bullish Market Scenario
- Directional line crosses above zero line
- Green columns grow in height and intensity
- High marker line forms steps upward
- Peak triangles appear at local maxima
- Background highlights appear at significant momentum peaks
Bearish Market Scenario
- Directional line crosses below zero line
- Red columns grow in depth and intensity
- Low marker line forms steps downward
- Peak triangles appear at local minima
- Background highlights appear at significant momentum troughs
Consolidation Scenario
- Directional line oscillates around zero line
- Column colors alternate frequently
- Marker lines remain relatively flat
- Few or no new peak highlights appear
- Directional values remain small
Understanding Market Dynamics Through RSI + MFI Momentum Mapper
At its core, this indicator provides a unique lens to visualize market momentum by combining two complementary oscillators:
1. Combined Strength: By averaging RSI (price-based) and MFI (volume-based), the indicator provides a more comprehensive view of market momentum that considers both price action and buying/selling pressure.
2. Normalized Scale: The indicator normalizes values around zero, making it easier to identify bullish vs bearish conditions and the relative strength of momentum in either direction.
3. Dynamic Boundaries: The marker lines create a visual representation of the "high water marks" of momentum in both directions, helping to identify when markets are making new momentum extremes.
4. Exhaustion Signals: The peak detection system highlights moments where momentum has reached a local maximum or minimum, often precursors to reversals or consolidations.
Remember:
- Combine signals from directional line, marker lines, and peak formations
- Use appropriate timeframe settings for your trading style
- Customize the indicator to match your visual preferences
- Consider market conditions and correlate with price action
This indicator works best when:
- Used as part of a comprehensive trading system
- Combined with proper risk management
- Applied with an understanding of current market conditions
- Signals are confirmed by price action and other indicators
DISCLAIMER: This indicator and its signals are intended solely for educational and informational purposes. They do not constitute financial advice. Trading involves significant risk of loss. Always conduct your own analysis and consult with financial professionals before making trading decisions.
RSI Intraday High AccuracyThis is a high-accuracy RSI-based intraday trading indicator written in TradingView Pine Script. It identifies overbought and oversold zones to generate buy/sell signals while also providing EMA confirmation to enhance signal accuracy.
Average Price Bar (APB) with Dynamic EMATrading Made Simple: APB + Dynamic EMA with Stochastic (8,3,3) Strategy
Introduction
The "Trading Made Simple" strategy, originally developed by BigE on ForexFactory in 2011, is a powerful yet straightforward approach to trading that combines price action, moving averages, and momentum indicators to identify high-probability setups. This enhanced version integrates:
Average Price Bar (APB) – A smoothed candlestick representation that filters market noise.
Dynamic EMA (5-period, HLC3-based) – Acts as a trend filter, changing color based on its position relative to price.
Stochastic (8,3,3) – A fast momentum oscillator to confirm overbought/oversold conditions.
Core Trading Rules (BigE's Original Concept)
Trend Direction: The EMA defines the trend (bullish if price is above, bearish if below).
Stochastic Confirmation:
Long Trades: Look for Stochastic crossing up from oversold (<20) while price is above the EMA.
Short Trades: Look for Stochastic crossing down from overbought (>80) while price is below the EMA.
APB as Entry Confirmation:
A bullish APB close above the EMA strengthens long signals.
A bearish APB close below the EMA strengthens short signals.
Why This Combination Works
APB + EMA provides a clean trend bias, reducing false signals.
Stochastic (8,3,3) adds momentum confirmation, ensuring entries are timed well.
The background color shift (green/red) makes trend reversals visually intuitive.
This system is ideal for swing traders and day traders looking for a rule-based, discretionary approach that removes emotional decision-making while keeping trading simple and effective.
Pivot Length Percentiles Oscillator# Pivot Length Percentiles Oscillator: Technical Mechanics Explained
## Introduction
The Pivot Length Percentiles Oscillator is a statistical approach to identifying potential market reversals by analyzing the distribution of price movements relative to pivot points. This publication explains the technical mechanics behind the indicator.
## Core Mechanics
### 1. Pivot Point Detection
The indicator begins by identifying significant pivot highs and lows using a user-defined lookback period:
- `lft`: Number of bars to the left of potential pivot point
- `rht`: Number of bars to the right of potential pivot point
These parameters determine how "significant" a pivot needs to be to qualify for analysis.
### 2. Distance Measurement & Historical Database
For each new pivot point identified, the indicator:
- Calculates the absolute price distance from the previous pivot of the same type
- Records the number of candles between consecutive pivots
- Stores these measurements in dynamic arrays that build a historical database
### 3. Statistical Distribution Analysis
Rather than using fixed values, the oscillator analyzes the complete distribution of historical pivot distances and calculates key percentile values:
- `lw` (Low Percentile): Lower boundary for statistical significance
- `md` (Mid Percentile): Median statistical boundary
- `hi` (High Percentile): Upper boundary for statistical extremes
### 4. Oscillator Construction
Two primary oscillator lines are calculated:
- Green line (`osc1`): Measures current price's fall below recent highs with `low - ta.highest(high, lft)`
- Red line (`osc2`): Measures current price's rise above recent lows with `high - ta.lowest(low, lft)`
### 5. Threshold Generation
The percentile values from the historical distribution create dynamic threshold lines:
- For downside movements: Scaled versions of the low percentile (`lw_distance_low`) and high percentile (`hi_distance_low`)
- For upside movements: Scaled versions of the low percentile (`lw_distance_high`) and high percentile (`hi_distance_high`)
### 6. Signal Logic
Entry signals are generated when:
- **Bullish Signal**: The downside oscillator crosses below a statistical threshold while price continues showing downward momentum (close < previous close AND close < previous open)
- **Bearish Signal**: The upside oscillator crosses above a statistical threshold while price continues showing upward momentum (close > previous close AND close > previous open)
### 7. Visualization Options
Users can toggle between:
- Standard view: Shows the oscillator and threshold lines
- Percentile view: Displays the current movement's percentile rank within the historical distribution
## Implementation Notes
- The indicator scales threshold values by 0.9 to create a slight buffer that reduces false signals
- The movement's continuation is confirmed by checking both close-to-close and close-to-open relationships
- Arrays dynamically update throughout the chart's history, making the indicator increasingly accurate as more data is processed
## Mathematical Framework
The core statistical function calculates percentiles using linear interpolation between values when needed:
```
calculate_percentile(array, percentile) =
sortedValue +
fraction * (sortedValue - sortedValue )
```
where `index = (array.size - 1) * percentile / 100`
This mathematical approach ensures the thresholds adapt dynamically to changing market conditions rather than relying on fixed values.
Oracle Prediction Futur
// (\_/)
// ( •.•)
// (")_(")
Indicator Description: Oracle Prediction Futur
The Oracle Prediction Futur is a sophisticated technical indicator designed for traders and analysts looking to gain insights into market trends through the analysis of price movements. This Pine Script™ code integrates innovative elements to enhance the trading experience and is governed by the Mozilla Public License 2.0.
Key Features:
Normalization of Closing Prices:
The indicator normalizes closing prices over a defined lookback period (100 periods) to provide a percentage-based representation of the current price relative to its historical range. This helps in identifying potential price extremes.
Peak and Trough Detection:
It identifies and plots peak tops and bottom troughs based on normalized closing values. Peak tops are marked with vibrant magenta circles, while peak bottoms are indicated by soothing cyan circles, helping traders visually spot significant turning points in the price action.
Dynamic Background Gradient:
The indicator features a visually appealing gradient background that represents market sentiment. The background color transitions between bear and bull colors based on the position of the normalized close within the 0-100 range. This provides an immediate visual cue about the strength or weakness of the market.
Horizontal Reference Lines:
The indicator includes horizontal lines at key levels (9.51 and 92.5) for quick reference, which can help to gauge areas of potential support or resistance.
User-Friendly Visuals:
The combination of background colors, dynamic plots, and clear labeling offers a user-friendly visual representation, making it easier to interpret market conditions at a glance.
Overlay Options:
As an overlay-free indicator, it maintains clarity on the price chart while providing insightful trends and forecasts.
Practical Application:
Traders can utilize the Oracle Prediction Futur indicator to identify potential entry and exit points in their trading strategies. By observing the peaks, troughs, and background color shifts, users can better understand market momentum and price action.
How to Use:
Deploy this indicator on your trading platform, and analyze the peaks and troughs along with the normalized close line and background gradient to inform your trading decisions. Look for alignment between price action and the signaling provided by the indicator for optimized trading results.
RSI Pro+ (Bear market, financial crisis and so on EditionIn markets defined by volatility, fear, and uncertainty – the battlegrounds of bear markets and financial crises – you need tools forged in resilience. Introducing RSI Pro+, a strategy built upon a legendary indicator born in 1978, yet engineered with modern visual clarity to remain devastatingly effective even in the chaotic financial landscapes of 3078.
This isn't about complex algorithms predicting the unpredictable. It's about harnessing the raw, time-tested power of the Relative Strength Index (RSI) to identify potential exhaustion points and capitalize on oversold conditions. RSI Pro+ cuts through the noise, providing clear, actionable signals when markets might be poised for a relief bounce or reversal.
Core Technology (The 1978 Engine):
RSI Crossover Entry: The strategy initiates a LONG position when the RSI (default period 11) crosses above a user-defined low threshold (default 30). This classic technique aims to enter when selling pressure may be waning, offering potential entry points during sharp downturns or periods of consolidation after a fall.
Modern Enhancements (The 3078 Cockpit):
RSI Pro+ isn't just about the signal; it's about providing a professional-grade visual experience directly on your chart:
Entry Bar Highlight: A subtle background flash on the chart signals the exact bar where the RSI crossover condition is met, alerting you to potential entry opportunities.
Trade Bar Coloring: Once a trade is active, the price bars are subtly colored, giving you immediate visual confirmation that the strategy is live in the market.
Entry Price Line: A clear, persistent line marks your exact average entry price for the duration of the trade, serving as a crucial visual anchor.
Take Profit Line: Your calculated Take Profit target is plotted as a distinct line, keeping your objective clearly in sight.
Custom Entry Marker: A precise shape (▲) appears below the bar where the trade entry was actually executed, pinpointing the start of the position.
On-Chart Info Table (HUD): A clean, customizable Heads-Up Display appears when a trade is active, showing vital information at a glance:
Entry Price: Your position's average cost basis.
TP Target: The calculated price level for your Take Profit exit.
Current PnL%: Real-time Profit/Loss percentage for the open trade.
Full Customization: Nearly every aspect is configurable via the settings menu:
RSI Period & Crossover Level
Take Profit Percentage
Toggle ALL visual enhancements on/off individually
Position the Info Table wherever you prefer on the chart.
How to Use RSI Pro+:
Add to Chart: Apply the "RSI Pro+ (Bear market...)" strategy to your TradingView chart. Ensure any previous versions are removed.
Access Settings: Click the cogwheel icon (⚙️) next to the strategy name on your chart.
Configure Inputs (Crucial Step):
RSI Crossover Level: This is key. The default (30) targets standard oversold conditions. In severe downturns, you might experiment with lower levels (e.g., 25, 20) or higher ones (e.g., 40) depending on the asset and timeframe. Observe where RSI(11) typically bottoms out on your chart.
Take Profit Percentage (%): Define your desired profit target per trade (e.g., enter 0.5 for 0.5%, 1.0 for 1%). The default is a very small 0.11%.
RSI Period: While default is 11, you can adjust this (e.g., the standard 14).
Visual Enhancements: Enable or disable the visual features (background highlights, bar coloring, lines, markers, table) according to your preference using the checkboxes. Adjust table position.
Observe & Backtest: Watch how the strategy behaves on your chosen asset and timeframe. Use TradingView's Strategy Tester to analyze historical performance based on your settings. No strategy works perfectly everywhere; testing is essential.
Important Considerations:
Risk Management: This specific script version focuses on a Take Profit exit. It does not include an explicit Stop Loss. You MUST manage risk through appropriate position sizing, potentially adding a Stop Loss manually, or by modifying the script.
Oversold ≠ Reversal: An RSI crossover is an indicator of potential exhaustion, not a guarantee of a price reversal.
Fixed TP: A fixed percentage TP ensures small wins but may exit before larger potential moves.
Backtesting Limitations: Past performance does not guarantee future results.
RSI Pro+ strips away complexity to focus on a robust, time-honored principle, enhanced with modern visuals for the discerning trader navigating today's (and tomorrow's) challenging markets
FiveFactorEdgeUses ATR14, TSI, RSI, Fast Stochastic and Slow Stochastic information to determine potential high and low price, trend strength and direction. The information ia easy to read, self-descriptive and color coded for quick reference. Since it incorporates 5 different elements it could be used by itself but as with any indicator it's highly recommended to use it with other tried and true indicators.
OG Trend MeterDescription:
The OG Trend Meter gives you a visual snapshot of multiple timeframe trends in one glance. Built for speed and clarity, it helps confirm direction across key intraday timeframes: 1m, 5m, 15m, and 30m.
How it works:
Each timeframe analyzes EMA alignment, price action, and momentum.
Displays clear green/red indicators for bullish/bearish trends on each timeframe.
Great for aligning trades with higher timeframe bias.
Best for:
Traders who want multi-timeframe confirmation before pulling the trigger.
Reducing fakeouts by staying with the dominant trend.
Scalping with the 1m chart while respecting 5m–30m direction.
Pair With: OG Supertrend or EMA Stack for high-probability confluence.
OG ATR RangeDescription:
The OG ATR Tool is a clean, visualized version of the Average True Range indicator for identifying volatility, stop-loss levels, and realistic price movement expectations.
How it works:
Calculates the average range (in points/pips) of recent candles.
Overlays ATR bands to help define breakout potential or squeeze zones.
Can be used to size trades or set dynamic stop-loss and target levels.
Best for:
Intraday traders who want to avoid unrealistic targets.
Volatility-based setups and breakout strategies.
Creating position sizing rules based on instrument volatility.
Pro Tip: Combine with your trend indicators to set sniper entries and exits that respect volatility.
Long Term Profitable Swing | AbbasA Story of a Profitable Swing Trading Strategy
Imagine you're sailing across the ocean, looking for the perfect wave to ride. Swing trading is quite similar—you're navigating the stock market, searching for the ideal moments to enter and exit trades. This strategy, created by Abbas, helps you find those waves and ride them effectively to profitable outcomes.
🌊 Finding the Perfect Wave (Entry)
Our journey begins with two simple signs that tell us a great trading opportunity is forming:
- Moving Averages: We use two lines that follow price trends—the faster one (EMA 16) reacts quickly to recent price moves, and the slower one (EMA 30) gives us a longer-term perspective. When the faster line crosses above the slower line, it's like a clear signal saying, "Hey! The wave is rising, and prices might move higher!"
- RSI Momentum: Next, we check a tool called the RSI, which measures momentum (how strongly prices are moving). If the RSI number is above 50, it means there's enough strength behind this rising wave to carry us forward.
When both signals appear together, that's our green light. It's time to jump on our surfboard and start riding this promising wave.
⚓ Safely Riding the Wave (Risk Management)
While we're riding this wave, we want to ensure we're safe from sudden surprises. To do this, we use something called the Average True Range (ATR), which measures how volatile (or bumpy) the price movements are:
- Stop-Loss: To avoid falling too hard, we set a safety line (stop-loss) 8 times the ATR below our entry price. This helps ensure we exit if the wave suddenly turns against us, protecting us from heavy losses.
- Take Profit: We also set a goal to exit the trade at 11 times the ATR above our entry. This way, we capture significant profits when the wave reaches a nice high point.
🌟 Multiple Rides, Bigger Adventures
This strategy allows us to take multiple positions simultaneously—like riding several waves at once, up to 5. Each trade we make uses only 10% of our trading capital, keeping risks manageable and giving us multiple opportunities to win big.
🗺️ Easy to Follow Settings
Here are the basic settings we use:
- Fast EMA**: 16
- Slow EMA**: 30
- RSI Length**: 9
- RSI Threshold**: 50
- ATR Length**: 21
- ATR Stop-Loss Multiplier**: 8
- ATR Take-Profit Multiplier**: 11
These settings are flexible—you can adjust them to better suit different markets or your personal trading style.
🎉 Riding the Waves of Success
This simple yet powerful swing trading approach helps you confidently enter trades, clearly know when to exit, and effectively manage your risk. It’s a reliable way to ride market waves, capture profits, and minimize losses.
Happy trading, and may you find many profitable waves to ride! 🌊✨
Please test, and take into account that it depends on taking multiple longs within the swing, and you only get to invest 25/30% of your equity.
IDX - 5UPThe UDX-5UP is a custom indicator designed to assist traders in identifying trends, entry and exit signals, and market reversal moments with greater accuracy. It combines price analysis, volume, and momentum (RSI) to provide clear buy ("Buy") and sell ("Sell") signals across any asset and timeframe, whether you're a scalper on the 5M chart or a swing trader on the 4H chart. Inspired by robust technical analysis strategies, the UDX-5UP is ideal for traders seeking a reliable tool to operate in volatile markets such as cryptocurrencies, forex, stocks, and futures.
Components of the UDX-5UP
The UDX-5UP consists of three main panels that work together to provide a comprehensive view of the market:
Main Panel (Price):
Pivot Supertrend: A dynamic line that changes color to indicate the trend. Green for an uptrend (look for buys), red for a downtrend (look for sells).
SMAs (Simple Moving Averages): Two SMAs (8 and 21 periods) to confirm the trend direction. When the SMA 8 crosses above the SMA 21, it’s a bullish signal; when it crosses below, it’s a bearish signal.
Entry/Exit Signals: "Buy" (green) and "Sell" (red) labels are plotted on the chart when entry or exit conditions are met.
Volume Panel:
Colored Volume Bars: Green bars indicate dominant buying volume, while red bars indicate dominant selling volume.
Volume Moving Average (MA 20): A blue line that helps identify whether the current volume is above or below the average, confirming the strength of the movement.
RSI Panel:
RSI (Relative Strength Index): Calculated with a period of 14, with overbought (70) and oversold (30) lines to identify momentum extremes.
Divergences: The indicator detects divergences between the RSI and price, plotting signals for potential reversals.
How the UDX-5UP Works
The UDX-5UP uses a combination of rules to generate buy and sell signals:
Buy Signal ("Buy"):
The Pivot Supertrend changes from red to green.
The SMA 8 crosses above the SMA 21.
The volume is above the MA 20, with green bars (indicating buying pressure).
The RSI is rising and, ideally, below 70 (not overbought).
Example: On the 4H chart, the price of Tether (USDT) is at 0.05515. The Pivot Supertrend turns green, the SMA 8 crosses above the SMA 21, the volume shows green bars above the MA 20, and the RSI is at 46. The UDX-5UP plots a "Buy".
Sell Signal ("Sell"):
The Pivot Supertrend changes from green to red.
The SMA 8 crosses below the SMA 21.
The volume is above the MA 20, with red bars (indicating selling pressure).
The RSI is falling and, ideally, above 70 (overbought).
Example: On the 4H chart, the price of Tether rises to 0.05817. The Pivot Supertrend turns red, the SMA 8 crosses below the SMA 21, the volume shows red bars, and the RSI is above 70. The UDX-5UP plots a "Sell".
RSI Divergences:
The indicator identifies bullish divergences (price makes a lower low, but RSI makes a higher low) and bearish divergences (price makes a higher high, but RSI makes a lower high), plotting alerts for potential reversals.
Adjustable Settings
The UDX-5UP is highly customizable to suit your trading style:
Pivot Supertrend Period: Default is 2. Increase to 3 or 4 for more conservative signals (fewer false positives, but more lag).
SMA Periods: Default is 8 and 21. Adjust to 5 and 13 for smaller timeframes (e.g., 5M) or 13 and 34 for larger timeframes (e.g., 1D).
RSI Period: Default is 14. Reduce to 10 for greater sensitivity or increase to 20 for smoother signals.
Overbought/Oversold Levels: Default is 70/30. Adjust to 80/20 in volatile markets.
Display Panels: You can enable/disable the volume and RSI panels to simplify the chart.
How to Use the UDX-5UP
Identify the Trend:
Use the Pivot Supertrend and SMAs to determine the market direction. Uptrend: look for buys. Downtrend: look for sells.
Confirm with Volume and RSI:
For buys: Volume above the MA 20 with green bars, RSI rising and below 70.
For sells: Volume above the MA 20 with red bars, RSI falling and above 70.
Enter the Trade:
Enter a buy when the UDX-5UP plots a "Buy" and all conditions are aligned.
Enter a sell when the UDX-5UP plots a "Sell" and all conditions are aligned.
Plan the Exit:
Use Fibonacci levels or support/resistance on the price chart to set targets.
Exit the trade when the UDX-5UP plots an opposite signal ("Sell" after a buy, "Buy" after a sell).
Tips for Beginners
Start with Larger Timeframes: Use the 4H or 1D chart for more reliable signals and less noise.
Combine with Other Indicators: Use the UDX-5UP with tools like Fibonacci or the Candles RSI (another powerful indicator) to confirm signals.
Practice in Demo Mode: Test the indicator in a demo account before using real money.
Manage Risk: Always use a stop-loss and don’t risk more than 1-2% of your capital per trade.
Why Use the UDX-5UP?
Simplicity: Clear "Buy" and "Sell" signals make trading accessible even for beginners.
Versatility: Works on any asset (crypto, forex, stocks) and timeframe.
Multiple Confirmations: Combines price, volume, and momentum to reduce false signals.
Customizable: Adjust the settings to match your trading style.
Author’s Notes
The UDX-5UP was developed based on years of trading and technical analysis experience. It is an evolution of tested strategies, designed to help traders navigate volatile markets with confidence. However, no indicator is infallible. Always combine the UDX-5UP with proper risk management and fundamental analysis, especially in unpredictable markets. Feedback is welcome – leave a comment or reach out with suggestions for improvements!
[blackcat] L2 Gradient RSIVWAPOVERVIEW
The L2 Gradient RSIVWAP indicator offers traders a powerful tool for assessing market conditions by combining Relative Strength Index (RSI) with Volume Weighted Average Price (VWAP). It features dynamic coloring and clear buy/sell signals to enhance decision-making.
Customizable Inputs: Adjust key parameters such as RSI-VWAP length, oversold/overbought levels, and smoothing period.
Gradient Color Visualization: Provides intuitive gradient coloring to represent RSI-VWAP values.
Buy/Sell Indicators: On-chart labels highlight potential buying and selling opportunities.
Transparent Fills: Visually distinguishes overbought and oversold zones without obscuring other data.
Access the TradingView platform and select the chart where you wish to implement the indicator.
Go to “Indicators” in the toolbar and search for “ L2 Gradient RSIVWAP.”
Click “Add to Chart” to integrate the indicator into your chart.
Customize settings via the input options:
Toggle between standard RSI and RSI-based VWAP.
Set preferred lengths and thresholds for RSI-VWAP calculations.
Configure the smoothing period for ALMA.
Performance can vary based on asset characteristics like liquidity and volatility.
Historical backtests do not predict future market behavior accurately.
The ALMA function, developed by Arnaud Legoux, enhances response times relative to simple moving averages.
Buy and sell signals are derived from RSI-VWAP crossovers; consider additional factors before making trades.
Special thanks to Arnaud Legoux for creating the ALMA function.
Adaptive KDJ (MTF)Hey guys,
this is an adaptive MTF KDJ oscillator.
Pick up to 3 different timeframes, choose a weighting if you want and enjoy the beautiful signals it will show you.
The length of every timeframe is adaptive and based of the timeframe's ATR.
The plot shows the smoothed average of the 3 KDJ values.
Large triangles show KDJ crossings.
Small triangles show anticipations of possible crossings.
I found out it works best with 1m, 5m, 15m and weighting=1 for forex scalping in 1m.
Use other indicators for confluence.
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.
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.
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.
Enhanced Fuzzy SMA Analyzer (Multi-Output Proxy) [FibonacciFlux]EFzSMA: Decode Trend Quality, Conviction & Risk Beyond Simple Averages
Stop Relying on Lagging Averages Alone. Gain a Multi-Dimensional Edge.
The Challenge: Simple Moving Averages (SMAs) tell you where the price was , but they fail to capture the true quality, conviction, and sustainability of a trend. Relying solely on price crossing an average often leads to chasing weak moves, getting caught in choppy markets, or missing critical signs of trend exhaustion. Advanced traders need a more sophisticated lens to navigate complex market dynamics.
The Solution: Enhanced Fuzzy SMA Analyzer (EFzSMA)
EFzSMA is engineered to address these limitations head-on. It moves beyond simple price-average comparisons by employing a sophisticated Fuzzy Inference System (FIS) that intelligently integrates multiple critical market factors:
Price deviation from the SMA ( adaptively normalized for market volatility)
Momentum (Rate of Change - ROC)
Market Sentiment/Overheat (Relative Strength Index - RSI)
Market Volatility Context (Average True Range - ATR, optional)
Volume Dynamics (Volume relative to its MA, optional)
Instead of just a line on a chart, EFzSMA delivers a multi-dimensional assessment designed to give you deeper insights and a quantifiable edge.
Why EFzSMA? Gain Deeper Market Insights
EFzSMA empowers you to make more informed decisions by providing insights that simple averages cannot:
Assess True Trend Quality, Not Just Location: Is the price above the SMA simply because of a temporary spike, or is it supported by strong momentum, confirming volume, and stable volatility? EFzSMA's core fuzzyTrendScore (-1 to +1) evaluates the health of the trend, helping you distinguish robust moves from noise.
Quantify Signal Conviction: How reliable is the current trend signal? The Conviction Proxy (0 to 1) measures the internal consistency among the different market factors analyzed by the FIS. High conviction suggests factors are aligned, boosting confidence in the trend signal. Low conviction warns of conflicting signals, uncertainty, or potential consolidation – acting as a powerful filter against chasing weak moves.
// Simplified Concept: Conviction reflects agreement vs. conflict among fuzzy inputs
bullStrength = strength_SB + strength_WB
bearStrength = strength_SBe + strength_WBe
dominantStrength = max(bullStrength, bearStrength)
conflictingStrength = min(bullStrength, bearStrength) + strength_N
convictionProxy := (dominantStrength - conflictingStrength) / (dominantStrength + conflictingStrength + 1e-10)
// Modifiers (Volatility/Volume) applied...
Anticipate Potential Reversals: Trends don't last forever. The Reversal Risk Proxy (0 to 1) synthesizes multiple warning signs – like extreme RSI readings, surging volatility, or diverging volume – into a single, actionable metric. High reversal risk flags conditions often associated with trend exhaustion, providing early warnings to protect profits or consider counter-trend opportunities.
Adapt to Changing Market Regimes: Markets shift between high and low volatility. EFzSMA's unique Adaptive Deviation Normalization adjusts how it perceives price deviations based on recent market behavior (percentile rank). This ensures more consistent analysis whether the market is quiet or chaotic.
// Core Idea: Normalize deviation by recent volatility (percentile)
diff_abs_percentile = ta.percentile_linear_interpolation(abs(raw_diff), normLookback, percRank) + 1e-10
normalized_diff := raw_diff / diff_abs_percentile
// Fuzzy sets for 'normalized_diff' are thus adaptive to volatility
Integrate Complexity, Output Clarity: EFzSMA distills complex, multi-factor analysis into clear, interpretable outputs, helping you cut through market noise and focus on what truly matters for your decision-making process.
Interpreting the Multi-Dimensional Output
The true power of EFzSMA lies in analyzing its outputs together:
A high Trend Score (+0.8) is significant, but its reliability is amplified by high Conviction (0.9) and low Reversal Risk (0.2) . This indicates a strong, well-supported trend.
Conversely, the same high Trend Score (+0.8) coupled with low Conviction (0.3) and high Reversal Risk (0.7) signals caution – the trend might look strong superficially, but internal factors suggest weakness or impending exhaustion.
Use these combined insights to:
Filter Entry Signals: Require minimum Trend Score and Conviction levels.
Manage Risk: Consider reducing exposure or tightening stops when Reversal Risk climbs significantly, especially if Conviction drops.
Time Exits: Use rising Reversal Risk and falling Conviction as potential signals to take profits.
Identify Regime Shifts: Monitor how the relationship between the outputs changes over time.
Core Technology (Briefly)
EFzSMA leverages a Mamdani-style Fuzzy Inference System. Crisp inputs (normalized deviation, ROC, RSI, ATR%, Vol Ratio) are mapped to linguistic fuzzy sets ("Low", "High", "Positive", etc.). A rules engine evaluates combinations (e.g., "IF Deviation is LargePositive AND Momentum is StrongPositive THEN Trend is StrongBullish"). Modifiers based on Volatility and Volume context adjust rule strengths. Finally, the system aggregates these and defuzzifies them into the Trend Score, Conviction Proxy, and Reversal Risk Proxy. The key is the system's ability to handle ambiguity and combine multiple, potentially conflicting factors in a nuanced way, much like human expert reasoning.
Customization
While designed with robust defaults, EFzSMA offers granular control:
Adjust SMA, ROC, RSI, ATR, Volume MA lengths.
Fine-tune Normalization parameters (lookback, percentile). Note: Fuzzy set definitions for deviation are tuned for the normalized range.
Configure Volatility and Volume thresholds for fuzzy sets. Tuning these is crucial for specific assets/timeframes.
Toggle visual elements (Proxies, BG Color, Risk Shapes, Volatility-based Transparency).
Recommended Use & Caveats
EFzSMA is a sophisticated analytical tool, not a standalone "buy/sell" signal generator.
Use it to complement your existing strategy and analysis.
Always validate signals with price action, market structure, and other confirming factors.
Thorough backtesting and forward testing are essential to understand its behavior and tune parameters for your specific instruments and timeframes.
Fuzzy logic parameters (membership functions, rules) are based on general heuristics and may require optimization for specific market niches.
Disclaimer
Trading involves substantial risk. EFzSMA is provided for informational and analytical purposes only and does not constitute financial advice. No guarantee of profit is made or implied. Past performance is not indicative of future results. Use rigorous risk management practices.
Fuzzy SMA with DCTI Confirmation[FibonacciFlux]FibonacciFlux: Advanced Fuzzy Logic System with Donchian Trend Confirmation
Institutional-grade trend analysis combining adaptive Fuzzy Logic with Donchian Channel Trend Intensity for superior signal quality
Conceptual Framework & Research Foundation
FibonacciFlux represents a significant advancement in quantitative technical analysis, merging two powerful analytical methodologies: normalized fuzzy logic systems and Donchian Channel Trend Intensity (DCTI). This sophisticated indicator addresses a fundamental challenge in market analysis – the inherent imprecision of trend identification in dynamic, multi-dimensional market environments.
While traditional indicators often produce simplistic binary signals, markets exist in states of continuous, graduated transition. FibonacciFlux embraces this complexity through its implementation of fuzzy set theory, enhanced by DCTI's structural trend confirmation capabilities. The result is an indicator that provides nuanced, probabilistic trend assessment with institutional-grade signal quality.
Core Technological Components
1. Advanced Fuzzy Logic System with Percentile Normalization
At the foundation of FibonacciFlux lies a comprehensive fuzzy logic system that transforms conventional technical metrics into degrees of membership in linguistic variables:
// Fuzzy triangular membership function with robust error handling
fuzzy_triangle(val, left, center, right) =>
if na(val)
0.0
float denominator1 = math.max(1e-10, center - left)
float denominator2 = math.max(1e-10, right - center)
math.max(0.0, math.min(left == center ? val <= center ? 1.0 : 0.0 : (val - left) / denominator1,
center == right ? val >= center ? 1.0 : 0.0 : (right - val) / denominator2))
The system employs percentile-based normalization for SMA deviation – a critical innovation that enables self-calibration across different assets and market regimes:
// Percentile-based normalization for adaptive calibration
raw_diff = price_src - sma_val
diff_abs_percentile = ta.percentile_linear_interpolation(math.abs(raw_diff), normLookback, percRank) + 1e-10
normalized_diff_raw = raw_diff / diff_abs_percentile
normalized_diff = useClamping ? math.max(-clampValue, math.min(clampValue, normalized_diff_raw)) : normalized_diff_raw
This normalization approach represents a significant advancement over fixed-threshold systems, allowing the indicator to automatically adapt to varying volatility environments and maintain consistent signal quality across diverse market conditions.
2. Donchian Channel Trend Intensity (DCTI) Integration
FibonacciFlux significantly enhances fuzzy logic analysis through the integration of Donchian Channel Trend Intensity (DCTI) – a sophisticated measure of trend strength based on the relationship between short-term and long-term price extremes:
// DCTI calculation for structural trend confirmation
f_dcti(src, majorPer, minorPer, sigPer) =>
H = ta.highest(high, majorPer) // Major period high
L = ta.lowest(low, majorPer) // Major period low
h = ta.highest(high, minorPer) // Minor period high
l = ta.lowest(low, minorPer) // Minor period low
float pdiv = not na(L) ? l - L : 0 // Positive divergence (low vs major low)
float ndiv = not na(H) ? H - h : 0 // Negative divergence (major high vs high)
float divisor = pdiv + ndiv
dctiValue = divisor == 0 ? 0 : 100 * ((pdiv - ndiv) / divisor) // Normalized to -100 to +100 range
sigValue = ta.ema(dctiValue, sigPer)
DCTI provides a complementary structural perspective on market trends by quantifying the relationship between short-term and long-term price extremes. This creates a multi-dimensional analysis framework that combines adaptive deviation measurement (fuzzy SMA) with channel-based trend intensity confirmation (DCTI).
Multi-Dimensional Fuzzy Input Variables
FibonacciFlux processes four distinct technical dimensions through its fuzzy system:
Normalized SMA Deviation: Measures price displacement relative to historical volatility context
Rate of Change (ROC): Captures price momentum over configurable timeframes
Relative Strength Index (RSI): Evaluates cyclical overbought/oversold conditions
Donchian Channel Trend Intensity (DCTI): Provides structural trend confirmation through channel analysis
Each dimension is processed through comprehensive fuzzy sets that transform crisp numerical values into linguistic variables:
// Normalized SMA Deviation - Self-calibrating to volatility regimes
ndiff_LP := fuzzy_triangle(normalized_diff, norm_scale * 0.3, norm_scale * 0.7, norm_scale * 1.1)
ndiff_SP := fuzzy_triangle(normalized_diff, norm_scale * 0.05, norm_scale * 0.25, norm_scale * 0.5)
ndiff_NZ := fuzzy_triangle(normalized_diff, -norm_scale * 0.1, 0.0, norm_scale * 0.1)
ndiff_SN := fuzzy_triangle(normalized_diff, -norm_scale * 0.5, -norm_scale * 0.25, -norm_scale * 0.05)
ndiff_LN := fuzzy_triangle(normalized_diff, -norm_scale * 1.1, -norm_scale * 0.7, -norm_scale * 0.3)
// DCTI - Structural trend measurement
dcti_SP := fuzzy_triangle(dcti_val, 60.0, 85.0, 101.0) // Strong Positive Trend (> ~85)
dcti_WP := fuzzy_triangle(dcti_val, 20.0, 45.0, 70.0) // Weak Positive Trend (~30-60)
dcti_Z := fuzzy_triangle(dcti_val, -30.0, 0.0, 30.0) // Near Zero / Trendless (~+/- 20)
dcti_WN := fuzzy_triangle(dcti_val, -70.0, -45.0, -20.0) // Weak Negative Trend (~-30 - -60)
dcti_SN := fuzzy_triangle(dcti_val, -101.0, -85.0, -60.0) // Strong Negative Trend (< ~-85)
Advanced Fuzzy Rule System with DCTI Confirmation
The core intelligence of FibonacciFlux lies in its sophisticated fuzzy rule system – a structured knowledge representation that encodes expert understanding of market dynamics:
// Base Trend Rules with DCTI Confirmation
cond1 = math.min(ndiff_LP, roc_HP, rsi_M)
strength_SB := math.max(strength_SB, cond1 * (dcti_SP > 0.5 ? 1.2 : dcti_Z > 0.1 ? 0.5 : 1.0))
// DCTI Override Rules - Structural trend confirmation with momentum alignment
cond14 = math.min(ndiff_NZ, roc_HP, dcti_SP)
strength_SB := math.max(strength_SB, cond14 * 0.5)
The rule system implements 15 distinct fuzzy rules that evaluate various market conditions including:
Established Trends: Strong deviations with confirming momentum and DCTI alignment
Emerging Trends: Early deviation patterns with initial momentum and DCTI confirmation
Weakening Trends: Divergent signals between deviation, momentum, and DCTI
Reversal Conditions: Counter-trend signals with DCTI confirmation
Neutral Consolidations: Minimal deviation with low momentum and neutral DCTI
A key innovation is the weighted influence of DCTI on rule activation. When strong DCTI readings align with other indicators, rule strength is amplified (up to 1.2x). Conversely, when DCTI contradicts other indicators, rule impact is reduced (as low as 0.5x). This creates a dynamic, self-adjusting system that prioritizes high-conviction signals.
Defuzzification & Signal Generation
The final step transforms fuzzy outputs into a precise trend score through center-of-gravity defuzzification:
// Defuzzification with precise floating-point handling
denominator = strength_SB + strength_WB + strength_N + strength_WBe + strength_SBe
if denominator > 1e-10
fuzzyTrendScore := (strength_SB * STRONG_BULL + strength_WB * WEAK_BULL +
strength_N * NEUTRAL + strength_WBe * WEAK_BEAR +
strength_SBe * STRONG_BEAR) / denominator
The resulting FuzzyTrendScore ranges from -1.0 (Strong Bear) to +1.0 (Strong Bull), with critical threshold zones at ±0.3 (Weak trend) and ±0.7 (Strong trend). The histogram visualization employs intuitive color-coding for immediate trend assessment.
Strategic Applications for Institutional Trading
FibonacciFlux provides substantial advantages for sophisticated trading operations:
Multi-Timeframe Signal Confirmation: Institutional-grade signal validation across multiple technical dimensions
Trend Strength Quantification: Precise measurement of trend conviction with noise filtration
Early Trend Identification: Detection of emerging trends before traditional indicators through fuzzy pattern recognition
Adaptive Market Regime Analysis: Self-calibrating analysis across varying volatility environments
Algorithmic Strategy Integration: Well-defined numerical output suitable for systematic trading frameworks
Risk Management Enhancement: Superior signal fidelity for risk exposure optimization
Customization Parameters
FibonacciFlux offers extensive customization to align with specific trading mandates and market conditions:
Fuzzy SMA Settings: Configure baseline trend identification parameters including SMA, ROC, and RSI lengths
Normalization Settings: Fine-tune the self-calibration mechanism with adjustable lookback period, percentile rank, and optional clamping
DCTI Parameters: Optimize trend structure confirmation with adjustable major/minor periods and signal smoothing
Visualization Controls: Customize display transparency for optimal chart integration
These parameters enable precise calibration for different asset classes, timeframes, and market regimes while maintaining the core analytical framework.
Implementation Notes
For optimal implementation, consider the following guidance:
Higher timeframes (4H+) benefit from increased normalization lookback (800+) for stability
Volatile assets may require adjusted clamping values (2.5-4.0) for optimal signal sensitivity
DCTI parameters should be aligned with chart timeframe (higher timeframes require increased major/minor periods)
The indicator performs exceptionally well as a trend filter for systematic trading strategies
Acknowledgments
FibonacciFlux builds upon the pioneering work of Donovan Wall in Donchian Channel Trend Intensity analysis. The normalization approach draws inspiration from percentile-based statistical techniques in quantitative finance. This indicator is shared for educational and analytical purposes under Attribution-NonCommercial-ShareAlike 4.0 International (CC BY-NC-SA 4.0) license.
Past performance does not guarantee future results. All trading involves risk. This indicator should be used as one component of a comprehensive analysis framework.
Shout out @DonovanWall
Fuzzy SMA Trend Analyzer (experimental)[FibonacciFlux]Fuzzy SMA Trend Analyzer (Normalized): Advanced Market Trend Detection Using Fuzzy Logic Theory
Elevate your technical analysis with institutional-grade fuzzy logic implementation
Research Genesis & Conceptual Framework
This indicator represents the culmination of extensive research into applying fuzzy logic theory to financial markets. While traditional technical indicators often produce binary outcomes, market conditions exist on a continuous spectrum. The Fuzzy SMA Trend Analyzer addresses this limitation by implementing a sophisticated fuzzy logic system that captures the nuanced, multi-dimensional nature of market trends.
Core Fuzzy Logic Principles
At the heart of this indicator lies fuzzy logic theory - a mathematical framework designed to handle imprecision and uncertainty:
// Improved fuzzy_triangle function with guard clauses for NA and invalid parameters.
fuzzy_triangle(val, left, center, right) =>
if na(val) or na(left) or na(center) or na(right) or left > center or center > right // Guard checks
0.0
else if left == center and center == right // Crisp set (single point)
val == center ? 1.0 : 0.0
else if left == center // Left-shoulder shape (ramp down from 1 at center to 0 at right)
val >= right ? 0.0 : val <= center ? 1.0 : (right - val) / (right - center)
else if center == right // Right-shoulder shape (ramp up from 0 at left to 1 at center)
val <= left ? 0.0 : val >= center ? 1.0 : (val - left) / (center - left)
else // Standard triangle
math.max(0.0, math.min((val - left) / (center - left), (right - val) / (right - center)))
This implementation of triangular membership functions enables the indicator to transform crisp numerical values into degrees of membership in linguistic variables like "Large Positive" or "Small Negative," creating a more nuanced representation of market conditions.
Dynamic Percentile Normalization
A critical innovation in this indicator is the implementation of percentile-based normalization for SMA deviation:
// ----- Deviation Scale Estimation using Percentile -----
// Calculate the percentile rank of the *absolute* deviation over the lookback period.
// This gives an estimate of the 'typical maximum' deviation magnitude recently.
diff_abs_percentile = ta.percentile_linear_interpolation(math.abs(raw_diff), normLookback, percRank) + 1e-10
// ----- Normalize the Raw Deviation -----
// Divide the raw deviation by the estimated 'typical max' magnitude.
normalized_diff = raw_diff / diff_abs_percentile
// ----- Clamp the Normalized Deviation -----
normalized_diff_clamped = math.max(-3.0, math.min(3.0, normalized_diff))
This percentile normalization approach creates a self-adapting system that automatically calibrates to different assets and market regimes. Rather than using fixed thresholds, the indicator dynamically adjusts based on recent volatility patterns, significantly enhancing signal quality across diverse market environments.
Multi-Factor Fuzzy Rule System
The indicator implements a comprehensive fuzzy rule system that evaluates multiple technical factors:
SMA Deviation (Normalized): Measures price displacement from the Simple Moving Average
Rate of Change (ROC): Captures price momentum over a specified period
Relative Strength Index (RSI): Assesses overbought/oversold conditions
These factors are processed through a sophisticated fuzzy inference system with linguistic variables:
// ----- 3.1 Fuzzy Sets for Normalized Deviation -----
diffN_LP := fuzzy_triangle(normalized_diff_clamped, 0.7, 1.5, 3.0) // Large Positive (around/above percentile)
diffN_SP := fuzzy_triangle(normalized_diff_clamped, 0.1, 0.5, 0.9) // Small Positive
diffN_NZ := fuzzy_triangle(normalized_diff_clamped, -0.2, 0.0, 0.2) // Near Zero
diffN_SN := fuzzy_triangle(normalized_diff_clamped, -0.9, -0.5, -0.1) // Small Negative
diffN_LN := fuzzy_triangle(normalized_diff_clamped, -3.0, -1.5, -0.7) // Large Negative (around/below percentile)
// ----- 3.2 Fuzzy Sets for ROC -----
roc_HN := fuzzy_triangle(roc_val, -8.0, -5.0, -2.0)
roc_WN := fuzzy_triangle(roc_val, -3.0, -1.0, -0.1)
roc_NZ := fuzzy_triangle(roc_val, -0.3, 0.0, 0.3)
roc_WP := fuzzy_triangle(roc_val, 0.1, 1.0, 3.0)
roc_HP := fuzzy_triangle(roc_val, 2.0, 5.0, 8.0)
// ----- 3.3 Fuzzy Sets for RSI -----
rsi_L := fuzzy_triangle(rsi_val, 0.0, 25.0, 40.0)
rsi_M := fuzzy_triangle(rsi_val, 35.0, 50.0, 65.0)
rsi_H := fuzzy_triangle(rsi_val, 60.0, 75.0, 100.0)
Advanced Fuzzy Inference Rules
The indicator employs a comprehensive set of fuzzy rules that encode expert knowledge about market behavior:
// --- Fuzzy Rules using Normalized Deviation (diffN_*) ---
cond1 = math.min(diffN_LP, roc_HP, math.max(rsi_M, rsi_H)) // Strong Bullish: Large pos dev, strong pos roc, rsi ok
strength_SB := math.max(strength_SB, cond1)
cond2 = math.min(diffN_SP, roc_WP, rsi_M) // Weak Bullish: Small pos dev, weak pos roc, rsi mid
strength_WB := math.max(strength_WB, cond2)
cond3 = math.min(diffN_SP, roc_NZ, rsi_H) // Weakening Bullish: Small pos dev, flat roc, rsi high
strength_N := math.max(strength_N, cond3 * 0.6) // More neutral
strength_WB := math.max(strength_WB, cond3 * 0.2) // Less weak bullish
This rule system evaluates multiple conditions simultaneously, weighting them by their degree of membership to produce a comprehensive trend assessment. The rules are designed to identify various market conditions including strong trends, weakening trends, potential reversals, and neutral consolidations.
Defuzzification Process
The final step transforms the fuzzy result back into a crisp numerical value representing the overall trend strength:
// --- Step 6: Defuzzification ---
denominator = strength_SB + strength_WB + strength_N + strength_WBe + strength_SBe
if denominator > 1e-10 // Use small epsilon instead of != 0.0 for float comparison
fuzzyTrendScore := (strength_SB * STRONG_BULL +
strength_WB * WEAK_BULL +
strength_N * NEUTRAL +
strength_WBe * WEAK_BEAR +
strength_SBe * STRONG_BEAR) / denominator
The resulting FuzzyTrendScore ranges from -1 (strong bearish) to +1 (strong bullish), providing a smooth, continuous evaluation of market conditions that avoids the abrupt signal changes common in traditional indicators.
Advanced Visualization with Rainbow Gradient
The indicator incorporates sophisticated visualization using a rainbow gradient coloring system:
// Normalize score to for gradient function
normalizedScore = na(fuzzyTrendScore) ? 0.5 : math.max(0.0, math.min(1.0, (fuzzyTrendScore + 1) / 2))
// Get the color based on gradient setting and normalized score
final_color = get_gradient(normalizedScore, gradient_type)
This color-coding system provides intuitive visual feedback, with color intensity reflecting trend strength and direction. The gradient can be customized between Red-to-Green or Red-to-Blue configurations based on user preference.
Practical Applications
The Fuzzy SMA Trend Analyzer excels in several key applications:
Trend Identification: Precisely identifies market trend direction and strength with nuanced gradation
Market Regime Detection: Distinguishes between trending markets and consolidation phases
Divergence Analysis: Highlights potential reversals when price action and fuzzy trend score diverge
Filter for Trading Systems: Provides high-quality trend filtering for other trading strategies
Risk Management: Offers early warning of potential trend weakening or reversal
Parameter Customization
The indicator offers extensive customization options:
SMA Length: Adjusts the baseline moving average period
ROC Length: Controls momentum sensitivity
RSI Length: Configures overbought/oversold sensitivity
Normalization Lookback: Determines the adaptive calculation window for percentile normalization
Percentile Rank: Sets the statistical threshold for deviation normalization
Gradient Type: Selects the preferred color scheme for visualization
These parameters enable fine-tuning to specific market conditions, trading styles, and timeframes.
Acknowledgments
The rainbow gradient visualization component draws inspiration from LuxAlgo's "Rainbow Adaptive RSI" (used under CC BY-NC-SA 4.0 license). This implementation of fuzzy logic in technical analysis builds upon Fermi estimation principles to overcome the inherent limitations of crisp binary indicators.
This indicator is shared under Attribution-NonCommercial-ShareAlike 4.0 International (CC BY-NC-SA 4.0) license.
Remember that past performance does not guarantee future results. Always conduct thorough testing before implementing any technical indicator in live trading.