Building Stock Selection into an Artificial Intelligence Framework

In this article, I propose a framework by which Machine Learning and Artificial Intelligence can empower the average trader’s decision making and trading strategies.

Empowering Decision Making Through AI…Credit: UnsplashBuilding an AI-based framework to drive your trading strategies is no simple feat.

I will not try to argue that the average trader is capable of such a task.

I will try to argue, however, that such a framework is possible.

One should be able to conceive of platforms that can be built that allow the average trader to point-and-click their way into a trading framework driven by Artificial Intelligence.

Such a framework could put powerful Machine Learning algorithms into the user’s hand and potentially even allow the user to hand-craft strategies and automate their trading decisions.

At the moment such a system would be prohibitively expensive.

But let’s examine how the system would be constructed and what steps we as developers, engineers, AI researchers, and other groups can begin to tackle such a problem.

Traditional Strategies → AI-Driven StrategiesAutomating Value InvestingThere are a number of different ways to value a stock.

Maybe you as a trader take a holistic approach of analyzing companies’ balance sheets.

Maybe you’re less interested in diving too deep and follow the mainstay metrics like P/E ratio, P/B ratio, D/E ratio, div yield, and earnings growth.

You’re probably limited to performing this analysis on a core basket of stocks you believe in.

What if you could automate this stock selection?.What if you could input the parameters that matter to you and return a list of stocks that fit your desired criteria?.Ultimately, depending on your stomach, you may or may not want your system to automatically build your portfolio based on these criteria.

Although I believe this is an optimal approach.

Better to let the approach work its magic and leave emotions at the door.

An AI-driven system that makes decisions based on your personal parameters for valuing a stock should be able to build your portfolio at t=0 and increase or decrease positions based on adherence to your parameters outlined at model inception.

Building a Neural Network to Constantly Update Market View Using Value InvestingIn the above model we use all of our desired inputs for valuing a stock.

We could add any additional inputs.

One can play with their network and add layers, add or remove neurons in the hidden layers, but ultimately the input and output layers are well determined.

Add as many inputs according to value investing principles as you see fit.

Though your output can be more complex.

Maybe you want your output to include recommendations for other positions like a short position for stocks with low buy recommendation.

Or maybe you want the system to automatically determine what option strategy is ideal.

We can add additional models for additional stocks.

Let’s say we allocate $100,000 dollars to invest in the top 100 stocks by market cap in the S&P 500.

We would then create 100 models, each model corresponding to one stock.

We automate the system to fit these models to the 100 stocks each time the metrics are updated (so probably whenever the company reports earnings).

We can then invest our money proportionally to those stocks whose probabilities in the output layer for Buy, Hold, or Sell align with our goal.

If we decide a 75% threshold for justifying a buy decision then maybe those stocks with above a 75% position for hold receive a certain percentage of our allocated capital.

We could also weight these decisions.

We could say that with 75% we allocate the minimum amount, let’s say 500$.

And then from there we could scale linearly; let’s say every additional percentage point is another $25.

At 100% probability this would indicate an investment of $5,000 for the single stock.

And as that buy probability decreased and the sell probability increased we could size down the position.

And those positions that increased in buy-side we could size up and those that decreased we could size down.

And maybe the stocks with a 75% sell probability we could take a short position.

As that sell probability decreases we size down our short.

You can quickly realize how many different strategies can be built out of the outputs of our Neural Network.

Automating Technical Analysis (TA)As we previously discussed, profits are becoming more and more difficult to find in the market.

Imagine that you are a day-trader who has seen your average daily-performance shrink from .

2% to .

02% each day.

In this case, you’ve seen your profits shrink from about $50,000/yr (at .

2% over 200 trading days for a starting portfolio of $100,000) to about $22,000/yr (at .

02% over 200 trading days for a starting portfolio of $100,000).

You would need to 10x your daily output to return to your normal earnings.

This seems impossible.

And for the average trader this is impossible.

One human could not handle the information flow or decision making necessary to 10x their daily returns without taking on massively more risk.

Many firms are running into this issue where their strategy to stay competitive is to squeeze every possible bit of profits out of their positions without increasing risk.

To do this, many take an algorithmic approach.

