Pine Script v5 · Strategy
adx efi 50 ema channel, trend pullback
A Pine Script v5 strategy built on BB (ohlc4, 50), SAR (.1, .1) and EMA (hlc3, 50). It has 5 order rules, 2 entries among them, and trades long and short with the default settings. Exits use a stop loss and a profit target. Each trade is one contract and pays no commission. It has no settings.
Generated from the script's code by a template: every clause is a fact read from the source. Not written by a person or a model, and not taken from the author's description.
- Does adx efi 50 ema channel, trend pullback repaint?
- No
- No repainting patterns were found in the source. The live replay was not measured: it had no trades to compare.
- How did adx efi 50 ema channel, trend pullback do on BTCUSDT 1D with default settings?
- Not measured
- It closed no trades there from 26 Jan 2024 to 21 Oct 2026 with the default settings, so there is no result to report. Its entry conditions never all held on this data. It closed no trades on the other markets either. A backtest, not investment advice.
- Does adx efi 50 ema channel, trend pullback run in Pine Script v6?
- Not tested
- Neither version placed a trade on any of the 8 markets, so there was nothing to compare. The v6 version is shown for reference and is not offered as a download.
- Does adx efi 50 ema channel, trend pullback use a stop loss?
- Yes
- strategy.exit sets a stop on line 66, 70.
- Does adx efi 50 ema channel, trend pullback run in Zeal Terminal?
- Yes
- It compiles in 24 ms and runs 1,000 bars in 67 ms, in the browser.
BTCUSDT · 1D · default settings
- Plot
- Plot
- Plot
- Plot
- Plot
- Plot
- Plot
- Plot
- Plot
- Plot
- Plot
- Plot
- Plot
- Winning trade
- Losing trade
- Equity
- Net profit
- 0.00%
- $0.00
- Buy and hold
- +102.5%
- same period
- Closed trades
- 0
- 0 won · 0 lost
- Profitable
- 0.0%
- of closed trades
- Profit factor
- —
- gross profit ÷ gross loss
- Max drawdown
- 0.00%
- $0.00
One run with the author's default settings, $100,000 starting capital, commission as the script sets it. A single backtest says little about future results and is not a recommendation. Backtests are simulations on historical data and are not investment advice.
Review
What a careful reader of this script would point out, found by checking the source and the backtest.
-
Check
No commission
The backtest assumes free trading. Results on any real exchange will be lower.
-
Note
No slippage
Fills are assumed at the exact open price. Add slippage in the properties for a more realistic test.
-
Note
Uses an argument v6 removed
when = on line 65, 67, 69. The upgraded version below moves each call inside an if block.
Settings
Every input the script declares, with its default and what it feeds. Bounds are the ones the script enforces.
The script declares no settings.
What it calculates
- BBohlc4, 50, 3
basis · line 6 - BBohlc4, 50, 3
upperband · line 6 - BBohlc4, 50, 3
lowerband · line 6 - BBohlc4, 50, 2
basis2 · line 7 - BBohlc4, 50, 2
upperband2 · line 7 - BBohlc4, 50, 2
lowerband2 · line 7 - SAR.1, .1, .09
psar · line 8 - EMAhlc3, 50
ema50 · line 9 - EMAhigh, 50
ema50hi · line 10 - EMAlow, 50
ema50lo · line 11 - WMAhlc3, 15
ema18 · line 12 - WMAopen, 9
wma9 · line 13 - WMAohlc4, 5
wma5 · line 14 - RMAhlc3, 10
ema34 · line 15 - MACDhlc3, 5, 34, 5
macdline · line 16 - MACDhlc3, 5, 34, 5
signalline · line 16 - MACDhlc3, 5, 34, 5
histline · line 16 - MACDhlc3, 15, 70, 24
macdline2 · line 17 - MACDhlc3, 15, 70, 24
signalline2 · line 17 - MACDhlc3, 15, 70, 24
histline2 · line 17 - DMI20, 20
diplus · line 18 - DMI20, 20
diminus · line 18 - DMI20, 20
adx · line 18 - DMI12, 12
diplus2 · line 19 - DMI12, 12
diminus2 · line 19 - DMI12, 12
adx2 · line 19 - RSIhlc3, 14
rsi · line 20 - SMArsi, 10
rsisma · line 21 - Stochclose, high, low, 21
stoch · line 22 - WMAstoch, 3
k · line 23 - WMAk, 3
d · line 24 - WMAhlc3, 300
trendline5 · line 25 - WMAopen, 540
trendline9 · line 26 - WMAopen, 1080
trendline18 · line 27 - ATR14
atr · line 28 - RMA / Changeta.change(close) * volume, 15
efi · line 43 - RMA / Changeta.change(close) * volume, 120
efi2 · line 44
Signal flow
How price data and settings reach the orders. Each box is a name in the script, or several computed the same way; each arrow is a value one of them reads. Hover a box for its members.
The script has 70 named inputs, calculations, conditions and outputs, too many to draw legibly here; the tables above list them.
Order rules
| Order | Fires when | By default | Line |
|---|---|---|---|
| Open buy long | buytrigema34 >= ema50lo | On | 65 |
| Exit exit buy stop and limit | (buy) | On | 66 |
| Close close | ta.crossunder(ema34, ema50lo) | On | 67 |
| Open sell short | selltrigema34 <= ema50hi | On | 69 |
| Exit exit sell stop and limit | (sell) | On | 70 |
Each order is guarded by the setting shown. “Off” orders never fire unless that setting is switched on.
Does it repaint?
No
No repainting patterns in the source.
- ClearHigher-timeframe dataThe script requests no other symbol or timeframe.
- ClearFuture-bar referencesNo negative history offsets such as close[-1].
- ClearIntrabar recalculationNo varip, calc_on_every_tick or realtime-only state. Orders are decided once per closed bar.
- ClearOrder timingOrders fill at the next bar's open, after the signal bar has closed.
The checks read the source; the replay runs it. Together they catch the common causes, not every possible one.
Other markets
The same script with default settings on 8 Binance markets. Each row is a separate backtest over the most recent 1,000 bars.
| Market | Net | Buy and hold | Trades | Won | Profit factor | Max drawdown | Period |
|---|---|---|---|---|---|---|---|
| BTCUSDT 1D | 0.0% | +102.5% | 0 | 0% | — | 0.0% | 26 Jan 2024 – 21 Oct 2026 |
| BTCUSDT 4h | 0.0% | +5.5% | 0 | 0% | — | 0.0% | 8 May 2026 – 21 Oct 2026 |
| ETHUSDT 1D | 0.0% | +9.8% | 0 | 0% | — | 0.0% | 26 Jan 2024 – 21 Oct 2026 |
| ETHUSDT 4h | 0.0% | +8.4% | 0 | 0% | — | 0.0% | 8 May 2026 – 21 Oct 2026 |
| SOLUSDT 1D | 0.0% | +16.7% | 0 | 0% | — | 0.0% | 26 Jan 2024 – 21 Oct 2026 |
| SOLUSDT 4h | 0.0% | +21.5% | 0 | 0% | — | 0.0% | 8 May 2026 – 21 Oct 2026 |
| BNBUSDT 1D | 0.0% | +148.3% | 0 | 0% | — | 0.0% | 26 Jan 2024 – 21 Oct 2026 |
| BNBUSDT 4h | 0.0% | +17.1% | 0 | 0% | — | 0.0% | 8 May 2026 – 21 Oct 2026 |
Backtests are simulations on historical data and are not investment advice.
Similar scripts
Indicators and strategies built from the same calculations, run on BTCUSDT 1D with their own defaults so they can be compared directly.
| Script | Shares | Type | Net | Trades | Max drawdown |
|---|---|---|---|---|---|
| adx efi 50 ema channel, trend pullback this page | — | v5 strategy | 0.0% | 0 | 0.0% |
| 888 BOT #backtest by UnknownUnicorn2151907 | sma ema rma sar macd atr | v4 strategy | +3.0% | 12 | 0.9% |
| Super 8 - 30M BTC by Good-Vibe | ema dmi sar macd sma bb atr | v5 strategy | −5.5% | 8 | 5.5% |
| BankNifty_Bearish_Intraday by makarandpatil | macd rsi dmi sma bb | v5 strategy | No trades on this market | ||
| BankNifty_Bullish_Intraday by makarandpatil | macd rsi dmi sma bb | v5 strategy | No trades on this market | ||
| [VJ]Phoenix Force of PSAR +MACD +RSI by vikris | sar sma macd rsi atr | v4 strategy | No trades on this market | ||
Upgrade and export
Written in Pine Script v5. The clean-v5 step types the settings and moves when = into if blocks, which v6 requires; it is run before and after like any upgrade.
- 3 strategy calls use the when = argument (line 65, 67, 69). It is deprecated in v5 and removed in v6, where each call moves inside an if block.
- No v6-only features. v6 is not needed to run this script.
Clean v5
Not verifiedNeither version placed a trade on any of the 8 markets, so there was nothing to compare.
- Line 65: when = buytrig → if block
- Line 67: when = ta.crossunder(ema34, ema50lo) → if block
- Line 69: when = selltrig → if block
⋯if(buy)- strategy.entry("buy", strategy.long, 5000, when= buytrig)+ if buytrig+ strategy.entry("buy", strategy.long, 5000) strategy.exit("exit buy", "buy", limit= tp, stop= sl)- strategy.close("close", when= ta.crossunder(ema34, ema50lo))+ if ta.crossunder(ema34, ema50lo)+ strategy.close("close")if(sell)- strategy.entry("sell", strategy.short, 5000, when= selltrig)+ if selltrig+ strategy.entry("sell", strategy.short, 5000) strategy.exit("exit sell", "sell", limit= selltp, stop= sellsl)Does it run in Pine Script v6?
Not tested
Neither version placed a trade on any of the 8 markets, so there was nothing to compare. The v6 version is shown for reference and is not offered as a download. It differs from the v5 version by 1 edit.
⋯// © trent777brown-//@version=5+//@version=6strategy("adx efi 50 ema channel, trend pullback", overlay=true, margin_long=100, margin_short=100, currency=currency.USD, initial_capital= 100000, close_entries_rule="ANY")⋯Where it runs
| Engine | Compiles | Runs | Matches TradingView |
|---|---|---|---|
| Zeal Terminal · OpenPineScript v2 | Yes 24 ms | Yes 1,000 bars in 67 ms | Not measured |
| PineTS | Not tested | Not tested | Not measured |
“Matches TradingView” needs this script's own output exported from TradingView and compared bar by bar, which has not been done for this script. The engine is built on OpenPineScript, whose conformance results are in its conformance report.
Source
Copied verbatim from the author's published script, with its licence header intact. The author may have updated the original since this snapshot.
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/// © trent777brown//@version=5strategy("adx efi 50 ema channel, trend pullback", overlay=true, margin_long=100, margin_short=100, currency=currency.USD, initial_capital= 100000, close_entries_rule="ANY")//bollingerbands[basis, upperband, lowerband]= ta.bb(ohlc4, 50, 3) [basis2, upperband2, lowerband2]= ta.bb(ohlc4, 50, 2)psar= ta.sar(.1, .1, .09)ema50= ta.ema(hlc3, 50) ema50hi= ta.ema(high, 50) ema50lo= ta.ema(low, 50) ema18= ta.wma(hlc3, 15)wma9= ta.wma(open, 9) wma5= ta.wma(ohlc4, 5) ema34= ta.rma(hlc3, 10)[macdline, signalline, histline]= ta.macd(hlc3, 5, 34, 5) [macdline2, signalline2, histline2]= ta.macd(hlc3, 15,70, 24) [diplus, diminus, adx]= ta.dmi(20, 20) [diplus2, diminus2, adx2]= ta.dmi(12, 12)rsi= ta.rsi(hlc3, 14)rsisma= ta.sma(rsi, 10) stoch= ta.stoch(close, high, low, 21)k= ta.wma(stoch, 3)d= ta.wma(k, 3)trendline5= ta.wma(hlc3, 300) trendline9= ta.wma(open, 540) trendline18= ta.wma(open, 1080)atr=ta.atr(14)plot(psar, color=color.red, style=plot.style_circles)plot(ema50, color=color.white, linewidth=4) plot(ema50hi, color=color.yellow, linewidth=4)plot(ema50lo, color=color.yellow, linewidth=4)plot(ema34, color=color.aqua, linewidth=4)plot(wma9, color=color.gray, linewidth=4) plot(wma5, color=color.lime, linewidth=4) plot(trendline18, color=color.orange, linewidth=4) plot(upperband, color=color.navy, linewidth=4) plot(lowerband, color=color.navy, linewidth=4)plot(upperband2, color=color.navy, linewidth=4)plot(lowerband2, color=color.navy, linewidth=4)plot(trendline9, color=color.maroon, linewidth=4)plot(trendline5, color=color.yellow, linewidth=4)efi = ta.rma(ta.change(close) * volume, 15)efi2= ta.rma(ta.change(close) * volume, 120)buy= efi2 > 0 and efi < 0 and efi[1] < efi and adx >= 20 and open < ema50hisell= efi2 < 0 and efi > 0 and efi[1] > efi and adx >= 20 and open > ema50lo//ell= rsi > 50 and ta.crossunder(wma5, wma9) and psar > high and ema18 <= ema50hi and macdline > 0 and macdline < signalline//buy= ta.crossunder(close, ema50) and rsi < 50 and adx2 < adx2[1] and k < 25 and psar > high//uy= rsi < 60 and ta.crossover(wma5, wma9) and psar < low and ema18 >= ema50 and macdline2 > 0 and diplus2 < 30 // and histline2 < 0 //buy= ema18 > ema50 and ta.crossunder(rsi, 45) and open < ema50hi and adx2[3] < adx2 and diplus2 < 25 and macdline < 0 and adx < 10//sell= ta.crossover(close, ema50) and rsi > 50 and adx2 < adx2[1] and k > 75 and psar < low//ell= ema18 < ema50 and ta.crossover(rsi, 60) and open > ema50lo and diminus2 < 30 and macdline2 < 0 and adx2[2] < adx2 //buy sell conditions 1//buy= ta.crossover(wma5, ema18) and ema18 > ema50lo and diplus > 22 and diminus < 22 and adx > 15//ell= ta.crossover(psar, high) and macdline2 < signalline2 and rsi < rsisma//when conditionsbuytrig= ema34 >= ema50loselltrig= ema34 <= ema50hi//strategysl= low - atr * 8tp= high + atr * 4sellsl= high + atr * 8selltp= low - atr * 4if(buy) strategy.entry("buy", strategy.long, 5000, when= buytrig) strategy.exit("exit buy", "buy", limit= tp, stop= sl) strategy.close("close", when= ta.crossunder(ema34, ema50lo))if(sell) strategy.entry("sell", strategy.short, 5000, when= selltrig) strategy.exit("exit sell", "sell", limit= selltp, stop= sellsl)