Advanced Gold Scalping Strategy with RSI Divergence# Advanced Gold Scalping Strategy with RSI Divergence
## Overview
This Pine Script implements an advanced scalping strategy for gold (XAUUSD) trading, primarily designed for the 1-minute timeframe. The strategy utilizes the Relative Strength Index (RSI) indicator along with its moving average to identify potential trade setups based on divergences between price action and RSI movements.
## Key Components
### 1. RSI Calculation
- Uses a customizable RSI length (default: 60)
- Allows selection of the source for RSI calculation (default: close price)
### 2. Moving Average of RSI
- Supports multiple MA types: SMA, EMA, SMMA (RMA), WMA, VWMA, and Bollinger Bands
- Customizable MA length (default: 3)
- Option to display Bollinger Bands with adjustable standard deviation multiplier
### 3. Divergence Detection
- Implements both bullish and bearish divergence identification
- Uses pivot high and pivot low points to detect divergences
- Allows for customization of lookback periods and range for divergence detection
### 4. Entry Conditions
- Long Entry: Bullish divergence when RSI is below 40
- Short Entry: Bearish divergence when RSI is above 60
### 5. Trade Management
- Stop Loss: Customizable, default set to 11 pips
- Take Profit: Customizable, default set to 33 pips
### 6. Visualization
- Plots RSI line and its moving average
- Displays horizontal lines at 30, 50, and 70 RSI levels
- Shows Bollinger Bands when selected
- Highlights divergences with "Bull" and "Bear" labels on the chart
## Input Parameters
- RSI Length: Adjusts the period for RSI calculation
- RSI Source: Selects the price source for RSI (close, open, high, low, hl2, hlc3, ohlc4)
- MA Type: Chooses the type of moving average applied to RSI
- MA Length: Sets the period for the moving average
- BB StdDev: Adjusts the standard deviation multiplier for Bollinger Bands
- Show Divergence: Toggles the display of divergence labels
- Stop Loss: Sets the stop loss distance in pips
- Take Profit: Sets the take profit distance in pips
## Strategy Logic
1. **RSI Calculation**:
- Computes RSI using the specified length and source
- Calculates the chosen type of moving average on the RSI
2. **Divergence Detection**:
- Identifies pivot points in both price and RSI
- Checks for higher lows in RSI with lower lows in price (bullish divergence)
- Checks for lower highs in RSI with higher highs in price (bearish divergence)
3. **Trade Entry**:
- Enters a long position when a bullish divergence is detected and RSI is below 40
- Enters a short position when a bearish divergence is detected and RSI is above 60
4. **Position Management**:
- Places a stop loss order at the entry price ± stop loss pips (depending on the direction)
- Sets a take profit order at the entry price ± take profit pips (depending on the direction)
5. **Visualization**:
- Plots the RSI and its moving average
- Draws horizontal lines for overbought/oversold levels
- Displays Bollinger Bands if selected
- Shows divergence labels on the chart for identified setups
## Usage Instructions
1. Apply the script to a 1-minute XAUUSD (Gold) chart in TradingView
2. Adjust the input parameters as needed:
- Increase RSI Length for less frequent but potentially more reliable signals
- Modify MA Type and Length to change the sensitivity of the RSI moving average
- Adjust Stop Loss and Take Profit levels based on current market volatility
3. Monitor the chart for Bull (long) and Bear (short) labels indicating potential trade setups
4. Use in conjunction with other analysis and risk management techniques
## Considerations
- This strategy is designed for short-term scalping and may not be suitable for all market conditions
- Always backtest and forward test the strategy before using it with real capital
- The effectiveness of divergence-based strategies can vary depending on market trends and volatility
- Consider using additional confirmation signals or filters to improve the strategy's performance
Remember to adapt the strategy parameters to your risk tolerance and trading style, and always practice proper risk management.
Goldtradingstrategy
Gold Value RainbowThis indicator can only be used with 'GOLD' ticker. It is used to estimate Gold valuation based on major countries base money supply M0 such as US, EU, JP and CN. These 4 countries represent nearly 75% of total global money supply in the world. The chart will compare how gold value will move alongside with base money supply for comparison study. The chart presented here is just a relative comparison with some scaling and shifting so it doesn't refers to any real measurement. However it can be used to track gold price whether it's too cheap or too expensive in relative to money supply available in the market.
- The gray line represent major countries money supply M0
- The rainbow above the gray line represent the multiplication factors from 1x, 2x, ..., 10x
- The rainbow below the gray line represent the division factors from 0.8x, 0.6x, ..., 0.2x
Check other script to value stock and index:
- Stock Value Rainbow: script to value stock based on book value, earning, dividend and cash flow
- Index Value Rainbow: script to value index based on fed balance sheet and base money supply
- Gold Value Rainbow: script to value gold based on global money supply
- Stock Value US: script to check US stock value
- Stock Value EU: script to check EU stock value
- Stock Value JP: script to check JP stock value
- Stock Value CN: script to check CN stock value