Introduction
In a world where technology shape-shifts like a chameleon, the stock market has seen a surge in automated trading strategies powered by artificial intelligence. I’ve always been a buy-and-hold investor, but witnessing the rapid success of many traders relying on technical analysis nudged me toward exploration. With $11,000 at stake, I set out to create a stock trading bot utilizing generative AI to identify patterns in stock charts, hoping to decipher if this high-tech approach could outperform traditional investment strategies.
In this article, I share my journey of developing a stock trading bot, the challenges I faced, and the surprising outcomes.
The Concept Behind My Trading Bot
The Shift from Traditional to AI Trading
Typically, my investment strategy revolved around choosing stocks and following their performance over time. This approach is meticulous but can feel slow-paced, especially when everyone seems to be making quick gains through day trading and technical analysis. Therefore, I decided it was time for me to adopt a new method—developing a stock trading bot capable of understanding the patterns in stock charts.
Why Generative AI?
I chose to leverage Google’s latest generative AI model, Gemini Pro Vision. Unlike simpler models, Gemini possesses the ability to analyze diverse data formats, including images. This aspect made it perfect for reading stock charts, where fluctuations in price can often look like cryptic artworks filled with potential insights. My goal was to enable Gemini to determine buy/sell signals purely based on these patterns.
Setting Up the Trading Bot
Step 1: Understanding Stock Chart Patterns
To make the bot effective, I had to begin by researching the various stock chart patterns. Through hours of research, I settled on focusing on six recognizable patterns that could yield insights regarding price trends—both bullish and bearish. Common patterns include the bullish flag, which indicates a continuation of an upward trend, and a bearish wedge, which typically signals declining prices.
Step 2: Teaching AI to Recognize Patterns
This process involved using Google’s Maker Suite to train my bot. Initially, I encountered some challenges, as the AI misinterpreted the charts’ information due to coding missteps. However, after several iterations, I implemented techniques like few-shot prompting and classification to ensure the AI could accurately recognize and evaluate stock chart patterns.
Step 3: Running the Tests
With my bot set up, I needed to test it against my traditional investment portfolio. I strategically picked a diverse set of stocks to compare outcomes over a week. Each investment from both methods was started with an initial consideration of performance over time, fundamentals, and chart patterns.
Monitoring the Performance
Initial Days of Trading
On day one, I began by executing trades based on the bot's recommendations. To my surprise, my personal portfolio came out on top, with a reported gain of nearly $30, while the bot only netted $3. The early underperformance of the bot had me feeling a sense of vindication in my traditional approach.
Bot’s Progress Over the Week
As the days progressed, the bot seemed to gain traction and refine its strategy. On day four, it managed to catch up to my portfolio's performance, suggesting that it was beginning to understand the market dynamics. This constant evolution of strategy led up to day five, where the bot made some impressive trades and recommendations—earlier missteps appeared to have been corrected.
Final Outcomes
Calculating the Profitability
At the end of the week, the bot accumulated profits amounting to $62.65, while my portfolio also saw an increase—but the gains were steadier and more predictable. It was clear that while the bot had learned, I preferred the peace of mind my traditional method provided, devoid of daily trading pressures.
Takeaway
Ultimately, the experiment was a great way to bridge the gap between traditional investing and modern technological enhancements such as AI. While the stock trading bot performed well, a significant takeaway is having emotional stability and a well-researched portfolio averted several potentially stressful scenarios.
Conclusion
In conclusion, my endeavor into the realm of automated trading led to an enlightening comparison between generative AI strategies and traditional investment approaches. Though the stock trading bot executed a notable performance, the comfort of long-term investments and sound company fundamentals still holds valuable lessons for new investors.
I’ll continue refining my trading bot to improve its accuracy and effectiveness, and I remain hopeful that future iterations will surpass my conventional portfolio's returns. If you enjoyed this article, leave a comment, and let me know if you’d like a sequel detailing further advancements!
made I've always been a long-term Buy and Hold investor but it seems like everyone nowadays is making big money
off of technical analysis and automated trading and I figured I know how to code so I should at least give this style of
investing a chance so I'm going to try to use generative AI to beat the market and no I'm not just going to use chat
GPT and ask it to invest I'll be building an algorithm that trades based on patterns in the stock chart and I'll
recognize these patterns PS using the latest Tools in generative AI yeah AI can read stock charts now sorry Jim
Kramer at least that's my plan but I've never seen anybody do this before so I don't even know if it's
Poss if I'm going to have any hope I need to use the most advanced AI model available today Google's Gemini Pro
Vision model so you haven't heard of Gemini well allow me to explain Gemini is the latest of Google's generative AI
tools these are tools like chat G BT that can understand language but not just spoken language they can understand
music they can understand code the latest models can even watch a video and tell you what it's about I know and as
with any new technology there's been a ton of hype around what these new models should be used for right now the answer
seems to be everything just give me some generative AI with a side of buzzword please but since newer is always better
right I plan to use Gemini's ability to recognize images to have it read stock charts and tell me if I should invest in
the stock or not and then I'll put $1,000 into whatever stocks it tells me to this is a dumb
idea my first job is to see if an AI can even understand a stock chart so to figure this out we're going to go to
Google's maker Suite so let's start out by just seeing if we can recognize an image what does this image show and
let's run it this image shows a buganvilia plantan vilia I'm going going to assume that that's correct because
I'm not really totally up on my boty okay let's go a little bit harder let's try to give it an actual ual picture of
a stock chart I just grabbed a screenshot of Apple's stock price we're going to run this through okay we got
something so it knows this image shows the stock price of Apple but it went a little farther it says the stock price
2023 so it's not only telling that this is a stock chart but it's grabbing the 125 from my little hover here and it's
getting the current price as well as the date that's pretty crazy let's try something even one step
farther so I found this stock chart that has these grid lines on it it shows the name of the company and it shows the
price on the right hand side so I'm going to run this and the AI needs to identify what company this is if the
stock price is going up or down and I'm going to throw in one tricky question when did the stock price see the most
rapid drop which is kind of a vague question I I want to see how it answers so it says the chart is for snow stock
the minimum stock price shown is 186 yeah pretty close and the biggest drop in the stock price is
$3.75 huh so I thought that this was going to be a lot harder and I was going to make a joke about how the AI would
need a lot of work but it seems to have just gotten it off the bat like what the heck that was like way too easy to do
way to get stock chart images than just screenshotting them from Google after a few hours testing out different sites I
ended up finding a site that had an unsecured URL with parameters I could just adjust in my code so I took that I
loaded up my Robin Hood account with $1,000 for the AI to invest I then had to start setting up the wireframe and
importing all the packages that I would be using in my actual code and with an AI that can read stock charts and all
the stock charts I could want in my fingertips I was ready to go and start making infinite money but wait wait wait
wait wait what am I doing with all these charts there's a whole world of day traders that just trade using the number
so why don't I just do that well firstly because it's more fun and secondly I don't plan to read any numbers off the
charts I just plan to look at patterns in the image to see if the stock is going to go up and based on my internet
research I should be able to make thousands without knowing any advanced mathematics like entry-level calculus by
so by so but after researching for the better part of two days watching everyday trading and pattern trading
videos I could find I realized there might be a flaw in my plan even if this algorithm makes money it doesn't
necessarily mean anything cuz anyone who invests long enough in the market will make money so we need to raise the
competition so while my bot is trading this week I'm going to be comparing its performance to my handpicked portfolio
of stocks that I assembled using fundamental analysis you know the long boring process of figuring out what a
company actually does and if they'll be worth more in the future than they are today let's see who wins the tried and
truee investing method of people like War Buffett or the most powerful AI ever known to man but first I need to
actually build the bot wait I thought this was supposed to be easy so coding a stock trading bot takes a lot of you
know code and since showing code is like YouTube Kryptonite I put together a whiteboard presentation to explain in
three easy steps exactly how I'm going to do this and I also got a bigger whiteboard so I don't have to keep on
crouching down step one I need to pick stock chart patterns that the AI can recognize that will reliably make me
money picking which stock patterns I would use only took took me around half a day because I was watching this over
an hour long video and reading all these different articles and I ended up finding this gu chart on LinkedIn that
basically simplified down to 16 different stock chart patterns that I could look for so I found the patterns
that I want to use now I just need to teach the AI to recognize these patterns reliably and to make it simple I'm just
going to focus on six of the patterns in this chart that look the most visually distinct from a distance cuz honestly
when it comes to training an AI it's like trying trying to train a half blind 3-year-old hey how should I teach the AI
to learn stocks but why do you want to make an AI well I want to trade stocks but why do you want to trade stocks to
get Hood Rich like all the big Traders I see online but why do you want to be rich I don't know maybe it's a
deep-seated insecurity for my childhood and I feel like I need to make more to try to live up to expectations that were
set when I was younger that I'm never going to be able to reach but why step two I need to teach the AI to recognize
the patterns and then make stock trades based on them basically this is just the process of building the bot and getting
it to do everything that I want it to do luckily I had no issues getting this to work this doesn't make any sense 280 how
do you know there's a bumblebee in the photo there's a whole different API that does the exact same thing okay so it
wasn't so easy it took around a week now I already had the AI able to read a stock chart but now I needed to get it
to recognize these patterns I set up a Jupiter notebook just to test this out success I can talk to the AI now I just
need to get it to recognize a stock stock chart okay the model's behaving really weirdly right now basically I'm
giving it the exact same image in Google maker Suite as I am in my code and yet the code is giving totally different
answers like here for example it says the stock price is decreasing from the start of the chart to the end but it's
clearly going up but it also gets some things right like it says the stock chart starts at 9:30 but the answers I'm
getting don't match up at all with what the stock chart looks like I don't really know what's going on so I'm
with my code the issue is the model isn't actually getting the image it's just trying to understand what the image
would show from the URL which is why it's giving me such random results basically I was trying to give an image
to the AI and I thought I could just give it a link to the image but it turned out the AI was trying to read the
text in the link and guess the answer to my question instead of actually looking at the image so now I just need to teach
the AI to actually recognize the patterns and I'm going to do this with two techniques few shot prompting and
classification and I'm not going to bore you with the specifics on how I do that but the point is I need to find examples
of these six patterns that I can show to the AI so that it knows what to look for so I could show this whole process or I
could just use the power of editing to skip to when it's done it's been 3 days I feel like I lost some of my soul
somewhere in the code I don't know why I thought this would just work but took me hours just to find examples of each
stock chart pattern and then I ran into issues storing that many images then more issues with the prompt being too
long for the model to process ultimately I managed to get all the examples in place and run it against a real stock
chart so I think I have everything set up successfully so now I'm just going to run it and see if it's able to recognize
this pattern and yes I am recording this on vacation because this thing takes forever to get to work let's
working but it keeps saying there's a bullish flag even sometimes when there isn't one so there's still clearly
something I need to change nothing a few hours of research and some Chain of Thought prompting couldn't fix I'm
telling you AI is a three-year-old you literally say think through this step by step first you have a stock chart then
buckets of patterns continuations and reversals a continuation just means the stock price will keep going in the
direction that it was before and a reversal means it will flip so a bullish continuation means the stock price is
going up and we expect it to keep on going up meanwhile a bullish reversal means the stock price was going down we
expect it to flip and start going up and each of the six patterns I showed before fall into one of these two buckets so
now I just need to put those parts together and I should be able to tell if a stock price will go up or down just by
looking looking at it price while all this was happening I was hard at work building my handpicked stock portfolio
I've already researched all the stocks so I didn't really have to do anything I only make like one or two trades a month
which you can see on fintech Circle this is my private stock group that's basically like patreon but actually
valuable and even though I don't make a lot of Trades when I do I always post them on their first so I got back to
work on the box after fixing a few last bugs my script started working and since my handpick stock portfolio was set I
was ready for step three profit or to to be more accurate we'll let the algorithm run for one week and compare how much
money it makes versus $11,000 invested in my handpicked stock portfolio so here are the ground rules I decided to let
the AI pick between 10 different stocks to make sure it didn't just pick anything and I'm going to let it run for
one week and see how much money it makes compared to the 10 stocks I can pick that I think will do the best over the
next week let's see who wins all the power of Google and the latest technological advances in AI or one guy
going to get my first set of stock recommendations from my stockbot I've got the Robin Hood app open and let's
see what stocks it recommends for me to buy today so first let me run this for Tesla it says this is a bullish flag and
since a bullish flag is a continuation pattern that means the AI thinks the stock price is going to continue to go
up so let's go ahead and buy some Tesla I'm also running this around midday on Monday and let's see what it predicts
for the rest of the day let's do the next one here's nvidia's stock price bullish flag also recommends Nvidia
here's an interesting one this Stock's actually going down bearish wedge is a continuation pattern so it thinks Apple
will keep going down today let's try Microsoft says it's a bullish flag okay so Microsoft a yes let's try Meta Meta
is a bullish flag let's try Exxon Mobile Exon Mobile is a bullish flag despite being down for the day okay okay let's
do Walmart bearish bullish bearish wedge double top which means we do not want to invest in Disney at this time so
my $1,000 350 of that is now actively trading so now the most advanced AI in the world has access over $350 worth of
my portfolio that money's in the market let's check back in tonight now it's time to compare how my
stockbot has done against my portfolio in day one the end of day one finished strong for team human my handpick stock
portfolio was up 2.96% or just under $30 while the bot was up $3 seems like an early win well I
was getting lucky one of my stocks increased 20% after reporting they were profitable for the first time so the bot
has a chance to catch up on day two my Robin Hood accounts up to $19 I didn't end up selling any of the
stocks overnight like I know a lot of day Traders do cuz I only do what the bot tells me to do and it didn't tell me
to sell so let's check now what stocks I'm supposed to buy on day two on day two the bot changed up its strategy of
buying everything and got a little more creative it started out hot out of the gates deciding to sell GE right before
GE star price went up then the bot broke for a few hours so I lost around half the day debugging code but ultimately
the bot picked five out of the 10 stocks to buy sold four of the stocks and left forward as it was meanwhile I didn't
make any trades in my handpick stock portfolio since there wasn't any news on the companies here were the totals at
the end of day two day three I made my first trade in my handpicked stock portfolio buying shares in the Brazilian
fintech stock new bank meanwhile over the next few days the bot was starting to make some pretty confusing moves
buying a stock then selling it then buying more of it it looked random but somehow the bot was catching up day four
came and went and I was neck and neck with the bot going into the final day as long as nothing crazy happened it seemed
like the bot wouldn't be able to beat me by too much on day five I put in the bot's final trades and waited to see
what would happen so I originally started this challenge with the idea that I could make some fast money using
the bot and it kind of worked if we add up the earnings of the bot bought over the past 5 days it made
bot technically won but also while I've been editing this video over the past week I tried to keep investing using the
bot but it was always in the back of my mind did the stock price go up by $1 did it drop by 2% honestly I'd rather have
the Peace of Mind of not having to trade every day than to keep on making a few dollars using the stock trading bot I
wonder how much money I spent running the bot anyway let's see how much money I paid to Google Gemini just to run this
AI well if you like this video maybe you'll like this next one and let me know in the comments if you want to see
Heads up!
This summary and transcript were automatically generated using AI with the Free YouTube Transcript Summary Tool by LunaNotes.
Generate a summary for freeRelated Summaries
![The Revolutionary Impact of Claude AI: A Game-Changer for Software Engineering](https://img.youtube.com/vi/DVRg0daTads/default.jpg)
The Revolutionary Impact of Claude AI: A Game-Changer for Software Engineering
Explore how Claude AI surpasses GPT-4 and revolutionary features that redefine productivity.
![The Future of Business: Leveraging Autonomous AI Agents](https://img.youtube.com/vi/8N2_iXC16uo/default.jpg)
The Future of Business: Leveraging Autonomous AI Agents
Discover how autonomous AI agents can transform the way businesses operate and increase efficiency.
![Deep Seek R1: The Game Changer in AI Technology](https://img.youtube.com/vi/o1sN1lB76EA/default.jpg)
Deep Seek R1: The Game Changer in AI Technology
Discover how Deep Seek R1 outshines OpenAI with unprecedented efficiency and performance on minimal resources.
![Unlocking Profits: Making $220,000 with AI-Generated TikTok Videos](https://img.youtube.com/vi/VOxTHGyQzbA/default.jpg)
Unlocking Profits: Making $220,000 with AI-Generated TikTok Videos
Discover how to leverage AI for TikTok to earn money efficiently with this comprehensive guide.
![Unlocking the Secrets of Photo Realistic AI Images and Digital Entrepreneurship](https://img.youtube.com/vi/oFtjKbXKqbg/default.jpg)
Unlocking the Secrets of Photo Realistic AI Images and Digital Entrepreneurship
Explore Peter Levels' journey in building startups, creating AI solutions, and mastering digital nomad life.
Most Viewed Summaries
![Pamamaraan ng Pagtamo ng Kasarinlan sa Timog Silangang Asya: Isang Pagsusuri](https://img.youtube.com/vi/rPneP-KQVAI/default.jpg)
Pamamaraan ng Pagtamo ng Kasarinlan sa Timog Silangang Asya: Isang Pagsusuri
Alamin ang mga pamamaraan ng mga bansa sa Timog Silangang Asya tungo sa kasarinlan at kung paano umusbong ang nasyonalismo sa rehiyon.
![A Comprehensive Guide to Using Stable Diffusion Forge UI](https://img.youtube.com/vi/q5MgWzZdq9s/default.jpg)
A Comprehensive Guide to Using Stable Diffusion Forge UI
Explore the Stable Diffusion Forge UI, customizable settings, models, and more to enhance your image generation experience.
![Kolonyalismo at Imperyalismo: Ang Kasaysayan ng Pagsakop sa Pilipinas](https://img.youtube.com/vi/nEsJ-IRwA1Y/default.jpg)
Kolonyalismo at Imperyalismo: Ang Kasaysayan ng Pagsakop sa Pilipinas
Tuklasin ang kasaysayan ng kolonyalismo at imperyalismo sa Pilipinas sa pamamagitan ni Ferdinand Magellan.
![Imperyalismong Kanluranin: Unang at Ikalawang Yugto ng Pananakop](https://img.youtube.com/vi/fJP_XisGkyw/default.jpg)
Imperyalismong Kanluranin: Unang at Ikalawang Yugto ng Pananakop
Tuklasin ang kasaysayan ng imperyalismong Kanluranin at mga yugto nito mula sa unang explorasyon hanggang sa mataas na imperyalismo.
![Pamaraan at Patakarang Kolonyal ng mga Espanyol sa Pilipinas](https://img.youtube.com/vi/QGxTAPfwYNg/default.jpg)
Pamaraan at Patakarang Kolonyal ng mga Espanyol sa Pilipinas
Tuklasin ang mga pamamaraan at patakarang kolonyal ng mga Espanyol sa Pilipinas at ang mga epekto nito sa mga Pilipino.