Danny Groves Profile picture
Machine learning & data in trading | Pythonista | Math PhD & Data Scientist | Sharing my discoveries and mistakes | No tweets are financial advice.
2 subscribers
Jan 9, 2024 31 tweets 11 min read
Finding optimal trading parameters is great - but they may not respond or adapt to market changes

This is where ML may be able to help us!

So let's take a step-by-step case study in this 🧵and use ML to try and predict the best trading parameters each day

Enjoy! Image I can't take credit for the idea - that goes to @chanep and his team at @PredictNowAI

They call it "Conditional Parameter Optmisation" (CPO) - the key idea is to use ML to find the optimal parameters based on the current market conditions, i.e. it's adaptive.
Dec 31, 2023 17 tweets 5 min read
Good visualisations are key to quickly assessing strategy performance

So here's a 🧵to discuss two I use frequently:

1. Monte Carlo Plots
2. Win Rate Heatmap

And yes, all Python code is included, enjoy! Image First of all, let me say that my personal ethos with visualisations is to be as minimalist as possible.

I have sat through one too many presentations with complex charts - sure they're packed with info, but not easy to immediately digest.
Dec 21, 2023 37 tweets 14 min read
Machine learning for finance can be tricky

So let's break it down in a step-by-step case study 🧵

This time - let's create a model, and use explainable ML techniques to understand how it's making decisions.

And hopefully we'll gain some trading insights along the way!

Enjoy! Image First of all - this 🧵will use the same application as in the quoted one.

However, this time we will:
• Use a different classifier
• Drop correlated features
• Explain the model outputd

And I'll even throw the details of the attached 🧵 here too.
Dec 16, 2023 17 tweets 5 min read
I spent 100's of hours making a ML breakout scanner.

The outcome - scanning the entire market ≤ 2 mins per day.

The thing is, I hardly use it now... but it taught me a lot.

Here's 10 things I learned from this experience 🧵

(My favourite is Tip 7!) Image Firstly, what was my rationale for this idea?

Pro traders recommend checking out 1000's of examples to learn setups.

I was like "Hey, whilst I'm doing that, I will save the examples and let ML find them again for me, saving me loads of time!"

Seemed like a win-win!
Dec 12, 2023 29 tweets 11 min read
Machine learning for finance is not all about prediction.

So let's take a step-by-step case study in this 🧵

This time - let's cluster trades to try and find similar ones in the future

Enjoy! Image First of all let me say that I love prediction problems, it's fun stuff.

However, prediction can be tricky - you have to be careful with what you ask the model or it may just not find anything at all.

Unsupervised is different, you let it find the patterns for you!
Dec 10, 2023 29 tweets 12 min read
Machine learning for finance can be tricky!

So let's explore with another step-by-step case study 🧵

This time, let's use ML to find time series patterns across multiple instruments.

The aim - to find like patterns in the market and build a scanner.

Enjoy! Image OK, what ML tools are we using here?

This will be a clustering approach = unsupervised.

Unsupervised means we give the algorithm no guidance on what to look for.

I'm interested to see what patterns IT can find for me.

Yes, I'm lazy.
Dec 5, 2023 30 tweets 11 min read
Machine learning for finance is hard.

So let's take a step-by-step case study in this 🧵

This time - let's ask ML to find patterns without giving it any direction, and use those patterns to mitigate risk.

Oh, and we'll backtest the ML model too!

Enjoy! Image To start, let's briefly introduce two fields of ML:

1. Unsupervised - grouping like cases, where the ML is given no direction.
2. Supervised - learning from labelled data (e.g. this is a cat, this is a dog)

We're going to use 1 to find a pattern, and 2 to de-risk it.
Dec 1, 2023 28 tweets 10 min read
In the linked tweet I showed an application for ML in finance.

Predicting trends in the SPY.

This was with a random forest model, so, how does a deep learning LSTM compare? 🤔

Can it learn from the OLHCV time series alone?

Let's explore in this step-by-step 🧵 First of all - let me say that this thread will be quite similar to the attached one.

However, for completeness, I'll describe the full deets here as well.

But feel free to skip parts if you already read the last one 🙂
Nov 28, 2023 23 tweets 9 min read
Machine learning for finance is hard!

So let's take a simple case, and break it down step-by-step in this 🧵

The application - a simple trend prediction on the SPY using a random forest.

Enjoy! Image 1. Getting the data

This is the easy part!

Since we are looking at the daily time frame, we can use yfinance to get the data in just two lines of code.

The output will be a pandas dataframe containing ~ 20 yrs of data. Image
Nov 27, 2023 16 tweets 6 min read
Distributions in trading are strange

An example = high-of-the-day time for red day small cap gappers

The mean + median look... well.. off.

Here's a tool I like - Kernel Density Estimation

Inside:
• A quick KDE intro
• How to use it in Python
• Some analysis ideas

Enjoy! Image Alright, let's start with one reason why I like a KDE

In this example, the distribution clearly isn't normal (e.g. bell-shaped)

E.g. the mean isn't a great average estimate

The median seems distant from the "peak" of the data too.

A KDE can approx where that peak is. Image
Nov 12, 2023 15 tweets 5 min read
The Stockbee Market Monitor by @PradeepBonde is probably one of the best free resources out there.

It's amazing for gauging situational awareness of the market.

Let's take a look from a data-science perspective in predicting trends in SPY 🧵 Image @PradeepBonde If you're a swing trader, then the Market Monitor is a seriously useful market breadth tool.

I'm using it to understand whether the market is favorable to long-based momentum trades.

Basically, I'm looking to trade long when the chart is highlighted green. Image