Pine Script v5 · Strategy
Renko Strategy V2
A Pine Script v5 strategy built on ATR (10). It has 4 order rules, 2 entries among them, and trades long only with the default settings; 1 entry is switched off until a setting enables it. Exits wait for a signal; there is no stop loss. Each trade commits 10000 in cash and pays 0.025 commission. 4 settings; defaults include ATR Length 10.
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 Renko Strategy V2 repaint?
- No
- No repainting patterns were found in the source. The live replay was not measured: it had no trades to compare.
- How did Renko Strategy V2 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 code limits trading to a date window, which can leave this period out. It closed no trades on the other markets either. A backtest, not investment advice.
- What alerts does Renko Strategy V2 have?
- 2
- Long Entry at price (' + str.tostring(close) + '); Short Entry at price (' + str.tostring(close) + ').
- Does Renko Strategy V2 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 Renko Strategy V2 use a stop loss?
- No
- Every exit waits for a signal; nothing limits a losing trade before it fires.
BTCUSDT · 1D · default settings
- Plot
- Winning trade
- Losing trade
- Equity
- Buy and hold
- 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, $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
No stop loss
Every exit waits for a signal. Nothing limits a losing trade before the exit condition fires.
-
Note
No slippage
Fills are assumed at the exact open price. Add slippage in the properties for a more realistic test.
-
Note
The short side is off by default line 73
Its orders only fire after “Allow Short” is switched on. The figures on this page cover long trades only.
-
Note
Uses an argument v6 removed
when = on line 70, 71, 73, 74. 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.
| Setting | Default | Type and range | Feeds |
|---|---|---|---|
| Date Range | |||
| Start Time | timestamp('01 Jan 2020 00:00 +0000') | time | time_cond |
| End Time | timestamp('31 Dec 2023 23:59 +0000') | time | time_cond |
| Settings | |||
| Allow Short | false | bool | entry short line 72 line 78 |
| ATR Length | 10 | int | atr |
What it calculates
- ATRATR Length (10)
atr · line 24
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 | long_entry | On | 70 |
| Close long | long_exit_entry | On | 71 |
| Open short short | short_entry | Off “Allow Short” | 73 |
| Close short | short_exit_entry | On | 74 |
Each order is guarded by the setting shown. “Off” orders never fire unless that setting is switched on.
Alerts
| Alert | Call | Message | Line |
|---|---|---|---|
| (no title) | alert | Long Entry at price (' + str.tostring(close) + ') | 77 |
| (no title) | alert | Short Entry at price (' + str.tostring(close) + ') | 79 |
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 |
|---|---|---|---|---|---|
| Renko Strategy V2 this page | — | v5 strategy | 0.0% | 0 | 0.0% |
| SOJA PIVOT by ParaBellum68 | atr | v4 strategy | +3.3% | 9 | 18.2% |
| Volatility System by EduardoMattje | atr | v5 strategy | +150.2% | 2 | 21.5% |
| ATR Stop Buy Strategy by phobo3s | atr | v4 strategy | No trades on this market | ||
| VBand Strategy by Saravanan_Ragavan | atr | v4 strategy | No trades on this market | ||
| Volatility Breakout Strategy [Angel Algo] by AngelAlgo | atr | v5 strategy | +3.1% | 18 | 3.6% |
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.
- 4 strategy calls use the when = argument (line 70, 71, 73, 74). 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 70: when = long_entry → if block
- Line 71: when = long_exit_entry → if block
- Line 73: when = short_entry → if block
- Line 74: when = short_exit_entry → if block
⋯short_exit_entry = plotColor == color.green // or (allow_alternative_sl and close > high_result )-strategy.entry('long', strategy.long, when=long_entry)+if long_entry+ strategy.entry('long', strategy.long)-strategy.close('long', when=long_exit_entry, comment=closeStatus)+if long_exit_entry+ strategy.close('long', comment=closeStatus)if allow_short- strategy.entry('short', strategy.short, when=short_entry)+ if short_entry+ strategy.entry('short', strategy.short)-strategy.close('short', when=short_exit_entry, comment=closeStatus)+if short_exit_entry+ strategy.close('short', comment=closeStatus)//=== Alerts ===⋯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.
-//@version=5+//@version=6// This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License https://creativecommons.org/licenses/by-sa/4.0/⋯Where it runs
| Engine | Compiles | Runs | Matches TradingView |
|---|---|---|---|
| Zeal Terminal · OpenPineScript v2 | Yes 37 ms | Yes 1,000 bars in 45 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.
//@version=5// This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License https://creativecommons.org/licenses/by-sa/4.0/// © dman103strategy(title='Renko Strategy V2', shorttitle='Renko Strategy V2', overlay=true, precision=3, commission_value=0.025, default_qty_type=strategy.cash, default_qty_value=10000, initial_capital=10000)// Version 2.0 of my previous renko strategy using Renko calculations, this time without Tilson T3 and without using security with Renko to remove repaints!// Seems to work nicely on cryptocurrencies on higher time frames.//== Description ==// Strategy gets Renko values and uses renko close and open to trigger signals.// Base on these results the strategy triggers a long and short orders, where green is uptrending and red is downtrending.// This Renko version is based on ATR, you can Set ATR (in settings) to adjust it.// == Notes ==// Supports alerts.// Supports backtesting time ranges.// Shorts are disabled by default (can be enabled in settings).// Link to previous Renko strategy V1: https://www.tradingview.com/script/KeWBWLGT-Renko-Strategy-T3-V1///// Stay tuned for version V3 in the future as i have an in progress prototype, Follow to get updated: https://www.tradingview.com/u/dman103/#published-scripts// === INPUT BACKTEST RANGE ===i_startTime = input.time(defval=timestamp('01 Jan 2020 00:00 +0000'), title='Start Time', group='Date Range')i_endTime = input.time(defval=timestamp('31 Dec 2023 23:59 +0000'), title='End Time', group='Date Range')time_cond = time >= i_startTime and time <= i_endTimeallow_short = input.bool(false, title='Allow Short', group='Settings')atr_len = input.int(10, 'ATR Length', group='Settings')atr = ta.atr(atr_len)// Thanks to renko snippet calculations from @RafaelZioni https://www.tradingview.com/script/2vKhpfVH-Renko-XZ/Renko1() => p1 = 0.0 p1 := close > nz(p1[1]) + atr ? nz(p1[1]) + atr : close < nz(p1[1]) - atr ? nz(p1[1]) - atr : nz(p1[1]) p1Renko2() => p2 = 0.0 Br_1 = Renko1() p2 := Renko1() != Renko1()[1] ? Br_1[1] : nz(p2[1]) p2Renko3() => p3 = 0.0 p3 := open > nz(p3[1]) + atr ? nz(p3[1]) + atr : open < nz(p3[1]) - atr ? nz(p3[1]) - atr : nz(p3[1]) p3Renko4() => open_v = 0.0 Br_2 = Renko3() open_v := Renko3() != Renko3()[1] ? Br_2[1] : nz(open_v[1]) open_vo2 = Renko4()c2 = Renko1()l2 = lowh2 = high//=== Plotting ===crossPlot = 0.0if o2 < c2 crossPlot := o2 crossPlotelse crossPlot := o2 crossPlot// Used to make sure that even if o2 and c2 are equal, the result (short or long) will be based on previous trend.bars_since_up = ta.barssince(o2 < c2)bars_since_down = ta.barssince(o2 > c2)go_long = bars_since_up < bars_since_down and o2 < c2go_short = bars_since_up > bars_since_down and o2 > c2plotColor = go_long ? color.green : go_short ? color.red : color.whiteplot(crossPlot, color=plotColor, style=plot.style_circles, linewidth=2, join=true)changeCond = plotColor != plotColor[1]//=== Buy/Sell ===closeStatus = strategy.openprofit > 0 ? 'win' : 'lose'long_entry = plotColor == color.green and time_cond and changeCondlong_exit_entry = plotColor == color.red //or (allow_alternative_sl and close < low_result )short_entry = plotColor == color.red and time_cond and changeCondshort_exit_entry = plotColor == color.green // or (allow_alternative_sl and close > high_result )strategy.entry('long', strategy.long, when=long_entry)strategy.close('long', when=long_exit_entry, comment=closeStatus)if allow_short strategy.entry('short', strategy.short, when=short_entry)strategy.close('short', when=short_exit_entry, comment=closeStatus)//=== Alerts ===if long_entry alert('Long Entry at price (' + str.tostring(close) + ')', alert.freq_once_per_bar)if allow_short and short_entry alert('Short Entry at price (' + str.tostring(close) + ')', alert.freq_once_per_bar)