Skip to main content

Building Your Personal Indicator Suite

Indicator design philosophy, architecture patterns, building a cohesive personal indicator workflow, and creating indicators that work together.

From Thrive on YouTube

Watch the matching Thrive video

Watch the series
ADX Indicator Explained: Is It a Trend or Just Chop?

ADX Indicator Explained: Is It a Trend or Just Chop?

Part of Charting and Market Structure. Education only. Not financial advice.

Indicator Design Philosophy

The difference between an amateur indicator and a professional one is not complexity. It is clarity. A professional indicator communicates maximum information with minimum visual clutter. Every line, shape, and color on your chart should answer a specific question. If an element does not help you make a better trading decision, it should not be on your chart. The goal is a chart you can glance at for two seconds and immediately know: what is the trend, where is momentum, what are the key levels, and is now a good time to trade?

One indicator, one question

Each indicator should answer exactly one question: "What is the trend?" or "Is momentum bullish?": never both.

Subtle backgrounds, bold signals

Use high transparency (85-95%) for backgrounds and zones. Reserve solid colors for primary signals and alert markers.

Signal rarity = signal quality

If your chart is covered in markers, none of them are useful. A good signal fires 2-5 times per week, not 20 times per day.

Consistent color language

Green = bullish, red = bearish, yellow = caution, gray = neutral. Never deviate from your color system.

Configurable by default

Every numeric constant should be an input(). Users have different timeframes, assets, and risk tolerances.

Label your outputs

Always include descriptive titles in plot(), hline(), and fill(). Users need to understand what each line represents.

The Thrive principle

Thrive's philosophy is that the best tools are invisible until they matter. A great indicator sits quietly on your chart doing nothing most of the time, then clearly and unambiguously signals when conditions align for action. If your indicator is constantly "screaming" at you with colors and markers, it is noise, not signal.

Architecture Patterns for Complex Indicators

As your indicators grow beyond 100 lines, architecture matters. A well-structured indicator is modular. Each section handles one concern (inputs, calculations, signals, visualization). Helper functions encapsulate reusable logic. User-defined types group related state. This structure makes your code maintainable, testable, and easy to extend.

pine-Modular indicator architecture pattern
1//@version=5
2indicator("Architecture Demo", overlay=true)
3
4// ─── SECTION 1: INPUTS ──────────────────────────
5maLen = input.int(21, "MA Length", group="Trend")
6atrLen = input.int(14, "ATR Length", group="Volatility")
7rsiLen = input.int(14, "RSI Length", group="Momentum")
8showBG = input.bool(true, "Show Background", group="Display")
9showSigs = input.bool(true, "Show Signals", group="Display")
10
11// ─── SECTION 2: HELPER FUNCTIONS ─────────────────
12getMA(src, len) => ta.ema(src, len)
13
14trendDir(src, len) =>
15 ma = getMA(src, len)
16 src > ma ? 1 : -1
17
18volState(atrVal, avgLen) =>
19 avg = ta.sma(atrVal, avgLen)
20 atrVal > avg * 1.3 ? 2 :
21 atrVal < avg * 0.7 ? 0 : 1
22
23// ─── SECTION 3: UDT FOR STATE ────────────────────
24type MarketState
25 int trend
26 int volatility
27 float rsi
28 bool bullSignal
29 bool bearSignal
30
31// ─── SECTION 4: CALCULATIONS ─────────────────────
32ema = getMA(close, maLen)
33atr = ta.atr(atrLen)
34rsiVal = ta.rsi(close, rsiLen)
35tDir = trendDir(close, maLen)
36vState = volState(atr, atrLen * 3)
37
38bullSig = ta.crossover(close, ema) and rsiVal > 45
39bearSig = ta.crossunder(close, ema) and rsiVal < 55
40
41state = MarketState.new(tDir, vState, rsiVal, bullSig, bearSig)
42
43// ─── SECTION 5: VISUALIZATION ────────────────────
44plot(ema, "EMA", state.trend == 1 ? color.green : color.red, 2)
45
46if showBG
47 bgcolor(state.trend == 1 ? color.new(color.green, 94) :
48 color.new(color.red, 94))
49if showSigs
50 plotshape(state.bullSignal, "Buy", shape.triangleup,
51 location.belowbar, color.green, size=size.small)
52 plotshape(state.bearSignal, "Sell", shape.triangledown,
53 location.abovebar, color.red, size=size.small)
1

