The idea
This open-source script is published by blitz_algo; the source header is copyrighted to blitz_locked, almost certainly the same author. The script title is “BTCUSD Supertrend + EMA Trend Filter (1H)”. Supertrend direction flips are the trigger, and a longer EMA blocks trades that go against that slower bias. The author is explicit: this is a trend system, not mean reversion, so the win rate is often lower and the account depends on a smaller number of larger runs.
The publication text is written for BTCUSD on the 1-hour chart, so this page is filed under BTC. The script is not hard-coded to one symbol and will load elsewhere, but the walkthrough and the image stay with the author’s chart. Page metadata names the preview symbol as BITSTAMP:BTCUSD; the recommended timeframe, in both the title and the write-up, is 1-hour. The ADX filter and the percent stop and target are all off in the defaults.

Indicators
- Supertrend is ta.supertrend(factor, atrPeriod), default factor 1.8 and ATR length 10. Pine returns a Supertrend line and a direction value: below 0 is an uptrend, above 0 a downtrend.
- Flips: bullFlip is ta.change(direction) < 0 (direction turned up); bearFlip is ta.change(direction) > 0 (turned down).
- Trend filter: trendEMA = ta.ema(close, emaLen), default length 200.
- Optional ADX: ta.dmi(adxLen, adxSmooth) supplies adx, both lengths default to 14. The adx > threshold test (default 20) runs only when Enable ADX Filter is on; it is off by default.
Entry rules
- Long: a bullFlip, with the close above trendEMA, and the ADX test passing (always true when the filter is off). The tester name is Long.
- Short: a bearFlip, with the close below trendEMA, and the ADX test passing. The tester name is Short.
- There is no long-only or short-only input; both sides can be entered.
- The tester defaults to 25% of equity, 0.075% commission, slippage 1, and 10,000 initial capital.
Exits and position sizing
- The primary exit is the opposite Supertrend flip: bearFlip closes Long; bullFlip closes Short. That close still happens if the EMA filter blocks a reverse entry.
- Percent stop and take-profit are off by default (4% and 8%). The strategy.exit that places the target sits inside if enableSL, so turning on take-profit alone never submits that exit.
- When both are enabled, the exit is only placed while a position is open: long stop at average entry × (1 − stop %), target at average entry × (1 + target %); shorts use the inverse.
- The chart plots Supertrend with a glow and an optional gradient fill, an orange EMA, flip triangles, and smaller circles for actual entries. A flip can show a triangle without an entry circle if the EMA or ADX filter rejects it. Bar and background tinting are off by default.
Inputs (source defaults)
| Input | Default | Purpose |
|---|---|---|
| Supertrend ATR Length | 10 | ATR length for Supertrend |
| Supertrend Factor | 1.8 | Supertrend band multiplier |
| EMA Trend Filter Length | 200 | EMA period used as the directional filter |
| Enable Stop Loss | false | Turn on the percent stop; off by default |
| Enable Take Profit | false | Turn on the percent target; the exit is only submitted if the stop is also on |
| Stop Loss % | 4.0 | Stop distance as a percent of average entry |
| Take Profit % | 8.0 | Target distance as a percent of average entry |
| Enable ADX Filter | false | Require ADX above the threshold for new entries |
| ADX Length / Smoothing / Threshold | 14 / 14 / 20 | DMI/ADX settings and cutoff |
| Visual options | Adjustable | Gradient fill, flip markers, color preset, bar/background tint |
Things to know before using it
- No stop is on by default. Bitcoin can move a long way before Supertrend flips. The author also warns that a stop should be considered before live or leveraged use.
- The default size is 25% of equity, not 100%. Changing that size changes drawdown and compounded equity; tester totals are not a live forecast.
- The script does not pin a symbol, but the author describes BTCUSD on the 1-hour chart. Other venues or timeframes need their own review.
- The copyright line says blitz_locked and the publication account is blitz_algo. This page uses the publication name and keeps the source copyright notice.
Installing it on TradingView
- Download the .pine file from Coinpred (active membership required, see below), or check the original page for a newer version.
- Open the Pine Editor, create a blank script, paste the full source, and save.
- Click Add to chart. To follow the author’s setup, start with BTCUSD on the 1-hour timeframe.
- Decide whether to enable the ADX filter and the percent stop or target, then review fills in the Strategy Tester.
- Past tester results do not guarantee future returns.
About backtest figures
Source, license and version
- Source: https://www.tradingview.com/script/NgSIfKQx-Bitcoin-SuperFlip-Supertrend-EMA-Trend-Following-Strategy/
- Author: blitz_algo (source header © blitz_locked). Source version 1.0 (Pine v6), scriptAccess=open_no_auth.
- License: Mozilla Public License 2.0. Redistribution must keep the copyright and license notices; modified files must remain under MPL 2.0. Coinpred ships the unmodified full source.
- Members can download the .pine file on this page to study the rules. Judge the risk yourself, and follow your venue’s rules.