OPEN-SOURCE SCRIPT
MACD-VWAP-BB Oscillator with Divergence

How to Use the Indicator for Trading
Here’s how to interpret and use the indicator’s signals as a beginner:
Look for Buy Signals:
Green Triangle Up (“BUY”):
Appears when MACD, VWAP, and Bollinger Bands all signal a strong bullish trend.
The ribbon turns green, and the background fill is green.
Action: Consider buying the asset, as this is a strong signal the price may rise.
Example: If you see a green triangle on a 1-hour chart for BTC/USD, it suggests a potential upward move.
Green Circle (“Div Buy”):
Indicates a bullish divergence, where the price is dropping, but the indicator suggests the downtrend may weaken or reverse.
This is a weaker signal than the triangle but can be an early warning of a trend change.
Action: Watch closely or consider a smaller buy position, especially if followed by a triangle signal.
Look for Sell Signals:
Red Triangle Down (“SELL”):
Appears when all three indicators signal a strong bearish trend.
The ribbon turns red, and the background fill is red.
Action: Consider selling or shorting the asset, as the price may fall.
Example: A red triangle on a stock chart suggests it’s time to exit a long position or go short.
Red Circle (“Div Sell”):
Indicates a bearish divergence, where the price is rising, but the indicator suggests the uptrend may weaken or reverse.
Action: Be cautious with long positions or consider preparing to sell, especially if a triangle signal follows.
Check the Ribbon and Background:
Green Ribbon and Fill: Confirms a bullish trend. Feel more confident in buy signals.
Red Ribbon and Fill: Confirms a bearish trend. Feel more confident in sell signals.
The ribbon’s spread (how far apart the lines are) shows trend strength: wider = stronger trend, tighter = weaker trend.
Use Divergence Signals for Early Warnings:
Divergence signals (circles) often appear before triangle signals, hinting at potential reversals.
Example: A green circle (“Div Buy”) on a downtrending chart suggests the price might stop falling soon. Wait for a green triangle to confirm before acting.
Choose a Timeframe:
Short-term traders (day trading): Use shorter timeframes like 5-minute, 15-minute, or 1-hour charts.
Swing traders: Use 4-hour or daily charts for signals that last days or weeks.
Long-term investors: Use daily or weekly charts for bigger trends.
Example: On a 4-hour chart, a green triangle might signal a trend lasting hours to days.
Combine with Price Action:
Don’t rely on the indicator alone. Look at the candlesticks:
Are there support/resistance levels nearby?
Is the price near a key level (e.g., a moving average or trendline)?
Use the indicator to confirm what you see in the price chart.
Risk Management:
Set Stop-Losses: Place a stop-loss below recent lows for buys or above recent highs for sells to limit losses.
Position Sizing: Only risk a small portion of your account (e.g., 1-2%) per trade.
Wait for Confirmation: Triangle signals are stronger than divergence signals. Consider waiting for a triangle before entering a trade, especially as a beginner.
Example Trading Scenario
Let’s say you’re trading EUR/USD on a 1-hour chart:
You see a green circle (“Div Buy”) at the bottom of the indicator panel, and the price is near a support level (a price where it stopped falling before).
This suggests a potential reversal, but it’s not confirmed yet.
Action: Watch closely but don’t enter a trade yet.
A few candles later, a green triangle (“BUY”) appears, the ribbon turns green, and the background fill is green.
This confirms a strong bullish signal (MACD, VWAP, and Bollinger Bands all agree).
Action: Enter a buy trade, set a stop-loss below the recent low, and aim for a target near a resistance level or a 1:2 risk-reward ratio.
Later, you see a red circle (“Div Sell”) while the price is still rising.
This warns that the uptrend might weaken.
Action: Tighten your stop-loss or prepare to exit if a red triangle appears.
A red triangle (“SELL”) appears, with the ribbon and fill turning red.
Action: Exit the buy trade or consider a short position.
Tips for Beginners
Start with a Demo Account: Practice using the indicator on a TradingView paper trading account or a broker’s demo account to avoid risking real money.
Test on Different Assets: Try the indicator on stocks, forex, or crypto to see where it performs best.
Avoid Overtrading: Wait for clear triangle signals for stronger trades. Divergence signals (circles) are less reliable, so use them as warnings.
Learn Basic Chart Patterns: Combine the indicator with simple patterns like support/resistance or candlestick patterns (e.g., pin bars) for better results.
Adjust Settings Carefully: The default settings (e.g., MACD 12,26,9; ribbon 8,13,21,34) are balanced, but you can tweak them in the indicator settings to match your trading style.
Common Questions
What timeframe should I use?
It depends on your trading style. Day traders might use 5-minute or 1-hour charts; swing traders might use 4-hour or daily charts. Test different timeframes to find what suits you.
Are divergence signals reliable?
Divergence signals (green/red circles) are early warnings and less reliable than triangle signals. Use them to prepare for a trade but wait for triangles for confirmation.
Can I use this on any asset?
Yes! It works on stocks, forex, crypto, or commodities. Adjust settings like pivotLookback or smoothWavy for volatile assets like crypto.
What if I see conflicting signals?
If a green circle appears but no green triangle, the trend isn’t confirmed yet. Wait for alignment of all indicators (triangle signal) for stronger trades.
How to Customize (Optional)
If you want to tweak the indicator:
Open the indicator settings (double-click its name on the chart).
Adjust Pivot Lookback for Divergence (default 5) to make divergence signals more frequent (smaller number) or less frequent (larger number).
Change Signal Line Smoothing Period (default 9) for a smoother or wavier signal line.
Modify EMA Ribbon Periods (default 8,13,21,34) for a tighter or wider ribbon.
Here’s how to interpret and use the indicator’s signals as a beginner:
Look for Buy Signals:
Green Triangle Up (“BUY”):
Appears when MACD, VWAP, and Bollinger Bands all signal a strong bullish trend.
The ribbon turns green, and the background fill is green.
Action: Consider buying the asset, as this is a strong signal the price may rise.
Example: If you see a green triangle on a 1-hour chart for BTC/USD, it suggests a potential upward move.
Green Circle (“Div Buy”):
Indicates a bullish divergence, where the price is dropping, but the indicator suggests the downtrend may weaken or reverse.
This is a weaker signal than the triangle but can be an early warning of a trend change.
Action: Watch closely or consider a smaller buy position, especially if followed by a triangle signal.
Look for Sell Signals:
Red Triangle Down (“SELL”):
Appears when all three indicators signal a strong bearish trend.
The ribbon turns red, and the background fill is red.
Action: Consider selling or shorting the asset, as the price may fall.
Example: A red triangle on a stock chart suggests it’s time to exit a long position or go short.
Red Circle (“Div Sell”):
Indicates a bearish divergence, where the price is rising, but the indicator suggests the uptrend may weaken or reverse.
Action: Be cautious with long positions or consider preparing to sell, especially if a triangle signal follows.
Check the Ribbon and Background:
Green Ribbon and Fill: Confirms a bullish trend. Feel more confident in buy signals.
Red Ribbon and Fill: Confirms a bearish trend. Feel more confident in sell signals.
The ribbon’s spread (how far apart the lines are) shows trend strength: wider = stronger trend, tighter = weaker trend.
Use Divergence Signals for Early Warnings:
Divergence signals (circles) often appear before triangle signals, hinting at potential reversals.
Example: A green circle (“Div Buy”) on a downtrending chart suggests the price might stop falling soon. Wait for a green triangle to confirm before acting.
Choose a Timeframe:
Short-term traders (day trading): Use shorter timeframes like 5-minute, 15-minute, or 1-hour charts.
Swing traders: Use 4-hour or daily charts for signals that last days or weeks.
Long-term investors: Use daily or weekly charts for bigger trends.
Example: On a 4-hour chart, a green triangle might signal a trend lasting hours to days.
Combine with Price Action:
Don’t rely on the indicator alone. Look at the candlesticks:
Are there support/resistance levels nearby?
Is the price near a key level (e.g., a moving average or trendline)?
Use the indicator to confirm what you see in the price chart.
Risk Management:
Set Stop-Losses: Place a stop-loss below recent lows for buys or above recent highs for sells to limit losses.
Position Sizing: Only risk a small portion of your account (e.g., 1-2%) per trade.
Wait for Confirmation: Triangle signals are stronger than divergence signals. Consider waiting for a triangle before entering a trade, especially as a beginner.
Example Trading Scenario
Let’s say you’re trading EUR/USD on a 1-hour chart:
You see a green circle (“Div Buy”) at the bottom of the indicator panel, and the price is near a support level (a price where it stopped falling before).
This suggests a potential reversal, but it’s not confirmed yet.
Action: Watch closely but don’t enter a trade yet.
A few candles later, a green triangle (“BUY”) appears, the ribbon turns green, and the background fill is green.
This confirms a strong bullish signal (MACD, VWAP, and Bollinger Bands all agree).
Action: Enter a buy trade, set a stop-loss below the recent low, and aim for a target near a resistance level or a 1:2 risk-reward ratio.
Later, you see a red circle (“Div Sell”) while the price is still rising.
This warns that the uptrend might weaken.
Action: Tighten your stop-loss or prepare to exit if a red triangle appears.
A red triangle (“SELL”) appears, with the ribbon and fill turning red.
Action: Exit the buy trade or consider a short position.
Tips for Beginners
Start with a Demo Account: Practice using the indicator on a TradingView paper trading account or a broker’s demo account to avoid risking real money.
Test on Different Assets: Try the indicator on stocks, forex, or crypto to see where it performs best.
Avoid Overtrading: Wait for clear triangle signals for stronger trades. Divergence signals (circles) are less reliable, so use them as warnings.
Learn Basic Chart Patterns: Combine the indicator with simple patterns like support/resistance or candlestick patterns (e.g., pin bars) for better results.
Adjust Settings Carefully: The default settings (e.g., MACD 12,26,9; ribbon 8,13,21,34) are balanced, but you can tweak them in the indicator settings to match your trading style.
Common Questions
What timeframe should I use?
It depends on your trading style. Day traders might use 5-minute or 1-hour charts; swing traders might use 4-hour or daily charts. Test different timeframes to find what suits you.
Are divergence signals reliable?
Divergence signals (green/red circles) are early warnings and less reliable than triangle signals. Use them to prepare for a trade but wait for triangles for confirmation.
Can I use this on any asset?
Yes! It works on stocks, forex, crypto, or commodities. Adjust settings like pivotLookback or smoothWavy for volatile assets like crypto.
What if I see conflicting signals?
If a green circle appears but no green triangle, the trend isn’t confirmed yet. Wait for alignment of all indicators (triangle signal) for stronger trades.
How to Customize (Optional)
If you want to tweak the indicator:
Open the indicator settings (double-click its name on the chart).
Adjust Pivot Lookback for Divergence (default 5) to make divergence signals more frequent (smaller number) or less frequent (larger number).
Change Signal Line Smoothing Period (default 9) for a smoother or wavier signal line.
Modify EMA Ribbon Periods (default 8,13,21,34) for a tighter or wider ribbon.
Açık kaynak kodlu komut dosyası
Gerçek TradingView ruhuna uygun olarak, bu komut dosyasının oluşturucusu bunu açık kaynaklı hale getirmiştir, böylece yatırımcılar betiğin işlevselliğini inceleyip doğrulayabilir. Yazara saygı! Ücretsiz olarak kullanabilirsiniz, ancak kodu yeniden yayınlamanın Site Kurallarımıza tabi olduğunu unutmayın.
Feragatname
Bilgiler ve yayınlar, TradingView tarafından sağlanan veya onaylanan finansal, yatırım, işlem veya diğer türden tavsiye veya tavsiyeler anlamına gelmez ve teşkil etmez. Kullanım Şartları'nda daha fazlasını okuyun.
Açık kaynak kodlu komut dosyası
Gerçek TradingView ruhuna uygun olarak, bu komut dosyasının oluşturucusu bunu açık kaynaklı hale getirmiştir, böylece yatırımcılar betiğin işlevselliğini inceleyip doğrulayabilir. Yazara saygı! Ücretsiz olarak kullanabilirsiniz, ancak kodu yeniden yayınlamanın Site Kurallarımıza tabi olduğunu unutmayın.
Feragatname
Bilgiler ve yayınlar, TradingView tarafından sağlanan veya onaylanan finansal, yatırım, işlem veya diğer türden tavsiye veya tavsiyeler anlamına gelmez ve teşkil etmez. Kullanım Şartları'nda daha fazlasını okuyun.