1Copy the scriptPress Copy script above, or the copy button on the code below.
2Open the Pine EditorOpen a TradingView chart and choose Pine Editor at the bottom of the screen.
3Paste over the templateCreate a new strategy, select all of the template text and paste. Press Save and give it a name.
4Add it to the chartPress Add to chart. The trades and results appear in the Strategy Tester tab; adjust the settings with the gear icon.
Source Code
82 lines of Pine Script v5 from 12_Supertrend/12_Supertrend.pine, published under MPL-2.0 (file header). Keep the author's credit and licence lines when you reuse it.
The primary Supertrend (factor 3, period 10) signals flips for entries, confirmed optionally by a faster Supertrend (factor 2, period 7). An optional 200-period EMA filters trends. ATR (length 14) sets stop loss and trailing stops. Long entries trigger on bullish flip with confirmation and EMA alignment, exiting on bearish flip or opposite signal. Short trades mirror this logic. Plots Supertrend lines for dynamic trailing. Settings control Supertrend parameters, dual confirmation, EMA filter, ATR length, and risk multipliers. No pyramiding or exit rules beyond Supertrend flips.
The inputs you can change from the gear icon on the chart. Defaults are the author's.
Setting
Type
Default
Variable
Supertrend Factor 1
float
3.0
stFactor1
Supertrend Period 1
int
10
stPeriod1
Supertrend Factor 2 (Fast)
float
2.0
stFactor2
Supertrend Period 2 (Fast)
int
7
stPeriod2
Use Dual Supertrend Confirmation
bool
true
useDualST
Trend Filter EMA
int
200
emaLength
Use EMA Trend Filter
bool
false
useTrendFilter
ATR Length
int
14
atrLength
ATR Multiplier for SL
float
2.0
atrMult
Trailing Stop ATR Mult
float
2.5
trailAtrMult
Third-party code. ForexR did not write, test or endorse this script, and the summary above was generated automatically from its code and README. Indicators describe the past, and a strategy's backtest can look better than live trading, especially when a script repaints. Check it in the Strategy Tester and on a demo account before you rely on it.
This strategy calculates Bollinger Bands and Aroon oscillator values to identify mean-reversion opportunities. It enters a long position using full equity when the closing price crosses below the lower Bollinger Band while Aroon Up remains above a user-specifi
This overlay strategy targets one-minute ES futures and plots volume-weighted moving-average bands from the open, scaled by a standard-deviation multiple, plus a slower band from ten-minute opens. A higher-timeframe exponential moving average can filter trades
STRG-BBForce is a Bollinger Bands trend-following strategy. It calculates standard Bollinger Bands and tracks directional alignment across the upper, lower, and basis lines. When all three lines slope upward, it opens a long position and closes short positions
This strategy uses multiple VWAP anchors and a custom Lull indicator to generate buy and sell signals on the Nasdaq price chart. It plots the VWAP trend line and three VWAP anchors with customizable colors and mitigation methods. The Lull indicator produces si
This strategy implements a single-layer perceptron machine learning model built from scratch to generate trading signals directly on the price chart. It calculates predictions based on sample size, threshold settings, and optional volatility or volume filters.
This overlay strategy plots a two-timeframe Ichimoku setup on the price chart, with Tenkan, Kijun, Chikou, and Kumo from a base higher timeframe and an optional highest-timeframe cloud. It allows two entries in the same direction and uses ATR-based trailing st