I Built an AI Trading System With Claude TradingView

MAKE YOU A TRADER
107 followers
AI Generated·May contain errors
Comments are disabled for this video.
I've been using Cloud Code, TradingView,
and various other AI tools to build a pre-market scanner,
strategy filters, and a Pinescript strategy on TradingView.
And I'll show you how to do so in this video.
AI is the talk of the town,
while you see a lot of AI enthusiasts on YouTube
integrating Cloud or Codex with their TradingView.
And those videos are great, don't get me wrong,
but they're not traders after all.
Remember, AI is mostly just slop
without specialized knowledge behind it.
Trading is the same.
You need real trading experience first,
then AI becomes a tool to sharpen your edge
instead of generating generic strategies.
The thing is, AI won't magically make you profitable.
So today I wanna show you my take as a full-time trader
with more than 10 years of experience,
how to automate your trade planning process
with Cloud Code and TradingView.
So here's what you'll learn in this video.
First, how to set up TradingView's connection to Cloud,
all the potential use cases
and how you can overcome the limitations.
Number two, how to create your own pre-market gap scanner
and news briefing.
Three, create your own strategy,
then back-testing your own strategy
on TradingView with Pinescript.
Number five, more AI trading automations,
sending alerts straight to your phone.
And finally, the bonus chapter of this video,
how to use TradingView's own AI that's still in beta.
Before we start, I just gotta say this.
I'm not a technical person.
I have no background in coding or tech,
but I am a trader and I'm leveraging AI tools
to automate and optimize my process today.
So if a non-technical person such as myself can do this,
then so can you.
Today's video is jam-packed.
If you're ready to follow along,
make sure to drop a like down below and subscribe
because I'm about to release a lot more videos
about using AI to level up your trading.
All right, let's start
with setting up TradingView connection to Cloud Code.
I'm not gonna spend forever here.
You can just read this ex-post over here,
which I'll link down below.
The author breaks down all the technical details
of how Cloud can now read a chart's source code.
So props to this guy for figuring out this MCP workaround.
I've made some modifications and simplified this process.
So you can easily copy and paste all the prompts
that I'm using for this video demo
and to set up my trading AI pipeline in the video.
The link is in the description.
So to start here, the two things you need to get right now.
Go to cloud.ai and install Cloud Code on your desktop.
And number two,
you need to install TradingView desktop version.
So you cannot use the web.
You have to use a desktop
like the one you're seeing right now.
This is running on my Mac.
So here's the caveat.
You need to do this TradingView
and Cloud connection on a Mac OS.
I first tried it on my PC computer right here
and it didn't work because of a desktop file
on the official website.
It's like a different Microsoft file
or something like that.
It doesn't matter.
I'm not technical, I just trade.
So if you run into that problem,
just ask your AI to solve it for you.
For the subscriptions, for Cloud or Codex,
which you can do the same thing here too,
you need at least the $20 per month paid plan
at least to get started.
For me personally, I'm using the max plan,
which you can see on screen over here.
I'm using the $100 a month plan
and that's enough for me or for all the things I'm doing.
As for TradingView,
you need a paid TradingView subscription
to do this connection, at least the essential plan.
The cheapest one, I think it's about $13 to $15 a month.
If you use my referral link down below,
I believe you get $15 credit.
So that's gonna help you get started.
Once you have these two subscriptions
and a desktop installed,
you're finally now ready to get started.
So just go to step number three on my blog
and copy this into Cloud Code.
Essentially that installs the MCP.
You're copying from this GitHub over here,
which is the one that you can see from this ex post.
You can verify, you can see a lot of people watching it
and using it, 2.9 thousand stars.
So this is legitimate.
And that's the one I personally downloaded as well.
So once you copy that, you just enter.
And during this process,
Cloud is gonna ask you a lot of different permissions.
So you can just read the different prompts and follow along.
And once it's done installing,
you're gonna have to restart Cloud.
Once you restart it,
go to a new session and copy this prompt
and run TV health check
and tell me if TradingView is connected.
So just run this prompt.
So you can see now that you've run the prompt
is showing that TradingView is connected.
By the way, your desktop obviously needs
to be open right now.
The link is live and API available.
The chart is now on NASDAQ AMD on the one day chart.
Let's check if that is correct.
Okay, so that's the daily charts on the NASDAQ.
Okay, great.
I'm gonna simplify this and go to the five minute chart
because that will be the chart that we'll be using.
Now that the connection is established,
you can try and test out some really basic prompts.
It can do almost anything as long as Cloud
can read all the different candlesticks on the daily chart
and essentially all the source code behind it.
Let me just do a quick demo right now.
Can you draw the levels for Intel?
Draw the recent higher days,
the pre-market highs and lows,
and the 52-week highs and lows,
as well as all time highs.
So you can see Cloud is switching timeframes live.
Okay, so you can see Cloud has just drawn
the 52-week highs and they actually have like
different styles and labeled it as well.
That's pretty cool.
Daily highs, daily lows, pre-market highs, pre-market lows.
Okay, now that you've tried the basic use cases,
let's move on to what actually matters for active trading.
The goal for me today here is very simple.
I wanna build a complete pre-market trade planning pipeline
from scanning for stocks to trade to building my strategy
and then back testing it.
Now remember, I did mention earlier
that TradingView and Cloud connection right now,
there is some limitations.
One is that TradingView cannot scan the entire market
for you all at once.
It's only able to scan and provide you data
on a basket of stocks that you selected
and told it to do specifically.
But no worries, there are some easy workarounds for this
and it's really fast too.
So what I decided to do,
which is way faster and simpler by the way,
is to create a preliminary pre-market scan
which will give me all the top gappers
and then put the results from that first scan,
I call it scanner A, into my strategy scanner
for my strategy to trade.
That would be scanner B.
So let's build that right now.
What I'm gonna build first is a simple pre-market scanner.
All right, let's start building the pre-market scanner now.
There are two or three prompts to use
and you can copy them from my blog post here on my website.
It's free, you don't even need to enter your email.
Let's start building the pre-market scanner now.
If I go to my blog post, so I can just copy it,
this one, copy, paste.
So you can see that I'm asking to build
a pre-market scanner every morning before the open,
build me something that does this.
So I'm scanning for all the criteria we just talked about.
Stocks that moved up more than,
so I'm scanning for the big movers
for my trend join long setup, by the way.
Stocks that gap up more than 5% from previous day,
price above $3 per share, and over 50K pre-market volume.
You can obviously adjust that to however fits you better,
but for me, that works.
And I'm actually gonna go to auto mode,
so it stops asking me for directions.
And then you can see that I tell it
the news catalyst source to use.
So for the tickers and the percentage
I'm fetching from Yahoo Finance,
and for the briefing, news catalyst briefing,
I'm sourcing them from, as you can tell, Benzinga.
And then I tell it the format I wanna see.
I wanna see ticker, price, gap percentage,
the one catalyst sentence.
So it's building that right now.
So this process should take you
about a minute or two minutes,
especially if it's your first time doing it,
but so give it some time.
Amazing, so you can see these are the results
that gave me for the gappers.
You can see the gappers pre-market.
Today's a Saturday, so this is obviously not from today.
This is probably from Friday.
Stocks over 5%, price above $3,
top 10 gappers in the news catalyst.
So you can see the tickers, SCDG, Figma,
EMPH, VG, Wing, Team, and you can see all the catalysts.
And you can see all the results each morning
is saved to a new JSON file with a date specified.
And don't worry, later I'm gonna show you
how to deploy and send that pre-market scanner results
to your phone every single morning.
Now let's move on to the strategy scanner filters.
Now that we have the pre-market scanner down,
let's dive into strategy building
and the scanner behind it.
I'll be demoing today with my favorite strategy,
which is the trend join long setup.
This is my favorite setup that I mentioned
in so many of my YouTube videos.
And by the way, every single weekend,
I curate a watch list of three to four trade ideas
based on my strategies.
You can get that for free
by signing up with the link down below.
I'm also developing a lot of AI tools
to help traders level up their day trading
and swing trading.
So make sure to stay tuned.
We're gonna build a strategy scanner filter
to read all the results that we've generated
from the pre-market scan.
The strategy filter essentially will tell you
which of these candidates are valid for entries and exits.
Now to build this trend join long strategy scanner,
you just need to copy my prompt here.
Don't worry, I'll show you exactly what it is.
So let me copy and paste.
Now it's building.
So essentially you can extend it and see that
I'm asking it to build a trend join long strategy scanner
that filters stocks down to which ones
that meet my day trading entry criteria.
I'm asking to do a test.
You can see it's doing a test on AMD NVIDIA MU.
And these are the prerequisites.
So while it's running, these are the criteria
I'm asking it to build for the strategy scanner.
Number one, I want it to run after 10 a.m. market time.
The price of the stock needs to be above
yesterday's daily high.
And yesterday's close needs to be above the 200 SMA.
The price needs to be above today's pre-market highs.
And the price needs to be above today's higher day.
Essentially, again, I'm joining strength.
It needs to be a higher day breakout.
If all five of the criteria passes, then it's a hit.
Then now the scanner will trigger an entry.
The difference between the scanner
and the previous pre-market gap scan we created
is that this strategy scanner needs to run on trading view.
That's where the connection to cloud comes into play.
Also, just make sure that your trading view desktop
must be running and the charting tab needs to be active.
So you can see now that it's built the second scanner.
So this run was a lot faster
than the pre-market gap scan.
They finished building the scanner in about two minutes.
I think it already has a context from the previous one.
Now at this point, I'm sure you're wondering,
all right, Shay, but does this strategy actually work?
Now this is where the fun begins.
We can backtest the strategy scanner
we just created on trading view.
And once again, you can just ask cloud to do this for you.
Okay, I want you to backtest the strategy
we just created in PineScript.
Backtest MU as far as you can go on the five minute chart.
All right, we are back.
Let's see what the backtesting did.
So what it did is essentially it created
like a pine strategy on trading view
and using the criteria we input earlier,
this is all the trades I did.
So there are the net P&Ls, okay.
So you can see it gives you the date to some longs,
some losses, some wins.
Oh, pretty decent.
A lot of greens, but also like AMD
has been really, really strong.
So keep that in mind.
And here are the key metrics.
Not bad, not bad.
So total P&L over 14 trades is $1,200.
And there's a max equity drawdown here as well.
Profitable nine out of 14.
Profit factor is 2.48, that's really good.
But again, I want to caveat by saying
that this is only one ticker.
And you can see the details that are provided here,
it's around the same.
And the initial capital we're using is $1,000.
Obviously you wouldn't be using 100%
of the equity per trade,
but again, this is just a backtest.
But again, that was a really limited backtest.
Let's extend this to a lot more tickers now.
And I think I'm gonna use higher timeframes
to speed this up.
Good job.
Now I want to extend this backtest to more tickers.
I want to backtest on MU, NVIDIA, Tesla,
Apple, Amazon, Meta, Google,
going as far as you can on the 15 minute chart.
So essentially I want to extend this backtest
to all the magnificent seven,
even though I don't think I got seven.
What am I missing?
Oh, I'm missing Netflix, but it's okay.
You'll get the idea.
I want to extend this to a max seven.
And on the 15 minute timeframe now.
Okay, so I'm not gonna lie,
that did take a while,
but we got some decent results.
You can see we have Tesla, NVIDIA, AMD.
So no trade on Tesla, that's fine.
But what happened to Google?
Anyways, this just to show you
that the strategy does work,
but once again, it's highly selective.
But as you can see, since we were backtesting
on the, I think 15 minute timeframe,
you are producing a lot less trades.
If you were on the five minute timeframe,
there'll be a lot more trades.
And again, my criteria,
like all the ones I listed out earlier
is really, really strict.
So if you want to take more trades,
which, you know, up to you,
I will prefer higher win rates
and higher returns than to take more trades.
But again, you can play around with this.
This is just a foundation strategy
for you to get started.
And this is where the real work
comes in as a trader.
As you can tell, this is a really good foundation,
but it's based on very selective criteria.
And it's only, you're only backtesting
on only select few tickers.
So make sure you go in yourself
and test out different entry rules.
And truth be told,
I'm still in the process of testing
and reiterating to make sure this applies
across all the stocks on my watch list.
I don't have all the answers for you today,
but I'll be making follow-up videos
on this very soon.
So I want to show you some examples
of how I would reiterate
and test out the strategies using Claude.
I see.
I think the amount of stocks you can backtest
is really limited using Pinescript.
I want you to switch to Python now
to backtest this exact same strategy.
And I want to expand you to the universe
to all the stocks on my watch list.
I believe there are around 30 stocks.
So expand the backtest to those 30 stocks
using our last 30 days.
So you can see Claude is now hard at work
writing me a backtesting Python
and I can tell it what tickers to run.
And again, all of these prompts will be available
on my blog post that you can just copy and paste.
But you do need to reiterate this
to fit your own strategy and your own capital as well.
All right, so that was a lot faster
than the previous one using Python.
So you can do the same
with all the other tickers you want to backtest on.
So basically within my watch list,
I have 32 tickers and I was backtesting the last 30 days.
And this is the portfolio totals
and I'm trading with $10,000 account,
54% win rate and a total P&L.
This is not bad.
A couple of tickers with no signal,
Meta and Robinhood, that's fine.
And you can see these are the rest of the tickers
and these are all the tick...
I thought I had a lot more tickers.
Oh, these are top 10 winners,
but all the tickers on my watch list are here.
You can see, so I basically asked it
to backtest with everything here.
There's a total of 32 tickers.
So again, this is just an example
of how you can reiterate and find anything
that you can improve your strategy on.
This is actually a really good result.
I don't think I had this kind of result
when I first built this.
But yeah, play around with it.
It's actually really fun.
Okay, so far we built many things
with TradingView and Claude
and of course Python and other resources.
We built a pre-market scanner
that shows you all the gappers on the day.
Then we built the strategy scanner
that allows you to scan for the stocks
that fit your entry and exit criteria
for the trend join long strategy.
And number three, we backtested the strategy
with a PineScript on TradingView,
as well as asking Claude to extend that
to build a Python for us to backtest even more tickers.
So the next thing to build naturally
is to automate everything.
So the scanner will fire on its own
pre-market send you the alert,
and then the strategy and the testing
will start on its own.
Okay, now I want to automate both scanners.
The pre-market scanner,
I wanted to first start at 8.30 a.m. market time
and run every 30 minutes until 2 p.m.
The strategy scanner,
I wanted to only start after 10 a.m.
and run five minutes after the pre-market scanner.
And the strategy scanner is only gonna run
based on the tickers produced by the pre-market scanner.
And I want this to run also until 3 p.m.
Okay, I think it did it.
That wasn't too bad.
That was only like five minutes, okay.
So, okay, let's see what it did.
So both jobs are loaded with a full schedule, okay.
So you can see the pre-market scanner,
these are the timeframes that's gonna run every 30 minutes.
So 12 runs a day, yeah, all the way till 2 o'clock.
And a trend-joined long scanner,
again, which the scanner is based off the results
from the pre-market scan,
and that's why it needs to go five minutes after,
runs from 10 o'clock all the way to 2.30.
Okay, sweet.
So, and it also shows you all the files created
and all that.
Okay, okay, this is great.
By the way, if you're trying to learn more
about integrating AI into your trading,
then you should definitely attend
my In Real Life Masterclass this July
in Toronto, Canada for BlossomCon.
BlossomCon is the ultimate conference series
for retail investors who want to learn,
connect, and grow in real life.
It's coming soon this summer
in Toronto, Vancouver, and New York City.
If you're a retail investor,
then check out the link down below,
and I hope to meet you soon in real life.
So I'm gonna show you the results on my Telegram.
These are results that you're gonna see
each and every single morning.
So at 8.30 a.m., you're gonna see the pre-market gapper.
Preview, you'll see the tickers,
percentage, and the news catalyst.
Then after open, you know, I don't trade right after open.
After about 10 o'clock,
that's when the strategy scanner will go.
That's when you'll see something like this
called Trend Join Long Watchlist,
and it's gonna show you if there's any setups
and any candidates available.
So essentially, you're gonna see this
every 30 minutes during the trading days.
You're gonna see the gap list and the news briefing,
and then you're gonna see the strategy scanner
telling you if there's any candidates
that fit the Trend Join Long strategy.
Okay, now I'm gonna walk you through
how to set up Telegram notifications
so you get these messages like the one
that just showed you on my screenshot.
Now, along with the automation,
I want all the runs, the results from both scanners
after each scheduled run to be sent to my Telegram
in this exact format.
Okay, so I just basically copy and pasted the format I have.
So you can see scanner A, pre-market gappers,
and then scanner B, the Trend Join Long hits.
So again, you can copy this prompt on my blog,
but I want it exactly in this format,
otherwise it's gonna be really messy.
So after you put in that prompt,
it's gonna show you how to do that,
and I'll walk you through too.
I'm gonna create a new one on my phone.
Okay, so basically, I just ask Claude,
and he's gonna walk you through the Telegram process.
So in Telegram, search for Botfather,
and you're gonna do all these.
Okay, I'm just gonna do this right now.
So go to Botfather, and I want a new bot.
New, new bot.
I'm gonna name it hdmo123.
Okay, now that we're done,
I'm gonna copy this token access.
I'm just gonna give it to Claude.
So once you have that from Telegram,
just give it to Claude.
Of course, I'm blurring this for obvious reasons.
So it's saving the token now.
Great.
And then it's gonna continue for you.
So yeah, basically,
Claude is gonna walk you through everything.
And make sure at this time you start the bot.
So I'm gonna make sure I'm talking to the bot.
Okay, hello, start.
I need to make sure that I'm starting the bot.
I did press start.
Okay, so retry again.
Okay, so now you can see on my iPhone screenshot
recording here, this is the pre-market gappers.
Amazing, amazing, amazing.
I do see the gap list.
Now also show me an example
of the strategy scan result message on Telegram as well.
So I want this to run again as well.
So again, this is just a sample.
But the pre-market gappers is the first one we're gonna see.
And then the strategy scanner is gonna use,
is gonna scan on all these results.
Sense, you should see a trend join log message
in your bot chat with three sample hits.
Amazing.
Okay, so you can also see this too.
So that's the strategy scanner.
Just to double check,
the Telegram will be triggered as soon as this new runs
on the pre-market scanner and the strategy scanners
as well, right, throughout the entire day.
Amazing.
As you can see this on screen,
here is the wiring that we just created.
You get a pre-market scan, 12 fires a day,
and you're gonna get 12 Telegram messages.
If that's too much,
you can obviously revise it on your own.
Then you get a trend join log strategy runs as well.
Okay, like I mentioned earlier,
there's a bonus section to this video.
The TradingView AI chart co-pilot.
The public beta is now available.
So they've been also on the DL on this.
I didn't even know about this
until after I finished all the backtesting
and building all the backtester on Python.
So they have this.
There's still some limitations,
but I just wanna show you what it can do.
It can actually make a lot of the backtesting a lot easier.
So give this article a read
and make sure you have the Chrome extension
for the TradingView Remix.
That's their AI model they're calling it.
So make sure you have this.
And again, you still need a paid subscription
on TradingView once again.
So now let's go to our charts here.
So it can actually start backtesting now.
So remember earlier that Claude
and the TradingView MCP connection,
they cannot do that many backtesting.
But now with this, I think you can backtest a lot more.
So let me make sure I have the strategy loaded in.
I want you to run the backtest
all the stocks in my watch list
for the last 90 days
on the 15 minute timeframe
using the current strategy that's loaded,
the demo TJL strategy.
All right, let's see if it works.
There you go, okay.
Oh, amazing.
First batch of six.
Okay.
So you can see it's able to do,
it's showing that I should have just bought and hold.
Yeah, you're probably right.
But again, we're using very limited samples.
So I wanna continue all the way.
All right, let's see what we got here.
The results.
So I'm not sure why the same backtest
on TradingView itself,
at least using the Remix bot, it's not working.
But as you can tell,
that it gives you a lot of options to optimize it.
So you guys can play around with it.
And I might do like a follow-up video
on the TradingView Remix as well.
The next thing I wanna try to see if it can do
is to give me the pre-market watch list, the gap scans.
Can you create pre-market gap scan
of the top 10 gappers on the day
with their ticker percentage change,
sorry, percentage gap pre-market by 8.30 a.m.
and any news catalysts that they may have.
The stock must be above $3 per share
and pre-market must be trading at least 20,000 shares.
So the exact same criteria we did
with Cloud and TradingView earlier,
I wanna see if this TradingView AI can do the same.
Okay, yeah, you're correct.
There's nothing on Sunday, but oh,
so it's able to give me all the lists
I asked for pre-market, amazing.
But I think the limitation is that
it's not able to send it to my Telegram.
Let's find out.
Are you able to send me that watch list
every single morning to my Telegram?
So let's find out.
I don't think it can.
Yeah, it's saying that we cannot do that.
We need to run the scan on demand every single morning.
But maybe in the future,
you can run like external automations.
I think I'm gonna keep playing around with this,
but just so you know that a lot of limitations
we saw earlier with Cloud,
you can solve that within TradingView Remix.
But again, there's always some other limitations.
Like with this one, you cannot schedule it.
You have to run it on demand every single morning.
But it's definitely really cool to try out.
If you want me to make a follow-up video
on the TradingView Remix,
especially with following up on the back testing
I did earlier, let me know down below.
If you watch it this far, you'll know one thing.
TradingView PineScript simply lets you back test.
It doesn't allow you to turn that PineScript or indicator
into an automated trading system.
But don't worry, I'm already on it.
I've already started trading this back testing strategy
using Interactive Brokers API.
And these on screen are the results so far.
So make sure to subscribe and turn on the notification bell
because next week, I'm gonna post a video
that'll walk you through the exact step-by-step process,
just like I did today.
Once again, the full blog with every single prompt
and all the links and resources are linked down below.
Like I mentioned earlier, AI cannot make you profitable.
You as the human still needs to learn how to trade
and still have a trading strategy.
So make sure to watch this video
to learn my two favorite trading strategies over here.