What if the indicators a day-trader is using for manual analysis could be translated into an automated strategy?From Implementing Moving Averages in Python…Source: MALet’s break it down into its simplest terms.

Let’s even oversimplify it.

Imagine you are a trader who religiously follows moving averages.

Maybe you are exceptionally competent and have set up a system of alerts for your 20 favorite stocks and trading moving averages (and potentially other indicators as well) during key moments like crossovers.

On an average day you capitalize on 5 short-term trades and quickly exit the trades when necessary.

You’re squeezing profits out of 5 trades by religiously following this strategy.

What if you could extend this same strategy to 300 stocks?.And what if instead of following alerts and scrambling to enter and exit trades you could build an automated system that handles this strategy for you.

What about for 1000 stocks?.How about 2000?.Instead of manually entering and exit trades you now become an operator.

Much like an operator in a factory watching the human-machine interfaces controlling some process using automation, you are now the operator ensuring the machines operating your portfolio are not misbehaving.

Building a Neural Network to Constantly Update Market View Using Technical Analysis (TA)In the above network we use indicators as inputs.

We do not use the direct numeric values of the indicators as inputs.

Instead, we use binary values for each indicator.

For example, if the Simple Moving Average (SMA) is giving a buy signal we call that a 1.

If the SMA is giving a sell signal we encode a 0.

We go down the line and encode all of our data accordingly.

The Future of AI-Dominated MarketsI think it is important to mention what would (will) happen if the above frameworks were utilized by most, if not all (99%+) market participants.

This of course isn’t the case.

But in a world where quant funds are outperforming all of the traditional investing firms, it’s hard to believe that the desire for profits will not drive more firms to mimic the behavior of quant funds.

And certainly, Artificial Intelligence and Machine Learning are massively studied within these funds.

I would contend some of the best research and applications of Machine Learning likely exist within these funds.

Unfortunately, these strategies are massively valuable intellectual property and the likelihood of this research exiting the walls of firms like Renaissance Technologies (aka Fort Knox) is very slim.

Looking Ahead to a Future Where AI Compete for Returns…Credit: UnsplashI think it is realistic to imagine a future where markets are almost completely dominated by AI, algorithmic trading, and machine-driven market making and order matching.

I don’t think it’s too fanatical to claim that within the next few decades the vast majority of market participants will be Artificial Intelligence that represent the intentions of their makers.

What does this mean?.I think this means AI will exist that take the brilliance of a portfolio manager and execute that brilliance across many different scenarios, all at once.

I think this means AI will exist that can digest massively large amounts of market signals and data that a normal human PM could never dream of analyzing.

The AI that receive the “best” data the fastest will outperform.

Imagine a future where AI has disseminated through the markets so widely that the market is just algorithms competing for scraps.

I think at this point it becomes difficult to argue with the Efficient Market Hypothesis.

When AI dominate the market, any trader (human or otherwise) that looks to make a trade will send a signal that all the algorithms operating in the world will receive and digest accordingly.

Game Theory will be highly evident in such a system.

Those firms whose AI can predict not only let’s say a company’s performance at earnings but also how other AI will react to all possible scenarios will get the best returns.

And many will try to game the system and perform malicious actions targeted at disrupting certain algorithms.

It’s fascinating to imagine a world where returns are dominated by the creators of such AI systems, rather than the traders and operators making single decisions at a time.

ConclusionAI-driven strategies are already prevalent in the market.

It is just a matter of time before these strategies are simplified and offered in a point-and-click manner for the average market participant.

Crafting models and simulating their performance is addicting and I encourage anyone well-versed in machine learning, deep learning, etc to have a stab at turning traditional value investing and technical analysis into broader Machine Learning based strategies.

Algorithmic trading – WikipediaSuch systems run strategies including market making, inter-market spreading, arbitrage, or pure speculation such as…en.


orgEfficient Market Hypothesis (EMH) DefinitionThe Efficient Market Hypothesis, or EMH, is an investment theory whereby share prices reflect all information and…www.


comHigh-frequency trading – WikipediaIn financial markets, high-frequency trading ( HFT) is a type of algorithmic trading characterized by high speeds, high…en.



. More details

Leave a Reply