Zeal Terminal Open Zeal Terminal

Pine Script v4 · Strategy

Renko Strategy T3 V1

A Pine Script v4 strategy with no technical-analysis calculation. It has 4 order rules, 2 entries among them, and trades long and short with the default settings. Exits wait for a signal; there is no stop loss. Each trade commits 10000 in cash and pays no commission. 15 settings; defaults include From Month 1, From Day 1 and From Year 2017.

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 T3 V1 repaint?
Yes
At least one pattern in the source can repaint: higher-timeframe data.
Can Renko Strategy T3 V1 be converted to Pine Script v5?
Not tested
The steps are shown below, but the original does not run in Zeal Terminal's engine, so they could not be checked.
What alerts does Renko Strategy T3 V1 have?
2
Renko Buy Signal; Renko Sell Signal.
Does Renko Strategy T3 V1 use a stop loss?
No
Every exit waits for a signal; nothing limits a losing trade before it fires.
Does Renko Strategy T3 V1 run in Zeal Terminal?
No
Not yet: renko: this engine cannot build Renko bricks from OHLCV bars — the transform needs intrabar prices this engine is not given, and returning the untransformed symbol would silently produce standard candles. See runtime/v1/stdlib/chart.ts.
Does not run in Zeal Terminal yetRenko: this engine cannot build Renko bricks from OHLCV bars — the transform needs intrabar prices this engine is not given, and returning the untransformed symbol would silently produce standard candles. See runtime/v1/stdlib/chart.ts. The settings, logic and review below are read from the source, which does not need a run.

Review

What a careful reader of this script would point out, found by checking the source.

  • Check

    2 settings do nothing

    “---------------- Trade Range ----------------”, “---------------- Settings ----------------” are declared but never read.

  • Check

    No stop loss

    Every exit waits for a signal. Nothing limits a losing trade before the exit condition fires.

  • 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 71, 72, 74, 75. The upgraded version below moves each call inside an if block.

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 renko → ticker.renko, ema → ta.ema, security → request.security, barssince → ta.barssince.
  • 4 strategy calls use the when = argument (line 71, 72, 74, 75). It is deprecated in v5 and removed in v6, where each call moves inside an if block.

v4 → v5

Not verified

The v4 script does not run in Zeal Terminal's engine (renko: this engine cannot build Renko bricks from OHLCV bars — the transform needs intrabar prices this engine is not given, and returning the untransformed symbol would silently produce standard candles. See runtime/v1/stdlib/chart.ts.), so this step could not be checked.

  • Line 1: //@version=4 → //@version=5
  • Line 17: input(type = input.bool) → input.bool()
  • Line 27: input(type = input.bool) → input.bool()
  • Line 30: renko → ticker.renko
  • Line 38: ema → ta.ema
  • Line 38: ema → ta.ema
9 more edits
  • Line 38: ema → ta.ema
  • Line 41: security → request.security
  • Line 42: security → request.security
  • Line 43: security → request.security
  • Line 44: security → request.security
  • Line 56: barssince → ta.barssince
  • Line 57: barssince → ta.barssince
  • Line 71: strategy.entry(…, true) → strategy.entry(…, strategy.long)
  • Line 74: strategy.entry(…, false) → strategy.entry(…, strategy.short)
