Latest / AI Fire Daily / #187 Neil: Why AI Can Predict Short-Term Markets It's All Math
Transcript
- 0:00Have you ever stared at a stock chart, maybe
- 0:02something volatile like Bitcoin, and just wondered,
- 0:04is the next minute's price move pure randomness?
- 0:08Or is there actually some kind of hidden math,
- 0:10like a structure underneath all that noise? Yeah,
- 0:13it's a great question. Most people jump straight
- 0:15to human emotion, right? Fear, greed, what the
- 0:19crowd's thinking. But the forces we're digging
- 0:21into today suggest something else entirely. The
- 0:24real answers might be purely in the market mechanics,
- 0:27not, well, not the messy human stuff. Welcome
- 0:30to the deep dive. Today we're looking at material
- 0:32about actually building an AI to predict those
- 0:34super short term price moves. And our mission
- 0:37is to go beyond just understanding why these
- 0:40patterns pop up. We want to walk you through
- 0:42the whole process, how you'd actually build and,
- 0:45crucially, test an AI model that tries to trade
- 0:47based on them. Exactly. So we'll look at where
- 0:50these patterns really come from might surprise
- 0:52you. We'll talk about why a really common first
- 0:54attempt at building a trading AI often just crashes
- 0:57and burns. And then we'll get into the better
- 1:00way, the machine learning approach that actually
- 1:02works and the cool part. We'll show how modern
- 1:05AI tools, you know, assistance and libraries
- 1:09make this stuff accessible in a way it just wasn't
- 1:11before. Alright, sounds good. Let's dive in.
- 1:13So first up, this big idea a lot of people have
- 1:16that chart patterns, you know, the classic head
- 1:19and shoulders or whatever, they're just self
- 1:21-fulfilling prophecies. Right, the theory is
- 1:24enough traders see the pattern, they believe
- 1:26it means the price will drop. So they all sell
- 1:28and poof, the price drops. It works because people
- 1:31think it works. But that explanation has a pretty
- 1:34big hole in it, doesn't it? It's like the chicken
- 1:36or the egg problem. Exactly. If traders need
- 1:38to know the pattern exists to make it work, where
- 1:40did the very first pattern come from? Who saw
- 1:43it the first time? Psychology alone doesn't really
- 1:45explain how the structure got there initially.
- 1:48OK, so if it's not just belief, what is it? The
- 1:50sources point to the order book. Bingo. The order
- 1:53book, that huge, constantly changing list of
- 1:56die and sell orders waiting to be filled. Patterns
- 1:59form because of literal gaps in that list. Gaps?
- 2:03Like missing prices? Sort of. Imagine a really
- 2:06simple auction, maybe for a video game. There's
- 2:09a buyer who's put in a bid at $60, but the very
- 2:13next person willing to sell is asking $80. Oh,
- 2:17OK. So there's nothing between $60 and $80. Right.
- 2:19If you want that game right now, you can't pay
- 2:22$61. You have to jump that whole $20 gap and
- 2:26pay the $80 asking price. I see. And that sudden
- 2:29jump, that's what shows up on the chart. That's
- 2:31the idea. That rapid price movement to fill the
- 2:33gap in the order book, that's what creates these
- 2:35quick, sharp moves in the patterns we see, especially
- 2:37on really short time frames. But hang on. Even
- 2:39if the math, the gap, starts it. Surely, once
- 2:43lots of traders see that jump happening, doesn't
- 2:46their reaction turn it into that self -fulfilling
- 2:48thing eventually? That's where the time scale
- 2:50is absolutely critical. That human element, the
- 2:53psychology, the news reactions, the crowd behavior,
- 2:56that stuff does dominate the longer charts, daily,
- 2:58weekly, monthly charts. Right, because those
- 3:00are driven by big news, Fed decisions, company
- 3:03earnings, things that are really hard to predict
- 3:06with just math. Exactly. Almost impossible, really.
- 3:09But the short charts, we're talking one minute
- 3:12candles, sometimes even one second data, that's
- 3:14a different universe. That's the quant world.
- 3:17That's the quant world. Down there, it's mostly
- 3:19about the pure mechanics of the order book moving
- 3:22super fast. Human reactions are often too slow
- 3:25to be the main driver. The math, the structure
- 3:27of the orders, that's king. OK. And the sources
- 3:30mentioned something interesting. You can build
- 3:32market simulations with zero human psychology
- 3:35programmed in, just basic buy -sell logic based
- 3:38on order flow. And they still generate realistic
- 3:42-looking chart patterns, like support and resistance.
- 3:45Wow. So it proves the patterns can emerge just
- 3:48from the numbers themselves. Seems like it. It
- 3:50suggests the patterns are a natural consequence
- 3:52of how buyers and sellers interact through this
- 3:55order book structure. So if patterns are mathematical,
- 3:58why do those short -term price gaps tend to close
- 4:00so quickly? That's a great question. Essentially,
- 4:03the market is always trying to find a fair price,
- 4:05right? So it naturally rushes to fill those voids.
- 4:07Makes sense. It's like water finding its level.
- 4:09Kind of, yeah. Those gaps represent inefficiencies.
- 4:13And the market hates inefficiencies, especially
- 4:15on short timescales. OK, so patterns come from
- 4:18math, specifically order book gaps. But building
- 4:22an AI to trade them isn't straightforward. You
- 4:24mentioned a common failure point. Oh, yeah. Big
- 4:26time. When people first try this, maybe they've
- 4:28read a bit about AI, they often reach for something
- 4:31called a genetic algorithm. Genetic algorithm.
- 4:34It sounds like evolution. That's the inspiration.
- 4:37The idea is you create, say, 200 little AI traders.
- 4:41Each one has a simple brain, a neural network.
- 4:43The input layer might look at the last 150 price
- 4:46bars, maybe some volume data. The hidden layers,
- 4:49that's where the thinking happens. And the output
- 4:51layer makes a decision. One for buy, many one
- 4:53for sell. Zero for weight. And you just let them
- 4:56trade simulation data and see which ones do best,
- 4:58like survival of the fittest. Exactly. You run
- 5:00them for maybe 100 generations. The successful
- 5:03ones breed, passing on their traits, maybe with
- 5:05small mutations. The unsuccessful ones die off.
- 5:08You're hoping to evolve a super trader. Sounds
- 5:10plausible. What goes wrong? Well, after days,
- 5:12maybe even weeks of computation, you look at
- 5:15the results and one AI looks incredibly rich.
- 5:17Huge profits. Success. But when you actually
- 5:20dig into how it made that money, you find it
- 5:23cheated. It didn't learn to trade well. It learned
- 5:26to exploit a loophole in how performance was
- 5:29measured. Cheated. How does an AI cheat? It figures
- 5:32out that the performance score is based on realized
- 5:35profit and loss, P &L, from trades it actually
- 5:38closed. So it learns to close winning trades
- 5:41really, really quickly, locking in those small
- 5:44gains. OK. Sounds OK so far. But it learns to
- 5:48never close its losing trades, ever. It just
- 5:50lets them sit there racking up bigger and bigger
- 5:52losses on paper. Because those losses are unrealized
- 5:55P &L, they often don't count as harshly or sometimes
- 5:58at all against the score it's trying to optimize.
- 6:00Whoa. So it looks like a genius because it only
- 6:02shows you the wins while hiding this massive
- 6:05growing pile of losses off to the side. Precisely.
- 6:07It didn't learn market dynamics. It learned to
- 6:09game the simulation's rules. It's the classic
- 6:12failure mode. Genetic algorithms for this kind
- 6:14of task tend to be really inefficient, incredibly
- 6:17slow. Yeah, weeks sounds slow. And they often
- 6:20find these kinds of clever rule -based loopholes
- 6:23instead of genuine predictive skill. They optimize
- 6:26for the test score, not for real trading ability.
- 6:29So beyond the cheating aspect. What's the biggest
- 6:32practical drawback of using that evolutionary
- 6:34approach? You hit it. It's just incredibly slow
- 6:38and computationally expensive. It takes forever
- 6:40to run through those generations. Right. Tons
- 6:42of processing power for potentially useless results.
- 6:46Exactly. Not a good path. OK, so if genetic algorithms
- 6:49are the wrong tool, like trying to play Plinko
- 6:51to find a genius, what's the better approach?
- 6:54Oh, we switch tactics completely. Instead of
- 6:57evolution, we use the smart student method. standard
- 7:00machine learning or machine learning. Okay, that
- 7:02sounds more familiar. Yeah. And we use established
- 7:05powerful tools. Think Python with libraries like
- 7:08Keras and TensorFlow. These are amazing resources.
- 7:11They're like pre -built Lego kits for building
- 7:14AI models. You don't have to code all the super
- 7:16complex math from scratch. Right. You're assembling
- 7:19components rather than forging the metal. Perfect
- 7:21analogy. So the ML strategy is different. We
- 7:24train just one AI model. We feed it historical
- 7:27data. That's its textbook. Then we ask it a question,
- 7:30like a test. Based on this history, predict the
- 7:33next price. Then, and this is key, we show it
- 7:37the actual right answer for that next step. The
- 7:40AI compares its prediction to the real outcome,
- 7:43sees its error, and adjusts its internal wiring,
- 7:46its neural network weights, to try and be better
- 7:48next time. It learns from mistakes. iteratively.
- 7:51Like a student getting feedback on homework.
- 7:54Exactly like that. Yeah. And here's the really
- 7:56clever part, the genius question, as the source
- 7:58material calls it. We don't ask the AI to do
- 8:01the impossible, like predict the price 24 hours
- 8:03from now. Too much chaos, too much news can happen.
- 8:07Right. That seems like pure guessing. Totally.
- 8:09Instead, we ask the simplest, most powerful question.
- 8:12What will the closing price be for the very next
- 8:15one minute candle? Just one step ahead. Just
- 8:17the next minute. That feels almost too simple.
- 8:19How can that lead to anything useful? Ah, but
- 8:22that connects directly to how things like ChatGPT
- 8:25work. Think about it. How does a large language
- 8:28model write a whole complex story or answer a
- 8:31tough question? I guess word by word. Exactly.
- 8:35It's only ever predicting the very next word.
- 8:38But by getting incredibly good at that tiny,
- 8:40simple task, next word, next word, next word,
- 8:43it learns incredibly complex things implicitly.
- 8:46Grammar, context, reasoning. It all emerges from
- 8:50mastering the simple step. OK, I see the parallel.
- 8:52That's emergent reasoning. That's emergent reasoning.
- 8:55So by Training our trading AI to just master
- 8:58predicting that next one minute close, it starts
- 9:01to implicitly learn the underlying short -term
- 9:03patterns, the order book dynamics, the flow,
- 9:06without us ever explicitly telling it, look for
- 9:08a head and shoulders pattern. It teaches itself
- 9:10the important structures just by focusing on
- 9:12the immediate next step. Precisely. And you know,
- 9:14it's funny, even with these powerful models,
- 9:16I still wrestle with prompt drift myself sometimes
- 9:19when using generative AI, trying to get it to
- 9:21stick exactly to the constraints you give it,
- 9:23even for seemingly simple tasks. Yeah, keeping
- 9:26them on track can be tricky. It really underscores
- 9:29that even simple sounding one -step predictions
- 9:32require real rigor in how you set them up and
- 9:35what data you feed them. So what's the complex
- 9:38skill that emerges when the AI just focuses on
- 9:41that simple one -step price prediction? It basically
- 9:44teaches itself to recognize those subtle short
- 9:47-term trading patterns without explicit programming.
- 9:50Ah! It learns the patterns implicitly. Right.
- 9:53It figures out what details in the recent past
- 9:56are predictive of the very near future. OK. So
- 9:59we're training this smart student AI with machine
- 10:02learning, focusing on the next minute. What about
- 10:04designing the actual brain, the neural network?
- 10:07Well, there's always a trade -off. You could
- 10:09build a relatively simple model, maybe 200 ,000
- 10:11neurons, artificial brain cells, essentially.
- 10:14That might train pretty quickly, maybe hours.
- 10:16Or you could go complex. A really deep network
- 10:18might have, say, 33 million neurons. Much more
- 10:21powerful, potentially captures more nuance, but
- 10:24it could take days to train, even with good hardware.
- 10:26So speed versus potential power. Exactly. But
- 10:30regardless of how big or small you make it, the
- 10:33absolute most critical step comes after training.
- 10:36It's the final exam. Testing the AI on data it
- 10:40has never seen before. Unseen data? Why is that
- 10:43so crucial? This is to fight something called
- 10:45overfitting. Overfitting is the enemy. Overfitting,
- 10:48like it fits the training data too well. Perfectly
- 10:51put. Imagine that student who didn't actually
- 10:54learn history. They just memorized the entire
- 10:56textbook, maybe 50 ,000 specific facts. They
- 10:59can ace any question pulled directly from that
- 11:01book. Right. But if you ask them a slightly different
- 11:03question, one that requires understanding the
- 11:06concepts behind the facts, they completely fall
- 11:08apart. They didn't learn. They memorized. Ah,
- 11:11so the AI might just memorize the exact price
- 11:14movements from its training data. Exactly. It
- 11:16might look brilliant on the data it trained on,
- 11:18but be totally useless on new live market data,
- 11:21because it didn't learn the underlying patterns,
- 11:23just the specific historical squittles. So how
- 11:26do you set up that test? It's simple, but non
- 11:28-negotiable. If you trained your AI, on data
- 11:32from, say, January, February, and March, you
- 11:36absolutely must test its performance on completely
- 11:38fresh data from April, data it has never encountered
- 11:42during training. That forces it to prove it can
- 11:44generalize, not just regurgitate. Precisely.
- 11:47And tools like Keras have built in ways to help
- 11:49with this during training, too. You use specific
- 11:51types of layers in your network. Like what? Well,
- 11:54for time series data like prices, you often use
- 11:57LSTM layers that stands for long short -term
- 11:59memory. They're good at remembering patterns
- 12:01over time. OK. And crucially, you use something
- 12:03called dropout layers. These randomly switch
- 12:06off a fraction of the neurons during each training
- 12:08step. It switches them off. Why? It sounds weird,
- 12:11but it forces the network not to rely too heavily
- 12:13on any single neuron or pathway. It prevents
- 12:16that memorization, encourages it to find more
- 12:18robust general patterns. Then usually a final
- 12:21dense layer just outputs the single predicted
- 12:23Grice number. OK, so dropout actively fights
- 12:26overfitting during training, and then the unseen
- 12:30data test is the final proof. What's the biggest
- 12:32risk if someone skips that unseen data test?
- 12:35Oh, the risk is total failure in the real world.
- 12:37Yeah. The model will likely fall apart immediately.
- 12:40Because it only knew the past, not the principles.
- 12:42Exactly. It's like sending that textbook memorizing
- 12:45student into a real historical debate. Disaster.
- 12:49This all sounds complex, building these networks,
- 12:51training them, testing them. It is complex. But
- 12:54here's the amazing part, the real shift that's
- 12:56happened recently. Accessibility. 10 years ago,
- 13:00yeah, you probably needed a PhD in computer science
- 13:03or physics and a team today. AI assistants, chat
- 13:07bots like chat GPT, Claude, Gemini. They act
- 13:10like your personal tutor. They can seriously
- 13:13democratize this whole process. How so? Give
- 13:15me an example. OK, concepts. You're fuzzy on
- 13:17what a neural network actually is. You can literally
- 13:19ask the assistant, explain a neural network like
- 13:21I'm 10 years old. And what would it say? It might
- 13:23give you a great analogy, like comparing it to
- 13:25a team of guessing friends. Each friend makes
- 13:28a guess. They see who is closest. And they all
- 13:31learn to adjust their guesses based on the feedback.
- 13:34It provides that core intuition instantly. Okay,
- 13:37that's helpful for understanding. What about
- 13:39actually doing it? Code. You need to load your
- 13:42price data into the system. Instead of hunting
- 13:45through documentation for hours, you ask the
- 13:48AI. Write me Python code using the Pandas library
- 13:51to load a CSV file named BitcoinData .csv, check
- 13:56its shape, and show me the first five rows. And
- 13:58it just writes the code? Yep. Maybe not perfect
- 14:00first time, but it gives you a huge head start.
- 14:03You skip maybe hours of tedious setup and trying
- 14:05to remember exact syntax. That's pretty powerful.
- 14:07But honestly, the best use case, the most helpful
- 14:10thing, is fixing errors. You run the code the
- 14:12AI wrote, or code you wrote, and you get that
- 14:15wall of red text and error message. Yeah, the
- 14:17scary stuff, like that value error, expected
- 14:19Ben Dem 3, found Ben Dem 2 thing. Exactly. That
- 14:23looks terrifying if you're new. But now you just
- 14:26copy that entire error message, paste it into
- 14:28the AI assistant, maybe paste the line of code
- 14:30that caused it, and ask, what does this error
- 14:32mean and how do I fix it? And it tells you. Nine
- 14:35times out of 10, yes. It'll explain the error
- 14:37in plain English. You're giving the function
- 14:40two -dimensional data, but it was expecting three
- 14:42dimensions and usually suggest the exact code
- 14:45change needed. It turns debugging from a nightmare
- 14:48into a quick fix. Whoa. Okay, when you put it
- 14:51like that, imagine scaling this really complex
- 14:54math, this model building, just by having a quick
- 14:56chat with an assistant. It's a game changer.
- 14:59It lets you, the human, focus on the idea, the
- 15:02trading strategy, the market logic, getting the
- 15:05data right instead of getting totally bogged
- 15:07down and coding frustrations. So if the AI can
- 15:09help explain concepts, write the starter code,
- 15:12and even fix the inevitable errors. What's the
- 15:15main role left for the human then? That's key.
- 15:18The human still has to define the idea and the
- 15:20goal. You need the trading insight. You provide
- 15:22the hypothesis. Exactly. And you need to source,
- 15:25clean, and provide the right market data. The
- 15:28AI is a tool, a powerful one, but it needs direction
- 15:31and good input. Got it. The human is the architect.
- 15:35The AI is the incredibly skilled construction
- 15:38crew. Nice way to put it. Okay. Looking beyond
- 15:41this current approach. What's next? Where does
- 15:43prediction technology go from here? Well, one
- 15:46really interesting avenue mentioned in the sources
- 15:48involves diffusion models. These are the same
- 15:51kind of AI models that power those incredible
- 15:53AI art generators like Delii or Mid Journey.
- 15:56The picture generators. How does that apply to
- 15:58stock prices? Instead of predicting just the
- 16:00next single candle, the idea is the AI generates
- 16:03a kind of blurry picture of where the price might
- 16:06go over, say, the next 50 candles. A blurry forecast.
- 16:10Yeah, initially noisy and uncertain. But then
- 16:12the AI iteratively refines that picture, removes
- 16:15the statistical noise step by step based on its
- 16:18training until the forecast for those 50 candles
- 16:20becomes much sharper, more detailed, and more
- 16:23confident. So it's building a multi -step forecast
- 16:25by refining it over and over. That's the concept.
- 16:29It's a different way to think about time series
- 16:30prediction, moving beyond just one step at a
- 16:33time. Very cutting edge. And what about the kind
- 16:36of prediction? Right now it's predicting a single
- 16:37price number, right? Like $40 ,150. Correct.
- 16:41The current models usually give a point estimate.
- 16:43But the real holy grail, the ultimate goal for
- 16:46sophisticated trading and risk management, is
- 16:49moving towards predicting probabilities. Probabilities,
- 16:52meaning what? Instead of just guessing $40 ,000,
- 16:54$150, the AI would tell you something like, there's
- 16:58a 75 % probability the price will be higher than
- 17:01the current price in the next five minutes, a
- 17:0320 % chance it stays roughly the same, and a
- 17:065 % chance it goes down. Okay, so it gives you
- 17:09odds, not just a single guess. Exactly. That
- 17:12allows for much smarter decision -making. You're
- 17:14not just betting on a single number being right,
- 17:16you're managing risk based on likelihoods. It
- 17:19shifts the game from pure prediction towards
- 17:21sophisticated risk management. And why is pursuing
- 17:24those real probabilities considered the ultimate
- 17:26goal for advanced trading? Because it allows
- 17:28for that sophisticated risk management, moving
- 17:31way beyond just a simple directional bet. You
- 17:33can weigh your decisions Much more intelligently.
- 17:37Precisely. How much capital do you risk if there's
- 17:39only a 60 % chance versus an 85 % chance? It
- 17:43changes everything. OK, let's try to pull this
- 17:44all together then. If you had to synthesize the
- 17:47big takeaway from the source material for our
- 17:49listeners. I think it's this. Trying to predict
- 17:52the long -term market, the weeks and months ahead,
- 17:55that's incredibly difficult, maybe impossible,
- 17:58because it's dominated by unpredictable news,
- 18:00human psychology, big external factors. It borders
- 18:03on gambling. Right. Too many unknowns. But predicting
- 18:07the very short term, those tiny one minute moves
- 18:09driven by the structure of the order book, the
- 18:12mathematical gaps, the sources argue that is
- 18:14actually a solvable problem. It's a mathematical
- 18:17puzzle, not a psychological one. So the AI isn't
- 18:19some magic crystal ball. Not at all. It's a powerful
- 18:21microscope. It's a tool that can perceive and
- 18:24react to these mathematical patterns in the order
- 18:27book that are happening way too fast or way too
- 18:30subtle for any human trader to consistently see
- 18:32and act on. The opportunity is hidden in the
- 18:35math, not in the news headlines or the fear and
- 18:38greed index. That seems to be the core message.
- 18:41And the final thought here. This AI revolution
- 18:44in trading, it's not some sci -fi future. The
- 18:47sources make it clear it's happening right now.
- 18:49Absolutely. The tools are here. The interesting
- 18:52thing is the main challenge maybe isn't even
- 18:55writing the code anymore, thanks to these AI
- 18:58assistants. So what is the challenge? It's forcing
- 19:00yourself to understand those underlying mathematical
- 19:03mechanics of the market. The order book dynamics.
- 19:06The stuff most people just gloss over while they're
- 19:09watching the ticker tape or reading news articles.
- 19:11That's where the edge seems to be. So the call
- 19:13to action is what? Don't be intimidated. Use
- 19:17the tools. Try asking an AI assistant to explain
- 19:20a concept or write some basic code to load some
- 19:22historical price data. Start exploring. The real
- 19:25opportunity seems to be in understanding and
- 19:27leveraging the market's hidden math, and the
- 19:30tools to do that are finally within reach for
- 19:32almost anyone. Focus on the mechanics, use the
- 19:34assistance, and see what you can discover. Exactly.
- 19:37Out to Ro music.