This Pine Script is designed to identify **Smart Money Technique (SMT)** setups between **Gold (GC1!)** and **Silver (SI1!) Futures** on a **15-minute timeframe**. It specifically looks for divergences between the price movements of Gold and Silver over the last 4 candles and compares it with the next candle's price movement. The script provides **Bullish** and **Bearish** signals for SMT during a specified time range of **8:45 AM EST to 10:30 AM EST**.
### Key Features of the Script: 1. **Futures Symbols**: - The script uses **Gold Futures (GC1!)** and **Silver Futures (SI1!)** on a 15-minute timeframe to monitor their price movements.
2. **Time Range Filtering**: - The signals are only active between **8:45 AM EST and 10:30 AM EST**, ensuring that the script only signals within the most relevant trading hours for your strategy.
3. **SMT Calculation (Last 4 Candles vs Next Candle)**: - **Gold and Silver Price Change Calculation**: The script compares the price changes of **Gold** and **Silver** over the **last 4 candles** and then compares them with the price movement of the **next candle**: - **Bullish SMT**: Occurs when Gold shows an increase in the last 4 candles while Silver shows a decrease, and both Gold and Silver show an increase in the next candle. - **Bearish SMT**: Occurs when Gold shows a decrease in the last 4 candles while Silver shows an increase, and both Gold and Silver show a decrease in the next candle.
4. **Bullish and Bearish Signals**: - **Bullish SMT Signal**: The script will plot a **green** arrow below the bar when a Bullish SMT setup is identified. - **Bearish SMT Signal**: A **red** arrow above the bar is plotted when a Bearish SMT setup is identified.
5. **Gold and Silver Difference Plot**: - The difference between the prices of **Gold** and **Silver** is plotted as a **blue line**, giving a visual representation of the relationship between the two assets. When the difference line moves significantly, it can indicate a potential divergence or convergence in the prices of Gold and Silver.
### Script Logic Breakdown: 1. **Price Change for Last 4 Candles**: - The script calculates the price change for Gold and Silver from the 4th-to-last candle to the last candle. - `gold_change_last4` and `silver_change_last4` calculate these price differences.
2. **Price Change for Next Candle**: - It then calculates the price change from the last candle to the next candle. - `gold_change_next` and `silver_change_next` calculate these price differences.
3. **Bullish SMT Condition**: - If Gold increased while Silver decreased in the last 4 candles, and both Gold and Silver show an increase in the next candle, it indicates a **Bullish SMT**.
4. **Bearish SMT Condition**: - If Gold decreased while Silver increased in the last 4 candles, and both Gold and Silver show a decrease in the next candle, it indicates a **Bearish SMT**.
5. **Time Filter**: - Signals are only plotted when the current time is between **8:45 AM EST and 10:30 AM EST** to match your preferred trading hours.
### Visualization: - **Bullish Signals**: Plotted as **green arrows** below the bars when a Bullish SMT setup is identified. - **Bearish Signals**: Plotted as **red arrows** above the bars when a Bearish SMT setup is identified. - **Gold - Silver Difference**: A **blue line** is plotted to show the price difference between Gold and Silver, helping visualize any divergence.
### How It Helps: - **Divergence Identification**: This script highlights potential divergences between Gold and Silver Futures, which can provide insights into market sentiment and smart money movements. - **Focus on Relevant Time Frame**: By filtering signals between 8:45 AM EST and 10:30 AM EST, you are focusing on a timeframe that can be more beneficial for trading. - **Visual Clarity**: The arrows and the price difference line provide clear signals and a visual representation of the relationship between Gold and Silver, helping you make informed trading decisions.
This script is an automated approach to detecting **SMT setups** and helping traders recognize when Gold and Silver might be signaling a bullish or bearish move based on their divergence patterns.