-//@version=4+//@version=5// This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License https://creativecommons.org/licenses/by-sa/4.0/⋯strategy(title="Renko Strategy T3 V1", shorttitle="Renko Strategy T3 V1", overlay=true,precision=3, commission_value=0.0, default_qty_type=strategy.cash, default_qty_value=10000, initial_capital=10000)-useDate = input(true,     title='---------------- Trade Range ----------------', type=input.bool)+useDate = input.bool(true,     title='---------------- Trade Range ----------------')FromMonth = input(defval = 1, title = "From Month", minval = 1, maxval = 12)⋯window()  => time >= start and time <= finish ? true : false // time range function-settings = input(true,     title='---------------- Settings ----------------', type=input.bool)+settings = input.bool(true,     title='---------------- Settings ----------------')renkoSize = input(5,title="Renko size",step=1)renkoTimePeriod = input("", title="Time frame")// For experimenting, Leave this blank for current time frame, D is for day, W is for week and so on. Numbers for minues.-renko_tickerid = renko(syminfo.tickerid, "ATR", renkoSize)+renko_tickerid = ticker.renko(syminfo.tickerid, "ATR", renkoSize)allow_short = input(true,title="Allow Short")⋯T3FactorCalc = T3Factor *.10-gd(src, T3Length, T3FactorCalc) => ema(src, T3Length) * (1 + T3FactorCalc) - ema(ema(src, T3Length), T3Length) * T3FactorCalc +gd(src, T3Length, T3FactorCalc) => ta.ema(src, T3Length) * (1 + T3FactorCalc) - ta.ema(ta.ema(src, T3Length), T3Length) * T3FactorCalc t3(src, T3Length, T3FactorCalc) => gd(gd(gd(src, T3Length, T3FactorCalc), T3Length, T3FactorCalc), T3Length, T3FactorCalc) //=== Renko Logic ===-renko_close = security(renko_tickerid, renkoTimePeriod, close[1],lookahead=barmerge.lookahead_on)+renko_close = request.security(renko_tickerid, renkoTimePeriod, close[1],lookahead=barmerge.lookahead_on)-renko_open = security(renko_tickerid, renkoTimePeriod, open[1],lookahead=barmerge.lookahead_on)+renko_open = request.security(renko_tickerid, renkoTimePeriod, open[1],lookahead=barmerge.lookahead_on)-renko_high = security(renko_tickerid, renkoTimePeriod, high[1],lookahead=barmerge.lookahead_on)+renko_high = request.security(renko_tickerid, renkoTimePeriod, high[1],lookahead=barmerge.lookahead_on)-renko_low = security(renko_tickerid,  renkoTimePeriod, low[1],lookahead=barmerge.lookahead_on)+renko_low = request.security(renko_tickerid,  renkoTimePeriod, low[1],lookahead=barmerge.lookahead_on)o2 = t3(renko_open, T3Length, T3FactorCalc) ⋯// Used to make sure that even if o2 and c2 are equal the result (short or long) will be based on previous trend. Usually happens when T3 Tilson length is small.-bars_since_up=barssince(o2 < c2)+bars_since_up=ta.barssince(o2 < c2)-bars_since_down=barssince(o2 > c2)+bars_since_down=ta.barssince(o2 > c2)go_long= (bars_since_up<bars_since_down) and  o2<c2⋯if (disable_strategy == false)-    strategy.entry("long", true, when = long_entry)+    strategy.entry("long", strategy.long, when = long_entry)    strategy.close("long",when=long_exit_entry,comment=closeStatus)    if (allow_short)-        strategy.entry("short",false, when = short_entry)+        strategy.entry("short",strategy.short, when = short_entry)strategy.close("short",when=short_exit_entry,comment=closeStatus)⋯

Clean v5

Not verified

The v5 script does not run in Zeal Terminal's engine (renko: this engine cannot build Renko bricks from OHLCV bars — the transform needs intrabar prices this engine is not given, and returning the untransformed symbol would silently produce standard candles. See runtime/v1/stdlib/chart.ts.), so this step could not be checked.

  • Line 18: input() → input.int()
  • Line 19: input() → input.int()
  • Line 20: input() → input.int()
  • Line 21: input() → input.int()
  • Line 22: input() → input.int()
  • Line 23: input() → input.int()
11 more edits
  • Line 28: input() → input.int()
  • Line 29: input() → input.string()
  • Line 31: input() → input.bool()
  • Line 32: input() → input.bool()
  • Line 33: input() → input.bool()
  • Line 35: input() → input.float()
  • Line 36: input() → input.int()
  • Line 71: when = long_entry → if block
  • Line 72: when = long_exit_entry → if block
  • Line 74: when = short_entry → if block
  • Line 75: when = short_exit_entry → if block
