Ad(): Adjusted closing price, adjust for dividends & splits
Financial Trading in R
Plo!ing Financial Data > Plot data using the plot command > plot(Cl(LQD))
60
80
100
120
Cl(LQD)
Jul 30 2002
Jan 02 2004
Jul 01 2005
Jan 03 2007
Jul 01 2008
Jan 04 2010
Jul 01 2011
Jan 02 2013
Jul 01 2014
Jan 04 2016
FINANCIAL TRADING IN R
Let’s practice!
FINANCIAL TRADING IN R
Adding indicators to financial data
Financial Trading in R
Trading indicators ●
TTR: toolbox of classical trading indicators
●
Simple Moving Average (SMA)
●
Popular for CTA’s: 200-day moving average ●
Displays where prices have been over the past 10 months
Financial Trading in R
Using SMA() > # Compute a simple moving average (SMA) across 200 days > sma # Add the SMA line to your plot of LQD closing price > plot(Cl(LQD)) > lines(sma, col = "red")