OPEN-SOURCE SCRIPT
Multiplied and Divided Moving Average

### Multiplied and Divided Moving Average Indicator
**Description**:
The "Multiplied and Divided Moving Average" indicator is a customizable tool for TradingView users, designed to create dynamic bands around a user-selected moving average (MA). It calculates a moving average (SMA, EMA, WMA, VWMA, or RMA) and generates a user-defined number of lines above and below it by multiplying and dividing the MA by linearly spaced factors. These bands serve as potential support and resistance levels, aiding in trend identification, mean reversion strategies, or breakout detection. Optional Buy/Sell labels appear when the price crosses below the divided MAs (Buy) or above the multiplied MAs (Sell), providing clear visual cues for trading opportunities.
**Key Features**:
- **Flexible MA Types**: Choose from Simple (SMA), Exponential (EMA), Weighted (WMA), Volume-Weighted (VWMA), or Running (RMA) moving averages.
- **Customizable Bands**: Set the number of lines (0–10) above and below the MA, allowing tailored analysis for any market or timeframe.
- **Dynamic Factors**: Bands are created using factors that scale linearly from 1 to a user-defined maximum (default: 5.0), creating intuitive overbought/oversold zones.
- **Buy/Sell Signals**: Optional labels highlight potential entry (Buy) and exit (Sell) points when the price crosses the bands.
- **Clear Visuals**: The main MA is plotted in blue, with green (multiplied) and red (divided) lines using graduated transparency for easy differentiation.
**Inputs**:
- **MA Type**: Select the moving average type (default: SMA).
- **MA Length**: Set the MA period (default: 14).
- **Number of Lines Above/Below**: Choose how many bands to plot above and below the MA (default: 4, range: 0–10).
- **Max Factor**: Define the largest multiplier/divisor for the outermost bands (default: 5.0).
- **Source**: Select the price data for the MA (default: close).
- **Show Buy/Sell Labels**: Enable or disable Buy/Sell labels (default: true).
**How It Works**:
1. Calculates the chosen moving average based on user inputs.
2. Creates up to 10 lines above the MA (e.g., MA × 2, ×3, ×4, ×5 for `numLines=4`, `maxFactor=5`) and 10 below (e.g., MA ÷ 2, ÷3, ÷4, ÷5).
3. Plots the main MA in blue, multiplied lines in green, and divided lines in red, with transparency increasing for outer bands.
4. If enabled, displays "Buy" labels when the price crosses below any divided MA and "Sell" labels when it crosses above any multiplied MA, positioned at the outermost band.
**Use Cases**:
- **Trend Analysis**: Use the bands as dynamic support/resistance to confirm trend direction or reversals.
- **Mean Reversion**: Identify overbought (near multiplied MAs) or oversold (near divided MAs) conditions.
- **Breakout Trading**: Monitor price crossovers of the outermost bands for potential breakout signals.
- **Signal Confirmation**: Use Buy/Sell labels for swing trading or to complement other indicators.
**How to Use**:
1. Copy the script into TradingView’s Pine Editor.
2. Compile and apply it to your chart (e.g., stocks, forex, crypto).
3. Adjust inputs like `numLines`, `maxFactor`, or `maType` to fit your strategy.
4. Enable `Show Buy/Sell Labels` to visualize trading signals.
5. Test on various timeframes (e.g., 1H, 4H, 1D) and assets to optimize settings.
**Example Settings**:
- **Swing Trading**: Use `numLines=3`, `maxFactor=4`, `maType=EMA`, `maLength=20` on a 4-hour chart.
- **Intraday**: Try `numLines=2`, `maxFactor=3`, `maType=SMA`, `maLength=10` on a 15-minute chart.
**Notes**:
- **Performance**: Supports up to 20 bands (10 above, 10 below), staying within TradingView’s 64-plot limit.
- **False Signals**: In choppy markets, frequent crossovers may occur. Combine with trend filters (e.g., ADX, higher-timeframe MA) to reduce noise.
- **Enhancements**: Add alerts via TradingView’s alert system for Buy/Sell signals, or experiment with different `maxFactor` values for volatility.
**Limitations**:
- Bands are reactive, as they’re based on a moving average, so confirm signals with other indicators.
- High `numLines` values may clutter the chart; use 2–4 for clarity.
- Signals may lag in fast-moving markets due to the MA’s smoothing effect.
This indicator is perfect for traders seeking a customizable, visually clear tool to enhance technical analysis on TradingView. For support, feature requests (e.g., alerts, custom colors), or community discussion, visit TradingView’s forums or contact the script author.
**Description**:
The "Multiplied and Divided Moving Average" indicator is a customizable tool for TradingView users, designed to create dynamic bands around a user-selected moving average (MA). It calculates a moving average (SMA, EMA, WMA, VWMA, or RMA) and generates a user-defined number of lines above and below it by multiplying and dividing the MA by linearly spaced factors. These bands serve as potential support and resistance levels, aiding in trend identification, mean reversion strategies, or breakout detection. Optional Buy/Sell labels appear when the price crosses below the divided MAs (Buy) or above the multiplied MAs (Sell), providing clear visual cues for trading opportunities.
**Key Features**:
- **Flexible MA Types**: Choose from Simple (SMA), Exponential (EMA), Weighted (WMA), Volume-Weighted (VWMA), or Running (RMA) moving averages.
- **Customizable Bands**: Set the number of lines (0–10) above and below the MA, allowing tailored analysis for any market or timeframe.
- **Dynamic Factors**: Bands are created using factors that scale linearly from 1 to a user-defined maximum (default: 5.0), creating intuitive overbought/oversold zones.
- **Buy/Sell Signals**: Optional labels highlight potential entry (Buy) and exit (Sell) points when the price crosses the bands.
- **Clear Visuals**: The main MA is plotted in blue, with green (multiplied) and red (divided) lines using graduated transparency for easy differentiation.
**Inputs**:
- **MA Type**: Select the moving average type (default: SMA).
- **MA Length**: Set the MA period (default: 14).
- **Number of Lines Above/Below**: Choose how many bands to plot above and below the MA (default: 4, range: 0–10).
- **Max Factor**: Define the largest multiplier/divisor for the outermost bands (default: 5.0).
- **Source**: Select the price data for the MA (default: close).
- **Show Buy/Sell Labels**: Enable or disable Buy/Sell labels (default: true).
**How It Works**:
1. Calculates the chosen moving average based on user inputs.
2. Creates up to 10 lines above the MA (e.g., MA × 2, ×3, ×4, ×5 for `numLines=4`, `maxFactor=5`) and 10 below (e.g., MA ÷ 2, ÷3, ÷4, ÷5).
3. Plots the main MA in blue, multiplied lines in green, and divided lines in red, with transparency increasing for outer bands.
4. If enabled, displays "Buy" labels when the price crosses below any divided MA and "Sell" labels when it crosses above any multiplied MA, positioned at the outermost band.
**Use Cases**:
- **Trend Analysis**: Use the bands as dynamic support/resistance to confirm trend direction or reversals.
- **Mean Reversion**: Identify overbought (near multiplied MAs) or oversold (near divided MAs) conditions.
- **Breakout Trading**: Monitor price crossovers of the outermost bands for potential breakout signals.
- **Signal Confirmation**: Use Buy/Sell labels for swing trading or to complement other indicators.
**How to Use**:
1. Copy the script into TradingView’s Pine Editor.
2. Compile and apply it to your chart (e.g., stocks, forex, crypto).
3. Adjust inputs like `numLines`, `maxFactor`, or `maType` to fit your strategy.
4. Enable `Show Buy/Sell Labels` to visualize trading signals.
5. Test on various timeframes (e.g., 1H, 4H, 1D) and assets to optimize settings.
**Example Settings**:
- **Swing Trading**: Use `numLines=3`, `maxFactor=4`, `maType=EMA`, `maLength=20` on a 4-hour chart.
- **Intraday**: Try `numLines=2`, `maxFactor=3`, `maType=SMA`, `maLength=10` on a 15-minute chart.
**Notes**:
- **Performance**: Supports up to 20 bands (10 above, 10 below), staying within TradingView’s 64-plot limit.
- **False Signals**: In choppy markets, frequent crossovers may occur. Combine with trend filters (e.g., ADX, higher-timeframe MA) to reduce noise.
- **Enhancements**: Add alerts via TradingView’s alert system for Buy/Sell signals, or experiment with different `maxFactor` values for volatility.
**Limitations**:
- Bands are reactive, as they’re based on a moving average, so confirm signals with other indicators.
- High `numLines` values may clutter the chart; use 2–4 for clarity.
- Signals may lag in fast-moving markets due to the MA’s smoothing effect.
This indicator is perfect for traders seeking a customizable, visually clear tool to enhance technical analysis on TradingView. For support, feature requests (e.g., alerts, custom colors), or community discussion, visit TradingView’s forums or contact the script author.
نص برمجي مفتوح المصدر
بروح TradingView الحقيقية، قام مبتكر هذا النص البرمجي بجعله مفتوح المصدر، بحيث يمكن للمتداولين مراجعة وظائفه والتحقق منها. شكرا للمؤلف! بينما يمكنك استخدامه مجانًا، تذكر أن إعادة نشر الكود يخضع لقواعد الموقع الخاصة بنا.
إخلاء المسؤولية
لا يُقصد بالمعلومات والمنشورات أن تكون، أو تشكل، أي نصيحة مالية أو استثمارية أو تجارية أو أنواع أخرى من النصائح أو التوصيات المقدمة أو المعتمدة من TradingView. اقرأ المزيد في شروط الاستخدام.
نص برمجي مفتوح المصدر
بروح TradingView الحقيقية، قام مبتكر هذا النص البرمجي بجعله مفتوح المصدر، بحيث يمكن للمتداولين مراجعة وظائفه والتحقق منها. شكرا للمؤلف! بينما يمكنك استخدامه مجانًا، تذكر أن إعادة نشر الكود يخضع لقواعد الموقع الخاصة بنا.
إخلاء المسؤولية
لا يُقصد بالمعلومات والمنشورات أن تكون، أو تشكل، أي نصيحة مالية أو استثمارية أو تجارية أو أنواع أخرى من النصائح أو التوصيات المقدمة أو المعتمدة من TradingView. اقرأ المزيد في شروط الاستخدام.