TradingView indicator development

Build TradingView indicators using AI

Describe the calculation and chart behaviour you need, generate a complete Pine Script v6 indicator, compile it in TradingView and refine the result against real chart evidence.

Turn an indicator idea into Pine Script

A custom indicator needs two things to be defined: the calculation behind it and the way the result should appear on the chart. It might use price, volume, a standard technical indicator or data from another timeframe, then present the result through lines, histograms, coloured regions, chart markers, tables or alerts.

You can describe those requirements in normal trading language and let TradingView Xen produce the Pine Script v6, without trying to name the Pine functions yourself. What matters is explaining the behaviour clearly enough that you can tell whether the finished indicator is correct.

Example indicator request

Create a Pine Script v6 overlay indicator with a 20 EMA and 50 EMA, showing a green marker when the fast EMA crosses above the slow EMA while RSI is above 55 and a red marker when the opposite conditions occur. Include configurable periods, bar-close signals and alert conditions.

Describe your indicator

A request such as “build a trend indicator” leaves too much open to interpretation, so explain what the indicator should measure, which source series it uses and what must appear on the chart. Standard names such as EMA, RSI and ATR have recognised definitions, while a custom calculation needs its formula, lookback and smoothing rules.

Calculation

Define the source, periods, formula and the exact condition that changes each signal or state.

Chart position

State whether the indicator overlays price or uses a separate pane and which scale its values require.

Visual output

Describe plots, colours, levels, fills, markers, labels or tables and when each should appear.

Alerts

Identify the event that should trigger an alert and whether it must wait for a confirmed bar.

If the design is visually specific, attach a chart screenshot to show the layout, colour and approximate placement, but also provide written requirements because an image cannot reveal the formula behind each value.

Create an indicator from an image

If you have seen another indicator with a useful chart layout or visual style, share an image with Xen and ask it to create a new TradingView indicator based on what is visible. The image option is available from Build Indicator whenever the selected AI model supports image input.

A reference image can show how lines, markers, colours, labels, panels, support and resistance areas or dashboard elements should look, so crop it closely enough for the chart and labels to remain readable and remove any account or personal information before uploading. Xen accepts PNG, JPEG and WebP images up to 3 MB.

Example image request

Use the attached chart as a visual reference and create a new Pine Script v6 overlay indicator with similar trend lines and reversal markers. Calculate trend direction from a 20 EMA and 50 EMA, display signals only after the bar closes and include configurable colours and alert conditions.

A screenshot does not contain the original source or reveal the formula behind another indicator, which means Xen uses the image together with your written description to create a new implementation rather than recovering hidden or proprietary code. Explain what each important visual element represents and provide the calculation rules you want it to use.

Once the source has been generated, compile it in Pine Editor and compare the new indicator with the reference across several symbols and timeframes. A similar appearance does not mean the calculations or signals are identical, so check the behaviour and continue refining the same Xen project where needed.

A practical indicator workflow

1. Start a Build Indicator project

Sign in to TradingView Xen and select Build Indicator when you want to create a new study without existing Pine source, then describe it in normal trading language and attach a visual reference if the appearance is important.

2. Clarify a complex design

A compact indicator can often be generated directly, while a dashboard, multi-signal tool or design with several interacting states is better handled through Prompt Builder. It can clarify the details and organise the work into stages, beginning with a smaller baseline that is easier to compile and compare with the specification.

3. Generate complete Pine Script v6

Xen returns one complete editable file, which you should review for the version directive, single indicator() declaration, configurable inputs and calculations behind each visible output.

//@version=6 indicator("EMA RSI Signals", overlay = true) fastEma = ta.ema(close, 20) slowEma = ta.ema(close, 50) rsiValue = ta.rsi(close, 14) longSignal = barstate.isconfirmed and ta.crossover(fastEma, slowEma) and rsiValue > 55 shortSignal = barstate.isconfirmed and ta.crossunder(fastEma, slowEma) and rsiValue < 45

This abbreviated example only shows the signal calculation; the complete indicator would also include its inputs, plots, markers and alert conditions.

4. Compile the source in Pine Editor

Copy the complete file into TradingView's Pine Editor and save it, using TradingView's compiler as the definitive check for Pine syntax and supported APIs. Read warnings as well as errors, particularly those concerning history-dependent calculations used only in conditional expressions.

5. Repair exact errors

If Pine Editor reports a problem, provide Xen with the exact diagnostic and the latest complete source so the dedicated repair workflow can correct the code and return a complete file for another compile check.

6. Add the indicator to a chart

Compilation proves that the source is valid, not that the indicator is correct, so compare its plots and markers with the stated rules, change the configurable inputs and check several symbols and timeframes, including periods with missing data, low volatility and sudden price movement.

7. Refine the tested version

When the chart shows that something needs changing, return to the same Xen project and request one focused revision, such as a new filter, clearer plot colours or an additional alert. Compile and inspect each meaningful version so a visual improvement does not conceal an unintended change to the calculation.

Check repainting behaviour

An indicator can show excellent historical signals yet behave differently while a bar is forming, so decide whether signals may update during the bar or must wait for a confirmed close and state that requirement clearly in the original request.

Take extra care with higher-timeframe calculations because values requested from another timeframe can continue changing until that bar closes. The expression, offset, gaps and look-ahead setting determine whether the historical output uses information that would not have been available at the time.

Test the indicator on historical and real-time bars across more than one chart timeframe, checking that supposedly final markers do not disappear or move.

Verify alerts separately from plots

A chart marker and an alert are related but separate outputs, so confirm that each alertcondition() uses the intended signal, has a useful title and message and follows the same bar-confirmation rule as the visible marker. Create a TradingView alert and test when it fires instead of assuming the plot proves that it is correct.

If the alert will feed another system, keep its message format stable and review every field used downstream, without connecting generated code to live automation until its timing and payload have been tested independently.

Continue from the current source

Most useful indicators evolve after they are placed on a chart because signals may need another filter, dashboard states may need to be clearer or a plot may need to be hidden on unsuitable timeframes. Continue from the complete tested source rather than generating a disconnected replacement.

Xen retains complete generated revisions and can compare the latest source with the requirements recorded in the project, identifying behaviour that appears implemented, partial or missing while TradingView remains authoritative for compilation and chart behaviour.

If the project should place simulated orders and produce Strategy Tester results, see how to build a TradingView strategy using AI.

How to verify the indicator

AI-generated Pine Script can compile while containing an incorrect formula, unsuitable defaults or misleading visual behaviour, so compare the output with known calculations where possible, review the complete source and test alerts, unusual inputs, multiple symbols and both historical and real-time behaviour.

TradingView Xen is a software-development tool rather than a source of financial or trading advice, and an indicator does not establish that a signal is predictive or suitable for live decisions. Its calculations and operational behaviour still require independent review.