Original: http://www.quantmod.com/examples/intro/
With Quantmod, you can obtain data from many data sources, including:
Yahoo! Finance (OHLC data) The Federal Reserve Bank of St. Louis fred® (11,000 economic series), Google Finance (OHLC data) Oanda, The Currency Site (FX and Metals) MySQL database (local data) R binary format (. RData and. RDA CSV file (. csv)
Get Data:
Getsymbols ("GOOG", src= "Yahoo")
Take a look at the data obtained:
Drawing:
Paint results:
Get AAPL data and paint:
RM (AAPL)
getsymbols ("AAPL", src= "Yahoo")
Draw the AAPL Candle chart:
Download XPTUSD data:
This data has only 2 columns of date and time:
Draw a graph:
The picture is very fast.
Custom Paint:
ChartSeries (To.weekly (XPTUSD), up.col= ' White ', dn.col= ' Blue ')
Require (TTR)
getsymbols ("AAPL")
chartseries (AAPL)
ADDMACD ()
Very good, can draw the indicator graph:
Then, the signal is generated from the data.