SMA, MACD, RSI (SMR) Trading Algorithm
View a stock's buy/sell recommendations based on a synthesis
of three indicators: SMA, MACD, and RSI
Syntax:
smr_strategy
Inputs:
none
Outputs:
none
An internet connection is required.
This tool performs techninal analysis of stock data automatically and
suggests times at which an investor should buy or sell a particular stock.
The plot of stock price vs. time contains red and green dots. Red dots
correspond to days that the strategy suggests to sell, and green dots
correspond to days that the strategy suggests to buy.
Definitions:
-MACD: Moving Average Convergence/Divergence. The difference between a
long period and short period Exponential Moving Average of the stock
price
-MACD Signal: The EMA of the MACD described above
-SMA: Simple Moving Average. The average stock price over the last n
days
-RSI: Relative strength index. Fluctuates between 0 and 100. Over 70 is
considered "overbought" (and expected to fall) while under 30 indicates
"oversold" (and expected to rise)
Recommendations are based on simple moving average, relative strength index,
and moving avg convergence/divergence. This algorithm to
this strategy is from the book "The Neatest Little Guide to Stock
Market Investing" by Jason Kelly and is outlined below.
Stock data is from Yahoo's! free, undocumented, non-commercial API.
At least two (2) of these three (3) conditions must be met in order to
recommend a buy or sell:
1. MACD and MACD signal have recently intersected. If MACD signal is
rising on intersection buy, otherwise sell
2. rsi < 30 and increasing (buy) or > 70 and decreasing (sell)
3. current price crosses sma (cross upwards = buy, downwards = sell)
There are no guarantees made as to the effectiveness of the tool, so
invest at your own risk. The author is not responsible for any losses you
may incur when following this strategy.
Cite As
Chad Smith (2024). SMA, MACD, RSI (SMR) Trading Algorithm (https://www.mathworks.com/matlabcentral/fileexchange/44936-sma-macd-rsi-smr-trading-algorithm), MATLAB Central File Exchange. Retrieved .
MATLAB Release Compatibility
Platform Compatibility
Windows macOS LinuxCategories
Tags
Acknowledgements
Inspired by: Technical Analysis Tool, Shade area between two curves
Inspired: twelve pulse rectifier AC/DC
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!Discover Live Editor
Create scripts with code, output, and formatted text in a single executable document.
Version | Published | Release Notes | |
---|---|---|---|
1.0.0.0 |