I Made My Own AI Trading Bots & Indicators - Copy This (Free & Easy)

Full Transcript — Download SRT & Markdown

00:00
Speaker A
Building trading bots and indicators used to be for tech geniuses...
00:05
Speaker A
Well, not anymore. I have zero coding experience.
00:10
Speaker A
And I'm creating my own trading bots in TradingView in just a few minutes.
00:15
Speaker A
So today, I want to help you create and optimize your own indicators and strategies in TradingView using AI without any experience in programming.
00:26
Speaker A
So let me walk you through the entire process step by step.
00:30
Speaker A
I'm using Claude AI on Poe app, but you can use any AI model you like.
00:35
Speaker A
I sometimes switch to DeepSeek or O1 models when I get several errors in a row, but the process remains the same.
00:44
Speaker A
Let's start with the most critical part: crafting the starting prompt.
00:48
Speaker A
Your trading bot's capabilities depend entirely on how well you structure these instructions.
00:55
Speaker A
So first, let's create a prompt that turns your AI into a trading agent.
01:02
Speaker A
Use this prompt.
01:06
Speaker A
I want you to be my trading assistant, you're an expert in trading and coding, especially Pine Script for TradingView, you can create any indicator or strategy I need, with clean code and few errors.
01:56
Speaker A
Now, let's make your assistant even smarter by feeding it more information about your specific trading preferences.
02:03
Speaker A
This step is crucial for making the AI truly yours, tell your bot about your preferred markets.
02:12
Speaker A
Do you prefer trading stocks, forex, crypto?
02:16
Speaker A
Tell your bot about your typical time frames, do you enjoy scalping, day trading, or swing trading?
02:22
Speaker A
You'll also mention your risk tolerance, your trading style, like trend following or breakouts.
02:28
Speaker A
For instance, you might say, I primarily swing trade stocks, using price action methods, on four-hour charts.
02:39
Speaker A
I prefer to use minimal indicators and focus on market structure.
02:42
Speaker A
Keep this in mind, please.
03:21
Speaker A
The more context you provide, the more tailored the advice becomes.
03:26
Speaker A
After creating your assistant, it's time to see if it works as expected.
03:31
Speaker A
Let's start with something easy.
03:33
Speaker A
I use exponential moving averages a lot in my trading, and I want to ask my AI assistant to help me color code an EMA.
03:44
Speaker A
I want it green when price is above it, and red when price is below it.
03:49
Speaker A
We'll ask it to modify the basic EMA code to change colors based on price position.
03:54
Speaker A
Now we'll copy the standard EMA code from TradingView and paste it into our chat.
04:00
Speaker A
Then we'll wait for the assistant to do its magic.
04:05
Speaker A
Nothing groundbreaking yet, we're just making that information more visible.
04:10
Speaker A
We've got our code, now let's implement it in TradingView.
04:15
Speaker A
You open your TradingView chart and look for the Pine Editor button at the bottom of your screen.
04:20
Speaker A
Click it to open the coding interface.
04:23
Speaker A
When the editor opens, you'll see a blank canvas or some template code.
04:31
Speaker A
You just click on new and select indicator from the dropdown menu.
05:12
Speaker A
This creates a fresh Pine Script file.
05:16
Speaker A
Don't forget to delete any template code, then paste the code your AI assistant provided.
05:22
Speaker A
Then give your script a name and save it.
05:26
Speaker A
Next, you press add to chart to see your creation in action.
05:31
Speaker A
If there are no errors, your indicator will appear on your chart.
05:36
Speaker A
If there are errors, and you will encounter them, just copy them or make a print screen and ask the assistant to fix the errors and rewrite the entire code again.
05:48
Speaker A
So this indicator seems to work as intended.
05:52
Speaker A
The visual feedback is instant.
05:54
Speaker A
When candles close above the EMA, the line turns green.
05:59
Speaker A
When price dips below, it immediately switches to red.
06:42
Speaker A
Let's check if this works on any time frame.
06:45
Speaker A
It does, so this works as expected.
06:48
Speaker A
Now let's continue with something practical involving pivot points.
06:53
Speaker A
Pivot points are powerful tools, but sometimes I want them to be calculated on lower time frames.
07:00
Speaker A
So I want to ask my AI assistant to modify the pivot point indicator to show hourly pivot levels.
07:07
Speaker A
Since daily is the lowest time frame available by default.
07:11
Speaker A
Fun fact, 10 years ago, I paid a programmer $200 to code this exact indicator for me.
07:18
Speaker A
So we'll ask our AI assistant to modify the standard pivot point indicator code to calculate pivots on an hourly time frame.
07:27
Speaker A
This should be a simple change in the time frame reference.
07:31
Speaker A
So we'll copy the pivot point code from TradingView and paste it into our chat.
07:38
Speaker A
The classic pivot point calculation shows daily support and resistance levels that help identify price combinations quickly and easily.
07:43
Speaker A
But I want them displayed on an hourly basis.
07:48
Speaker A
I want pivot points to confirm intraday bias in the markets.
07:56
Speaker A
I like to compare the current trading day's central pivot with the previous day's to establish bias.
08:03
Speaker A
And then confirm that bias based on where price opens.
08:08
Speaker A
Having this on an hourly time frame will give me more granular entry opportunities.
08:53
Speaker A
The modified code came back quickly.
08:55
Speaker A
Now let's head over to TradingView and open the Pine Editor.
09:00
Speaker A
We'll clear out the default code and paste in the modified pivot point script from my assistant.
09:06
Speaker A
We can immediately see the hourly pivot points appear.
09:10
Speaker A
Each horizontal line represents a key support or resistance level, calculated from the previous hour's levels.
09:18
Speaker A
The indicator works beautifully, showing clear pivot points that align perfectly with price reactions.
09:24
Speaker A
I can use these pivot levels alongside other tools for confirmation.
09:30
Speaker A
Also, when you make your own tools, don't forget to check if they work on different symbols and time frames.
09:35
Speaker A
Testing it on various charts confirms its working perfectly across the board.
09:42
Speaker A
Honestly, I'm amazed at how much things have changed.
09:50
Speaker A
In the past, getting this kind of custom indicator made would have cost me $200, required many back and forth emails and taken a full two weeks to complete.
10:00
Speaker A
But today, the entire process took less than three minutes from start to finish.
10:46
Speaker A
Now let's create a more complex indicator.
10:49
Speaker A
I want a tool that highlights engulfing candles, with their volume higher than the previous five candles.
10:56
Speaker A
Engulfing candlestick patterns are powerful signals, especially when confirmed by volume.
11:03
Speaker A
They occur when a larger candle completely engulfs the previous candle.
11:08
Speaker A
When combined with volume analysis, these patterns become even more significant.
11:53
Speaker A
I'll ask my AI assistant to create a custom indicator for this high volume engulfing patterns.
12:00
Speaker A
This should be straightforward, since we just need to check two main conditions.
12:06
Speaker A
The engulfing pattern formation and the volume comparison.
12:10
Speaker A
First, let's define what makes an engulfing pattern, for a bullish engulfing, the current candle must be green and its body must completely engulf the previous red candle's body.
12:23
Speaker A
For a bearish engulfing, the current candle must be red and its body must completely engulf the previous green candle's body.
12:30
Speaker A
The widespread of these engulfing candles sends a clear signal with one message.
12:37
Speaker A
Sentiment is strong.
12:38
Speaker A
Either bullishly or bearishly.
13:22
Speaker A
So we'll ask our assistant to write code that identifies these patterns and checks if the volume is higher than the previous five candles.
13:24
Speaker A
This is a key condition.
13:33
Speaker A
Volume is crucial because it validates the price action.
13:37
Speaker A
If we see a large engulfing candle, but the volume is below average, it's a warning signal.
13:43
Speaker A
Only when volume rises with the price pattern, it shows real market strength or weakness.
13:50
Speaker A
The assistant has finished the code, so let's head over to TradingView.
13:54
Speaker A
We'll clear out any default code and paste in our new indicator.
14:00
Speaker A
Now let's see the indicator in action.
14:03
Speaker A
So the indicator works by placing colored markers on candles that meet our criteria.
14:10
Speaker A
Looking at some examples on the chart, we can see how these high volume patterns often mark significant turning points or continuation signals.
14:19
Speaker A
Testing on different time frames shows the indicator works well across various chart settings.
14:26
Speaker A
One interesting pattern I'm noticing is that many of the bearish engulfing candles with high volume appear at resistance levels.
15:17
Speaker A
While bullish engulfing candles with high volume often appear at support.
15:22
Speaker A
This aligns with what we know about volume profile analysis.
15:27
Speaker A
It takes effort for the market to move away from established levels, and this effort shows up as increased volume.
15:35
Speaker A
I could also look for additional confirmation, like adding a moving average or another indicator.
15:42
Speaker A
But the main condition, price action and volume, is in place.
15:47
Speaker A
So I'll save this indicator because we'll be particularly useful for spotting potential continuation and reversals after a strong move.
15:56
Speaker A
When combined with support and resistance levels and other volume profile analysis, it becomes a powerful edge for entering trades with conviction.
16:47
Speaker A
Now let's increase the difficulty notch.
16:50
Speaker A
Let's create a momentum indicator that measures the strength of price action over the last X candles.
16:56
Speaker A
This indicator will count recent bars and measure the body of bullish candles versus bearish candles, giving us a clear picture of which side is winning the battle.
17:09
Speaker A
The body of a candle tells us about strength.
17:12
Speaker A
A long body shows strong commitment from either buyers or sellers.
17:17
Speaker A
When consecutive bodies become larger, it shows increasing momentum, while smaller bodies indicate slowing momentum.
17:25
Speaker A
That's exactly what our indicator will track.
17:28
Speaker A
I'll ask the assistant to write a custom indicator that adds up the body sizes of bullish and bearish candles over a lookback period.
17:39
Speaker A
This will give us a momentum score for each side of the market.
17:43
Speaker A
The size of these bodies matters greatly.
17:48
Speaker A
In every bar, the same number of contracts or shares are traded.
17:56
Speaker A
The only reason a bar ends with a higher price is that buyers were more committed and aggressive than sellers.
18:03
Speaker A
The reverse is true for bearish candles.
18:06
Speaker A
So the body size directly reflects the strength behind the move.
18:12
Speaker A
That's why I want the indicator to loop through the last X candles to measure each body size and to add them to either a bullish or bearish total.
18:56
Speaker A
We have the code, now let's head to TradingView and paste our new indicator.
19:02
Speaker A
No errors when we add it to chart.
19:05
Speaker A
We can see three lines appear, one for bullish momentum, one for bearish momentum, and one showing the ratio.
19:14
Speaker A
Let's hide the ratio for now and let's focus on the main lines.
19:59
Speaker A
Looking at the chart with our new indicator, we can spot some interesting patterns.
20:04
Speaker A
When the bullish line rises sharply, while the bearish line remains flat, we see price making strong upward moves.
20:10
Speaker A
This aligns with a well-known candlestick analysis principle, a wide body represents strong market sentiment.
20:22
Speaker A
This tool works well with the concept of consecutive candles increasing or decreasing in size.
20:30
Speaker A
When we see the momentum lines diverging, meaning bullish line rising while bearish line falling, it often corresponds to consecutive candles getting larger in the direction of the trend.
20:43
Speaker A
This pattern frequently appears at the start of strong moves.
20:51
Speaker A
If the bullish line starts to flatten after a strong rise, it suggests buyers are losing control.
20:58
Speaker A
An early warning of a potential reversal.
21:00
Speaker A
When the bearish line flattens after a decline, it signals sellers may be losing control.
21:45
Speaker A
Volume validates price action, so as a next step, we might enhance this indicator by factoring in volume.
21:50
Speaker A
But even in its current form, it provides valuable insight into market momentum.
21:59
Speaker A
I like using it on the four-hour time frame, and I must say, this is pretty accurate.
22:05
Speaker A
Perfect to identify when momentum is slowing or rising, I can predict the next four-hour candle with a pretty high accuracy using it.
22:15
Speaker A
You may find this useless, but for me, this indicator is amazing.
22:20
Speaker A
By measuring the relative strength of buyers versus sellers over the last several candles, this little tool helps me read the momentum based on actual price action.
22:32
Speaker A
Now let's create a trading strategy using the indicator we just built.
22:36
Speaker A
The rules are simple.
22:38
Speaker A
Enter long when bullish strength crosses above bearish strength, and price is above the 100 SMA, enter short when bearish strength crosses above bullish strength and price is below the 100 SMA.
23:34
Speaker A
The strategy logic is to check for crossovers between the bullish and bearish strength lines, while confirming the price position relative to the 100 SMA.
23:49
Speaker A
When all conditions align, the strategy enters a position.
23:50
Speaker A
When I first ran the code, I got an error.
23:53
Speaker A
This happens often when building strategies.
23:56
Speaker A
So I just copied the error message and asked the assistant to fix it.
24:01
Speaker A
We went back and forth a few times, fixing bugs and refining the logic.
24:06
Speaker A
One issue was with the crossover detection.
24:10
Speaker A
We needed to make sure we were only entering on the bar where the crossover happened at the candle close, not in the middle of it.
25:00
Speaker A
After a few iterations, we had a working code, I pasted it into TradingView and ran a backtest.
25:06
Speaker A
I checked if the strategy was taking trades at exactly the right moments, as intended.
25:13
Speaker A
Entering longs when bullish candles were overpowering bearish ones, and shorts when bearish candles dominated above and below the SMA.
25:25
Speaker A
The backtest results were promising.
25:28
Speaker A
The strategy showed positive returns and a decent win rate.
25:33
Speaker A
The best results were on the 30 minutes time frame with the 200 SMA as a filter and the indicator measuring the strength of the last 10 candles.
25:43
Speaker A
This makes sense because we're essentially trading with the more dominant market force, while also respecting the overall trend direction with the SMA filter.
25:54
Speaker A
Then I asked the assistant to assess the backtest results.
25:58
Speaker A
And it noted that the strategy was profitable but had a relatively low Sharpe ratio, the Sharpe ratio measures return relative to risk, so this suggested our returns weren't quite high enough compared to the volatility we were experiencing.
26:45
Speaker A
The Sortino ratio, however, was relatively high, this is important because the Sortino ratio focuses specifically on downside risk, the bad volatility that hurts us, rather than all volatility, a high Sortino ratio means our strategy is making money while controlling drawdowns effectively.
27:18
Speaker A
Of course, I can go deeper with the adjustments, but you get the point, the assistant suggested we might improve performance by refining entry and exit conditions or adjusting position sizing.
27:30
Speaker A
One specific recommendation was to test increasing position size, since the strategy appeared reliable enough to potentially handle larger positions without significantly increasing risk.
28:24
Speaker A
What makes this strategy smart is the fact it doesn't try to predict the future, it just measures what's happening right now, which side is showing more strength and trades accordingly.
28:41
Speaker A
What I like about this trading bot is that it doesn't rely on complex indicators, it simply measures what's happening with price action, the size of bullish versus bearish candles and trades when a clear advantage appears for one side, the SMA filter adds another dimension by keeping us on the right side of the larger trend.
29:05
Speaker A
Overall, the assistant concluded this was a decent combination of high returns and controlled risk, so I'll keep adjusting and backtesting it in the future.
29:17
Speaker A
Here's another tool I've created.
29:20
Speaker A
I wanted an indicator to highlight a trading range for each day.
29:25
Speaker A
This daily boxes indicator tracks each trading day with colored boxes.
29:30
Speaker A
I want to see daily highs and lows at a glance.
29:35
Speaker A
Which is critical for understanding market structure.
29:40
Speaker A
This tool provides a broader perspective of price movements.
29:45
Speaker A
And helps me identify key levels and trends.
30:25
Speaker A
Green boxes show bullish days, where price closed higher than it opened.
30:30
Speaker A
Red boxes show bearish days, where price closed lower than it opened.
30:35
Speaker A
What makes this indicator powerful is how it lets me quickly see the sequence of daily highs and lows.
30:43
Speaker A
When analyzing charts, I pay attention to the number of up boxes or red boxes, this helps determine the strength of buy or sell scenarios.
30:53
Speaker A
The boxes make this pattern recognition much easier.
30:58
Speaker A
I've asked the assistant to let me choose how many days I want to display and what colors to use, then I wanted a clear function to detect when a new trading day begins, this is important because we need to know when to start a new box.
31:45
Speaker A
I had a few problems here, as I got many errors, but in the end, the indicator worked as I wanted.
31:54
Speaker A
Each time a new day starts, the indicator creates a fresh box starting at the current bar, the box extends to the right and gets updated throughout the day as price makes new highs or lows, the box color changes based on whether price is currently above or below the day's opening price.
32:23
Speaker A
From a price action perspective, these boxes help me identify the premium and discount zones that are so important in trading.
32:32
Speaker A
The daily highs and lows marked by these boxes become significant levels, previous day's highs offer short-term resistance levels if price reaches those levels again.
33:25
Speaker A
Similarly, the lowest low traded in the previous day can offer significant support.
33:31
Speaker A
These levels are precisely what banks and institutions often monitor for buying and selling interest.
33:39
Speaker A
By having them clearly boxed on your chart, I can position myself strategically for these potential moves.
33:46
Speaker A
The indicator also helps identify order flow patterns.
33:50
Speaker A
In a bullish order flow, buyers dominate the market, driving prices higher, and the market tends to seek buy-side liquidity above the previous day's highs.
34:02
Speaker A
You'll see this as a series of green boxes with higher highs.
34:07
Speaker A
In bearish order flow, sellers dominate, and the market seeks sell-side liquidity below the previous day's lows.
34:16
Speaker A
Visible as a sequence of red boxes with lower lows.
34:21
Speaker A
With these boxes, you can spot when a day's range is much smaller or larger than previous days.
34:29
Speaker A
Indicating potential changes in market sentiment.
35:13
Speaker A
Another tool I've created is an average daily range indicator.
35:17
Speaker A
This helps me understand market volatility and how much a market has moved today compared to its typical daily movement.
35:26
Speaker A
This tool answers key questions, is today more or less volatile than normal, has the market already reached its typical daily range, is there still room for price to move?
35:39
Speaker A
The ADR concept is rooted in market volatility analysis, markets trade with an average daily range that varies by instrument, and this variation is critical for setting realistic profit targets and stops.
35:55
Speaker A
The code creates a simple, yet powerful indicator that calculates the average range over a set number of days, then compares today's range to that average, I wanted the indicator to have a user input for how many days to include in the calculation, usually 20 days, it also asks for a pips multiplier, which helps adjust the decimal places for different markets, it also calculates what percentage of the average today's move represents.
37:09
Speaker A
This information is crucial for my trading decisions.
37:14
Speaker A
Especially with my profit targets, for instance, if today's range is already at 95% of the average, I might expect limited further movement and consider taking profits.
37:25
Speaker A
But if the ADR is only at 30%, there might still be substantial movement ahead.
37:31
Speaker A
I can also use the ADR to set targets based on the previous day's high and low.
37:36
Speaker A
Using the daily boxes indicator, for example, if today's range is small compared to the average, the previous day's high or low might be realistic targets, depending on the trend direction, I wanted this tool because instead of using arbitrary numbers, I want to use the market's own volatility signature to guide my decisions.
38:32
Speaker A
Your AI assistant can build almost any trading tool, you just need to know how to ask.
38:41
Speaker A
Tools that once took months to perfect, now take minutes, now it won't be perfect from the first prompt.
38:53
Speaker A
You will get errors or different bugs, when the code had bugs.
38:59
Speaker A
I simply copied the error messages and asked the AI to fix them.
39:05
Speaker A
And this takes minutes, not days or weeks of debugging, with AI, you can now create custom tools that match your specific trading approach.
39:16
Speaker A
Instead of using generic indicators everyone else uses, and the process becomes educational too, as you describe what you want and review the requirements, you'll learn how these tools actually work, what's truly revolutionary is that the AI can turn any TradingView indicator into a complete trading strategy.
40:12
Speaker A
Once you have an indicator you like, simply specify the entry and exit rules, the AI transforms this into strategy code that you can backtest immediately.
40:30
Speaker A
This lets you validate trading ideas much faster than traditional methods, if the strategy produces bad results or is completely unprofitable, simply ask for improvements from the AI, make a screenshot with the results and ask for other adjustments.
40:50
Speaker A
If you are like me and you prefer trading based on price movement, AI can help you make simple tools, these tools can show you when the market is leaning in a certain direction, or I can highlight the specific situations you've found useful in your own trading, again, the key is being specific with your requests, tell the AI exactly what your indicator should measure, how calculations should work, what the visual display should look like, and for strategies, the exact entry and exit conditions, the more precise your description, the better the result.
41:50
Speaker A
If you want a follow-up video about this, let me know in the comments, and if you're curious about mastering other trading techniques, go ahead and watch one of these videos next.

Get More with the Söz AI App

Transcribe recordings, audio files, and YouTube videos — with AI summaries, speaker detection, and unlimited transcriptions.

Or transcribe another YouTube video here →