Supertrend Strategy

ATR-based trailing stop strategy that flips direction when price crosses the Supertrend line.

A Supertrend strategy sounds simple on paper: buy when the indicator flips bullish, sell when it flips bearish, and follow the trend for as long as it lasts. The problem is that markets are rarely that clean.

Supertrend Strategy on US Wall St 30 (OANDA) 1-hour chart showing long and short entries with trend shading
Figure 1. Supertrend Strategy (10, 3) applied to OANDA:US30USD on a 1-hour timeframe showing directional entries and trend fill zones.

Supertrend is a useful trend-following tool, but turning it into a tradable strategy requires more than taking every colour change on the chart. In trending conditions it can work well. In sideways conditions it can whipsaw badly. That means the real challenge is not understanding what Supertrend does. The real challenge is deciding when its signals are worth acting on.

If you want a deeper explanation of how the indicator itself works, including ATR length, multiplier, and how the line is calculated, read the Supertrend indicator guide first.

Why Supertrend is useful for strategy building

Supertrend has a few qualities that make it attractive as the foundation of a rules-based strategy.

First, it gives a very clear directional state. The line sits below price in bullish conditions and above price in bearish conditions. That makes it easy to define whether a strategy should currently be looking long, short, or not trading at all.

Second, it is volatility-adjusted. Because it is based on ATR, the line automatically gives price more room in fast conditions and less room in quieter ones. That makes it more practical than using a fixed stop distance across every market environment.

Third, it is simple enough to test properly. That matters. Many trading ideas fail not because they are too basic, but because they are too vague. Supertrend is structured enough to turn into clear entry, exit, and filter rules.

That said, simplicity cuts both ways. A strategy built around Supertrend can also become too reactive if you do not control when signals are allowed.

The problem with raw Supertrend entries

The most obvious Supertrend strategy is:

That is a valid starting point, but it is rarely a strong finished strategy.

The issue is that Supertrend is still a lagging trend-following tool. In a clean trend, that is fine. In a range, price can cross back and forth through the line repeatedly. That creates a string of small losses with no sustained move to recover them.

This is why a raw Supertrend strategy often looks acceptable on a chart screenshot but much worse in a proper backtest. The chart highlights the big runs. The backtest exposes the chop.

A usable Supertrend strategy usually needs at least one of these improvements:

A better Supertrend strategy

My preferred way to use Supertrend is not as a stand-alone signal generator, but as the primary trigger inside a long-biased filtered strategy.

That long bias matters.

If I am trading broad equity indices, one of the first things I want to establish is whether the strategy should really be trading both directions at all. In my experience, the most profitable use of Supertrend on indices is often on the long side, not the short side. Indices have a structural tendency to reward bullish trend-following more consistently than bearish trend-following, and Supertrend is fundamentally a trend tool. That combination makes long-only or long-biased designs a very sensible place to start.

A clean version of the strategy looks like this:

| Component | Role | Question it answers | |---|---|---| | Supertrend | Immediate bullish trend flip | Has the short-term trend state turned bullish? | | EMA | Broader trend bias | Is the broader direction supportive of longs? | | RSI | Optional momentum confirmation | Is momentum confirming the move? | | Supertrend (trailing) | Trailing stop reference | Where should the stop follow price? |

That is a much better structure than taking every Supertrend flip in both directions and hoping the market behaves cleanly.

Why I favour long-only first

Before worrying about optimisation, I think this is one of the first questions that should be asked:

> Does this market actually reward short trades in the same way it rewards long trades?

> For many broad indices, the answer is often no.

Bearish moves can be sharp, but they are also frequently less stable, more violent, and more prone to reversal than bullish trends. A Supertrend short signal on an index can easily appear during a pullback or a burst of volatility, only for price to recover and resume the broader uptrend. That makes short-side trend-following much less attractive than it may look at first glance.

So rather than starting with a symmetrical long/short model, I think it is usually better to start here:

That approach is usually cleaner, easier to understand, and often more profitable.

Example strategy logic

This example uses three layers:

Long rules

Enter long when:

Exit rules

Exit long when:

That structure keeps the strategy focused on the side of the market that often behaves most cleanly on indices. It also gives the trade room to stay open while the trend remains intact, rather than forcing a fixed target that may cut strong bullish runs short.

Optional short rules

