← All results
Guide

Building a Custom TradingView Indicator with ChatGPT

A tutorial on building TradingView indicators with ChatGPT. It does not test whether a strategy makes money.

Source Eddy PipsVideo published Jul 21, 2026
Watch the video

The guide, written out

What this page is

There are thousands of indicators on TradingView, but sometimes the one you want doesn't exist. This tutorial shows how to have ChatGPT (or Gemini, DeepSeek or any other AI) write a custom indicator for you in Pine Script, TradingView's programming language. It's a how-to, not a strategy test, and the example indicator isn't something I've backtested.

Step 1: set ChatGPT up first

Before asking for any indicator, I send a setup prompt that tells it:

  1. You're going to help me build a TradingView indicator in the latest version of Pine Script.
  2. Search the web and get familiar with TradingView and Pine Script first. Tell me when you're ready.
  3. If I paste an error from Pine Script, give me the complete corrected code, not instructions on what to change.
  4. When I give feedback, apply it and give me the complete, correct code again.

Two parts of that matter most. Asking it to research first gets better code from the start. And asking for the full code every time stops it from saying "change line 14 to…", which is confusing if you don't code.

Step 2: describe the indicator in plain words

Be specific about what should appear on the chart and when. My first request was:

  • Draw an up arrow under a candle that closes bullish and has a lower wick longer than its body.
  • Draw a down arrow over a candle that closes bearish and has an upper wick longer than its body.

Step 3: add it to TradingView

  1. Copy the code ChatGPT gives you.
  2. In TradingView, open the Pine Editor, select everything, and paste in the new code.
  3. Click Add to chart.

The arrows appeared on exactly the candles I described.

Step 4: improve it one rule at a time

Next I asked it to only print arrows on candles inside a fair value gap (a three-candle gap left by a fast move). I didn't define a fair value gap on purpose, and it used the standard three-candle definition on its own. Paste the new code over the old, refresh, and check the chart.

Then I added a third rule: a buy or sell signal on the candle after the arrow, if that next candle "engulfs" it.

Step 5: when it gets it wrong, be more specific

The third rule didn't do what I wanted, because "engulfs" was too vague. So I rewrote it precisely: if the next candle closes the same direction and its body is bigger than the body of the arrow candle, print a signal. The corrected version put the signals exactly where I meant.

That's the most useful lesson here. When the indicator is wrong, the code usually isn't the problem. The description is. Say exactly what you mean, in terms of open, high, low and close.

A word of caution

An indicator that prints arrows isn't a strategy until you've tested it. The signals in this example looked good on the few examples I scrolled through, but that's exactly how people fool themselves. If you build something you like, write down the entry, stop and target, and backtest it the way I describe in how I backtest a trading strategy.

The test

How I tested
Guide / walkthrough
What this is
This video is not a new backtest.

Trade log

No trade log is linked for this guide.

What’s in the video

Format
Live build: AI prompt to Pine Script to chart
Runtime
~10 minutes

Where the numbers come from

Checked Sep 22, 2026. These numbers come from the video. They are backtest or simulated results, not live trading, and not financial advice.

Original video ↗

Test your own trades

EdgeFinder

The app I built to log a backtest and run it through prop firm challenge rules. It is free to try.

Try EdgeFinder free ↗

Backtest Lab

Members get the code behind my backtests, the results before the video goes public, and a vote on what I test next.

Join Backtest Lab ↗

EdgeFinder is my app and Backtest Lab is my channel membership, so both of these pay me. They never change a test result.