OPEN-SOURCE SCRIPT

EMA with Bar Count


---

### **Key Features and Functionalities**

#### 1. **Multi-Timeframe Exponential Moving Averages (EMA)**
- The script calculates and plots EMAs for various timeframes (e.g., 1 minute, 5 minutes, 60 minutes, daily, and custom intervals).
- Users can customize the length and resolution of each EMA using inputs.
- Different colors are assigned to each EMA for easy identification on the chart.

#### 2. **Background Coloring**
- Optional background coloring (`bgcolor`) indicates whether the current price is above or below the 1-hour 20 EMA.
- Green indicates the price is above, and red indicates the price is below the EMA.

#### 3. **Bar Count Labeling**
- The script tracks bar counts and displays labels at specific intervals (e.g., every 3 bars).
- Label size and text color can be customized through user inputs.

#### 4. **Inside and Outside Bar Detection**
- Detects and highlights "Inside Bars" and "Outside Bars" on the chart.
- **Inside Bar**: The current bar's high and low are within the previous bar's range.
- **Outside Bar**: The current bar's range exceeds the previous bar's range.
- These patterns are marked with shapes for visual identification.

#### 5. **Bullish/Bearish Candle Streaks**
- Identifies and marks streaks of three consecutive bullish or bearish candles.
- **Bullish Streaks**: Marked with green shapes above the bar.
- **Bearish Streaks**: Marked with red shapes above the bar.

#### 6. **Time-Based Marking**
- The script includes an option to highlight specific time intervals (e.g., 7:30 AM) with a colored vertical line or background shading.
- Configurable time inputs allow flexibility.

#### 7. **Micro Gap Detection**
- Highlights gaps between the opening price of the current bar and the closing price of the previous bar.
- Blue shapes indicate bullish gaps.
- Purple shapes indicate bearish gaps.

#### 8. **TR (Trading Range) Detection**
- Identifies bars with significant overlap based on a user-defined threshold.
- Displays "TR" labels when overlap conditions are met.

#### 9. **Bar Coloring**
- Optionally colors bars based on specific conditions:
- Green: Bullish breakout (high and low higher than the previous bar, closing above the midpoint).
- Red: Bearish breakout (high and low lower than the previous bar, closing below the midpoint).

#### 10. **50% Midpoint Line**
- Displays a horizontal line at the 50% midpoint of the bar's range, customizable for the current or last bar only.

#### 11. **Pattern Detection**
- Recognizes specific candlestick patterns (e.g., IOI, OII, IOO).
- Provides alerts for detected patterns or predefined thresholds.

#### 12. **Alerts**
- Configurable alerts for:
- Specific patterns (e.g., IOI, OII, IOO).
- Bar range exceeding a user-defined threshold.
- Bullish or bearish streaks.

#### 13. **Gap Detector**
- Identifies gaps between bars and marks them with shaded boxes.
- Bullish gaps are shaded green, while bearish gaps are shaded red.

#### 14. **Advanced Customization**
- Extensive user inputs allow traders to tailor the indicator to their trading style.
- Includes support for various levels of detail (e.g., debug mode, label visibility, etc.).

#### 15. **ZigZag and Wedge Patterns**
- Optional zigzag lines to connect swing highs and lows.
- Detects wedge patterns using customizable settings for pivot points and angle differences.

---

### **Use Case Scenarios**
1. **Trend Identification**: Use multi-timeframe EMAs to confirm overall market direction.
2. **Range Trading**: Trade within ranges using detected inside and outside bars as key levels.
3. **Breakout Trading**: Use patterns like IOI and OII to anticipate breakouts.
4. **Scalping**: Exploit bullish and bearish streaks or micro gaps for quick trades.
5. **Pattern-Based Alerts**: Set up alerts for specific market conditions or candlestick patterns.

### **Why This Indicator Is Useful**
- Combines multiple trading tools into a single, customizable script.
- Saves time by automating complex calculations and pattern detections.
- Improves decision-making with clear visual cues and configurable alerts.

Let me know if you'd like any additional explanations or adjustments!

Clause de non-responsabilité