ronakclasses1

Envelope and Moving Average

**Description:**
- This script creates an indicator that combines an envelope and a simple moving average (MA).
- The envelope is constructed using a specified length, percentage deviation, and source price (close by default).
- The moving average is calculated based on a specified length and source price.

**Inputs:**
1. Envelope:
- Length: Number of periods used for the envelope calculation (default is 20).
- Percentage Deviation: Percentage above and below the envelope basis (default is 10%).
- Source: The price used for the envelope calculation (default is close).
- Exponential MA: Option to use exponential moving average for the envelope basis (default is false).

2. Moving Average:
- Length: Number of periods used for the moving average calculation (default is 20).
- Source: The price used for the moving average calculation (default is close).

**Plotting:**
- The script plots the envelope basis, upper envelope line, and lower envelope line.
- The area between the upper and lower envelope lines is filled with a semi-transparent color for better visualization.
- The moving average is plotted on the chart with a specified color and line width.

**How to Use in a Strategy:**
1. **Envelope Crossovers:**
- Go Long (Buy): When the close price crosses above the upper envelope line.
- Go Short (Sell): When the close price crosses below the lower envelope line.

2. **Moving Average Crossovers:**
- Go Long (Buy): When the close price crosses above the moving average.
- Go Short (Sell): When the close price crosses below the moving average.

3. **Confirmation:**
- Consider additional confirmation signals or filters to improve the robustness of your strategy.
- For example, you might require a certain amount of price momentum or use other technical indicators in conjunction with envelope and moving average signals.

4. **Optimization:**
- Experiment with different parameter values (e.g., envelope length, percentage deviation, moving average length) to optimize the strategy for specific market conditions.

5. **Risk Management:**
- Implement proper risk management techniques, such as setting stop-loss orders and position sizing, to control risk.

Remember to thoroughly backtest any strategy before deploying it in a live trading environment. Additionally, consider the current market conditions and adapt your strategy accordingly.
Script open-source

Dans le véritable esprit de TradingView, l'auteur de ce script l'a publié en open-source, afin que les traders puissent le comprendre et le vérifier. Bravo à l'auteur! Vous pouvez l'utiliser gratuitement, mais la réutilisation de ce code dans une publication est régie par le règlement. Vous pouvez le mettre en favori pour l'utiliser sur un graphique.

Clause de non-responsabilité

Les informations et les publications ne sont pas destinées à être, et ne constituent pas, des conseils ou des recommandations en matière de finance, d'investissement, de trading ou d'autres types de conseils fournis ou approuvés par TradingView. Pour en savoir plus, consultez les Conditions d'utilisation.

Vous voulez utiliser ce script sur un graphique ?