OPEN-SOURCE SCRIPT
ATR

# ATR Trailing Stop Multi-Strategy v7 with Pivot & GST
## Overview
A comprehensive multi-indicator trading strategy that combines multiple technical analysis approaches with sophisticated risk management. The strategy uses a confirmation-based system where trades are executed only when multiple indicators agree on the direction.
## Core Strategy Logic
### Signal Confirmation System
- **Entry Condition**: Requires at least 3 confirmation points from different indicators
- **Weighted Indicators**:
- Dow Theory (Weight: 2 points)
- ATR Trailing Stop (Weight: 2 points)
- Gaussian Smooth Trend (Weight: 1 point)
- KAMA (Weight: 1 point)
- VWMA (Weight: 1 point)
- Alligator (Weight: 1 point)
### Exit Conditions
- **Profit Exit**: When opposite signals achieve 3+ confirmation points
- **Stop Loss**: Fixed percentage stop loss (configurable)
- **Filter-Based Exit**: Signals from individual indicators when filters are violated
## Technical Indicators
### 1. Dow Theory Filter
- Analyzes volume and volatility conditions
- Uses SMA 20/50 crossovers for trend direction
- Volume must exceed MA by threshold (default: 1.5x)
- NATR must exceed threshold (default: 1.0%)
### 2. ATR Trailing Stop System
- Three ATR-based trailing lines (Fast/Medium/Slow)
- Fast: ATR(5) × 0.5 multiplier
- Medium: ATR(10) × 1.5 multiplier
- Slow: ATR(20) × 3.0 multiplier
- State changes when medium line crosses slow line
### 3. Gaussian Smooth Trend (GST)
- Advanced smoothing using DEMA, Gaussian filter, and SMMA
- Includes standard deviation bands for volatility filtering
- Multiple color schemes available for visualization
### 4. KAMA (Kaufman Adaptive Moving Average)
- Two KAMA lines with different lengths (10, 24)
- Adaptive smoothing based on market volatility
- Signals generated on crossovers
### 5. VWMA (Volume Weighted Moving Average)
- Price weighted by volume
- Signals on price crossing VWMA
### 6. Alligator Indicator
- Three SMMA lines (Jaw/Teeth/Lips)
- Standard Williams Alligator settings
- Signals based on line alignment and price position
## Entry Block Filters
### ADX Filter (Optional)
- Filters trades based on trend strength
- Configurable min/max values for long and short positions
- Default: ADX between 15-60
### RSI Filter (Optional)
- Additional RSI-based filtering
- Separate ranges for long and short positions
- Default Long: RSI 20-70, Short: RSI 30-80
### NATR Filter (Optional)
- Filters based on normalized ATR
- Ensures minimum volatility for valid signals
- Default Long/Short: NATR 0.5-5.0%
## Additional Filters
### CCI Filter
- Filters signals based on CCI momentum
- Oversold condition for longs: CCI > -100 and rising
- Overbought condition for shorts: CCI < 100 and falling
### Volatility Filter
- Minimum ATR percentage requirement
- Default: 0.3% minimum ATR/price ratio
### Distance Filter
- Minimum distance from Alligator lips in pips
- Ensures sufficient movement before entry
- Default: 10 pips minimum
## Pivot Points Support
- Multiple pivot point calculation methods:
- Traditional
- Fibonacci
- Woodie
- Classic
- DM
- Camarilla
- Multiple timeframe support (Daily, Weekly, Monthly, etc.)
- Visual display of pivot levels and labels
## Risk Management
### Stop Loss
- Configurable percentage-based stop loss
- Default: 2.5%
- Applied immediately on entry
### Position Management
- Single position only (no pyramiding)
- Position tracking with P/L calculation
- Visual exit lines for individual indicator signals
## Visual Features
### Signal Display
- Colored arrows for each indicator signal
- Entry/Exit labels with price information
- Horizontal exit lines for visual confirmation
- All indicators can be toggled on/off
### Color Schemes
- GST with multiple color modes
- Customizable pivot point colors
- Consistent color coding across indicators
## Alerts
- Entry alerts for both long and short positions
- Exit alerts for both profit and stop loss exits
- Individual indicator alerts available
## Settings Overview
### Strategy Settings
- Dow Theory thresholds (Volume, NATR)
- Stop loss percentage
- ATR Trailing parameters
- Indicator toggles and weights
### Filter Settings
- Entry block filters (ADX, RSI, NATR)
- CCI parameters
- Volatility and distance filters
### Visual Settings
- Show/hide indicators
- Arrow and label display
- Color scheme selection
### Pivot Settings
- Calculation method
- Timeframe
- Level colors and visibility
## Usage Recommendations
### Timeframes
- Works on all timeframes
- Pivot points automatically adjust to timeframe
- Recommended: 15-minutes and above
### Market Conditions
- Best in trending markets
- Multiple filters help avoid choppy conditions
- Volume confirmation adds reliability
### Customization
- Adjust confirmation thresholds for more/less aggressive trading
- Modify filters based on market volatility
- Fine-tune stop loss based on risk tolerance
## Performance Notes
- Strategy uses close prices for order execution
- Maximum 500 labels to prevent chart clutter
- All calculations in real-time
- Historical backtesting supported
## Important Notes
- Past performance doesn't guarantee future results
- Test thoroughly before live trading
- Adjust parameters for specific instruments
- Consider commission and slippage in backtesting
## Overview
A comprehensive multi-indicator trading strategy that combines multiple technical analysis approaches with sophisticated risk management. The strategy uses a confirmation-based system where trades are executed only when multiple indicators agree on the direction.
## Core Strategy Logic
### Signal Confirmation System
- **Entry Condition**: Requires at least 3 confirmation points from different indicators
- **Weighted Indicators**:
- Dow Theory (Weight: 2 points)
- ATR Trailing Stop (Weight: 2 points)
- Gaussian Smooth Trend (Weight: 1 point)
- KAMA (Weight: 1 point)
- VWMA (Weight: 1 point)
- Alligator (Weight: 1 point)
### Exit Conditions
- **Profit Exit**: When opposite signals achieve 3+ confirmation points
- **Stop Loss**: Fixed percentage stop loss (configurable)
- **Filter-Based Exit**: Signals from individual indicators when filters are violated
## Technical Indicators
### 1. Dow Theory Filter
- Analyzes volume and volatility conditions
- Uses SMA 20/50 crossovers for trend direction
- Volume must exceed MA by threshold (default: 1.5x)
- NATR must exceed threshold (default: 1.0%)
### 2. ATR Trailing Stop System
- Three ATR-based trailing lines (Fast/Medium/Slow)
- Fast: ATR(5) × 0.5 multiplier
- Medium: ATR(10) × 1.5 multiplier
- Slow: ATR(20) × 3.0 multiplier
- State changes when medium line crosses slow line
### 3. Gaussian Smooth Trend (GST)
- Advanced smoothing using DEMA, Gaussian filter, and SMMA
- Includes standard deviation bands for volatility filtering
- Multiple color schemes available for visualization
### 4. KAMA (Kaufman Adaptive Moving Average)
- Two KAMA lines with different lengths (10, 24)
- Adaptive smoothing based on market volatility
- Signals generated on crossovers
### 5. VWMA (Volume Weighted Moving Average)
- Price weighted by volume
- Signals on price crossing VWMA
### 6. Alligator Indicator
- Three SMMA lines (Jaw/Teeth/Lips)
- Standard Williams Alligator settings
- Signals based on line alignment and price position
## Entry Block Filters
### ADX Filter (Optional)
- Filters trades based on trend strength
- Configurable min/max values for long and short positions
- Default: ADX between 15-60
### RSI Filter (Optional)
- Additional RSI-based filtering
- Separate ranges for long and short positions
- Default Long: RSI 20-70, Short: RSI 30-80
### NATR Filter (Optional)
- Filters based on normalized ATR
- Ensures minimum volatility for valid signals
- Default Long/Short: NATR 0.5-5.0%
## Additional Filters
### CCI Filter
- Filters signals based on CCI momentum
- Oversold condition for longs: CCI > -100 and rising
- Overbought condition for shorts: CCI < 100 and falling
### Volatility Filter
- Minimum ATR percentage requirement
- Default: 0.3% minimum ATR/price ratio
### Distance Filter
- Minimum distance from Alligator lips in pips
- Ensures sufficient movement before entry
- Default: 10 pips minimum
## Pivot Points Support
- Multiple pivot point calculation methods:
- Traditional
- Fibonacci
- Woodie
- Classic
- DM
- Camarilla
- Multiple timeframe support (Daily, Weekly, Monthly, etc.)
- Visual display of pivot levels and labels
## Risk Management
### Stop Loss
- Configurable percentage-based stop loss
- Default: 2.5%
- Applied immediately on entry
### Position Management
- Single position only (no pyramiding)
- Position tracking with P/L calculation
- Visual exit lines for individual indicator signals
## Visual Features
### Signal Display
- Colored arrows for each indicator signal
- Entry/Exit labels with price information
- Horizontal exit lines for visual confirmation
- All indicators can be toggled on/off
### Color Schemes
- GST with multiple color modes
- Customizable pivot point colors
- Consistent color coding across indicators
## Alerts
- Entry alerts for both long and short positions
- Exit alerts for both profit and stop loss exits
- Individual indicator alerts available
## Settings Overview
### Strategy Settings
- Dow Theory thresholds (Volume, NATR)
- Stop loss percentage
- ATR Trailing parameters
- Indicator toggles and weights
### Filter Settings
- Entry block filters (ADX, RSI, NATR)
- CCI parameters
- Volatility and distance filters
### Visual Settings
- Show/hide indicators
- Arrow and label display
- Color scheme selection
### Pivot Settings
- Calculation method
- Timeframe
- Level colors and visibility
## Usage Recommendations
### Timeframes
- Works on all timeframes
- Pivot points automatically adjust to timeframe
- Recommended: 15-minutes and above
### Market Conditions
- Best in trending markets
- Multiple filters help avoid choppy conditions
- Volume confirmation adds reliability
### Customization
- Adjust confirmation thresholds for more/less aggressive trading
- Modify filters based on market volatility
- Fine-tune stop loss based on risk tolerance
## Performance Notes
- Strategy uses close prices for order execution
- Maximum 500 labels to prevent chart clutter
- All calculations in real-time
- Historical backtesting supported
## Important Notes
- Past performance doesn't guarantee future results
- Test thoroughly before live trading
- Adjust parameters for specific instruments
- Consider commission and slippage in backtesting
Mã nguồn mở
Theo đúng tinh thần TradingView, tác giả của tập lệnh này đã công bố nó dưới dạng mã nguồn mở, để các nhà giao dịch có thể xem xét và xác minh chức năng. Chúc mừng tác giả! Mặc dù bạn có thể sử dụng miễn phí, hãy nhớ rằng việc công bố lại mã phải tuân theo Nội quy.
Thông báo miễn trừ trách nhiệm
Thông tin và các ấn phẩm này không nhằm mục đích, và không cấu thành, lời khuyên hoặc khuyến nghị về tài chính, đầu tư, giao dịch hay các loại khác do TradingView cung cấp hoặc xác nhận. Đọc thêm tại Điều khoản Sử dụng.
Mã nguồn mở
Theo đúng tinh thần TradingView, tác giả của tập lệnh này đã công bố nó dưới dạng mã nguồn mở, để các nhà giao dịch có thể xem xét và xác minh chức năng. Chúc mừng tác giả! Mặc dù bạn có thể sử dụng miễn phí, hãy nhớ rằng việc công bố lại mã phải tuân theo Nội quy.
Thông báo miễn trừ trách nhiệm
Thông tin và các ấn phẩm này không nhằm mục đích, và không cấu thành, lời khuyên hoặc khuyến nghị về tài chính, đầu tư, giao dịch hay các loại khác do TradingView cung cấp hoặc xác nhận. Đọc thêm tại Điều khoản Sử dụng.