NEWCard payments are live · from $18/month, USDT also acceptedSee plans
COINPRED / STRATEGY LIBRARY

BTC SuperFlip: Supertrend Flips with an EMA Trend Filter

An open-source (MPL 2.0) trend-following strategy from blitz_algo. Entries and exits are Supertrend flips (ATR 10, factor 1.8 by default), allowed only when the close is on the same side of a 200-period EMA. The optional ADX filter and percent stop/target are off by default. The author describes it on BTCUSD, 1-hour. Rules follow the source; no invented backtest figures.

Illustrated guidesPine Script®Included with monthly & annual plans
← All strategies
blitz_algo · 1.0 · 2026-11-21 · Trend following
BTC SuperFlip: Supertrend Flips with an EMA Trend Filter

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.

Author chart of the SuperFlip Supertrend and EMA filter strategy on BITSTAMP:BTCUSD
Author chart: BITSTAMP:BTCUSD, from the publication page. The author says the script was tuned on the 1-hour chart. The image shows the Supertrend band, the EMA, and markers; it only illustrates appearance and is not a Coinpred backtest.

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)

InputDefaultPurpose
Supertrend ATR Length10ATR length for Supertrend
Supertrend Factor1.8Supertrend band multiplier
EMA Trend Filter Length200EMA period used as the directional filter
Enable Stop LossfalseTurn on the percent stop; off by default
Enable Take ProfitfalseTurn on the percent target; the exit is only submitted if the stop is also on
Stop Loss %4.0Stop distance as a percent of average entry
Take Profit %8.0Target distance as a percent of average entry
Enable ADX FilterfalseRequire ADX above the threshold for new entries
ADX Length / Smoothing / Threshold14 / 14 / 20DMI/ADX settings and cutoff
Visual optionsAdjustableGradient 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

  1. Download the .pine file from Coinpred (active membership required, see below), or check the original page for a newer version.
  2. Open the Pine Editor, create a blank script, paste the full source, and save.
  3. Click Add to chart. To follow the author’s setup, start with BTCUSD on the 1-hour timeframe.
  4. Decide whether to enable the ADX filter and the percent stop or target, then review fills in the Strategy Tester.
  5. 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.

Source, license and version

Mozilla Public License 2.0 (MPL 2.0),源码头注明 © blitz_locked;TradingView 发布账号为 blitz_algo。再分发须保留原版权与许可声明;如修改源码文件,修改后的文件仍须按 MPL 2.0 提供。Coinpred 未修改源码。 / Licensed under MPL 2.0 per the source header, © blitz_locked (published as blitz_algo). Redistribution must keep the copyright and license notices; modified files must remain under MPL 2.0. Coinpred ships the unmodified source.

View original source ↗

Check the script license and your TradingView account features. Historical results do not guarantee future performance.