OPEN-SOURCE SCRIPT

DAO - Demand Advanced Oscillator

72
# DAO - Demand Advanced Oscillator

## 📊 Overview

DAO (Demand Advanced Oscillator) is a powerful momentum oscillator that measures buying and selling pressure by analyzing consecutive high-low relationships. It helps identify market extremes, divergences, and potential trend reversals.

**Values range from 0 to 1:**
- **Above 0.70** = Overbought (potential reversal down)
- **Below 0.30** = Oversold (potential reversal up)
- **0.30 - 0.70** = Neutral zone

---

## ✨ Key Features

✅ **Automatic Divergence Detection**
- Bullish divergences (price lower low + DAO higher low)
- Bearish divergences (price higher high + DAO lower high)
- Visual lines connecting divergence points

✅ **Multi-Timeframe Analysis**
- View higher timeframe DAO on current chart
- Perfect for trend alignment strategies

✅ **Signal Line (EMA)**
- Customizable EMA for trend confirmation
- Crossover signals for momentum shifts

✅ **Real-Time Statistics Dashboard**
- Current DAO value
- Market status (Overbought/Oversold/Neutral)
- Trend direction indicator

✅ **Complete Alert System**
- Overbought/Oversold signals
- Bullish/Bearish divergences
- Signal line crosses
- Level crosses

✅ **Fully Customizable**
- Adjustable periods and levels
- Customizable colors and zones
- Toggle features on/off

---

## 📈 Trading Signals

### 1. Divergences (Most Powerful)
**Bullish Divergence:**
- Price makes lower low
- DAO makes higher low
- Signal: Strong reversal up likely

**Bearish Divergence:**
- Price makes higher high
- DAO makes lower high
- Signal: Strong reversal down likely

### 2. Overbought/Oversold
**Overbought (>0.70):**
- Market may be overextended
- Consider taking profits or looking for shorts
- Can remain overbought in strong trends

**Oversold (<0.30):**
- Market may be oversold
- Consider buying opportunities
- Can remain oversold in strong downtrends

### 3. Signal Line Crossovers
**Bullish Cross:**
- DAO crosses above signal line
- Momentum turning positive

**Bearish Cross:**
- DAO crosses below signal line
- Momentum turning negative

### 4. Level Crosses
**Cross Above 0.30:** Exiting oversold zone (potential uptrend)
**Cross Below 0.70:** Exiting overbought zone (potential downtrend)

---

## ⚙️ Default Settings

📊 Oscillator Period: 14
Number of bars for calculation

📈 Signal Line Period: 9
EMA period for signal line

🔴 Overbought Level: 0.70
Upper threshold

🟢 Oversold Level: 0.30
Lower threshold

🎯 Divergence Detection: ON
Auto divergence identification

⏰ Multi-Timeframe: OFF
Higher TF overlay (optional)

All parameters are fully customizable!

---

## 🔔 Alerts

Six pre-configured alerts available:
1. DAO Overbought
2. DAO Oversold
3. DAO Bullish Divergence
4. DAO Bearish Divergence
5. DAO Signal Cross Up
6. DAO Signal Cross Down

**Setup:** Right-click indicator → Add Alert → Choose condition

---

## 💡 How to Use

### Best Practices:
✅ Focus on divergences (strongest signals)
✅ Combine with support/resistance levels
✅ Use multiple timeframes for confirmation
✅ Wait for price action confirmation
✅ Practice proper risk management

### Avoid:
❌ Trading on indicator alone
❌ Fighting strong trends
❌ Ignoring market context
❌ Overtrading

### Recommended Settings by Trading Style:

**Day Trading:** Period 7-10, All alerts ON
**Swing Trading:** Period 14-21, Divergence alerts
**Scalping:** Period 5-7, Signal crosses
**Position Trading:** Period 21-30, Weekly/Daily TF

---

## 🌍 Markets & Timeframes

**Works on all markets:**
- Forex (all pairs)
- Stocks (all exchanges)
- Cryptocurrencies
- Commodities
- Indices
- Futures

**Works on all timeframes:** 1m to Monthly

---

## 📊 How It Works

DAO calculates the ratio of buying pressure to total market pressure:

1. **Calculate Buying Pressure (DemandMax):**
- If current high > previous high: DemandMax = difference
- Otherwise: DemandMax = 0

2. **Calculate Selling Pressure (DemandMin):**
- If previous low > current low: DemandMin = difference
- Otherwise: DemandMin = 0

3. **Apply Smoothing:**
- Calculate SMA of DemandMax over N periods
- Calculate SMA of DemandMin over N periods

4. **Final Formula:**
```
DAO = SMA(DemandMax) / (SMA(DemandMax) + SMA(DemandMin))
```

This produces a normalized value (0-1) representing market demand strength.

---

## 🎯 Trading Strategies

### Strategy 1: Divergence Trading
- Wait for divergence label
- Confirm at support/resistance
- Enter on confirming candle
- Stop loss beyond recent swing
- Target: opposite level or 0.50

### Strategy 2: Overbought/Oversold
- Best for ranging markets
- Wait for extreme readings
- Enter on reversal from extremes
- Target: middle line (0.50)

### Strategy 3: Trend Following
- Identify trend direction first
- Use DAO to time entries in trend direction only
- Enter on pullbacks to oversold (uptrend) or overbought (downtrend)
- Trade with the trend

### Strategy 4: Multi-Timeframe
- Enable MTF feature
- Trade only when both timeframes align
- Higher TF = trend direction
- Lower TF = precise entry

---

## 📂 Category

**Primary:** Oscillators
**Secondary:** Statistics, Volatility, Momentum

---

## 🏷️ Tags

dao, oscillator, momentum, overbought-oversold, divergence, reversal, demand-indicator, price-exhaustion, statistics, volatility, forex, stocks, crypto, multi-timeframe, technical-analysis

---

## ⚠️ Disclaimer

**This indicator is for educational purposes only.** It does not constitute financial advice. Trading involves substantial risk of loss. Always conduct your own research, use proper risk management, and consult with financial professionals before making trading decisions. Past performance does not guarantee future results.

---

## 📄 License

Open source - Free to use for personal trading, modify as needed, and share with attribution.

---

**Version:** 1.0
**Status:** Production Ready ✅
**Pine Script:** v5
**Trademark-Free:** 100% Safe to Publish

---

*Made with 💙 for traders worldwide*

Disclaimer

The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.