⋯useDate = input.bool(true,     title='---------------- Trade Range ----------------')-FromMonth = input(defval = 1, title = "From Month", minval = 1, maxval = 12)+FromMonth = input.int(defval = 1, title = "From Month", minval = 1, maxval = 12)-FromDay   = input(defval = 1, title = "From Day", minval = 1, maxval = 31)+FromDay   = input.int(defval = 1, title = "From Day", minval = 1, maxval = 31)-FromYear  = input(defval = 2017, title = "From Year", minval = 2000)+FromYear  = input.int(defval = 2017, title = "From Year", minval = 2000)-ToMonth   = input(defval = 1, title = "To Month", minval = 1, maxval = 12)+ToMonth   = input.int(defval = 1, title = "To Month", minval = 1, maxval = 12)-ToDay     = input(defval = 1, title = "To Day", minval = 1, maxval = 31)+ToDay     = input.int(defval = 1, title = "To Day", minval = 1, maxval = 31)-ToYear    = input(defval = 2021, title = "To Year", minval = 2010)+ToYear    = input.int(defval = 2021, title = "To Year", minval = 2010)start     = timestamp(FromYear, FromMonth, FromDay, 00, 00)  // backtest start window⋯settings = input.bool(true,     title='---------------- Settings ----------------')-renkoSize = input(5,title="Renko size",step=1)+renkoSize = input.int(5,title="Renko size",step=1)-renkoTimePeriod = input("", title="Time frame")// For experimenting, Leave this blank for current time frame, D is for day, W is for week and so on. Numbers for minues.+renkoTimePeriod = input.string("", title="Time frame")// For experimenting, Leave this blank for current time frame, D is for day, W is for week and so on. Numbers for minues.renko_tickerid = ticker.renko(syminfo.tickerid, "ATR", renkoSize)-allow_short = input(true,title="Allow Short")+allow_short = input.bool(true,title="Allow Short")-color_bars = input(false, title="Color Bars")+color_bars = input.bool(false, title="Color Bars")-disable_strategy = input(false,title="Disable Strategy")+disable_strategy = input.bool(false,title="Disable Strategy")// === Tilson T3 ===-T3Factor=input( defval=0.5, minval=0,maxval = 100,step = 0.05,title="T3 Factor")+T3Factor=input.float( defval=0.5, minval=0,maxval = 100,step = 0.05,title="T3 Factor")-T3Length = input(defval=2, minval=1, title ="T3 Length")+T3Length = input.int(defval=2, minval=1, title ="T3 Length")T3FactorCalc = T3Factor *.10⋯if (disable_strategy == false)-    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

The v5 script does not run in Zeal Terminal's engine (renko: this engine cannot build Renko bricks from OHLCV bars — the transform needs intrabar prices this engine is not given, and returning the untransformed symbol would silently produce standard candles. See runtime/v1/stdlib/chart.ts.), so this step could not be checked. 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/⋯

Settings

Every input the script declares, with its default and what it feeds. Bounds are the ones the script enforces.

SettingDefaultType and rangeFeeds
---------------- Trade Range ----------------trueboolunused
From Month1int · min 1 · max 12start
From Day1int · min 1 · max 31start
From Year2017int · min 2000start
To Month1int · min 1 · max 12finish
To Day1int · min 1 · max 31finish
To Year2021int · min 2010finish
---------------- Settings ----------------trueboolunused
Renko size5int · step 1renko_tickerid
Time framestringrenko_close renko_open renko_high renko_low
Allow Shorttrueboolentry short line 73
Color Barsfalseboolbarcolor
Disable Strategyfalseboolentry long close long line 70
T3 Factor0.5float · min 0 · max 100 · step 0.05T3FactorCalc
T3 Length2int · min 1o2 c2 h2 l2 line 38 line 39

What it calculates

No technical-analysis calculation: the script works on prices and settings directly.

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.