Short trades can still be tested, but I would treat them as optional rather than core.

Enter short when:

Exit short when:

The reason I place this second is simple: on indices, shorts should usually have to prove they deserve a place in the strategy. Longs should not.

Why these filters help

The EMA filter helps solve one of the biggest problems with raw Supertrend signals: taking trades against the broader market structure.

For example, if price is above a rising 200 EMA, then a bearish Supertrend flip is often just a temporary pullback inside a larger uptrend. Blocking those short trades can remove a lot of low-quality signals. On the long side, that same EMA filter helps keep the strategy aligned with the broader direction of the market, which is exactly where a trend-following indicator like Supertrend tends to perform best.

The RSI filter adds another layer of quality control. I would not use it here as a traditional overbought or oversold signal. A much better use is simply to treat RSI above 50 as supportive bullish momentum. That helps avoid long entries where Supertrend flips bullish but the move still lacks real momentum.

Neither filter is magic. The goal is not to predict every winning trade. The goal is to cut out the weaker Supertrend signals and focus the strategy on the conditions where it is most likely to perform well.

Long-only versus long/short

This is one of the most important design decisions in the whole strategy.

If I am trading broad equity indices, I would usually begin by assuming that a long-only Supertrend strategy is the right benchmark. That matches both the upward bias of the instrument and the natural strength of Supertrend as a trend-following tool.

A full long/short version may still be worth testing, but it should be compared against the long-only baseline rather than treated as the default model.

For forex, commodities, or markets with more balanced two-way behaviour, a full long/short Supertrend strategy may make much more sense.

That is why strategy design has to come before optimisation. The same Supertrend logic can behave very differently depending on the instrument, and on indices one of the most important edges may simply come from recognising that the long side deserves priority.

Risk management matters more than the entry

A Supertrend strategy is still only as good as its risk model.

Even if the entry logic is sound, poor position sizing can ruin the whole system. This is especially important if you are trading small timeframes, volatile instruments, or prop-firm style constraints where daily loss and max drawdown matter more than raw expectancy.

A practical approach is:

In other words, the Supertrend line can define more than your exit. It can also define the initial risk distance.

That is often far more robust than choosing an arbitrary lot size and hoping the stop happens to make sense.

// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at https://mozilla.org/MPL/2.0/.
// Copyright (c) 2026 - BuildTradingStrategies.com / TradeXecution.com

//@version=6
strategy("Supertrend Strategy", overlay=true, pyramiding=0, initial_capital=10000)

// Inputs
atrPeriod   = input.int(10, "ATR Period", minval=1)
factor      = input.float(3.0, "Supertrend Factor", step=0.1)
emaLength   = input.int(200, "EMA Length", minval=1)
useRSI      = input.bool(true, "Use RSI Filter")
rsiLength   = input.int(14, "RSI Length", minval=1)
allowLongs  = input.bool(true, "Allow Long Trades")
allowShorts = input.bool(false, "Allow Short Trades")

// Core calculations
[supertrend, direction] = ta.supertrend(factor, atrPeriod)
emaValue = ta.ema(close, emaLength)
rsiValue = ta.rsi(close, rsiLength)

// Trend state
bullishTrend = direction < 0
bearishTrend = direction > 0

// Confirmed flips
bullishFlip = ta.change(direction) < 0 and barstate.isconfirmed
bearishFlip = ta.change(direction) > 0 and barstate.isconfirmed

// Filters
longFilter  = close > emaValue and (not useRSI or rsiValue > 50)
shortFilter = close < emaValue and (not useRSI or rsiValue < 50)

// Entries
longEntry  = allowLongs and bullishFlip and longFilter
shortEntry = allowShorts and bearishFlip and shortFilter

if longEntry
    strategy.entry("Long", strategy.long)

if shortEntry
    strategy.entry("Short", strategy.short)

// Supertrend trailing stops
longStop  = strategy.position_size > 0 and bullishTrend ? supertrend : na
shortStop = strategy.position_size < 0 and bearishTrend ? supertrend : na

strategy.exit("Long Exit", from_entry="Long", stop=longStop)
strategy.exit("Short Exit", from_entry="Short", stop=shortStop)

// Opposite flip exits
if strategy.position_size > 0 and bearishFlip
    strategy.close("Long")

