How to build a basic quantative trading model

There are two general approaches to predicting stock prices. One is qualitative, where one makes decisions based on qualitative information such as industry trends or financial data on the company itself. I built a qualitative model based on NLP classification on financial news and their impact on stock prices here. The second one is quantitative trading, based on mathematical models based on algorithms, and sometimes a combination of both. There are pure quant funds like RENAISSANCE TECHNOLOGIES, that are investing strictly adhering to mathematical and statistical methods.

However, personally I’m not a fan of that. I’m not saying stock prices are random walks as many have, but at the same time, I do think that logical causalities are the main driver of stock prices. For instance, covid lockdowns are responsible for the massive stock market downturn in March 2020, and those events can’t be predicted by algorithms, but rather profound knowledge in pandemic spread patterns. With that being said, quantitative trading has produced consistent results for a lot of hedge funds, and I want to explore some of the basic ones as I dive into this topic.

1. Model Building

First, I need to identify what model I want to implement for my quantitative trading. In this case, I decided on the 200-50 EMA (Exponential Moving Average) strategy as my model in constructing my algorithmic trading strategy. In this model, the basic concept is that if the 50 day moving average is higher or lower than the 200 day moving average, then an action of buy or sell would take place based on that information alone.

2. Portfolio Selection

There are a few ways to improve this model with the portfolio selection of what stocks I want to implement this model on. A part of this algorithm is built on the consistency of the stock prices in the long run, so it is possible to only apply this model on stocks from certain industries and with certina price ranges.

3. Parameter Setting

In here, I want to define how much difference I choose to perform my trade on. For instance, if the 50 day average is below the 200 day average by 5% or 10%, I would then perform the buy action. And if one is higher than the other one by a certain percentage, and then I would initate a sell action. It is also decided here that what percentage of my holdings of a certain stock is bought or sold.

4. Automatic Trading Pipeline

Lastly, I just need to build it into a pipeline, and actions that were set prior will be triggered automatically and trades are performed automatically.