Group inputs logically

Use the group parameter in input functions to organize settings into collapsible sections. Trend settings, volatility settings, momentum settings, and display settings should be separate groups. This makes the settings panel navigable even for indicators with 15+ parameters.
2

Extract helper functions

Any calculation used more than once should be a function. MA calculations, trend direction checks, volatility state assessment. These are all reusable building blocks. Functions also make your main logic section shorter and more readable.
3

Use UDTs for state management

When your indicator tracks multiple related values (trend direction, volatility state, RSI reading, signal flags), group them into a UDT. This creates a single state object that your visualization section can read from, rather than a dozen loose variables scattered throughout the code.
4

Separate calculation from visualization

Never mix calculation logic with plotting statements. All calculations should be done before the first plot call. The visualization section should only read from already-computed values. This separation makes it trivial to add or remove visual elements without touching the logic.

Building a Cohesive Indicator Workflow

Your indicators should work together as a system, not as independent tools. A cohesive workflow typically consists of three layers: a trend indicator (overlay on the price chart showing MA ribbons, trailing stops, or Ichimoku cloud), a momentum indicator (oscillator pane showing RSI, MACD, or your composite score), and a volume indicator (separate pane showing RVOL with volume-price confirmation). Each layer answers a different question, and together they give you the complete picture.

Layer 1: Trend (overlay)Answers "what direction should I trade?" MA ribbon + ATR trailing stop on the price chart. Green background = long bias.
Layer 2: Momentum (pane 1)Answers "is now a good time to enter?" Composite oscillator score. Score > +2 = look for longs. Score < -2 = look for shorts.
Layer 3: Volume (pane 2)Answers "is the market confirming?" RVOL with color coding. High RVOL on a signal bar = high confidence. Low RVOL = wait.
Decision flowCheck trend first (are you allowed to trade this direction?), then momentum (is the timing right?), then volume (is the market participating?).

Organizing Your Indicator Library on TradingView

As you build more indicators, organization becomes critical. TradingView allows you to save scripts in folders, create indicator templates (preset combinations), and use Pine libraries to share common functions across scripts. A disciplined naming convention prevents your Pine Editor from becoming a graveyard of abandoned experiments.

Prefix naming convention

Name scripts like "[Trend] MA Ribbon", "[Osc] RSI Pro", "[Vol] RVOL Suite". The bracket prefix groups by function.

Version numbering

Append v2, v3 to scripts as you iterate. Keep the previous version until the new one is proven. Never edit a working script in-place.

Indicator templates

Save chart layouts with your preferred indicator combination as templates. One-click to load your full trading setup on any asset.

Pine libraries for shared code

Extract common functions (MA helpers, color utilities, risk calculations) into a library. Import in all your indicators.

Separate dev from production

Keep experimental scripts separate from your daily trading indicators. Only promote a script to your trading layout after testing.

Document in the code

Add a comment block at the top of every script explaining what it does, what signals it produces, and what settings to adjust per asset.

Performance Optimization for Complex Indicators

TradingView imposes computation limits on PineScript. Complex indicators that combine multiple timeframes, large arrays, or many drawing objects can hit these limits. Optimization is not optional for production indicators. It determines whether your tool works on high-bar-count charts like 1-minute BTC or crashes with a timeout error.

Cache repeated calculationsStore ta.atr(14) in a variable and reuse it. Each call re-computes from scratch. 5 calls = 5x the cost.
Minimize request.security() callsEach security call fetches data from TradingView servers. Bundle multiple values into one call using tuples.
Tables only on barstate.islastBuilding tables on every bar is the #1 performance killer. Always guard table creation with barstate.islast.
Limit drawing objectsSet max_lines_count, max_labels_count in the indicator declaration. Delete old objects: line.delete(oldLine).
Avoid large array operationsSorting a 500-element array every bar is expensive. Sort only when needed (e.g., when a new element is added).
Use var for accumulationvar float total = 0.0 with incremental updates is far cheaper than re-summing an array every bar.
pine-Bundling request.security() calls
1//@version=5
2indicator("Optimized MTF", overlay=true)
3
4// BAD: three separate security calls
5// dailyClose = request.security(syminfo.tickerid, "D", close[1], ...)
6// dailyHigh = request.security(syminfo.tickerid, "D", high[1], ...)
7// dailyRSI = request.security(syminfo.tickerid, "D", ta.rsi(close,14)[1], ...)
8
9// GOOD: one security call returning a tuple
10[dClose, dHigh, dRSI] = request.security(syminfo.tickerid, "D",
11 [close[1], high[1], ta.rsi(close, 14)[1]],
12 lookahead=barmerge.lookahead_on)
13
14plot(dClose, "Daily Close", color.orange, 2, plot.style_stepline)

