Here is a very simple model of a file. The file represents stock market closing prices. The first five prices are "uptrending". Then there are three "downtrending" prices. The remaining prices are again uptrending. Note that there is no trading on weekends.
1-Jan-2015, 1
2-Jan-2015, 2
5-Jan-2015, 3 //monday
6-Jan-2015, 4
7-Jan-2015, 5
8-Jan-2015, 4
9-Jan-2015, 3
12-Jan-2015, 2 //monday
13-Jan-2015, 1
14-Jan-2015, 2
15-Jan-2015, 3
16-Jan-2015, 4
19-Jan-2015, 5 //monday
I want to construct a price series that is ONLY uptrending. I want to delete downtrending rows, and advance the earlier dates to fill the gaps.
The final file looks like this:
6-Jan-2015, 1
7-Jan-2015, 2
8-Jan-2015, 3
9-Jan-2015, 4
12-Jan-2015, 5 //monday
13-Jan-2015, 5 // make it the same price as 12-Jan-2015
14-Jan-2015, 6
15-Jan-2015, 7
16-Jan-2015, 8
19-Jan-2015, 9 //monday
I can easily delete any data manually, simply by looking at the stock charts "by eye".
I would like some advice on how to do the following:
- The latest date (19-Jan-2015) needs to be the same as the latest date in the first file:
- The remaining dates needs to be closed up to fill the gaps (observing the weekends).
- Adjust the second batch of uptrending data so that it starts where the previous data finishes (at 5).
I would be grateful for any advice.
Bookmarks