In this lecture, we are going to conclude everything we learned in this section.
Please note that our study of algorithmic trading is not yet complete.
In the coming seconds, we will be studying reinforcement learning, which will extend what we've learned
here.
But this is a good stopping point to consider what we've learned so far since reinforcement learning
is a very different subject.
OK, so this section was all about algorithmic trading, we learned about a classic technique called
trend following this made use of a pretty basic tool we learned about early on in the course called
the simple moving average.
Next, we learned about machine learning based techniques.
We applied linear regression, logistic regression and random for us as our machine learning models.
We saw that although random forests are powerful models in general, they also have the capacity to
overfit to noise, which is abundant in financial data.
I want to reiterate one of the important themes of this section and of this course in general, it's
that models are just models.
You can't say this model is good and it should work because it is a good model.
You can't say so-and-so says this is a good model.
Therefore it will work for me.
As we saw and have considered previously, your data also matters.
We looked at the returns on a few components of the S&P as input features.
Even considering only these, there is still many more choices.
For example, you could use multiple lags of those returns.
This will give you a vector auto regressive model.
You can plug this kind of data into more powerful models like CNN Zain Arnon's from Deep Learning.
However, you can assume that CNN Zain Arnon's will work better than Anan's or linear models.
And we see students make the mistake of presuming that deep learning is powerful.
Therefore, deep learning should always work.
The more powerful the deep learning model, the better.
These are not good assumptions, especially in finance.
Going back to data, there is still much more data from around the world that can be used, as you know,
European markets and Asian markets open and close at different times compared to the U.S. market.
Therefore, it's possible that what happens in those markets might be predictive of what happens in
the U.S. market.
In addition, there's always opportunity to make use of Twitter and the news using NLP techniques such
as sentiment analysis.
So that would be an example of having multiple machine learning models in your pipeline.
Your first model reads the news and outputs the sentiment for that day.
Your second model takes the sentiments and tries to predict tomorrow's return.
So these are just some ideas about data that you can consider.
But also remember that if you do end up finding a good signal, other people can find it, too.
And if everyone knows about it and everyone is using super fast computers to act on it quickly, then
that is exactly an efficient market.
Another important consideration is to check for robustness over time in our examples, we looked at
only a single train set and test set.
But what if I want a strategy that performs well all of the time this year, next year and the year
after that?
This doesn't necessarily mean that you will use the same model with the same parameters over all time
periods since you could just retrain your model periodically.
It means that we care that the method itself is robust.
That is, can I take the same strategy one year from now, train a new model and still perform well?
Another important consideration is to check for robustness over different assets in our examples.
We looked at only the S&P.
If you want to consider our algorithm good, then you might want to make sure that it works for other
signals as well.
For example, we might see that it beats buy and hold for the S&P, but does it buy and hold for the
Dow Jones?
How much money does it lose if we use the algorithm on a stock that ends up going down?
Can it handle a market crash?
These are all important questions to ask.
OK, so to conclude this lecture, let's remember that these lectures are meant to introduce you to
some ideas, but as with portfolio theory, it's necessary to make sure your algorithm is robust and
not just overly optimistic.
In the next section, I will introduce you to a new paradigm called Reinforcement Learning.
Reinforcement learning is a complex subject, and although I've included a multiple hour introduction
to the topic in this course, it still might be too dense for you to take in and digest all at once.
For many people, myself included, it's necessary to study reinforcement learning in depth until you
truly understand it.
This includes coding everything from scratch and demonstrating all the ideas in a computer program instead
of just thinking about them in your mind.
Personally, that just does not work for me.
Nonetheless, the next section will review reinforcement learning from scratch.
After that, we will apply what we've learned to algorithmic trading.