Skip to main content
Indicators designed to identify and follow market trends. These help determine trend direction, strength, and potential reversal points.

Overview

FunctionDescription
adx()Average Directional Index - measures trend strength
supertrend()Trend-following indicator with dynamic support/resistance
ichimoku()Comprehensive trend analysis with multiple components

adx()

Average Directional Index - measures trend strength regardless of direction.

Signature

adx(source: TimeSeries, period?: number = 14): number

Parameters

ParameterTypeDescription
sourceTimeSeriesOHLC data series
periodnumberCalculation period (default: 14)

Returns

number - ADX value (0-100, higher = stronger trend)

Interpretation

ADX ValueTrend Strength
0-25Weak or no trend
25-50Strong trend
50-75Very strong trend
75-100Extremely strong trend

Example

//@version=2

define(title="ADX Trend Strength", position="offchart", axis=true);

timeseries ohlcvData = ohlcv(symbol=currentSymbol, exchange=currentExchange);

var adxValue = adx(source=ohlcvData, period=14);

// Color based on trend strength
var colorIndex = adxValue > 25 ? 0 : 1;

plotLine(value=adxValue, width=2, colors=["green", "gray"], colorIndex=colorIndex, label=["ADX"], desc=["Average Directional Index"]);
hline(value=25, color="orange", width=1, style="dashed", label="Trend Threshold");

supertrend()

Trend-following indicator that provides dynamic support and resistance levels.

Signature

supertrend(source: TimeSeries, period?: number = 10, multiplier?: number = 3): [number, number]

Parameters

ParameterTypeDescription
sourceTimeSeriesOHLC data series
periodnumberATR period (default: 10)
multipliernumberATR multiplier (default: 3)

Returns

[number, number] - [supertrend value, direction (1=bullish, -1=bearish)]

Example

//@version=2

define(title="Supertrend", position="onchart", axis=false);

timeseries ohlcvData = ohlcv(symbol=currentSymbol, exchange=currentExchange);

var supertrendData = supertrend(source=ohlcvData, period=10, multiplier=3);

plotLine(value=supertrendData, width=2, colors=["green", "red"], label=["Supertrend"], desc=["Supertrend Indicator"]);

ichimoku()

Ichimoku Cloud - comprehensive trend analysis system with multiple components.

Signature

ichimoku(source: TimeSeries, conversionPeriod?: number = 9, basePeriod?: number = 26, spanPeriod?: number = 52): object

Parameters

ParameterTypeDescription
sourceTimeSeriesOHLC data series
conversionPeriodnumberTenkan-sen period (default: 9)
basePeriodnumberKijun-sen period (default: 26)
spanPeriodnumberSenkou Span B period (default: 52)

Components

ComponentDescription
Tenkan-senConversion line (short-term trend)
Kijun-senBase line (medium-term trend)
Senkou Span ALeading span A (cloud boundary)
Senkou Span BLeading span B (cloud boundary)
Chikou SpanLagging span

Example

//@version=2

define(title="Ichimoku Cloud", position="onchart", axis=false);

timeseries ohlcvData = ohlcv(symbol=currentSymbol, exchange=currentExchange);

var ichimokuData = ichimoku(source=ohlcvData, conversionPeriod=9, basePeriod=26, spanPeriod=52);

plotLine(value=ichimokuData, width=1, colors=["blue", "red", "green", "orange"], label=["Tenkan", "Kijun", "Span A", "Span B"], desc=["Conversion Line", "Base Line", "Leading Span A", "Leading Span B"]);

Tips

Trend Confirmation

Use multiple trend indicators together for stronger confirmation. ADX tells you trend strength, while Supertrend and Ichimoku show direction.

Timeframe Selection

Trend indicators work best on higher timeframes (4H, Daily) for reliable signals. Lower timeframes produce more noise.

Entry Timing

Use trend indicators to determine overall direction, then use oscillators or price action for entry timing.