# Indicators for Technical Analysis
## Relative Strength Index (RSI)


The Relative Strength Index (RSI) is an oscillator indicator that compares buying and selling power based on price changes over a specific period. Here are the key points about RSI:
1. Background & Formula:
- Developed by Wells Wilder in 1978, RSI is based on the principle of supply and demand.
- RSI is calculated using the formula: RSI = 100 * Average Gain / (Average Loss + Average Gain).
- It measures the average price increase (gain) and decrease (loss) over a specified period.
- The RSI is displayed as an oscillator with values ranging from 0 to 100.
2. What RSI Tells You:
- RSI provides insights into market momentum and the intrinsic nature of stock prices.
- By analyzing RSI values, traders can identify potential trends and market reversals.
- RSI values range from 0 to 100, with overbought conditions typically above 70 and oversold conditions below 30.
3. Relative Strength Index Strategy:
- Overbought and Oversold: Traders can use RSI to determine buying and selling points.
- Buying: When RSI is below 30 (oversold), it may indicate prices are too low, suggesting a buying opportunity.
- Selling: When RSI crosses below 70 from the overbought area, it may signal a selling point as prices could be high.
- Bull/Bear Trend: RSI can also help identify bull and bear trends.
- Bull Trend: RSI above 40 suggests a bull market, where RSI tends to remain above 40. Buying when RSI crosses above 60 can be a favorable entry point.
- Bear Trend: RSI dropping below 60 indicates a bear market, with RSI tending to stay below 60. Selling when RSI crosses below 40 can be a suitable exit point.
### Strategies implementation:
- https://github.com/yaonology/PineScript/tree/master/Relative%20Strength%20Index
## Moving Average




Moving averages are popular indicators used in technical analysis to identify trends and generate trading signals.
1. Types of Moving Averages:
- Simple Moving Average (SMA): It calculates the average price over a specified period, giving equal weight to all data points.
- Exponential Moving Average (EMA): It gives more weight to recent price data, making it more responsive to recent price action.
2. Lagging Indicator:
- Moving averages are lagging indicators because they are based on past price data.
- The longer the period considered, the greater the lag in reflecting current price movements.
3. Trend Identification:
- Traders use moving averages to identify the direction of the trend.
- For example, if the price stays above a certain moving average (e.g., 200-day SMA) for an extended period, it may indicate a bullish trend.
4. Moving Average Crossovers:
- Traders also employ moving average crossovers as potential buy or sell signals.
- A common example is the crossover between a shorter-term moving average (e.g., 100-day SMA) and a longer-term moving average (e.g., 200-day SMA).
- When the shorter-term moving average crosses above the longer-term moving average, it may be considered a buy signal. Conversely, a crossover where the shorter-term moving average crosses below the longer-term moving average may be seen as a sell signal.
- These crossovers suggest a change in the average price relationship, indicating a potential reversal in the trend.
5. Periods:
- The period can be any positive integer. There are three different ranges.
- Short-term: The period will be from 5 to 30.
- Middle-term: The period will be from 30 to 150.
- Long-term: The period will be from 150 to 250.
It's important to note that moving averages are not foolproof indicators, and they may generate false signals or lag in highly volatile or choppy markets. Traders often combine moving averages with other technical analysis tools and indicators to increase the accuracy of their trading decisions.
### Strategies implementation:
1. https://github.com/yaonology/PineScript/tree/master/Moving%20Average
## Moving Average Convergence Divergence (MACD)

The Moving Average Convergence Divergence (MACD) is a popular technical indicator used to analyze the momentum and trend strength of an asset. Here are some key points about MACD:
1. Calculation: The MACD is derived by subtracting the 26-period Exponential Moving Average (EMA) from the 12-period EMA. This calculation results in the MACD line. The signal line is a 9-period EMA of the MACD line. The histogram represents the difference between the MACD line and the signal line.
2. Divergence: Traders often look for divergences between the MACD and price action. Divergence occurs when the price is moving in one direction while the MACD is moving in the opposite direction. For example, if the price is making higher highs while the MACD is making lower highs, it may indicate that the current trend is losing momentum, potentially signaling a trend reversal or a pullback.
3. Crossovers: Traders also analyze crossovers between the MACD line and the signal line. When the MACD line crosses above the signal line, it is considered a bullish signal, suggesting a potential buying opportunity. Conversely, when the MACD line crosses below the signal line, it is seen as a bearish signal, indicating a potential selling opportunity.
4. MACD and RSI: The MACD is often used in conjunction with other indicators, such as the Relative Strength Index (RSI), to gain more comprehensive insights into market conditions. While the MACD measures momentum based on moving averages, the RSI assesses the overbought or oversold conditions of an asset. Using both indicators together can provide a more holistic view of market trends and potential trading opportunities.
Remember, like any technical indicator, the MACD should not be used in isolation. It's essential to consider other factors, perform thorough analysis, and combine it with proper risk management strategies before making trading decisions.
### Strategies implementation:
1. https://www.investopedia.com/articles/forex/05/macddiverge.asp
## Stochastic RSI (StochRSI)

1. Definition: The Stochastic RSI is a momentum oscillator derived from RSI values and used to determine overbought or oversold conditions of an asset.
2. Calculation: It applies the Stochastic oscillator formula to ordinary RSI values. Stochastic RSI values typically range between 0 and 1 (or 0 and 100).
3. Speed and Sensitivity: The Stochastic RSI has greater speed and sensitivity, generating numerous trading signals that can be challenging to interpret.
4. Usefulness: It is most useful when the Stochastic RSI is near the upper or lower extremes of its range.
5. Overbought and Oversold: A Stochastic RSI reading above 0.8 indicates overbought conditions, while a value below 0.2 suggests oversold conditions.
6. Extremes: A Stochastic RSI value of 0 represents the lowest RSI value in the measured period, and a value of 1 represents the highest RSI value.
7. Reversal Indication: An overbought or oversold Stochastic RSI value does not guarantee a price reversal but indicates that the RSI values are near recent extremes.
8. Sensitivity: The Stochastic RSI is more sensitive than the RSI indicator, leading to more false or misleading signals.
## Bollinger Bands (BB)
Bollinger Bands consist of three lines: the middle band, which is a simple moving average (typically over the past 20 days), and an upper and lower band, which are two standard deviations away from the middle band. These bands provide a relative definition of high and low prices in a market.
There are several concepts related to Bollinger Bands:
1. Statistical Concept: Bollinger Bands are based on the statistical concept that around 95% of the stock prices will fall between the upper and lower bands. When the price exceeds the upper band, it indicates the stock may be overbought, while falling below the lower band suggests it may be oversold.
2. Percent B: Percent B is a metric that reflects the close price as a percentage of the lower and upper Bollinger Bands. It helps visualize whether the stock price is overbought (above 100), natural (around 50), or oversold (below 0).
3. Bollinger Band Width: The Bollinger Band Width measures the consolidation of stock price movements and volatility. It is calculated as the difference between the upper and lower bands divided by the middle band. An increasing Band Width indicates increasing trend strength, while a decreasing Band Width suggests a potential end to the current trend.
## Correlation Coefficient
## DMI and ADX
## KDJ
---
References/Other notes:
<a id="1">[1]</a> [Yaonology Algorithmic Trading](https://github.com/yaonology/PineScript)
<a id="2">[2]</a> [5 Essential Indicators Used in Technical Analysis](https://academy.binance.com/en/articles/5-essential-indicators-used-in-technical-analysis)