supertrend
Supertrend line (ATR stop that flips with price).
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
| Name | Type | Description |
|---|---|---|
atrLengthoptional | int default 10 | ATR period. |
factoroptional | float 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