FromYearFrom Yearsetting · 2017FromMonthFrom Monthsetting · 1FromDayFrom Daysetting · 1ToYearTo Yearsetting · 2021ToMonthTo Monthsetting · 1ToDayTo Daysetting · 1renkoSizeRenko sizesetting · 5T3FactorT3 Factorsetting · 0.5closecloseprice datarenkoTimePeriodTime framesetting · openopenprice datahighhighprice datalowlowprice dataT3LengthT3 Lengthsetting · 2startstartvaluefinishfinishvaluerenko_tickeridrenko_tickeridvalueT3FactorCalcT3FactorCalcvaluerenko_closerenko_closevaluerenko_openrenko_openvaluerenko_highrenko_highvaluerenko_lowrenko_lowvalueo2o2valuec2c2valueh2h2valuel2l2valuecrossPlotcrossPlotvaluecloseStatuscloseStatusvaluebars_since_up, bars_since_downbars_since_up · bars_si…2 conditionsgo_long, go_shortgo_long · go_short2 conditionschangeCondchangeCondconditionplotColor, long_entry, long_exit_entry, short_entry, short_exit_entryColourplotColor · long_entry +3entry:longOpen longstrategy.entryclose:longClose longstrategy.closeentry:shortOpen shortstrategy.entryclose:shortClose shortstrategy.closeplot:61plotplotbarcolor:62barcolorbarcoloralertcondition:77Renko Buy Signalalertconditionalertcondition:78Renko Sell Signalalertcondition

Order rules

OrderFires whenBy defaultLine
Open long longlong_entryOn71
Close longlong_exit_entryOn72
Open short shortshort_entryOn74
Close shortshort_exit_entryOn75

Each order is guarded by the setting shown. “Off” orders never fire unless that setting is switched on.

Alerts

AlertCallMessageLine
Renko Buy SignalalertconditionRenko Revered to Buy Signal77
Renko Sell SignalalertconditionRenko Revered to Sell Signal78

Does it repaint?

Yes

At least one pattern in the source can repaint; it is marked Check below.

The live replay needs a run, and this script does not run in Zeal Terminal yet; the answer comes from the checks on the source alone.

  • CheckHigher-timeframe data4 security call(s) use lookahead_on (line 41, 42, 43, 44). Without a [1] offset this reads future bars in history.
  • 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.

Similar scripts

No other indicator or strategy here shares enough of its calculations.

Where it runs

EngineCompilesRunsMatches TradingView
Zeal Terminal · OpenPineScript v2No Renko: this engine cannot build Renko bricks from OHLCV bars — the transform needs intrabar prices this engine is not given, and returning the untransformed symbol would silently produce standard candles. See runtime/v1/stdlib/chart.ts.Not measured
PineTSNo v5 and v6 only—Not measured

Zeal Terminal's engine currently reads an order side written as true, false as a short, whatever it says; this page passes the same side as strategy.long or strategy.short (lines 71, 74) so the engine trades the way the script says.

“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.