Master Indicator Project: The Complete Tool

This final project combines every concept from the indicators module into a single, polished tool. It includes trend detection (EMA with ATR trailing stop), momentum scoring (RSI + MACD composite), volume confirmation (RVOL), and session awareness: all in one indicator with a compact dashboard table. This is the type of indicator that professional crypto traders build as their primary chart tool. Study the architecture: modular sections, grouped inputs, UDT state management, and clean visualization.

pine-Master indicator: trend + momentum + volume + sessions
1//@version=5
2indicator("Master Indicator", overlay=true,
3 max_lines_count=50, max_labels_count=50)
4
5// ─── INPUTS ──────────────────────────────────────
6maLen = input.int(21, "EMA Length", group="Trend")
7atrLen = input.int(14, "ATR Length", group="Trend")
8atrMult = input.float(2.5, "Trail Multiplier", step=0.1,
9 group="Trend")
10rsiLen = input.int(14, "RSI Length", group="Momentum")
11showTable = input.bool(true, "Show Dashboard", group="Display")
12
13// ─── HELPERS ─────────────────────────────────────
14type State
15 int trend
16 float trailStop
17 float rsi
18 float macdHist
19 float rvol
20 int score
21 string session
22
23// ─── TREND ───────────────────────────────────────
24ema = ta.ema(close, maLen)
25atr = ta.atr(atrLen)
26
27var float trail = na
28var int tDir = 1
29lStop = close - atr * atrMult
30sStop = close + atr * atrMult
31
32if na(trail[1])
33 trail := lStop
34 tDir := 1
35else if tDir == 1
36 trail := math.max(nz(trail[1]), lStop)
37 if close < trail
38 trail := sStop
39 tDir := -1
40else
41 trail := math.min(nz(trail[1]), sStop)
42 if close > trail
43 trail := lStop
44 tDir := 1
45
46// ─── MOMENTUM ────────────────────────────────────
47rsiVal = ta.rsi(close, rsiLen)
48[macdL, sigL, hist] = ta.macd(close, 12, 26, 9)
49
50rsiScore = rsiVal > 55 ? 1 : rsiVal < 45 ? -1 : 0
51macdScore = hist > 0 and hist > hist[1] ? 1 :
52 hist < 0 and hist < hist[1] ? -1 : 0
53
54// ─── VOLUME ──────────────────────────────────────
55rvol = volume / ta.sma(volume, 20)
56volBias = close > open ? 1 : -1
57volScore = rvol > 1.5 ? volBias : 0
58
59// ─── SESSION ─────────────────────────────────────
60tz = "America/New_York"
61inNY = not na(time("", "0930-1600", tz))
62inLondon = not na(time("", "0300-1130", tz))
63inAsia = not na(time("", "2000-0400", tz))
64sessName = inNY ? "NY" : inLondon ? "LON" :
65 inAsia ? "ASIA" : "OFF"
66
67// ─── COMPOSITE SCORE ─────────────────────────────
68trendScore = tDir
69total = trendScore + rsiScore + macdScore + volScore
70
71state = State.new(tDir, trail, rsiVal, hist, rvol,
72 total, sessName)
73
74// ─── VISUALIZATION ───────────────────────────────
75plot(ema, "EMA", tDir == 1 ? color.green : color.red, 2)
76plot(trail, "Trail", tDir == 1 ?
77 color.new(color.green, 30) :
78 color.new(color.red, 30), 2, plot.style_linebr)
79
80bgcolor(tDir == 1 ? color.new(color.green, 95) :
81 color.new(color.red, 95))
82
83// Entry signals: trail flip + momentum agreement
84bullEntry = tDir == 1 and tDir[1] == -1 and total >= 2
85bearEntry = tDir == -1 and tDir[1] == 1 and total <= -2
86
87plotshape(bullEntry, "Bull Entry", shape.triangleup,
88 location.belowbar, color.green, size=size.small)
89plotshape(bearEntry, "Bear Entry", shape.triangledown,
90 location.abovebar, color.red, size=size.small)
91
92// ─── DASHBOARD TABLE ─────────────────────────────
93if showTable and barstate.islast
94 t = table.new(position.top_right, 2, 6,
95 bgcolor=color.new(#0d0b14, 10),
96 border_width=1,
97 border_color=color.new(color.gray, 70))
98
99 addRow(tbl, r, lbl, val, c) =>
100 table.cell(tbl, 0, r, lbl, text_color=color.gray,
101 text_size=size.small)
102 table.cell(tbl, 1, r, val, text_color=c,
103 text_size=size.small)
104
105 addRow(t, 0, "Session", state.session, color.white)
106 addRow(t, 1, "Trend",
107 state.trend == 1 ? "▲ Bull" : "▼ Bear",
108 state.trend == 1 ? color.green : color.red)
109 addRow(t, 2, "RSI",
110 str.tostring(state.rsi, "#.#"),
111 state.rsi > 70 ? color.red :
112 state.rsi < 30 ? color.green : color.white)
113 addRow(t, 3, "RVOL",
114 str.tostring(state.rvol, "#.##") + "x",
115 state.rvol > 2 ? color.yellow :
116 state.rvol > 1 ? color.green : color.gray)
117 addRow(t, 4, "MACD Hist",
118 str.tostring(state.macdHist, "#.##"),
119 state.macdHist > 0 ? color.green : color.red)
120 addRow(t, 5, "Score",
121 str.tostring(state.score) + "/4",
122 state.score >= 3 ? color.green :
123 state.score <= -3 ? color.red : color.yellow)
1

Trend layer: EMA + ATR trailing stop

The EMA provides the directional bias. The ATR trailing stop provides the objective exit level. When the trail flips from bearish to bullish (price crosses above the trailing stop), it is a potential entry. The trail adapts to volatility automatically: wider during BTC liquidation cascades, tighter during low-volatility consolidation.
2

Momentum layer: RSI + MACD scoring

RSI above 55 scores +1, below 45 scores -1. MACD histogram rising and positive scores +1, falling and negative scores -1. This creates a -2 to +2 momentum component. The scoring system avoids the "noise zone" in the middle where signals are unreliable.
3

Volume confirmation

RVOL above 1.5 on a bullish bar scores +1, on a bearish bar scores -1. Below 1.5 scores zero. This ensures that high-conviction signals require volume participation. Thin-volume signals are filtered out by the scoring system automatically.
4

Entry signal: trail flip + score filter

An entry signal fires only when the ATR trailing stop flips direction AND the composite score agrees (at least +2 for longs, -2 or lower for shorts). This produces rare but high-quality signals. On BTC 4H, expect 2–4 signals per month. Each one represents a moment where trend, momentum, and volume all align simultaneously.

Making it your own

This master indicator is a starting template, not a finished product. Every trader has a unique style. You might add Ichimoku cloud integration, swap RSI for Stochastic, add divergence detection to the momentum layer, or integrate funding rate data for crypto perpetuals. The architecture (modular sections, UDT state, grouped inputs, separated visualization) scales to any level of complexity. Start with this, then iterate until it matches your exact decision-making process.
Total lines of code~120 lines. A complete multi-system indicator should stay under 200 lines by using helper functions and UDTs.
request.security() callsZero in this version. All data comes from the current chart timeframe. Add MTF data by bundling into one tuple call.
Drawing object countControlled via max_lines_count and max_labels_count. Set these in the indicator() declaration to avoid hitting limits.
Performance profileRuns in <50ms on 10,000-bar 1-minute BTC charts. The UDT is constructed once per bar: no redundant calculations.
Customization surface6 inputs across 3 groups. Users can adjust trend sensitivity, momentum parameters, and display preferences independently.
Module Quiz

1.In PineScript, what is the difference between 'overlay=true' and 'overlay=false' in the indicator() declaration?

2.What does 'alertcondition()' require that 'alert()' does not?

3.When building a custom indicator, what is the purpose of 'input.int()' and 'input.float()'?

4.Why would you use a User-Defined Type (UDT) in a PineScript indicator?

5.What is the recommended maximum number of request.security() calls per PineScript script?

0/5 answered

Put this lesson to work

Free on Thrive, no account needed.