Instructions:
1. This is an individual project.
2. Please also submit your Turnitin report.
3. Please print your R code in a Rscript file with comments explaining what you are trying to do at each step.
4. What we are trying to do here is to have an automatic program which executes everyday to check whether a certain stock has shown a “buy” or a “sell” signal. This program should be able to read the stock prices, process an indicator, and alert the end-user to check out the stock.
Task:
There are more than 3000 stocks trading in NYSE. Select a company with a dividend history longer than 10 years, which you would like to invest in.
1. Explain or present your idea about why you would like to invest in this particular company along with a suggested investment horizon using approximately 1000 words. Please do not copy and paste from the company’s annual report or website.
2. Install the package “Quantmod” in R and obtain the price history of your suggested stock.
3. Write a R function to calculate the n-days moving average of the closing price.
4. Write a R function to calculate the Bollinger bands. Normally, we use a 20 day moving average to create the Bollinger bands. For the sake of an individual project, please use a
πππππππππ οΏ½20 + πππ π‘ π‘π‘π‘π ππππππππ‘π πππ π π‘π’ππππ‘ πΌπ·οΏ½ days moving average.
10
For example, if your student ID is 20221234D, then please use the ceiling(20+3.4)=24 days moving average to create the Bollinger bands.
5. Stanley believes that an investment strategy would be buy the stock when the stock price touches the bottom band and sell the stock when the stock price touches the upper band. Write a R function for this strategy. For the last 720 trading days, count how many times this strategy was executed and find the probability of making a profit and calculate the profit if one stock is being bought and sold whenever the strategy is executed.
6. Adam believes that this strategy only works if the Bollinger bands are converging. This is something which we can do easily by reading the chart. Suggest a way to instruct R to identify that that Bollinger bands are converging.
7. Imagine your father has bought 1 share of this company 10 years ago on your birthday, works out the Internal Rate of Return. Note: dividends are part of your returns as well. Please apply what you have learned in root finding to obtain the IRR. Would it be smarter to buy the US 10-years treasury bill ten years ago?
8. Use taskcheduleR or any scheduling package in R to schedule your functions to run everyday by 18:00.
(Possible) Useful packages:
taskscheduleR
(Possible) Useful functions:
GetSymbols() GetDividends() julian()
Internal Rate of Return (IRR): The IRR is the discount rate that makes the net present value (NPV) of an investment zero. In other words, it is the expected compounded annual rate of return that will be earned on an investment. Hence,
CS 340 Milestone One Guidelines and Rubric Overview: For this assignment, you will implement the fundamental operations of create, read, update,
Retail Transaction Programming Project Project Requirements: Develop a program to emulate a purchase transaction at a retail store. This
7COM1028 Secure Systems Programming Referral Coursework: Secure
Create a GUI program that:Accepts the following from a user:Item NameItem QuantityItem PriceAllows the user to create a file to store the sales receip
CS 340 Final Project Guidelines and Rubric Overview The final project will encompass developing a web service using a software stack and impleme