2017-12-15 04:42:59 +00:00
|
|
|
---
|
|
|
|
title: "Getting Into Day Trading: Analyzing The Moving Average"
|
|
|
|
date: 2017-11-04T14:11:54-04:00
|
|
|
|
draft: true
|
2017-12-15 04:52:57 +00:00
|
|
|
tags: ["day trading", "data analysis", "julia"]
|
2017-12-15 04:42:59 +00:00
|
|
|
---
|
|
|
|
|
|
|
|
Now that we have a Julia environment good to go, and a dataset available, time to start doing some real analysis.
|
|
|
|
|
|
|
|
I know that I have this bit of data for the WLTW symbol, and what would be helpful is to see that data completely
|
|
|
|
plotted in all of it's glory. Let's take a look at the closing costs (y) plotted against the date(x).
|
|
|
|
|
|
|
|
![Image](/img/post/WLTW_CLOSING_COSTS.png)
|
|
|
|
|
2017-12-15 04:52:57 +00:00
|
|
|
Not bad, we can see an ok trend going from January to December 2016. This data isn't very useful yet but I can
|
|
|
|
showcase some awesome Julia packages, and how I generated the graph.
|
|
|
|
|
|
|
|
I used DataFrames.jl to store the data, Query.jl to grab a subset of the data, and Gadfly.jl to plot the data.
|
|
|
|
All of these are excellent libraries for doing your thing when analyzing.
|
|
|
|
|
|
|
|
```julia
|
|
|
|
data = readtable("prices.csv", header=True)
|
|
|
|
q = @from i in data begin
|
|
|
|
@where i.symbol == "WLTW"
|
|
|
|
@select {i.date, i.close}
|
|
|
|
@collect DataFrame
|
|
|
|
end
|
|
|
|
|
|
|
|
p = (q, y=:close, Geom.Point, Guide.Title("Closing Costs: WLTW - 2016"))
|
|
|
|
draw(PNG("wltw_closing_costs.png, 6inch, 4inch), p)
|
|
|
|
```
|
|
|
|
|
|
|
|
Now I'd like to add the plots for the 3-day SMA, and the 5-day SMA to the plot of WLTW closing costs. What these
|
|
|
|
are, are the average of either the last 3 days or the last 5 days for a single datapoint. I believe that
|
|
|
|
by doing so, we may be able to visualize if either datapoint is adequate in predicting trends in this data. I'll be looking for
|
|
|
|
how close any given moving average is to the actual trend of the close costs for the WLTW security.
|
2017-12-15 04:42:59 +00:00
|
|
|
|
|
|
|
|