OPEN-SOURCE SCRIPT

Enhanced Kaufman Adaptive Moving Average (KAMA) with Bollinger B

# Enhanced Kaufman Adaptive Moving Average (KAMA) with Bollinger Bands

## Overview
This indicator combines the Kaufman Adaptive Moving Average (KAMA) with Bollinger Bands to create a comprehensive trading system. It provides adaptive trend following capabilities while measuring market volatility and potential reversal points.

## Key Features
- Adaptive moving average that adjusts to market conditions
- Dynamic Bollinger Bands for volatility measurement
- Color-coded KAMA line indicating trend direction
- Integrated buy/sell signals based on multiple confirmations
- Customizable parameters for both KAMA and Bollinger Bands
- Optional bar confirmation wait feature
- Built-in alert conditions for trade signals

## Main Components

### 1. Kaufman Adaptive Moving Average (KAMA)
- Adapts to market volatility using an efficiency ratio
- Changes color based on trend direction (green for uptrend, red for downtrend)
- Adjustable parameters for fine-tuning:
- Base Length: Controls the main calculation period (default: 10)
- Fast EMA Length: For rapid market response (default: 2)
- Slow EMA Length: For stable market conditions (default: 30)

### 2. Bollinger Bands
- Standard deviation-based volatility bands
- Customizable length and standard deviation multiplier
- Includes expansion threshold for volatility measurement
- Components:
- Upper Band: Upper volatility threshold
- Middle Band: Simple moving average
- Lower Band: Lower volatility threshold

## Signal Generation

### Buy Signals
Generated when:
1. KAMA color changes from red to green
2. Price closes above KAMA
3. Price closes above the middle Bollinger Band
4. Signals are marked with:
- Green triangles below the candles
- "B" labels for easy identification

### Sell Signals
Generated when:
1. KAMA color changes from green to red
2. Price closes below KAMA
3. Price closes below the middle Bollinger Band
4. Signals are marked with:
- Red triangles above the candles
- "S" labels for easy identification

## Customizable Parameters

### KAMA Settings
- Base Length (1-50)
- Fast EMA Length (1-10)
- Slow EMA Length (10-50)
- Source Price Selection
- Direction Highlight Toggle
- Bar Confirmation Option

### Bollinger Bands Settings
- Length (default: 20)
- Standard Deviation Multiplier (default: 2.0)
- Expansion Threshold (0.1-3.0)

## Alert Functionality
Built-in alerts for:
- Buy signals with customizable messages
- Sell signals with customizable messages

## Best Practices

### Timeframe Selection
- Works well on multiple timeframes
- Recommended for 15m to 4h charts for optimal signal generation
- Higher timeframes provide more reliable trend signals

### Parameter Optimization
- Adjust KAMA lengths based on trading style:
- Shorter lengths for day trading
- Longer lengths for swing trading
- Fine-tune BB multiplier based on market volatility
- Consider waiting for bar confirmation in volatile markets

### Risk Management
- Use in conjunction with other indicators for confirmation
- Consider market conditions and volatility when trading signals
- Implement proper position sizing and stop-loss levels

## Technical Notes
- Written in Pine Script™ v6
- Overlay indicator (displays on price chart)
- Compatible with all TradingView-supported markets
- Resource-efficient implementation for smooth performance

## Disclaimer
This indicator is provided under the Mozilla Public License 2.0. While it can be a valuable tool for technical analysis, it should not be used as the sole basis for trading decisions. Always combine with proper risk management and additional analysis methods.
Bands and ChannelsCandlestick analysisChart patterns

Skrip sumber terbuka

Dalam semangat sebenar TradingView, penulis telah menerbitkan kod Pine ini sebagai sumber terbuka supaya pedagang dapat memahami dan mengesahkannya. Sorakan kepada penulis! Anda boleh menggunakan perpustakaan ini secara percuma, tetapi penggunaan semula kod dalam penerbitan ini adalah dikawal oleh Peraturan dalaman. Anda boleh menyukainya untuk menggunakannya pada carta.

Ingin menggunakan skrip ini pada carta?

Penafian