The script identifies bullish and bearish divergences using MFI EMA and price pivots: Bullish Divergence: Price forms a lower low, while the MFI EMA forms a higher low. Bearish Divergence: Price forms a higher high, while the MFI EMA forms a lower high. Pivots are determined using configurable left and right bars for fine-tuned divergence detection. Dynamic Entry Conditions:
For bullish divergences, the script: Records the pivot high formed between the two pivot lows. Triggers a buy signal only when the price closes above the recorded pivot high. Ensures that the divergence aligns with a positive trend and occurs under favorable volatility conditions. For bearish divergences, the script: Records the pivot low formed between the two pivot highs. Triggers a sell signal only when the price closes below the recorded pivot low. Confirms the divergence aligns with a negative trend and sufficient volatility. Trend and Volatility Filtering:
Confirms trend alignment using EMA crossovers: Bullish Trend: EMA (25) > EMA (50). Bearish Trend: EMA (25) < EMA (50). Filters signals using Historical Volatility (HV): Signals are valid only if HV exceeds its 50-period SMA benchmark, ensuring active market conditions. Enhanced Money Flow Index (MFI):
The MFI calculation is enhanced by: Adjusting for volume weight using a logarithmic scale based on the ratio of current to average volume. Normalizing weights to stay within a stable range (0.5–1.5). Offers the option to toggle between standard and adjusted MFI using the “Use adjusted MFI” input. Clear Visual and Alert System:
Signals are marked directly on the chart: Green "BUY" labels appear below the bars for bullish signals. Red "SELL" labels appear above the bars for bearish signals. Alerts for both bullish and bearish divergences enable real-time notifications. Entry Conditions: Bullish Entry: Divergence Confirmation:
Price forms a lower low. MFI EMA forms a higher low. Pivot low is confirmed. Pivot High Recording:
The script records the pivot high formed between the two pivot lows. Entry Trigger:
A buy alert is triggered only when the price closes above the recorded pivot high. Additional checks: Trend Confirmation: EMA (25) > EMA (50). Volatility Validation: HV exceeds its benchmark (50-period SMA). MFI EMA Threshold: MFI EMA > 61.8. Bearish Entry: Divergence Confirmation:
Price forms a higher high. MFI EMA forms a lower high. Pivot high is confirmed. Pivot Low Recording:
The script records the pivot low formed between the two pivot highs. Entry Trigger:
A sell alert is triggered only when the price closes below the recorded pivot low. Additional checks: Trend Confirmation: EMA (25) < EMA (50). Volatility Validation: HV exceeds its benchmark (50-period SMA). MFI EMA Threshold: MFI EMA < 38.2. Practical Applications: Divergence-Based Reversals:
Ideal for detecting potential trend reversals using divergence signals confirmed by pivot breakouts. Trend-Filtered Signals:
Eliminates false signals by requiring trend alignment via EMA crossovers. Volatility-Aware Trading:
Ensures signals occur during active market conditions, reducing noise and enhancing signal reliability. Why Choose This Indicator? The Custom MFI Divergence Alerts script combines:
Accurate divergence detection using pivots on price and MFI EMA. Dynamic entry conditions that align with trend and market volatility. Volume-weighted MFI adjustments for more reliable oscillator signals
ברוח TradingView אמיתית, מחבר הסקריפט הזה פרסם אותו בקוד פתוח, כך שסוחרים יוכלו להבין ולאמת אותו. כל הכבוד למחבר! אתה יכול להשתמש בו בחינם, אבל השימוש החוזר בקוד זה בפרסום כפוף לכללי הבית. אתה יכול להכניס אותו למועדפים כדי להשתמש בו בגרף.
המידע והפרסומים אינם אמורים להיות, ואינם מהווים, עצות פיננסיות, השקעות, מסחר או סוגים אחרים של עצות או המלצות שסופקו או מאושרים על ידי TradingView. קרא עוד בתנאים וההגבלות.