Pine Script v5 · Strategy
BTC WaveTrend R-R=1-1.5
A Pine Script v5 strategy built on EMA (ap, 10) and SMA (wt1, 4). It has 2 order rules, 1 entry among them, and trades long only with the default settings. Exits use a stop loss and a profit target. Each trade is one contract and pays no commission. 8 settings; defaults include Channel Length 10, Average Length 21 and Over Bought Lv 1 60.
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 BTC WaveTrend R-R=1-1.5 repaint?
- No
- No repainting patterns were found in the source, and a live tick-by-tick replay matched history on 4 of 4 trades.
- How did BTC WaveTrend R-R=1-1.5 do on BTCUSDT 1D with default settings?
- +0.16%
- From 26 Jan 2024 to 21 Oct 2026, over 28 closed trades, against +102.5% for buy and hold. A backtest, not investment advice.
- Does BTC WaveTrend R-R=1-1.5 run in Pine Script v6?
- No
- The v6 version does not run in Zeal Terminal's engine: Pine Script v6 Error at @L37:C30: 'fill' has no 'transp' parameter in Pine Script v6. Use color.new(color, transparency) instead. The v6 version is shown for reference and is not offered as a download.
- Does BTC WaveTrend R-R=1-1.5 use a stop loss?
- Yes
- strategy.exit sets a stop on line 32.
- Does BTC WaveTrend R-R=1-1.5 run in Zeal Terminal?
- Yes
- It compiles in 12 ms and runs 1,000 bars in 50 ms, in the browser.
BTCUSDT · 1D · default settings
- SL
- TP
- Entry
- Winning trade
- Losing trade
- Equity
- Buy and hold
- Net profit
- +0.16%
- $1,644.69
- Buy and hold
- +102.5%
- same period
- Closed trades
- 28
- 13 won · 15 lost
- Profitable
- 46.4%
- of closed trades
- Profit factor
- 1.02
- gross profit ÷ gross loss
- Max drawdown
- 2.66%
- −$26,561.70
One run with the author's default settings, $1,000,000 starting capital, commission as the script sets it. A long position was still open at the last bar. 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
4 settings do nothing
“Over Bought Lv 1”, “Over Bought Lv 2”, “Over Sold Lv 1”, “Over Sold Lv 2” are declared but never read.
-
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.
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 |
|---|---|---|---|
| Set up WaveTrend | |||
| Channel Length | 10 | int | esa d |
| Average Length | 21 | int | tci |
| Over Bought Lv 1 | 60 | int | unused |
| Over Bought Lv 2 | 53 | int | unused |
| Over Sold Lv 1 | -60 | int | unused |
| Over Sold Lv 2 | -53 | int | unused |
| Set up risk : reward | |||
| Limit value WT1 to open entry long | 20 | int | buy |
| Risk : Reward | 1.5 | float | takeprofitlevel |
What it calculates
- EMAap, Channel Length (10)
esa · line 14 - EMAmath.abs(ap - esa), Channel Length (10)
d · line 15 - EMAci, Average Length (21)
tci · line 17 - SMAwt1, 4
wt2 · line 20
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.
Order rules
| Order | Fires when | By default | Line |
|---|---|---|---|
| Open Long long | (buy) | On | 25 |
| Exit Long stop and limit | every bar | On | 32 |
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 | +0.2% | +102.5% | 28 | 46% | 1.02 | 2.7% | 26 Jan 2024 – 21 Oct 2026 |
| BTCUSDT 4h | +0.3% | +5.5% | 37 | 49% | 1.13 | 0.9% | 8 May 2026 – 21 Oct 2026 |
| ETHUSDT 1D | −0.1% | +9.8% | 34 | 44% | 0.82 | 0.2% | 26 Jan 2024 – 21 Oct 2026 |
| ETHUSDT 4h | +0.0% | +8.4% | 38 | 50% | 1.12 | 0.0% | 8 May 2026 – 21 Oct 2026 |
| SOLUSDT 1D | −0.0% | +16.7% | 34 | 41% | 0.96 | 0.0% | 26 Jan 2024 – 21 Oct 2026 |
| SOLUSDT 4h | −0.0% | +21.5% | 37 | 38% | 0.89 | 0.0% | 8 May 2026 – 21 Oct 2026 |
| BNBUSDT 1D | −0.0% | +148.3% | 32 | 44% | 0.89 | 0.0% | 26 Jan 2024 – 21 Oct 2026 |
| BNBUSDT 4h | +0.0% | +17.1% | 38 | 47% | 1.19 | 0.0% | 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 | 29% | −$6,009.29 |
| Sideways market | 15 | 47% | −$5,282.14 |
| Falling market | 6 | 67% | $12,936.10 |
Rising and falling mean the market moved more than 15% over the 90 bars before entry.
How bad could the drawdown be?
5.2%
The 95th percentile of the worst drawdown when the same 28 trades are reshuffled 5,000 times. The bar spans the 5th to 95th percentile, 2.2% to 5.2%; the tick is what actually happened, 2.6%. Order luck alone moves it this much.
All 28 trades
| Side | Entry | Exit | Bars | P&L |
|---|---|---|---|---|
| long | 26 Mar 2024 69,880.00 | 13 Apr 2024 63,000.00 | 18 | −$6,880.00 |
| long | 21 Apr 2024 64,940.60 | 30 Apr 2024 59,600.00 | 9 | −$5,340.57 |
| long | 5 May 2024 63,892.00 | 4 Jul 2024 56,911.80 | 60 | −$6,980.19 |
| long | 10 Jul 2024 58,050.00 | 15 Jul 2024 63,734.80 | 5 | $5,684.76 |
| long | 10 Aug 2024 60,838.00 | 6 Sep 2024 54,558.60 | 27 | −$6,279.37 |
| long | 11 Sep 2024 57,636.00 | 19 Sep 2024 63,646.50 | 8 | $6,010.47 |
| long | 8 Oct 2024 62,224.00 | 9 Oct 2024 61,689.30 | 1 | −$534.75 |
| long | 13 Oct 2024 63,206.20 | 28 Oct 2024 69,596.60 | 15 | $6,390.35 |
| long | 3 Jan 2025 96,984.80 | 9 Jan 2025 92,033.70 | 6 | −$4,951.06 |
| long | 15 Jan 2025 96,560.90 | 20 Jan 2025 107,517.00 | 5 | $10,956.20 |
| long | 15 Feb 2025 97,500.50 | 18 Feb 2025 94,088.20 | 3 | −$3,412.24 |
| long | 21 Feb 2025 98,305.00 | 24 Feb 2025 93,388.10 | 3 | −$4,916.92 |
| long | 3 Mar 2025 94,270.00 | 10 Mar 2025 78,258.50 | 7 | −$16,011.50 |
| long | 14 Mar 2025 81,115.80 | 24 Mar 2025 87,880.40 | 10 | $6,764.67 |
| long | 3 Apr 2025 82,516.30 | 3 Apr 2025 81,278.50 | 0 | −$1,237.76 |
| long | 11 Apr 2025 79,607.30 | 21 Apr 2025 87,088.30 | 10 | $7,480.95 |
| long | 9 Jun 2025 105,734.00 | 21 Jun 2025 101,096.00 | 12 | −$4,638.21 |
| long | 25 Jun 2025 106,083.00 | 11 Jul 2025 117,908.00 | 16 | $11,824.50 |
| long | 8 Aug 2025 117,472.00 | 20 Aug 2025 112,650.00 | 12 | −$4,822.02 |
| long | 3 Sep 2025 111,240.00 | 17 Sep 2025 117,218.00 | 14 | $5,977.52 |
| long | 30 Sep 2025 114,312.00 | 3 Oct 2025 122,183.00 | 3 | $7,871.36 |
| long | 22 Oct 2025 108,298.00 | 24 Oct 2025 111,589.00 | 2 | $3,291.45 |
| long | 10 Nov 2025 104,723.00 | 13 Nov 2025 99,260.90 | 3 | −$5,462.09 |
| long | 24 Nov 2025 86,830.00 | 13 Jan 2026 96,175.00 | 50 | $9,345.00 |
| long | 9 Feb 2026 70,330.40 | 5 Jun 2026 60,000.00 | 116 | −$10,330.40 |
| long | 8 Jun 2026 63,332.00 | 24 Jun 2026 59,130.90 | 16 | −$4,201.10 |
| long | 2 Jul 2026 60,024.00 | 4 Jul 2026 63,359.70 | 2 | $3,335.72 |
| long | 5 Aug 2026 64,106.60 | 19 Aug 2026 66,816.40 | 14 | $2,709.83 |
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 |
|---|---|---|---|---|---|
| BTC WaveTrend R-R=1-1.5 this page | — | v5 strategy | +0.2% | 28 | 2.7% |
| MACD Long Strat by TheGrindToday | ema sma | v4 strategy | +24.0% | 79 | 20.1% |
| Stock trending strategy by exlux99 | ema sma | v4 strategy | +35.3% | 21 | 14.7% |
| 4-Hour Stochastic EMA Trend by slymnturkoglu | ema sma | v4 strategy | No trades on this market | ||
| 4X EMA and volume strategy by SoftKill21 | ema sma | v4 strategy | +1.8% | 3 | 25.8% |
| Simple Momentum Strategy Based on SMA, EMA and Volume by slip_stream | sma ema | v4 strategy | +7.4% | 18 | 27.4% |
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.
- 8 settings use the untyped input() (line 6, 7, 8, 9, 10, 11, 22, 27). It still compiles in v6; input.int, input.float or input.source state the type.
- No v6-only features. v6 is not needed to run this script.
Same 28 trades and the same P&L on BTCUSDT 1D, 1,000 bars, in Zeal Terminal's engine.
- Line 6: input() → input.int()
- Line 7: input() → input.int()
- Line 8: input() → input.int()
- Line 9: input() → input.int()
- Line 10: input() → input.int()
- Line 11: input() → input.int()
- Line 22: input() → input.int()
- Line 27: input() → input.float()
⋯//WaveTrend indicator - author LazyBear-n1 = input(10, "Channel Length", group = "Set up WaveTrend")+n1 = input.int(10, "Channel Length", group = "Set up WaveTrend")-n2 = input(21, "Average Length", group = "Set up WaveTrend")+n2 = input.int(21, "Average Length", group = "Set up WaveTrend")-oblv1 = input(60, "Over Bought Lv 1", group = "Set up WaveTrend")+oblv1 = input.int(60, "Over Bought Lv 1", group = "Set up WaveTrend")-oblv2 = input(53, "Over Bought Lv 2", group = "Set up WaveTrend")+oblv2 = input.int(53, "Over Bought Lv 2", group = "Set up WaveTrend")-oslv1 = input(-60, "Over Sold Lv 1", group = "Set up WaveTrend")+oslv1 = input.int(-60, "Over Sold Lv 1", group = "Set up WaveTrend")-oslv2 = input(-53, "Over Sold Lv 2", group = "Set up WaveTrend")+oslv2 = input.int(-53, "Over Sold Lv 2", group = "Set up WaveTrend") ⋯//Strategy-limitwt1 = input(20, "Limit value WT1 to open entry long", group = "Set up risk : reward")+limitwt1 = input.int(20, "Limit value WT1 to open entry long", group = "Set up risk : reward")buy = ta.crossover(wt1, wt2) and wt1 < limitwt1⋯//Set up risk : reward-rr = input(1.5, "Risk : Reward", group = "Set up risk : reward")+rr = input.float(1.5, "Risk : Reward", group = "Set up risk : reward")var float stoplosslevel = na⋯Does it run in Pine Script v6?
No
The v6 version does not run in Zeal Terminal's engine: Pine Script v6 Error at @L37:C30: 'fill' has no 'transp' parameter in Pine Script v6. Use color.new(color, transparency) instead. The v6 version is shown for reference and is not offered as a download. It differs from the v5 version by 1 edit.
⋯// ©TrendCrypto2022-//@version=5+//@version=6strategy("4 - BTC WaveTrend R:R=1:1.5", overlay=true)⋯Where it runs
| Engine | Compiles | Runs | Matches TradingView |
|---|---|---|---|
| Zeal Terminal · OpenPineScript v2 | Yes 12 ms | Yes 1,000 bars in 50 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/// ©TrendCrypto2022//@version=5strategy("4 - BTC WaveTrend R:R=1:1.5", overlay=true)//WaveTrend indicator - author LazyBearn1 = input(10, "Channel Length", group = "Set up WaveTrend")n2 = input(21, "Average Length", group = "Set up WaveTrend")oblv1 = input(60, "Over Bought Lv 1", group = "Set up WaveTrend")oblv2 = input(53, "Over Bought Lv 2", group = "Set up WaveTrend")oslv1 = input(-60, "Over Sold Lv 1", group = "Set up WaveTrend")oslv2 = input(-53, "Over Sold Lv 2", group = "Set up WaveTrend") ap = hlc3 esa = ta.ema(ap, n1)d = ta.ema(math.abs(ap - esa), n1)ci = (ap - esa) / (0.015 * d)tci = ta.ema(ci, n2) wt1 = tciwt2 = ta.sma(wt1,4)//Strategylimitwt1 = input(20, "Limit value WT1 to open entry long", group = "Set up risk : reward")buy = ta.crossover(wt1, wt2) and wt1 < limitwt1if (buy) strategy.entry("Long", strategy.long)//Set up risk : rewardrr = input(1.5, "Risk : Reward", group = "Set up risk : reward")var float stoplosslevel = naif buy and strategy.position_size==0 stoplosslevel := math.min(low, low[1], low[2])takeprofitlevel = strategy.position_avg_price + rr*(strategy.position_avg_price-stoplosslevel)strategy.exit("Long", limit = takeprofitlevel, stop=stoplosslevel, comment="TP/SL")//Plot SL and TPp1=plot(strategy.position_size > 0 ? stoplosslevel : na, color=color.red, style=plot.style_linebr, title="SL")p2=plot(strategy.position_size > 0 ? takeprofitlevel : na, color=color.lime, style=plot.style_linebr, title="TP")p3=plot(strategy.position_size > 0 ? strategy.position_avg_price : na, color=color.silver, style=plot.style_linebr, title="Entry")fill(p1, p3, color=color.red, transp = 90)fill(p2, p3, color=color.green, transp = 90)