Pine Script v4 · Strategy
EMA-ADX-VOL-CRYPTO KILLER [15M]
A Pine Script v4 strategy built on Change (high), RMA (tr, _len) and SMA (DX, _len). It has 4 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 commits 100% of equity and pays 0.03% commission. 18 settings; defaults include Source open, Adx Type MASANAKAMURA and Adx Length 21.
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 EMA-ADX-VOL-CRYPTO KILLER [15M] repaint?
- No
- No repainting patterns were found in the source, and a live tick-by-tick replay matched history on 8 of 8 trades.
- How did EMA-ADX-VOL-CRYPTO KILLER [15M] do on BTCUSDT 1D with default settings?
- +4.53%
- From 26 Jan 2024 to 21 Oct 2026, over 22 closed trades, against +102.5% for buy and hold. A backtest, not investment advice.
- Can EMA-ADX-VOL-CRYPTO KILLER [15M] be converted to Pine Script v5?
- Yes
- The upgrade takes 1 step, from v4; each was run before and after on the same candles with identical results, and the v5 script can be downloaded below.
- Does EMA-ADX-VOL-CRYPTO KILLER [15M] use a stop loss?
- Yes
- strategy.exit sets a stop on line 214, 215.
- Does EMA-ADX-VOL-CRYPTO KILLER [15M] run in Zeal Terminal?
- Yes
- It compiles in 76 ms and runs 1,000 bars in 181 ms, in the browser.
BTCUSDT · 1D · default settings
- TP_L
- TP_S
- Long TP
- Short TP
- TP Long Signal
- TP Short Signal
- Long
- Short
- Winning trade
- Losing trade
- Equity
- Buy and hold
- Net profit
- +4.53%
- $453.01
- Buy and hold
- +102.5%
- same period
- Closed trades
- 22
- 16 won · 6 lost
- Profitable
- 72.7%
- of closed trades
- Profit factor
- 1.49
- gross profit ÷ gross loss
- Max drawdown
- 5.29%
- −$549.81
One run with the author's default settings, $10,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
Every trade uses all the equity
default_qty_value is 100% of equity.
-
Note
Uses iff(), which v5 removed line 157
iff() on line 157, 158. v5 writes it as the ternary c ? a : b.
-
Note
Uses transp =, which v5 removed line 203
transp = on line 203, 204, 205, 206. v5 folds the transparency into the colour with color.new(c, transp).
Upgrade and export
Written in Pine Script v4. The upgrade to v5 takes 1 step, one per version, each applied to the result of the one before. A last clean-v5 pass then types the settings and moves when = into if blocks, which v6 requires. Every step runs before and after on the same candles in Zeal Terminal's engine; a step whose results differ is shown but not offered as a download. Upgrades preserve behaviour: bugs are fixed in the Review, never silently here.
- Upgrading to v5 renames change → ta.change, rma → ta.rma, abs → math.abs, max → math.max, sma → ta.sma, ema → ta.ema, min → math.min.
v4 → v5
VerifiedSame 22 trades and the same P&L on BTCUSDT 1D, 1,000 bars, in Zeal Terminal's engine.
- Line 3: //@version=4 → //@version=5
- Line 10: input(type = input.integer) → input.int()
- Line 11: input(type = input.float) → input.float()
- Line 27: input(type = input.float) → input.float()
- Line 28: input(type = input.float) → input.float()
- Line 30: input(type = input.float) → input.float()
40 more edits
- Line 34: change → ta.change
- Line 35: change → ta.change
- Line 38: rma → ta.rma
- Line 38: tr → ta.tr
- Line 39: rma → ta.rma
- Line 40: rma → ta.rma
- Line 42: rma → ta.rma
- Line 42: abs → math.abs
- Line 48: max → math.max
- Line 48: max → math.max
- Line 48: abs → math.abs
- Line 48: abs → math.abs
- Line 49: max → math.max
- Line 50: max → math.max
- Line 56: abs → math.abs
- Line 57: sma → ta.sma
- Line 68: ema → ta.ema
- Line 69: ema → ta.ema
- Line 70: ema → ta.ema
- Line 71: ema → ta.ema
- Line 72: ema → ta.ema
- Line 81: ema → ta.ema
- Line 81: abs → math.abs
- Line 82: ema → ta.ema
- Line 94: sma → ta.sma
- Line 95: sma → ta.sma
- Line 157: iff(c, a, b) → (c ? a : b)
- Line 158: iff(c, a, b) → (c ? a : b)
- Line 173: min → math.min
- Line 173: max → math.max
- Line 174: min → math.min
- Line 174: max → math.max
- Line 203: transp = 0 → color.new(color.red, 0)
- Line 204: transp = 0 → color.new(color.green, 0)
- Line 205: transp = 0 → color.new(color.blue, 0)
- Line 206: transp = 0 → color.new(color.red, 0)
- Line 214: abs → math.abs
- Line 214: abs → math.abs
- Line 215: abs → math.abs
- Line 215: abs → math.abs
⋯// © BabehDyo-//@version=4+//@version=5strategy("EMA/ADX/VOL-CRYPTO KILLER [15M]", overlay = true, pyramiding=1,initial_capital = 10000, default_qty_type= strategy.percent_of_equity, default_qty_value = 100, calc_on_order_fills=false, slippage=0,commission_type=strategy.commission.percent,commission_value=0.03)⋯ADX_options = input("MASANAKAMURA", title=" Adx Type", options = ["CLASSIC", "MASANAKAMURA"], group="ADX")-ADX_len = input(21, title=" Adx Length", type=input.integer, minval = 1, group="ADX")+ADX_len = input.int(21, title=" Adx Length", minval = 1, group="ADX")-th = input(20, title=" Adx Treshold", type=input.float, minval = 0, step = 0.5, group="ADX")+th = input.float(20, title=" Adx Treshold", minval = 0, step = 0.5, group="ADX")//EMA--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------⋯//TP PLOTSHAPE ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------tp_long0 = input(0.9, title=" % TP Long", type = input.float, minval = 0, step = 0.1, group="Target Point") +tp_long0 = input.float(0.9, title=" % TP Long", minval = 0, step = 0.1, group="Target Point") -tp_short0 = input(0.9, title=" % TP Short", type = input.float, minval = 0, step = 0.1, group="Target Point") +tp_short0 = input.float(0.9, title=" % TP Short", minval = 0, step = 0.1, group="Target Point") // SL PLOTSHAPE ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------sl0 = input(4.2, title=" % Stop loss", type = input.float, minval = 0, step = 0.1, group="Stop Loss")+sl0 = input.float(4.2, title=" % Stop loss", minval = 0, step = 0.1, group="Stop Loss")//INDICATORS =======================================================================================================================================================================================================================================================================================================⋯calcADX(_len) =>- up = change(high)+ up = ta.change(high)- down = -change(low)+ down = -ta.change(low) plusDM = na(up) ? na : (up > down and up > 0 ? up : 0) minusDM = na(down) ? na : (down > up and down > 0 ? down : 0)- truerange = rma(tr, _len)+ truerange = ta.rma(ta.tr, _len)- _plus = fixnan(100 * rma(plusDM, _len) / truerange)+ _plus = fixnan(100 * ta.rma(plusDM, _len) / truerange)- _minus = fixnan(100 * rma(minusDM, _len) / truerange)+ _minus = fixnan(100 * ta.rma(minusDM, _len) / truerange) sum = _plus + _minus- _adx = 100 * rma(abs(_plus - _minus) / (sum == 0 ? 1 : sum), _len)+ _adx = 100 * ta.rma(math.abs(_plus - _minus) / (sum == 0 ? 1 : sum), _len) [_plus,_minus,_adx]⋯ SmoothedDirectionalMovementMinus = 0.0- TrueRange = max(max(high - low, abs(high - nz(close[1]))), abs(low - nz(close[1])))+ TrueRange = math.max(math.max(high - low, math.abs(high - nz(close[1]))), math.abs(low - nz(close[1])))- DirectionalMovementPlus = high - nz(high[1]) > nz(low[1]) - low ? max(high - nz(high[1]), 0) : 0+ DirectionalMovementPlus = high - nz(high[1]) > nz(low[1]) - low ? math.max(high - nz(high[1]), 0) : 0- DirectionalMovementMinus = nz(low[1]) - low > high - nz(high[1]) ? max(nz(low[1]) - low, 0) : 0+ DirectionalMovementMinus = nz(low[1]) - low > high - nz(high[1]) ? math.max(nz(low[1]) - low, 0) : 0 SmoothedTrueRange := nz(SmoothedTrueRange[1]) - (nz(SmoothedTrueRange[1]) /_len) + TrueRange⋯ DIM = SmoothedDirectionalMovementMinus / SmoothedTrueRange * 100- DX = abs(DIP-DIM) / (DIP+DIM)*100+ DX = math.abs(DIP-DIM) / (DIP+DIM)*100- adx = sma(DX, _len)+ adx = ta.sma(DX, _len) [DIP,DIM,adx]⋯xPrice = close-EMA1 = ema(xPrice, Length_ema1)+EMA1 = ta.ema(xPrice, Length_ema1)-EMA2 = ema(xPrice, Length_ema2)+EMA2 = ta.ema(xPrice, Length_ema2)-EMA3 = ema(xPrice, Length_ema3)+EMA3 = ta.ema(xPrice, Length_ema3)-EMA4 = ema(xPrice, Length_ema4)+EMA4 = ta.ema(xPrice, Length_ema4)-EMA5 = ema(xPrice, Length_ema5)+EMA5 = ta.ema(xPrice, Length_ema5)L_ema = EMA1 < close and EMA2 < close and EMA3 < close and EMA4 < close and EMA5 < close⋯ wper = (_per_*2) - 1- avrng = ema(abs(_src - _src[1]), _per_)+ avrng = ta.ema(math.abs(_src - _src[1]), _per_)- _smoothrng = ema(avrng, wper)*_mult+ _smoothrng = ta.ema(avrng, wper)*_mult _filt = _src⋯// Volume --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------Volume_condt = volume > sma(volume,sma_length)*volume_f+Volume_condt = volume > ta.sma(volume,sma_length)*volume_f-Volume_condt1 = volume > sma(volume,sma_length1)*volume_f1+Volume_condt1 = volume > ta.sma(volume,sma_length1)*volume_f1//STRATEGY ==========================================================================================================================================================================================================================================================================================================⋯Final_Short_tp := (short_tp and last_shortCondition > nz(last_short_tp[1]) and last_shortCondition > nz(last_short_sl[1]))-L_tp = iff(Final_Long_tp, fixnan(Position_Price) * (1 + tp_long) , na) +L_tp = (Final_Long_tp ? fixnan(Position_Price) * (1 + tp_long) : na) -S_tp = iff(Final_Short_tp, fixnan(Position_Price) * (1 - tp_short) , na) +S_tp = (Final_Short_tp ? fixnan(Position_Price) * (1 - tp_short) : na) //TP SIGNALS--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------⋯Percent_Capital = 99-sl = in_longCondition ? min(sl0,(((Risk) * 100) / (Percent_Capital * max(1, nLongs)))) : +sl = in_longCondition ? math.min(sl0,(((Risk) * 100) / (Percent_Capital * math.max(1, nLongs)))) : - in_shortCondition ? min(sl0,(((Risk) * 100) / (Percent_Capital * max(1, nShorts)))) : sl0+ in_shortCondition ? math.min(sl0,(((Risk) * 100) / (Percent_Capital * math.max(1, nShorts)))) : sl0 ⋯//PLOTSHAPES-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------plotshape(Final_Long_tp, title="TP Long Signal", style = shape.triangledown, location=location.abovebar, color=color.red, size=size.tiny , text="TP", textcolor=color.red, transp = 0 ) +plotshape(Final_Long_tp, title="TP Long Signal", style = shape.triangledown, location=location.abovebar, color=color.new(color.red, 0), size=size.tiny , text="TP", textcolor=color.red ) -plotshape(Final_Short_tp, title="TP Short Signal", style = shape.triangleup, location=location.belowbar, color=color.green, size=size.tiny , text="TP", textcolor=color.green, transp = 0 ) +plotshape(Final_Short_tp, title="TP Short Signal", style = shape.triangleup, location=location.belowbar, color=color.new(color.green, 0), size=size.tiny , text="TP", textcolor=color.green ) -plotshape(longCondition, title="Long", style=shape.triangleup, location=location.belowbar, color=color.blue, size=size.tiny , transp = 0 )+plotshape(longCondition, title="Long", style=shape.triangleup, location=location.belowbar, color=color.new(color.blue, 0), size=size.tiny )-plotshape(shortCondition, title="Short", style=shape.triangledown, location=location.abovebar, color=color.red, size=size.tiny , transp = 0 )+plotshape(shortCondition, title="Short", style=shape.triangledown, location=location.abovebar, color=color.new(color.red, 0), size=size.tiny )// Backtest ==================================================================================================================================================================================================================================================================================================================================⋯ -strategy.exit("TP_L", "LONG", profit = (abs((last_open_longCondition * (1 + tp_long)) - last_open_longCondition) / syminfo.mintick), limit = nLongs >= 1 ? strategy.position_avg_price * (1 + tp_long) : na, loss = (abs((last_open_longCondition*(1-(sl/100)))-last_open_longCondition)/syminfo.mintick))+strategy.exit("TP_L", "LONG", profit = (math.abs((last_open_longCondition * (1 + tp_long)) - last_open_longCondition) / syminfo.mintick), limit = nLongs >= 1 ? strategy.position_avg_price * (1 + tp_long) : na, loss = (math.abs((last_open_longCondition*(1-(sl/100)))-last_open_longCondition)/syminfo.mintick))-strategy.exit("TP_S", "SHORT", profit = (abs((last_open_shortCondition * (1 - tp_short)) - last_open_shortCondition) / syminfo.mintick), limit = nShorts >= 1 ? strategy.position_avg_price*(1-(tp_short)) : na, loss = (abs((last_open_shortCondition*(1+(sl/100)))-last_open_shortCondition)/syminfo.mintick))+strategy.exit("TP_S", "SHORT", profit = (math.abs((last_open_shortCondition * (1 - tp_short)) - last_open_shortCondition) / syminfo.mintick), limit = nShorts >= 1 ? strategy.position_avg_price*(1-(tp_short)) : na, loss = (math.abs((last_open_shortCondition*(1+(sl/100)))-last_open_shortCondition)/syminfo.mintick))//By BabehDyoSame 22 trades and the same P&L on BTCUSDT 1D, 1,000 bars, in Zeal Terminal's engine.
- Line 6: input() → input.source()
- Line 9: input() → input.string()
- Line 13: input() → input.int()
- Line 14: input() → input.int()
- Line 15: input() → input.int()
- Line 16: input() → input.int()
7 more edits
- Line 17: input() → input.int()
- Line 19: input() → input.int()
- Line 20: input() → input.float()
- Line 22: input() → input.float()
- Line 23: input() → input.int()
- Line 24: input() → input.float()
- Line 25: input() → input.int()
⋯//SOURCE =============================================================================================================================================================================================================================================================================================================-src = input(open, title=" Source")+src = input.source(open, title=" Source")// Inputs ========================================================================================================================================================================================================================================================================================================//ADX ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ADX_options = input("MASANAKAMURA", title=" Adx Type", options = ["CLASSIC", "MASANAKAMURA"], group="ADX")+ADX_options = input.string("MASANAKAMURA", title=" Adx Type", options = ["CLASSIC", "MASANAKAMURA"], group="ADX")ADX_len = input.int(21, title=" Adx Length", minval = 1, group="ADX")⋯//EMA---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------Length_ema1 = input(8, title=" 1-EMA Length", minval=1)+Length_ema1 = input.int(8, title=" 1-EMA Length", minval=1)-Length_ema2 = input(13, title=" 2-EMA Length", minval=1)+Length_ema2 = input.int(13, title=" 2-EMA Length", minval=1)-Length_ema3 = input(21, title=" 3-EMA Length", minval=1)+Length_ema3 = input.int(21, title=" 3-EMA Length", minval=1)-Length_ema4 = input(34, title=" 4-EMA Length", minval=1)+Length_ema4 = input.int(34, title=" 4-EMA Length", minval=1)-Length_ema5 = input(55, title=" 5-EMA Length", minval=1)+Length_ema5 = input.int(55, title=" 5-EMA Length", minval=1)// Range Filter ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------per_ = input(15, title=" Period", minval=1, group = "Range Filter")+per_ = input.int(15, title=" Period", minval=1, group = "Range Filter")-mult = input(2.6, title=" mult.", minval=0.1, step = 0.1, group = "Range Filter")+mult = input.float(2.6, title=" mult.", minval=0.1, step = 0.1, group = "Range Filter")// Volume -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------volume_f = input(3.2, title=" Volume mult.", minval = 0, step = 0.1, group="Volume")+volume_f = input.float(3.2, title=" Volume mult.", minval = 0, step = 0.1, group="Volume")-sma_length = input(20, title=" Volume lenght", minval = 1, group="Volume")+sma_length = input.int(20, title=" Volume lenght", minval = 1, group="Volume")-volume_f1 = input(1.9, title=" Volume mult. 1", minval = 0, step = 0.1, group="Volume")+volume_f1 = input.float(1.9, title=" Volume mult. 1", minval = 0, step = 0.1, group="Volume")-sma_length1 = input(22, title=" Volume lenght 1", minval = 1, group="Volume")+sma_length1 = input.int(22, title=" Volume lenght 1", minval = 1, group="Volume")//TP PLOTSHAPE -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------⋯Does it run in Pine Script v6?
No
The v6 version does not run in Zeal Terminal's engine: Pine Script v6 Error at @L76:C0: a 'bool' cannot be 'na' in Pine Script v6 — declare it as true or false. The v6 version is shown for reference and is not offered as a download. It differs from the v5 version by 1 edit.
⋯// © BabehDyo-//@version=5+//@version=6strategy("EMA/ADX/VOL-CRYPTO KILLER [15M]", overlay = true, pyramiding=1,initial_capital = 10000, default_qty_type= strategy.percent_of_equity, default_qty_value = 100, calc_on_order_fills=false, slippage=0,commission_type=strategy.commission.percent,commission_value=0.03)⋯Settings
Every input the script declares, with its default and what it feeds. Bounds are the ones the script enforces.
| Setting | Default | Type and range | Feeds |
|---|---|---|---|
| Source | open | source | smoothrng filt upward downward |
| 1-EMA Length | 8 | int · min 1 | EMA1 |
| 2-EMA Length | 13 | int · min 1 | EMA2 |
| 3-EMA Length | 21 | int · min 1 | EMA3 |
| 4-EMA Length | 34 | int · min 1 | EMA4 |
| 5-EMA Length | 55 | int · min 1 | EMA5 |
| ADX | |||
| Adx Type | MASANAKAMURA | string · options ["CLASSIC", "MASANAKAMURA"] | DIPlus DIMinus ADX |
| Adx Length | 21 | int (written input.integer) · min 1 | DIPlusC DIMinusC ADXC DIPlusM DIMinusM ADXM |
| Adx Treshold | 20 | float · min 0 · step 0.5 | L_adx S_adx |
| Range Filter | |||
| Period | 15 | int · min 1 | smoothrng filt upward downward |
| mult. | 2.6 | float · min 0.1 · step 0.1 | smoothrng filt upward downward |
| Volume | |||
| Volume mult. | 3.2 | float · min 0 · step 0.1 | Volume_condt |
| Volume lenght | 20 | int · min 1 | Volume_condt |
| Volume mult. 1 | 1.9 | float · min 0 · step 0.1 | Volume_condt1 |
| Volume lenght 1 | 22 | int · min 1 | Volume_condt1 |
| Target Point | |||
| % TP Long | 0.9 | float · min 0 · step 0.1 | tp_long |
| % TP Short | 0.9 | float · min 0 · step 0.1 | tp_short |
| Stop Loss | |||
| % Stop loss | 4.2 | float · min 0 · step 0.1 | Risk sl |
What it calculates
- Change (
change,ta.changein v5)highup · line 34 - Change (
change,ta.changein v5)lowdown · line 35 - RMA (
rma,ta.rmain v5)tr, _lentruerange · line 38 - RMA (
rma,ta.rmain v5)plusDM, _len_plus · line 39 - RMA (
rma,ta.rmain v5)minusDM, _len_minus · line 40 - RMA (
rma,ta.rmain v5)abs(_plus - _minus) / (sum == 0 ? 1 : sum), _len_adx · line 42 - SMA (
sma,ta.smain v5)DX, _lenadx · line 57 - EMA (
ema,ta.emain v5)xPrice, 1-EMA Length (8)EMA1 · line 68 - EMA (
ema,ta.emain v5)xPrice, 2-EMA Length (13)EMA2 · line 69 - EMA (
ema,ta.emain v5)xPrice, 3-EMA Length (21)EMA3 · line 70 - EMA (
ema,ta.emain v5)xPrice, 4-EMA Length (34)EMA4 · line 71 - EMA (
ema,ta.emain v5)xPrice, 5-EMA Length (55)EMA5 · line 72 - EMA (
ema,ta.emain v5)abs(_src - _src[1]), _per_avrng · line 81 - EMA (
ema,ta.emain v5)avrng, wper_smoothrng · line 82
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 123 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 LONG long | L_basic_condt | On | 209 |
| Open SHORT short | S_basic_condt | On | 211 |
| Exit TP_L stop and limit | every bar | On | 214 |
| Exit TP_S stop and limit | every bar | On | 215 |
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, and the live replay matched history.
- 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 | +4.5% | +102.5% | 22 | 73% | 1.49 | 5.3% | 26 Jan 2024 – 21 Oct 2026 |
| BTCUSDT 4h | +9.5% | +5.5% | 25 | 48% | 12.64 | 4.1% | 8 May 2026 – 21 Oct 2026 |
| ETHUSDT 1D | +11.1% | +9.8% | 21 | 57% | 21.56 | 0.5% | 26 Jan 2024 – 21 Oct 2026 |
| ETHUSDT 4h | +8.4% | +8.4% | 24 | 46% | 11.39 | 1.3% | 8 May 2026 – 21 Oct 2026 |
| SOLUSDT 1D | +1.0% | +16.7% | 15 | 60% | 1.12 | 7.9% | 26 Jan 2024 – 21 Oct 2026 |
| SOLUSDT 4h | +11.7% | +21.5% | 25 | 56% | 17.78 | 3.9% | 8 May 2026 – 21 Oct 2026 |
| BNBUSDT 1D | −10.9% | +148.3% | 25 | 64% | 0.54 | 10.9% | 26 Jan 2024 – 21 Oct 2026 |
| BNBUSDT 4h | +1.4% | +17.1% | 24 | 75% | 1.10 | 11.4% | 8 May 2026 – 21 Oct 2026 |
Backtests are simulations on historical data and are not investment advice.
The trades
By market direction
| At entry, last 90 bars | Trades | Won | P&L |
|---|---|---|---|
| Rising market | 7 | 71% | −$74.80 |
| Sideways market | 7 | 71% | −$10.19 |
| Falling market | 8 | 75% | $538.00 |
Rising and falling mean the market moved more than 15% over the 90 bars before entry.
How bad could the drawdown be?
8.4%
The 95th percentile of the worst drawdown when the same 22 trades are reshuffled 5,000 times. The bar spans the 5th to 95th percentile, 4.3% to 8.4%; the tick is what actually happened, 4.3%. Order luck alone moves it this much.
All 22 trades
| Side | Entry | Exit | Bars | P&L |
|---|---|---|---|---|
| short | 5 Jul 2024 57,050.00 | 5 Jul 2024 57,050.00 | 0 | −$6.00 |
| short | 6 Jul 2024 56,628.80 | 6 Jul 2024 56,628.80 | 0 | −$5.99 |
| long | 11 Nov 2024 80,370.00 | 11 Nov 2024 80,370.00 | 0 | −$5.99 |
| long | 12 Nov 2024 88,648.00 | 12 Nov 2024 89,371.30 | 0 | $75.41 |
| long | 13 Nov 2024 87,952.00 | 13 Nov 2024 88,749.80 | 0 | $85.15 |
| long | 14 Nov 2024 90,375.20 | 14 Nov 2024 91,166.80 | 0 | $82.70 |
| long | 6 Dec 2024 96,945.60 | 6 Dec 2024 97,759.00 | 0 | $79.61 |
| short | 26 Feb 2025 88,680.40 | 26 Feb 2025 88,680.40 | 0 | −$6.18 |
| short | 27 Feb 2025 84,250.10 | 27 Feb 2025 83,452.00 | 0 | $91.39 |
| short | 1 Mar 2025 84,349.90 | 2 Mar 2025 87,892.60 | 1 | −$442.62 |
| long | 22 May 2025 109,644.00 | 22 May 2025 110,517.00 | 0 | $73.15 |
| short | 12 Oct 2025 110,644.00 | 12 Oct 2025 109,885.00 | 0 | $62.74 |
| short | 15 Nov 2025 94,594.00 | 16 Nov 2025 93,742.60 | 1 | $84.70 |
| short | 22 Nov 2025 85,129.40 | 22 Nov 2025 84,278.10 | 0 | $95.59 |
| short | 3 Feb 2026 78,738.60 | 3 Feb 2026 77,972.40 | 0 | $93.71 |
| short | 4 Feb 2026 75,770.20 | 4 Feb 2026 75,061.60 | 0 | $90.66 |
| short | 6 Feb 2026 62,909.90 | 6 Feb 2026 62,227.90 | 0 | $106.99 |
| short | 7 Feb 2026 70,580.30 | 7 Feb 2026 70,014.10 | 0 | $78.34 |
| short | 6 Jun 2026 61,056.50 | 6 Jun 2026 60,421.20 | 0 | $104.25 |
| long | 22 Aug 2026 78,338.00 | 24 Aug 2026 79,043.10 | 2 | $90.14 |
| long | 25 Aug 2026 78,992.80 | 25 Aug 2026 79,697.80 | 0 | $90.09 |
| long | 22 Sep 2026 86,620.00 | 24 Sep 2026 82,982.00 | 2 | −$464.82 |
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 |
|---|---|---|---|---|---|
| EMA-ADX-VOL-CRYPTO KILLER [15M] this page | — | v4 strategy | +4.5% | 22 | 5.3% |
| Optimized Keltner Channels SL-TP Strategy for BTC by chanu_lev10k | sma ema rma | v4 strategy | −19.4% | 36 | 70.0% |
| Soheil PKO's 5 min Hitman Scalp - 3MA + Laguerre RSI + ADX [Pt] by PtGambler | ema sma rma | v5 strategy | No trades on this market | ||
| Contrarian Scalping Counter Trend Bb Envelope Adx and Stochastic by exlux99 | sma ema rma | v5 strategy | +1.9% | 15 | 3.2% |
| CCI + EMA with RSI Cross Strategy by rwestbrookjr | ema rma sma | v5 strategy | No trades on this market | ||
| Best TradingView Strategy - For NASDAQ and DOW30 and other Index by The_Bigger_Bull | sma rma ema | v5 strategy | +2.2% | 17 | 3.4% |
Where it runs
| Engine | Compiles | Runs | Matches TradingView |
|---|---|---|---|
| Zeal Terminal · OpenPineScript v2 | Yes 76 ms | Yes 1,000 bars in 181 ms | Not measured |
| PineTS | No v5 and v6 only | — | 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. PineTS runs Pine Script v5 and v6 only.
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/// © BabehDyo//@version=4strategy("EMA/ADX/VOL-CRYPTO KILLER [15M]", overlay = true, pyramiding=1,initial_capital = 10000, default_qty_type= strategy.percent_of_equity, default_qty_value = 100, calc_on_order_fills=false, slippage=0,commission_type=strategy.commission.percent,commission_value=0.03)//SOURCE =============================================================================================================================================================================================================================================================================================================src = input(open, title=" Source")// Inputs ========================================================================================================================================================================================================================================================================================================//ADX --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ADX_options = input("MASANAKAMURA", title=" Adx Type", options = ["CLASSIC", "MASANAKAMURA"], group="ADX")ADX_len = input(21, title=" Adx Length", type=input.integer, minval = 1, group="ADX")th = input(20, title=" Adx Treshold", type=input.float, minval = 0, step = 0.5, group="ADX")//EMA--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------Length_ema1 = input(8, title=" 1-EMA Length", minval=1)Length_ema2 = input(13, title=" 2-EMA Length", minval=1)Length_ema3 = input(21, title=" 3-EMA Length", minval=1)Length_ema4 = input(34, title=" 4-EMA Length", minval=1)Length_ema5 = input(55, title=" 5-EMA Length", minval=1)// Range Filter ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------per_ = input(15, title=" Period", minval=1, group = "Range Filter")mult = input(2.6, title=" mult.", minval=0.1, step = 0.1, group = "Range Filter")// Volume ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------volume_f = input(3.2, title=" Volume mult.", minval = 0, step = 0.1, group="Volume")sma_length = input(20, title=" Volume lenght", minval = 1, group="Volume")volume_f1 = input(1.9, title=" Volume mult. 1", minval = 0, step = 0.1, group="Volume")sma_length1 = input(22, title=" Volume lenght 1", minval = 1, group="Volume")//TP PLOTSHAPE -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------tp_long0 = input(0.9, title=" % TP Long", type = input.float, minval = 0, step = 0.1, group="Target Point") tp_short0 = input(0.9, title=" % TP Short", type = input.float, minval = 0, step = 0.1, group="Target Point") // SL PLOTSHAPE ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------sl0 = input(4.2, title=" % Stop loss", type = input.float, minval = 0, step = 0.1, group="Stop Loss")//INDICATORS =======================================================================================================================================================================================================================================================================================================//ADX-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------calcADX(_len) => up = change(high) down = -change(low) plusDM = na(up) ? na : (up > down and up > 0 ? up : 0) minusDM = na(down) ? na : (down > up and down > 0 ? down : 0) truerange = rma(tr, _len) _plus = fixnan(100 * rma(plusDM, _len) / truerange) _minus = fixnan(100 * rma(minusDM, _len) / truerange) sum = _plus + _minus _adx = 100 * rma(abs(_plus - _minus) / (sum == 0 ? 1 : sum), _len) [_plus,_minus,_adx]calcADX_Masanakamura(_len) => SmoothedTrueRange = 0.0 SmoothedDirectionalMovementPlus = 0.0 SmoothedDirectionalMovementMinus = 0.0 TrueRange = max(max(high - low, abs(high - nz(close[1]))), abs(low - nz(close[1]))) DirectionalMovementPlus = high - nz(high[1]) > nz(low[1]) - low ? max(high - nz(high[1]), 0) : 0 DirectionalMovementMinus = nz(low[1]) - low > high - nz(high[1]) ? max(nz(low[1]) - low, 0) : 0 SmoothedTrueRange := nz(SmoothedTrueRange[1]) - (nz(SmoothedTrueRange[1]) /_len) + TrueRange SmoothedDirectionalMovementPlus := nz(SmoothedDirectionalMovementPlus[1]) - (nz(SmoothedDirectionalMovementPlus[1]) / _len) + DirectionalMovementPlus SmoothedDirectionalMovementMinus := nz(SmoothedDirectionalMovementMinus[1]) - (nz(SmoothedDirectionalMovementMinus[1]) / _len) + DirectionalMovementMinus DIP = SmoothedDirectionalMovementPlus / SmoothedTrueRange * 100 DIM = SmoothedDirectionalMovementMinus / SmoothedTrueRange * 100 DX = abs(DIP-DIM) / (DIP+DIM)*100 adx = sma(DX, _len) [DIP,DIM,adx][DIPlusC,DIMinusC,ADXC] = calcADX(ADX_len) [DIPlusM,DIMinusM,ADXM] = calcADX_Masanakamura(ADX_len)DIPlus = ADX_options == "CLASSIC" ? DIPlusC : DIPlusMDIMinus = ADX_options == "CLASSIC" ? DIMinusC : DIMinusMADX = ADX_options == "CLASSIC" ? ADXC : ADXML_adx = DIPlus > DIMinus and ADX > thS_adx = DIPlus < DIMinus and ADX > th//EMA-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------xPrice = closeEMA1 = ema(xPrice, Length_ema1)EMA2 = ema(xPrice, Length_ema2)EMA3 = ema(xPrice, Length_ema3)EMA4 = ema(xPrice, Length_ema4)EMA5 = ema(xPrice, Length_ema5)L_ema = EMA1 < close and EMA2 < close and EMA3 < close and EMA4 < close and EMA5 < closeS_ema = EMA1 > close and EMA2 > close and EMA3 > close and EMA4 > close and EMA5 > close// Range Filter ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------var bool L_RF = na, var bool S_RF = naRange_filter(_src, _per_, _mult)=> var float _upward = 0.0 var float _downward = 0.0 wper = (_per_*2) - 1 avrng = ema(abs(_src - _src[1]), _per_) _smoothrng = ema(avrng, wper)*_mult _filt = _src _filt := _src > nz(_filt[1]) ? ((_src-_smoothrng) < nz(_filt[1]) ? nz(_filt[1]) : (_src-_smoothrng)) : ((_src+_smoothrng) > nz(_filt[1]) ? nz(_filt[1]) : (_src+_smoothrng)) _upward := _filt > _filt[1] ? nz(_upward[1]) + 1 : _filt < _filt[1] ? 0 : nz(_upward[1]) _downward := _filt < _filt[1] ? nz(_downward[1]) + 1 : _filt > _filt[1] ? 0 : nz(_downward[1]) [_smoothrng,_filt,_upward,_downward][smoothrng, filt, upward, downward] = Range_filter(src, per_, mult)hband = filt + smoothrnglband = filt - smoothrngL_RF := high > hband and upward > 0S_RF := low < lband and downward > 0// Volume -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------Volume_condt = volume > sma(volume,sma_length)*volume_fVolume_condt1 = volume > sma(volume,sma_length1)*volume_f1//STRATEGY ==========================================================================================================================================================================================================================================================================================================var bool longCond = na, var bool shortCond = navar int CondIni_long = 0, var int CondIni_short = 0var bool _Final_longCondition = na, var bool _Final_shortCondition = navar float last_open_longCondition = na, var float last_open_shortCondition = navar int last_longCondition = na, var int last_shortCondition = navar int last_Final_longCondition = na, var int last_Final_shortCondition = navar int nLongs = na, var int nShorts = naL_1 = L_adx and Volume_condt and L_RF and L_emaS_1 = S_adx and Volume_condt and S_RF and S_emaL_2 = L_adx and L_RF and L_ema and Volume_condt1S_2 = S_adx and S_RF and S_ema and Volume_condt1L_basic_condt = L_1 or L_2S_basic_condt = S_1 or S_2longCond := L_basic_condtshortCond := S_basic_condtCondIni_long := longCond[1] ? 1 : shortCond[1] ? -1 : nz(CondIni_long[1] )CondIni_short := longCond[1] ? 1 : shortCond[1] ? -1 : nz(CondIni_short[1] )longCondition = (longCond[1] and nz(CondIni_long[1]) == -1 )shortCondition = (shortCond[1] and nz(CondIni_short[1]) == 1 )//POSITION PRICE-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------var float sum_long = 0.0, var float sum_short = 0.0var float Position_Price = 0.0last_open_longCondition := longCondition ? close[1] : nz(last_open_longCondition[1] )last_open_shortCondition := shortCondition ? close[1] : nz(last_open_shortCondition[1] )last_longCondition := longCondition ? time : nz(last_longCondition[1] )last_shortCondition := shortCondition ? time : nz(last_shortCondition[1] )in_longCondition = last_longCondition > last_shortConditionin_shortCondition = last_shortCondition > last_longConditionlast_Final_longCondition := longCondition ? time : nz(last_Final_longCondition[1] )last_Final_shortCondition := shortCondition ? time : nz(last_Final_shortCondition[1] )nLongs := nz(nLongs[1] )nShorts := nz(nShorts[1] )if longCondition nLongs := nLongs + 1 nShorts := 0 sum_long := nz(last_open_longCondition) + nz(sum_long[1]) sum_short := 0.0if shortCondition nLongs := 0 nShorts := nShorts + 1 sum_short := nz(last_open_shortCondition)+ nz(sum_short[1]) sum_long := 0.0 Position_Price := nz(Position_Price[1])Position_Price := longCondition ? sum_long/nLongs : shortCondition ? sum_short/nShorts : na//TP---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------var bool long_tp = na, var bool short_tp = navar int last_long_tp = na, var int last_short_tp = navar bool Final_Long_tp = na, var bool Final_Short_tp = navar bool Final_Long_sl0 = na, var bool Final_Short_sl0 = navar bool Final_Long_sl = na, var bool Final_Short_sl = navar int last_long_sl = na, var int last_short_sl = natp_long = ((nLongs > 1) ? tp_long0 / nLongs : tp_long0) / 100tp_short = ((nShorts > 1) ? tp_short0 / nShorts : tp_short0) / 100long_tp := high > (fixnan(Position_Price) * (1 + tp_long)) and in_longConditionshort_tp := low < (fixnan(Position_Price) * (1 - tp_short)) and in_shortConditionlast_long_tp := long_tp ? time : nz(last_long_tp[1])last_short_tp := short_tp ? time : nz(last_short_tp[1])Final_Long_tp := (long_tp and last_longCondition > nz(last_long_tp[1]) and last_longCondition > nz(last_long_sl[1]))Final_Short_tp := (short_tp and last_shortCondition > nz(last_short_tp[1]) and last_shortCondition > nz(last_short_sl[1]))L_tp = iff(Final_Long_tp, fixnan(Position_Price) * (1 + tp_long) , na) S_tp = iff(Final_Short_tp, fixnan(Position_Price) * (1 - tp_short) , na) //TP SIGNALS--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------tplLevel = (in_longCondition and (last_longCondition > nz(last_long_tp[1])) and (last_longCondition > nz(last_long_sl[1])) and not Final_Long_sl[1]) ? (nLongs > 1) ? (fixnan(Position_Price) * (1 + tp_long)) : (last_open_longCondition * (1 + tp_long)) : natpsLevel = (in_shortCondition and (last_shortCondition > nz(last_short_tp[1])) and (last_shortCondition > nz(last_short_sl[1])) and not Final_Short_sl[1]) ? (nShorts > 1) ? (fixnan(Position_Price) * (1 - tp_short)) : (last_open_shortCondition * (1 - tp_short)) : na//SL ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------Risk = sl0Percent_Capital = 99sl = in_longCondition ? min(sl0,(((Risk) * 100) / (Percent_Capital * max(1, nLongs)))) : in_shortCondition ? min(sl0,(((Risk) * 100) / (Percent_Capital * max(1, nShorts)))) : sl0 Normal_long_sl = ((in_longCondition and low <= ((1 - (sl / 100)) * (fixnan(Position_Price)))))Normal_short_sl = ((in_shortCondition and high >= ((1 + (sl / 100)) * (fixnan(Position_Price))))) last_long_sl := Normal_long_sl ? time : nz(last_long_sl[1])last_short_sl := Normal_short_sl ? time : nz(last_short_sl[1])Final_Long_sl := Normal_long_sl and last_longCondition > nz(last_long_sl[1]) and last_longCondition > nz(last_long_tp[1]) and not Final_Long_tpFinal_Short_sl := Normal_short_sl and last_shortCondition > nz(last_short_sl[1]) and last_shortCondition > nz(last_short_tp[1]) and not Final_Short_tp//RE-ENTRY ON TP-HIT-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------if Final_Long_tp or Final_Long_sl CondIni_long := -1 sum_long := 0.0 nLongs := na if Final_Short_tp or Final_Short_sl CondIni_short := 1 sum_short := 0.0 nShorts := na// Colors ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------Bar_color = in_longCondition ? #009688 : in_shortCondition ? #f06292 : color.orangebarcolor (color = Bar_color)//PLOTS==============================================================================================================================================================================================================================================================================================================plot(L_tp, title = "TP_L", style = plot.style_cross, color = color.fuchsia, linewidth = 7 )plot(S_tp, title = "TP_S", style = plot.style_cross, color = color.fuchsia, linewidth = 7 )//Price plots ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------plot((nLongs > 1) or (nShorts > 1) ? Position_Price : na, title = "Price", color = in_longCondition ? color.aqua : color.orange, linewidth = 2, style = plot.style_cross)plot(tplLevel, title="Long TP ", style = plot.style_cross, color=color.fuchsia, linewidth = 1 )plot(tpsLevel, title="Short TP ", style = plot.style_cross, color=color.fuchsia, linewidth = 1 )//PLOTSHAPES----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------plotshape(Final_Long_tp, title="TP Long Signal", style = shape.triangledown, location=location.abovebar, color=color.red, size=size.tiny , text="TP", textcolor=color.red, transp = 0 ) plotshape(Final_Short_tp, title="TP Short Signal", style = shape.triangleup, location=location.belowbar, color=color.green, size=size.tiny , text="TP", textcolor=color.green, transp = 0 ) plotshape(longCondition, title="Long", style=shape.triangleup, location=location.belowbar, color=color.blue, size=size.tiny , transp = 0 )plotshape(shortCondition, title="Short", style=shape.triangledown, location=location.abovebar, color=color.red, size=size.tiny , transp = 0 )// Backtest ==================================================================================================================================================================================================================================================================================================================================if L_basic_condt strategy.entry ("LONG", strategy.long )if S_basic_condt strategy.entry ("SHORT", strategy.short ) strategy.exit("TP_L", "LONG", profit = (abs((last_open_longCondition * (1 + tp_long)) - last_open_longCondition) / syminfo.mintick), limit = nLongs >= 1 ? strategy.position_avg_price * (1 + tp_long) : na, loss = (abs((last_open_longCondition*(1-(sl/100)))-last_open_longCondition)/syminfo.mintick))strategy.exit("TP_S", "SHORT", profit = (abs((last_open_shortCondition * (1 - tp_short)) - last_open_shortCondition) / syminfo.mintick), limit = nShorts >= 1 ? strategy.position_avg_price*(1-(tp_short)) : na, loss = (abs((last_open_shortCondition*(1+(sl/100)))-last_open_shortCondition)/syminfo.mintick))//By BabehDyo