sqa 0.0.31 → 0.0.32
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +13 -0
- data/CLAUDE.md +21 -0
- data/README.md +56 -32
- data/docs/api/dataframe.md +0 -1
- data/docs/assets/images/sqa.jpg +0 -0
- data/docs/concepts/index.md +2 -10
- data/docs/data_frame.md +0 -1
- data/docs/getting-started/index.md +0 -16
- data/docs/getting-started/installation.md +2 -2
- data/docs/getting-started/quick-start.md +4 -4
- data/docs/index.md +0 -2
- data/docs/strategies/bollinger-bands.md +1 -1
- data/docs/strategies/rsi.md +1 -1
- data/examples/sinatra_app/Gemfile +20 -0
- data/examples/sinatra_app/Gemfile.lock +268 -0
- data/examples/sinatra_app/QUICKSTART.md +13 -3
- data/examples/sinatra_app/README.md +12 -2
- data/examples/sinatra_app/RUNNING_WITHOUT_TALIB.md +90 -0
- data/examples/sinatra_app/TROUBLESHOOTING.md +95 -0
- data/examples/sinatra_app/app.rb +85 -25
- data/examples/sinatra_app/public/css/style.css +101 -37
- data/examples/sinatra_app/public/debug_macd.html +82 -0
- data/examples/sinatra_app/start.sh +53 -0
- data/examples/sinatra_app/views/dashboard.erb +558 -146
- data/examples/sinatra_app/views/layout.erb +2 -2
- data/lib/sqa/data_frame/alpha_vantage.rb +13 -3
- data/lib/sqa/data_frame.rb +21 -15
- data/lib/sqa/indicator.rb +17 -4
- data/lib/sqa/stock.rb +73 -11
- data/lib/sqa/ticker.rb +9 -2
- data/lib/sqa/version.rb +1 -1
- data/lib/sqa.rb +12 -4
- data/mkdocs.yml +4 -40
- metadata +7 -21
- data/docs/alpha_vantage_technical_indicators.md +0 -62
- data/docs/average_true_range.md +0 -9
- data/docs/bollinger_bands.md +0 -15
- data/docs/candlestick_pattern_recognizer.md +0 -4
- data/docs/donchian_channel.md +0 -5
- data/docs/double_top_bottom_pattern.md +0 -3
- data/docs/exponential_moving_average.md +0 -19
- data/docs/fibonacci_retracement.md +0 -30
- data/docs/head_and_shoulders_pattern.md +0 -3
- data/docs/market_profile.md +0 -4
- data/docs/momentum.md +0 -19
- data/docs/moving_average_convergence_divergence.md +0 -23
- data/docs/peaks_and_valleys.md +0 -11
- data/docs/relative_strength_index.md +0 -6
- data/docs/simple_moving_average.md +0 -8
- data/docs/stochastic_oscillator.md +0 -4
- data/docs/ta_lib.md +0 -160
- data/docs/true_range.md +0 -12
- data/docs/true_strength_index.md +0 -46
- data/docs/weighted_moving_average.md +0 -48
data/docs/market_profile.md
DELETED
data/docs/momentum.md
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
# Momentum
|
|
2
|
-
|
|
3
|
-
Calculates the momentum of a stock based on the rate of change (ROC).
|
|
4
|
-
|
|
5
|
-
The interpretation of a stock's momentum value in terms of forecasting future price depends on the specific trading strategy or approach being used. However, in general, a positive momentum value indicates that the stock's price has been increasing over the specified period, while a negative momentum value indicates that the stock's price has been decreasing.
|
|
6
|
-
|
|
7
|
-
Here are some common interpretations of momentum values:
|
|
8
|
-
|
|
9
|
-
1. Positive Momentum: A positive momentum value suggests that the stock's price has been trending upwards. This could indicate that the stock is in an uptrend and may continue to rise in the near future. Traders and investors may interpret this as a bullish signal and consider buying or holding the stock.
|
|
10
|
-
|
|
11
|
-
2. Negative Momentum: A negative momentum value suggests that the stock's price has been trending downwards. This could indicate that the stock is in a downtrend and may continue to decline in the near future. Traders and investors may interpret this as a bearish signal and consider selling or avoiding the stock.
|
|
12
|
-
|
|
13
|
-
3. High Momentum: A high positive momentum value indicates a strong upward trend in the stock's price. This could suggest that the stock has significant buying pressure and may continue to rise. Traders and investors may interpret this as a strong bullish signal and consider entering or adding to their positions.
|
|
14
|
-
|
|
15
|
-
4. Low Momentum: A low positive momentum value suggests a weak upward trend or a sideways movement in the stock's price. This could indicate a lack of significant buying pressure. Traders and investors may interpret this as a neutral signal and may choose to wait for a stronger momentum signal or look for other indicators to make trading decisions.
|
|
16
|
-
|
|
17
|
-
It's important to note that momentum alone may not be sufficient for accurate price forecasting. It is often used in conjunction with other technical indicators, fundamental analysis, or market conditions to make more informed trading decisions.
|
|
18
|
-
|
|
19
|
-
Additionally, the interpretation of momentum values may vary depending on the time frame and the specific trading strategy being employed. Traders and investors should consider their own risk tolerance, investment goals, and trading approach when interpreting momentum values for forecasting future price movements.
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
# Moving Average Convergence Divergence (MACD)
|
|
2
|
-
|
|
3
|
-
The MACD is a trend-following momentum indicator that measures the relationship between two moving averages over a specified time period. The MACD is calculated by subtracting the long-term moving average from the short-term moving average.
|
|
4
|
-
|
|
5
|
-
The method takes in an array of historical prices for a stock, a short period (the number of days to calculate the short-term moving average over), a long period (the number of days to calculate the long-term moving average over), and a signal period (the number of days to calculate the signal line moving average over).
|
|
6
|
-
|
|
7
|
-
The method first calculates the short-term moving average by calling the `moving_averages` method with the `prices` array and the `short_period` parameter. It then calculates the long-term moving average by calling the `moving_averages` method with the `prices` array and the `long_period` parameter.
|
|
8
|
-
|
|
9
|
-
Next, the method calculates the MACD line by subtracting the long-term moving average from the short-term moving average. This is done by taking the last element of the `short_ma` array (which contains the short-term moving averages for each window) and subtracting the last element of the `long_ma` array (which contains the long-term moving averages for each window).
|
|
10
|
-
|
|
11
|
-
Finally, the method calculates the signal line by taking the moving average of the MACD line over the specified `signal_period`. This is done by calling the `moving_averages` method with the `short_ma` array and the `signal_period` parameter, and taking the last element of the resulting array.
|
|
12
|
-
|
|
13
|
-
The method returns an array containing the MACD line and the signal line.
|
|
14
|
-
|
|
15
|
-
Note that this is just a basic implementation of the MACD indicator, and there are many variations and refinements that can be made depending on the specific requirements of your program.
|
|
16
|
-
|
|
17
|
-
The Moving Average Convergence Divergence (MACD) is a technical analysis indicator that is used to identify changes in momentum, direction, and trend for a security. The MACD is calculated by subtracting the 26-period exponential moving average (EMA) from the 12-period EMA.
|
|
18
|
-
|
|
19
|
-
The values 1.8231937142857078 and 164.44427957142855 that you provided are likely the MACD line and the signal line, respectively. The MACD line is the difference between the 12-period EMA and the 26-period EMA, while the signal line is a 9-period EMA of the MACD line.
|
|
20
|
-
|
|
21
|
-
The MACD line crossing above the signal line is often considered a bullish signal, while the MACD line crossing below the signal line is often considered a bearish signal. The distance between the MACD line and the signal line can also provide insight into the strength of the trend.
|
|
22
|
-
|
|
23
|
-
Without additional context, it's difficult to interpret the specific values of 1.8231937142857078 and 164.44427957142855 for the MACD and signal lines of a stock. However, in general, the MACD can be used to identify potential buy and sell signals for a security, as well as to provide insight into the strength of the trend.
|
data/docs/peaks_and_valleys.md
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
# Peaks and Valleys
|
|
2
|
-
|
|
3
|
-
In financial technical analysis of stock prices, knowing the peak prices and low prices within a series of prices can provide valuable information. These peak and valley points are often used to identify support and resistance levels, which are important indicators for traders and investors.
|
|
4
|
-
|
|
5
|
-
- **Peak prices** represent the points at which the price of the stock reaches a high level before declining. This information can help identify potential trends and the maximum price levels that the stock has reached in the past. Traders may use peak prices to set profit targets or to determine when to sell a stock if it reaches a certain price level again.
|
|
6
|
-
|
|
7
|
-
- **Low prices in valleys** represent the points at which the price of the stock reaches a low level before increasing. These bottom points can help identify potential buying opportunities or areas of support. Traders may use valley prices to set stop-loss orders or to determine when the stock is oversold and potentially undervalued.
|
|
8
|
-
|
|
9
|
-
By analyzing the peak and valley prices within a series of prices, technical analysts can identify patterns such as trendlines, channels, or chart patterns like head and shoulders. These patterns can provide insights into the future direction of the stock price and help make informed trading decisions.
|
|
10
|
-
|
|
11
|
-
Overall, understanding the peak prices and low prices within a price array can provide valuable insights into the historical levels of support and resistance, allowing traders to make more informed decisions regarding their buying and selling strategies.
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
# Relative Strength Index (RSI)
|
|
2
|
-
|
|
3
|
-
This method takes in an array of historical prices for a stock and a period (the number of days to calculate the RSI over). It uses the `each_cons` method to iterate over a sliding window of closing prices and calculate the gains and losses for each window. Then, it calculates the average gain and average loss for the time period and uses these values to calculate the RSI. The method returns the RSI value for the given period.
|
|
4
|
-
|
|
5
|
-
* over_bought if rsi >= 70
|
|
6
|
-
* over_sold if rsi <= 30
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
# Simple Moving Average (SMA)
|
|
2
|
-
|
|
3
|
-
This method takes in an array of historical prices for a stock and a period (the number of days to calculate the moving average over). It uses the `each_cons` method to iterate over a sliding window of closing prices and calculate the moving average for each window. The method returns an array of the moving averages for each windo
|
|
4
|
-
|
|
5
|
-
# Simple Moving Average Trend
|
|
6
|
-
|
|
7
|
-
Up or down with angle to indicate how steep the movement is.
|
|
8
|
-
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
# Stochastic Oscillator
|
|
2
|
-
|
|
3
|
-
The Stochastic Oscillator is a popular technical indicator used in financial analysis to determine the current momentum and potential reversal points in a stock or market. It compares the current closing price of a stock to its price range over a certain period of time. The indicator consists of two lines: %K and %D.
|
|
4
|
-
|
data/docs/ta_lib.md
DELETED
|
@@ -1,160 +0,0 @@
|
|
|
1
|
-
# TA-Lib
|
|
2
|
-
|
|
3
|
-
`SQA` does not use the `ta-lib` but is considering it. Currently there are no ruby wrappers. There is a Java implementation and a Python wrapper.
|
|
4
|
-
|
|
5
|
-
The `ta-lib` library is a C/C++ implementation of about 200 technical analysis indicators which has been around since a little after the turn of the century. | It supports the follow indicators:
|
|
6
|
-
|
|
7
|
-
| TA Function | Name |
|
|
8
|
-
| ----------- | ---- |
|
|
9
|
-
| AD | Chaikin A/D Line |
|
|
10
|
-
| ADOSC | Chaikin A/D Oscillator |
|
|
11
|
-
| ADX | Average Directional Movement Index |
|
|
12
|
-
| ADXR | Average Directional Movement Index Rating |
|
|
13
|
-
| APO | Absolute Price Oscillator |
|
|
14
|
-
| AROON | Aroon |
|
|
15
|
-
| AROONOSC | Aroon Oscillator |
|
|
16
|
-
| ATR | Average True Range |
|
|
17
|
-
| AVGPRICE | Average Price |
|
|
18
|
-
| BBANDS | Bollinger Bands |
|
|
19
|
-
| BETA | Beta |
|
|
20
|
-
| BOP | Balance Of Power |
|
|
21
|
-
| CCI | Commodity Channel Index |
|
|
22
|
-
| CDL2CROWS | Two Crows |
|
|
23
|
-
| CDL3BLACKCROWS | Three Black Crows |
|
|
24
|
-
| CDL3INSIDE | Three Inside Up/Down |
|
|
25
|
-
| CDL3LINESTRIKE | Three Outside Up/Down |
|
|
26
|
-
| CDL3STARSINSOUTH | Three Stars In The South |
|
|
27
|
-
| CDL3WHITESOLDIERS | Three Advancing White Soldiers |
|
|
28
|
-
| CDLABANDONEDBABY | Abandoned Baby |
|
|
29
|
-
| CDLADVANCEBLOCK | Advance Block |
|
|
30
|
-
| CDLBELTHOLD | Belt-hold |
|
|
31
|
-
| CDLBREAKAWAY | Breakaway |
|
|
32
|
-
| CDLCLOSINGMARUBOZU | Closing Marubozu |
|
|
33
|
-
| CDLCONCEALBABYSWALL | Concealing Baby Swallow |
|
|
34
|
-
| CDLCOUNTERATTACK | Counterattack |
|
|
35
|
-
| CDLDARKCLOUDCOVER | Dark Cloud Cover |
|
|
36
|
-
| CDLDOJI | Doji |
|
|
37
|
-
| CDLDOJISTAR | Doji Star |
|
|
38
|
-
| CDLDRAGONFLYDOJI | Dragonfly Doji |
|
|
39
|
-
| CDLENGULFING | Engulfing Pattern |
|
|
40
|
-
| CDLEVENINGDOJISTAR | Evening Doji Star |
|
|
41
|
-
| CDLEVENINGSTAR | Evening Star |
|
|
42
|
-
| CDLGAPSIDESIDEWHITE | Up/Down-gap side-by-side white lines |
|
|
43
|
-
| CDLGRAVESTONEDOJI | Gravestone Doji |
|
|
44
|
-
| CDLHAMMER | Hammer |
|
|
45
|
-
| CDLHANGINGMAN | Hanging Man |
|
|
46
|
-
| CDLHARAMI | Harami Pattern |
|
|
47
|
-
| CDLHARAMICROSS | Harami Cross Pattern |
|
|
48
|
-
| CDLHIGHWAVE | High-Wave Candle |
|
|
49
|
-
| CDLHIKKAKE | Hikkake Pattern |
|
|
50
|
-
| CDLHIKKAKEMOD | Modified Hikkake Pattern |
|
|
51
|
-
| CDLHOMINGPIGEON | Homing Pigeon |
|
|
52
|
-
| CDLIDENTICAL3CROWS | Identical Three Crows |
|
|
53
|
-
| CDLINNECK | In-Neck Pattern |
|
|
54
|
-
| CDLINVERTEDHAMMER | Inverted Hammer |
|
|
55
|
-
| CDLKICKING | Kicking |
|
|
56
|
-
| CDLKICKINGBYLENGTH | Kicking - bull/bear determined by the longer marubozu |
|
|
57
|
-
| CDLLADDERBOTTOM | Ladder Bottom |
|
|
58
|
-
| CDLLONGLEGGEDDOJI | Long Legged Doji |
|
|
59
|
-
| CDLLONGLINE | Long Line Candle |
|
|
60
|
-
| CDLMARUBOZU | Marubozu |
|
|
61
|
-
| CDLMATCHINGLOW | Matching Low |
|
|
62
|
-
| CDLMATHOLD | Mat Hold |
|
|
63
|
-
| CDLMORNINGDOJISTAR | Morning Doji Star |
|
|
64
|
-
| CDLMORNINGSTAR | Morning Star |
|
|
65
|
-
| CDLONNECK | On-Neck Pattern |
|
|
66
|
-
| CDLPIERCING | Piercing Pattern |
|
|
67
|
-
| CDLRICKSHAWMAN | Rickshaw Man |
|
|
68
|
-
| CDLRISEFALL3METHODS | Rising/Falling Three Methods |
|
|
69
|
-
| CDLSEPARATINGLINES | Separating Lines |
|
|
70
|
-
| CDLSHOOTINGSTAR | Shooting Star |
|
|
71
|
-
| CDLSHORTLINE | Short Line Candle |
|
|
72
|
-
| CDLSPINNINGTOP | Spinning Top |
|
|
73
|
-
| CDLSTALLEDPATTERN | Stalled Pattern |
|
|
74
|
-
| CDLSTICKSANDWICH | Stick Sandwich |
|
|
75
|
-
| CDLTAKURI | Takuri (Dragonfly Doji with very long lower shadow) |
|
|
76
|
-
| CDLTASUKIGAP | Tasuki Gap |
|
|
77
|
-
| CDLTHRUSTING | Thrusting Pattern |
|
|
78
|
-
| CDLTRISTAR | Tristar Pattern |
|
|
79
|
-
| CDLUNIQUE3RIVER | Unique 3 River |
|
|
80
|
-
| CDLUPSIDEGAP2CROWS | Upside Gap Two Crows |
|
|
81
|
-
| CDLXSIDEGAP3METHODS | Upside/Downside Gap Three Methods |
|
|
82
|
-
| CMO | Chande Momentum Oscillator |
|
|
83
|
-
| CORREL | Pearson's Correlation Coefficient ® |
|
|
84
|
-
| DEMA | Double Exponential Moving Average |
|
|
85
|
-
| DX | Directional Movement Index |
|
|
86
|
-
| EMA | Exponential Moving Average |
|
|
87
|
-
| HT_DCPERIOD | Hilbert Transform - Dominant Cycle Period |
|
|
88
|
-
| HT_DCPHASE | Hilbert Transform - Dominant Cycle Phase |
|
|
89
|
-
| HT_PHASOR | Hilbert Transform - Phasor Components |
|
|
90
|
-
| HT_SINE | Hilbert Transform - SineWave |
|
|
91
|
-
| HT_TRENDLINE | Hilbert Transform - Instantaneous Trendline |
|
|
92
|
-
| HT_TRENDMODE | Hilbert Transform - Trend vs Cycle Mode |
|
|
93
|
-
| KAMA | Kaufman Adaptive Moving Average |
|
|
94
|
-
| LINEARREG | Linear Regression |
|
|
95
|
-
| LINEARREG_ANGLE | Linear Regression Angle |
|
|
96
|
-
| LINEARREG_INTERCEPT | Linear Regression Intercept |
|
|
97
|
-
| LINEARREG_SLOPE | Linear Regression Slope |
|
|
98
|
-
| MA | All Moving Average |
|
|
99
|
-
| MACD | Moving Average Convergence/Divergence |
|
|
100
|
-
| MACDEXT | MACD with controllable MA type |
|
|
101
|
-
| MACDFIX | Moving Average Convergence/Divergence Fix 12/26 |
|
|
102
|
-
| MAMA | MESA Adaptive Moving Average |
|
|
103
|
-
| MAX | Highest value over a specified period |
|
|
104
|
-
| MAXINDEX | Index of highest value over a specified period |
|
|
105
|
-
| MEDPRICE | Median Price |
|
|
106
|
-
| MFI | Money Flow Index |
|
|
107
|
-
| MIDPOINT | MidPoint over period |
|
|
108
|
-
| MIDPRICE | Midpoint Price over period |
|
|
109
|
-
| MIN | Lowest value over a specified period |
|
|
110
|
-
| MININDEX | Index of lowest value over a specified period |
|
|
111
|
-
| MINMAX | Lowest and highest values over a specified period |
|
|
112
|
-
| MINMAXINDEX | Indexes of lowest and highest values over a specified period |
|
|
113
|
-
| MINUS_DI | Minus Directional Indicator |
|
|
114
|
-
| MINUS_DM | Minus Directional Movement |
|
|
115
|
-
| MOM | Momentum |
|
|
116
|
-
| NATR | Normalized Average True Range |
|
|
117
|
-
| OBV | On Balance Volume |
|
|
118
|
-
| PLUS_DI | Plus Directional Indicator |
|
|
119
|
-
| PLUS_DM | Plus Directional Movement |
|
|
120
|
-
| PPO | Percentage Price Oscillator |
|
|
121
|
-
| ROC | Rate of change |
|
|
122
|
-
| ROCP | Rate of change Percentage |
|
|
123
|
-
| ROCR | Rate of change ratio |
|
|
124
|
-
| ROCR100 | Rate of change ratio 100 scale |
|
|
125
|
-
| RSI | Relative Strength Index |
|
|
126
|
-
| SAR | Parabolic SAR |
|
|
127
|
-
| SAREXT | Parabolic SAR - Extended |
|
|
128
|
-
| SMA | Simple Moving Average |
|
|
129
|
-
| STDDEV | Standard Deviation |
|
|
130
|
-
| STOCH | Stochastic |
|
|
131
|
-
| STOCHF | Stochastic Fast |
|
|
132
|
-
| STOCHRSI | Stochastic Relative Strength Index |
|
|
133
|
-
| SUM | Summation |
|
|
134
|
-
| T3 | Triple Exponential Moving Average (T3) |
|
|
135
|
-
| TEMA | Triple Exponential Moving Average |
|
|
136
|
-
| TRANGE | True Range |
|
|
137
|
-
| TRIMA | Triangular Moving Average |
|
|
138
|
-
| TRIX | 1-day Rate-Of-Change (ROC) of a Triple Smooth EMA |
|
|
139
|
-
| TSF | Time Series Forecast |
|
|
140
|
-
| TYPPRICE | Typical Price |
|
|
141
|
-
| ULTOSC | Ultimate Oscillator |
|
|
142
|
-
| VAR | Variance |
|
|
143
|
-
| WCLPRICE | Weighted Close Price |
|
|
144
|
-
| WILLR | Williams' %R |
|
|
145
|
-
| WMA | Weighted Moving Average |
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
Rate of Change Implementation Definitions:
|
|
149
|
-
|
|
150
|
-
ROC - Rate of Change
|
|
151
|
-
> `((price/prevPrice)-1)*100`
|
|
152
|
-
|
|
153
|
-
ROCP - Rate of Change Precentage
|
|
154
|
-
> `(price-prevPrice)/prevPrice`
|
|
155
|
-
|
|
156
|
-
ROCR - Rate of Change Ratio
|
|
157
|
-
> `(price/prevPrice)`
|
|
158
|
-
|
|
159
|
-
ROCR100 - Rate of Change Ration on 100 Scale
|
|
160
|
-
> `(price/prevPrice)*100`
|
data/docs/true_range.md
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
# True Range
|
|
2
|
-
|
|
3
|
-
Calculates the True Range (TR) for a given set of price data.
|
|
4
|
-
|
|
5
|
-
The True Range is a measure of the price volatility of a security over a given period. It is calculated as the greatest of the following three values:
|
|
6
|
-
|
|
7
|
-
* The difference between the current high and the current low.
|
|
8
|
-
* The absolute value of the difference between the current high and the previous close.
|
|
9
|
-
* The absolute value of the difference between the current low and the previous close.
|
|
10
|
-
|
|
11
|
-
The True Range helps to capture the true extent of price movement, taking into account potential gaps or price jumps between periods. It is often used as a component in calculating other indicators, such as the Average True Range.
|
|
12
|
-
|
data/docs/true_strength_index.md
DELETED
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
# Technical Market Analysis: Understanding the True Strength Index (TSI)
|
|
2
|
-
|
|
3
|
-
The **True Strength Index (TSI)** is a technical momentum oscillator used to identify trends and reversals primarily in the price of a security. It is not directly related to the Relative Strength Index (RSI), although both are momentum indicators.
|
|
4
|
-
|
|
5
|
-
## How TSI is Calculated
|
|
6
|
-
|
|
7
|
-
The TSI formula is based on double smoothing of price changes:
|
|
8
|
-
|
|
9
|
-
1. **Calculate the Price Momentum**:
|
|
10
|
-
- Determine the daily price change: Current price minus previous price.
|
|
11
|
-
- Create a 25-period Exponential Moving Average (EMA) of price changes (this period can vary based on the trader's preference).
|
|
12
|
-
|
|
13
|
-
2. **Calculate the Absolute Price Momentum**:
|
|
14
|
-
- Calculate the absolute value of the daily price change.
|
|
15
|
-
- Create a 25-period EMA of the absolute price changes.
|
|
16
|
-
|
|
17
|
-
3. **Apply a Secondary Smoothing**:
|
|
18
|
-
- Calculate a 13-period EMA of the 25-period EMA of price changes.
|
|
19
|
-
- Calculate a 13-period EMA of the 25-period EMA of the absolute price changes.
|
|
20
|
-
|
|
21
|
-
4. **The TSI Formula**:
|
|
22
|
-
- TSI = 100 x (Double Smoothed Price Change / Double Smoothed Absolute Price Change)
|
|
23
|
-
|
|
24
|
-
The most common settings for the TSI are the 25-period EMA for initial smoothing and the 13-period EMA for the second smoothing. These periods can be adjusted to suit different trading styles and timeframes.
|
|
25
|
-
|
|
26
|
-
## How to Interpret TSI
|
|
27
|
-
|
|
28
|
-
- **Centerline Crossover**:
|
|
29
|
-
- When the TSI crosses above the centerline (0), it is considered bullish.
|
|
30
|
-
- When it crosses below the centerline, it is considered bearish.
|
|
31
|
-
|
|
32
|
-
- **Signal Line Crossover**:
|
|
33
|
-
- Traders often add a signal line, which is an EMA of the TSI (commonly a 7-period EMA).
|
|
34
|
-
- A bullish signal is generated when the TSI crosses above the signal line.
|
|
35
|
-
- A bearish signal is generated when TSI crosses below the signal line.
|
|
36
|
-
|
|
37
|
-
- **Overbought / Oversold Conditions**:
|
|
38
|
-
- The TSI can indicate overbought or oversold conditions. However, unlike RSI, there are no standard levels, such as 70 or 30, to indicate these conditions in TSI.
|
|
39
|
-
- Traders often observe extreme levels or divergence with the price to identify possible reversals.
|
|
40
|
-
|
|
41
|
-
- **Divergences**:
|
|
42
|
-
- Bullish divergence occurs if the price is making new lows while the TSI is failing to make new lows.
|
|
43
|
-
- Bearish divergence occurs if the price is making new highs while the TSI is failing to make new highs.
|
|
44
|
-
|
|
45
|
-
The TSI can be a valuable tool in your technical analysis toolkit. It helps to smooth out the volatility inherent in the market and provides a clearer picture of the price momentum. As with any technical indicator, it is advisable to use the TSI in conjunction with other tools and analysis methods to confirm signals and make informed trading decisions.
|
|
46
|
-
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
## Weighted Moving Average (WMA)
|
|
2
|
-
|
|
3
|
-
### What is a Weighted Moving Average?
|
|
4
|
-
|
|
5
|
-
A Weighted Moving Average (WMA) is a type of moving average that assigns more importance to recent prices by giving them greater weights. Unlike a simple moving average (SMA) that treats all values equally, a WMA emphasizes the latest data points, thus responding more quickly to price changes.
|
|
6
|
-
|
|
7
|
-
### How is a WMA Calculated?
|
|
8
|
-
|
|
9
|
-
To calculate a WMA, you follow these steps:
|
|
10
|
-
|
|
11
|
-
1. Choose the number of periods (n) for the average.
|
|
12
|
-
2. Assign weights to each price point, with the most recent price having the highest weight and the oldest price having the lowest. Weights typically decrement by 1 - for example, starting from n down to 1.
|
|
13
|
-
3. Multiply each price by its corresponding weight.
|
|
14
|
-
4. Sum up the weighted prices.
|
|
15
|
-
5. Divide the sum by the total of the weights.
|
|
16
|
-
|
|
17
|
-
The formula for WMA is:
|
|
18
|
-
|
|
19
|
-
WMA = (Price_n * Weight_n + Price_(n-1) * Weight_(n-1) + ... + Price_1 * Weight_1) / (Weight_n + Weight_(n-1) + ... + Weight_1)
|
|
20
|
-
|
|
21
|
-
Where:
|
|
22
|
-
- Price_n is the most recent price,
|
|
23
|
-
- Weight_n is the weight for the most recent price (usually equal to n).
|
|
24
|
-
|
|
25
|
-
### Using a Weighted Moving Average in Technical Analysis
|
|
26
|
-
|
|
27
|
-
A WMA is used in technical stock market analysis to smooth out price data and help identify trends. Here are some common uses:
|
|
28
|
-
|
|
29
|
-
1. **Trend Identification**: An upward sloping WMA indicates an uptrend, while a downward sloping WMA suggests a downtrend.
|
|
30
|
-
|
|
31
|
-
2. **Support and Resistance**: A WMA can act as a potential support or resistance level. Prices often bounce off the WMA line or struggle to break through it.
|
|
32
|
-
|
|
33
|
-
3. **Crossover Signals**: The crossover of a short-term WMA above a long-term WMA may signal a bullish trend, and vice versa for a bearish trend.
|
|
34
|
-
|
|
35
|
-
4. **Enhanced Reaction**: WMAs can provide quicker signals than simple moving averages due to their greater emphasis on recent prices, which is useful for short-term traders looking for prompt entry or exit points.
|
|
36
|
-
|
|
37
|
-
5. **Confluence with Other Indicators**: Traders often use WMAs in conjunction with other indicators, such as the Relative Strength Index (RSI) or Moving Average Convergence Divergence (MACD), to confirm signals or gain additional insights into market momentum.
|
|
38
|
-
|
|
39
|
-
### Limitations of Weighted Moving Averages
|
|
40
|
-
|
|
41
|
-
1. **Lagging Indicator**: While WMAs are designed to be more responsive than simple moving averages, they are still lagging indicators and might give signals after a trend has already begun.
|
|
42
|
-
|
|
43
|
-
2. **Noise**: In highly volatile markets, the WMA might be too reactive to price changes, resulting in false signals.
|
|
44
|
-
|
|
45
|
-
3. **Subjectivity**: The choice of the period and weight assignment can be subjective and significantly impact the analysis outcomes.
|
|
46
|
-
|
|
47
|
-
Traders should consider these limitations and ideally combine the WMA with other forms of analysis to make informed trading decisions.
|
|
48
|
-
|