if strategy.position_size < 0 and bullishFlip
    strategy.close("Short")

// Plots
plot(bullishTrend ? supertrend : na, "Bullish Supertrend", color=color.green, style=plot.style_linebr, linewidth=2)
plot(bearishTrend ? supertrend : na, "Bearish Supertrend", color=color.red, style=plot.style_linebr, linewidth=2)
plot(emaValue, "EMA", color=color.blue)

plotshape(longEntry, title="Long Entry", location=location.belowbar, style=shape.triangleup, color=color.green, size=size.small)
plotshape(shortEntry, title="Short Entry", location=location.abovebar, style=shape.triangledown, color=color.red, size=size.small)

This strategy is intentionally simple. That makes it easier to understand and test, but it also means there is room to refine it.

The script uses Supertrend as the primary trigger, a 200 EMA as a trend filter, optional RSI confirmation, Supertrend-based trailing stops, and confirmed-bar entries only.

How I would improve this strategy further

I've kept the base version of this strategy intentionally simple. That matters, because simple strategies are easier to understand, easier to test properly, and easier to improve without losing sight of what is actually driving performance.

Once I have that base in place, the next step is not to start adding filters at random. The next step is to look at the backtest and ask a better question: where is the strategy actually weak?

One of the first refinements I would make is to turn the RSI confirmation level into an input rather than fixing it at 50. RSI above 50 is a reasonable default because it suggests bullish momentum, but I would not assume it is the best value for every market. In some cases, a higher threshold such as 55 or 60 can do a better job of filtering out weaker long entries and forcing the strategy to participate only when momentum is more clearly aligned. The trade-off is that stronger filtering usually means fewer trades and sometimes later entries, so this is something I would always test rather than hardcode.

Beyond that, these are the main extensions I would consider.

Trade long-only on index markets. This is one of the most important improvements in my view. Broad indices tend to reward bullish trend-following more consistently than bearish trend-following, so removing shorts can often improve both stability and overall expectancy.

Add an ADX filter to block weak-trend conditions. Supertrend tends to perform best when the market is actually trending. If the backtest shows repeated losses in sideways conditions, adding ADX can be a sensible way to avoid taking flips when trend strength is weak.

Restrict trading to specific sessions. Some markets behave far better during their main session than they do during quieter periods. If the strategy is taking low-quality entries outside the best trading hours, I would test whether session filtering improves the results.

Require a retest of the Supertrend line before entry. Instead of entering immediately on the initial flip, I can require price to pull back and confirm the move. That can help avoid chasing entries after an already extended move, although it may also reduce trade frequency and miss some strong breakouts.

Use fixed-risk position sizing. This is one of the most practical improvements because it strengthens the strategy without changing the core entry logic. I want position size to be driven by the stop distance and the amount I am prepared to lose on the trade, not by an arbitrary lot size or contract size.

Add a higher-timeframe directional filter. A lower-timeframe Supertrend entry often becomes more reliable when it is aligned with the broader direction on a higher timeframe. That is a simple way to stop the strategy from fighting the larger market structure.

The right improvement depends entirely on what the backtest is telling me.

If the strategy struggles in chop, I would look at adding a trend-quality filter such as ADX or a higher-timeframe bias. If entries are too late, I would look at reducing lag by testing different Supertrend settings or lowering the RSI confirmation threshold. If there are too many weak entries, I would test whether increasing the RSI requirement from 50 to 55 or 60 improves trade quality. If drawdowns are too large, I would fix the risk model first before I touched the signal logic.

That is really the key point: I do not want to keep adding filters just to make the strategy look more sophisticated. I want each change to solve a specific problem the testing has already exposed.

Who this strategy suits

A Supertrend strategy suits traders who want:

It is less suitable for traders who want frequent reversal entries or who expect every signal to fire near the exact turning point. That is not what Supertrend is designed for.

Final thoughts

Supertrend is a useful building block for a strategy, but it is rarely enough on its own.

The strongest way to use it is usually as a trigger inside a broader framework that controls direction, momentum, and risk. Once you do that, it becomes much more than just a line flipping from green to red. It becomes a structured way to participate in trends while staying honest about where trend-following systems tend to fail.

If you want to understand the mechanics behind the line itself, including ATR length, multiplier, and how the indicator works under the hood, go back to the Supertrend indicator page.