//@version=4// This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License https://creativecommons.org/licenses/by-sa/4.0/// © dman103// An interesting strategy using Renko calculations and T3 Tilson on normal charts targeted for cryptocurrencies but can work with different assets.// Tested on Daily but can work with lower frames (no too low) using Renko Size and T3 Length adjustments.// == Description ==// Strategy get Renko close/open/high/low values and smooth them with T3 Tilson.// Base on these results the strategy triggers a long and short orders, where green uptrending and red downtrending. // Including Alerts//// == Repaint ==// There seems to be some sort of inconsistency when doing 'Replay' to the strategy, which means using Replay function won't trade like if you see the trading results without Replay.// Regarding real time, it does not repaint. Of course you need to wait for the last active bar to complete for it to give you indication.// You can disable strategy to use it has a sole indicator.// There might be a new script of Renko Strategy V2 in the future as i have a prototype, follow to get updated: https://www.tradingview.com/u/dman103/#published-scriptsstrategy(title="Renko Strategy T3 V1", shorttitle="Renko Strategy T3 V1", overlay=true,precision=3, commission_value=0.0, default_qty_type=strategy.cash, default_qty_value=10000, initial_capital=10000)useDate = input(true,     title='---------------- Trade Range ----------------', type=input.bool)FromMonth = input(defval = 1, title = "From Month", minval = 1, maxval = 12)FromDay   = input(defval = 1, title = "From Day", minval = 1, maxval = 31)FromYear  = input(defval = 2017, title = "From Year", minval = 2000)ToMonth   = input(defval = 1, title = "To Month", minval = 1, maxval = 12)ToDay     = input(defval = 1, title = "To Day", minval = 1, maxval = 31)ToYear    = input(defval = 2021, title = "To Year", minval = 2010)start     = timestamp(FromYear, FromMonth, FromDay, 00, 00)  // backtest start windowfinish    = timestamp(ToYear, ToMonth, ToDay, 23, 59)        // backtest finish windowwindow()  => time >= start and time <= finish ? true : false // time range functionsettings = input(true,     title='---------------- Settings ----------------', type=input.bool)renkoSize = input(5,title="Renko size",step=1)renkoTimePeriod = input("", title="Time frame")// For experimenting, Leave this blank for current time frame, D is for day, W is for week and so on. Numbers for minues.renko_tickerid = renko(syminfo.tickerid, "ATR", renkoSize)allow_short = input(true,title="Allow Short")color_bars = input(false, title="Color Bars")disable_strategy = input(false,title="Disable Strategy")// === Tilson T3 ===T3Factor=input( defval=0.5, minval=0,maxval = 100,step = 0.05,title="T3 Factor")T3Length = input(defval=2, minval=1, title ="T3 Length")T3FactorCalc = T3Factor *.10gd(src, T3Length, T3FactorCalc) => ema(src, T3Length) * (1 + T3FactorCalc) - ema(ema(src, T3Length), T3Length) * T3FactorCalc t3(src, T3Length, T3FactorCalc) => gd(gd(gd(src, T3Length, T3FactorCalc), T3Length, T3FactorCalc), T3Length, T3FactorCalc) //=== Renko Logic ===renko_close = security(renko_tickerid, renkoTimePeriod, close[1],lookahead=barmerge.lookahead_on)renko_open = security(renko_tickerid, renkoTimePeriod, open[1],lookahead=barmerge.lookahead_on)renko_high = security(renko_tickerid, renkoTimePeriod, high[1],lookahead=barmerge.lookahead_on)renko_low = security(renko_tickerid,  renkoTimePeriod, low[1],lookahead=barmerge.lookahead_on)o2 = t3(renko_open, T3Length, T3FactorCalc) c2 =  t3(renko_close, T3Length, T3FactorCalc) h2 =  t3(renko_high, T3Length, T3FactorCalc) l2 =  t3(renko_low, T3Length, T3FactorCalc) //=== Plotting ===crossPlot= 0.0if (o2 < c2)    crossPlot := l2else     crossPlot := h2// Used to make sure that even if o2 and c2 are equal the result (short or long) will be based on previous trend. Usually happens when T3 Tilson length is small.bars_since_up=barssince(o2 < c2)bars_since_down=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 and  o2<c2 ? color.green : go_short and o2>c2?  color.red : color.white plot(crossPlot, color = plotColor, style = plot.style_circles, linewidth = 2,join=false)barcolor(color_bars ? plotColor==color.green ?color.lime : color.red : na)changeCond = plotColor != plotColor[1]//=== Buy/Sell ===closeStatus =  strategy.openprofit > 0 ? "win" : "lose"long_entry = plotColor == color.green and window()  and changeCondlong_exit_entry = plotColor == color.red //or (allow_alternative_sl and close < low_result  )short_entry = plotColor == color.red  and window() and changeCondshort_exit_entry = plotColor == color.green   // or (allow_alternative_sl and close > high_result )if (disable_strategy == false)    strategy.entry("long", true, when = long_entry)    strategy.close("long",when=long_exit_entry,comment=closeStatus)    if (allow_short)        strategy.entry("short",false, when = short_entry)strategy.close("short",when=short_exit_entry,comment=closeStatus)//=== Alerts ===alertcondition(go_long and changeCond , title='Renko Buy Signal', message='Renko Revered to Buy Signal')alertcondition(go_short and changeCond , title='Renko Sell Signal', message='Renko Revered to Sell Signal')