Home/Dovee/Function reference

supertrend

Supertrend line (ATR stop that flips with price).

Reference/Trend/Function

supertrend(atrLength, factor)

Argument order is ATR length then factor — supertrend(10, 3). That is the Dovee/chart convention, not Pine’s (factor, atrPeriod). The value is the trailing line: below price in an uptrend, above in a downtrend.

Parameters

NameTypeDescription
atrLengthoptionalint
default 10
ATR period.
factoroptionalfloat
default 3
ATR multiple.

Return value

series

Note

  • Defaults are length 10 and factor 3 if you write supertrend().

Example

st = supertrend(10, 3)
plot st as "Supertrend" orange
when close crosses above st
  buy
when close crosses below st
  exit

See also