Zeal Terminal Open Zeal Terminal

Pine Script v4 · Strategy

Joseph Nemeth Heiken Ashi Renko MTF Strategy

A Pine Script v4 strategy built on EMA (close, 20). 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 is one contract and pays no commission. 4 settings; defaults include Middle time frame 60, Higher time frame D and Renko size 1.0.

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 Joseph Nemeth Heiken Ashi Renko MTF Strategy repaint?
No
No repainting patterns were found in the source.
Can Joseph Nemeth Heiken Ashi Renko MTF Strategy 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.
Does Joseph Nemeth Heiken Ashi Renko MTF Strategy use a stop loss?
No
Every exit waits for a signal; nothing limits a losing trade before it fires.
Does Joseph Nemeth Heiken Ashi Renko MTF Strategy 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

    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 39, 40, 41, 42. The upgraded version below moves each call inside an if block.

  • Note

    Uses long =, which v5 renamed line 39

    long = on line 39, 41. v5 writes it as direction = strategy.long or strategy.short.

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, security → request.security, heikinashi → ticker.heikinashi, ema → ta.ema.
  • 4 strategy calls use the when = argument (line 39, 40, 41, 42). 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 14: renko → ticker.renko
  • Line 15: security → request.security
  • Line 16: security → request.security
  • Line 20: heikinashi → ticker.heikinashi
  • Line 22: security → request.security
12 more edits
  • Line 22: security(resolution = …) → timeframe = …
  • Line 23: security → request.security
  • Line 23: security(resolution = …) → timeframe = …
  • Line 26: security → request.security
  • Line 26: security(resolution = …) → timeframe = …
  • Line 26: ema → ta.ema
  • Line 30: security → request.security
  • Line 30: security(resolution = …) → timeframe = …
  • Line 31: security → request.security
  • Line 31: security(resolution = …) → timeframe = …
  • Line 39: long = true → direction = strategy.long
  • Line 41: long = false → direction = strategy.short
-//@version=4+//@version=5// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/⋯//renko-renko_tickerid = renko(syminfo.tickerid, renkoType, renkoSize)+renko_tickerid = ticker.renko(syminfo.tickerid, renkoType, renkoSize)-renko_close = security(renko_tickerid, timeframe.period, close)+renko_close = request.security(renko_tickerid, timeframe.period, close)-renko_open = security(renko_tickerid, timeframe.period, open)+renko_open = request.security(renko_tickerid, timeframe.period, open)renkoGreen = renko_close>renko_open⋯//heiken ashi-ha_id = heikinashi(syminfo.tickerid)+ha_id = ticker.heikinashi(syminfo.tickerid)//middle time frame-haopen1 = security(ha_id, resolution=res1, expression=open)+haopen1 = request.security(ha_id, timeframe=res1, expression=open)-haclose1 = security(ha_id, resolution=res1, expression=close)+haclose1 = request.security(ha_id, timeframe=res1, expression=close)green1 = haclose1 > haopen1red1 = haclose1 < haopen1-ema1 = security(syminfo.tickerid, resolution=res1, expression=ema(close, 20))+ema1 = request.security(syminfo.tickerid, timeframe=res1, expression=ta.ema(close, 20))slopeUp1 = ema1 > ema1[1]⋯//higher time frame-haopen2 = security(ha_id, resolution=res2, expression=open)+haopen2 = request.security(ha_id, timeframe=res2, expression=open)-haclose2 = security(ha_id, resolution=res2, expression=close)+haclose2 = request.security(ha_id, timeframe=res2, expression=close)green2 = haclose2 > haopen2⋯cover = green1 or green2 or slopeUp1 or renkoGreen //and (strategy.openprofit>0) -strategy.entry(id="enter long", long=true, when=buy)+strategy.entry(id="enter long", direction = strategy.long, when=buy)strategy.close(id="enter long", comment="exit long", when=sell)-strategy.entry(id="enter short", long=false, when=short)+strategy.entry(id="enter short", direction = strategy.short, when=short)strategy.close(id="enter short", comment="exit short", when=cover)

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 8: input() → input.string()
  • Line 9: input() → input.string()
  • Line 10: input() → input.float()
  • Line 11: input() → input.string()
  • Line 39: when = buy → if block
  • Line 40: when = sell → if block
  • Line 41: when = short → if block
  • Line 42: when = cover → if block
⋯strategy(title="Joseph Nemeth Heiken Ashi Renko MTF Strategy", shorttitle="Nemeth Strategy", overlay=true)-res1 = input("60", title="Middle time frame")+res1 = input.string("60", title="Middle time frame")-res2 = input("D", title="Higher time frame")+res2 = input.string("D", title="Higher time frame")-renkoSize = input(1.0, title="Renko size")+renkoSize = input.float(1.0, title="Renko size")-renkoType = input("ATR", title="Renko type", options=["ATR", "Traditional"])+renkoType = input.string("ATR", title="Renko type", options=["ATR", "Traditional"])//withRecovery = input(false, title="with trade recovery?")⋯cover = green1 or green2 or slopeUp1 or renkoGreen //and (strategy.openprofit>0) -strategy.entry(id="enter long", direction = strategy.long, when=buy)+if buy+    strategy.entry(id="enter long", direction = strategy.long)-strategy.close(id="enter long", comment="exit long", when=sell)+if sell+    strategy.close(id="enter long", comment="exit long")-strategy.entry(id="enter short", direction = strategy.short, when=short)+if short+    strategy.entry(id="enter short", direction = strategy.short)-strategy.close(id="enter short", comment="exit short", when=cover)+if cover+    strategy.close(id="enter short", comment="exit short")

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 source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/⋯

Settings

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

SettingDefaultType and rangeFeeds
Middle time frame60stringhaopen1 haclose1 ema1
Higher time frameDstringhaopen2 haclose2
Renko size1.0floatrenko_tickerid
Renko typeATRstring · options ["ATR", "Traditional"]renko_tickerid

What it calculates

  • EMA (ema, ta.ema in v5)close, 20ema1 · line 26

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.

closecloseprice datares1Middle time framesetting · 60renkoTypeRenko typesetting · ATRrenkoSizeRenko sizesetting · 1.0openopenprice datares2Higher time framesetting · Dema1EMA→ ema1renko_tickeridrenko_tickeridvaluerenko_closerenko_closevaluerenko_openrenko_openvalueha_idha_idvaluehaopen1haopen1valuehaclose1haclose1valuehaopen2haopen2valuehaclose2haclose2valuebuybuyconditionsellsellconditionshortshortconditioncovercoverconditionrenkoGreen, renkoRedrenkoGreen · renkoRed2 conditionsgreen1, red1green1 · red12 conditionsslopeUp1, slopeDown1slopeUp1 · slopeDown12 conditionsgreen2, red2green2 · red22 conditionsentry:enter longOpen enter longstrategy.entryclose:enter longClose enter longstrategy.closeentry:enter shortOpen enter shortstrategy.entryclose:enter shortClose enter shortstrategy.close

Order rules

OrderFires whenBy defaultLine
Open enter long longbuygreen1 and green2 and slopeUp1 and renkoGreenOn39
Close enter longsellred1 or red2 or slopeDown1 or renkoRedOn40
Open enter short shortshortred1 and red2 and slopeDown1 and renkoRedOn41
Close enter shortcovergreen1 or green2 or slopeUp1 or renkoGreenOn42

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.

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.

  • ClearHigher-timeframe data7 security call(s), none with lookahead on.
  • 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

Indicators and strategies built from the same calculations.

ScriptSharesTypeNetTradesMax drawdown
EMA Slope AyE by fajardoarelysemav4 strategyNo trades on this market
ROoT by realisticDove62527emav5 strategy−4.7%2259.4%
sachin5986 by mohitesachin78emav4 strategy+32.1%3517.6%
sonu1997 by Sonu1997emav4 strategy+960.7%21,103.8%
Moving Average Crossover by Muh4mm4demav4 strategy+19,990.1%301,274.2%

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 long = true, long = false as a short, whatever it says; this page passes the same side as strategy.long or strategy.short (lines 39, 41) 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 source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/// Joseph Nemeth Heiken Ashi Renko MTF Strategy// by SparkyFlary//For Educational Purposes//Results can differ on different markets and can fail at any time. Profit is not guaranteed.strategy(title="Joseph Nemeth Heiken Ashi Renko MTF Strategy", shorttitle="Nemeth Strategy", overlay=true)res1 = input("60", title="Middle time frame")res2 = input("D", title="Higher time frame")renkoSize = input(1.0, title="Renko size")renkoType = input("ATR", title="Renko type", options=["ATR", "Traditional"])//withRecovery = input(false, title="with trade recovery?")//renkorenko_tickerid = renko(syminfo.tickerid, renkoType, renkoSize)renko_close = security(renko_tickerid, timeframe.period, close)renko_open = security(renko_tickerid, timeframe.period, open)renkoGreen = renko_close>renko_openrenkoRed = renko_close<renko_open//heiken ashiha_id = heikinashi(syminfo.tickerid)//middle time framehaopen1 = security(ha_id, resolution=res1, expression=open)haclose1 = security(ha_id, resolution=res1, expression=close)green1 = haclose1 > haopen1red1 = haclose1 < haopen1ema1 = security(syminfo.tickerid, resolution=res1, expression=ema(close, 20))slopeUp1 = ema1 > ema1[1]slopeDown1 = ema1 < ema1[1]//higher time framehaopen2 = security(ha_id, resolution=res2, expression=open)haclose2 = security(ha_id, resolution=res2, expression=close)green2 = haclose2 > haopen2red2 = haclose2 < haopen2//Strategybuy = green1 and green2 and slopeUp1 and renkoGreen //and abs(strategy.position_size[1])==0sell = red1 or red2 or slopeDown1 or renkoRed //and (strategy.openprofit>0)short = red1 and red2 and slopeDown1 and renkoRed //and abs(strategy.position_size[1])==0cover = green1 or green2 or slopeUp1 or renkoGreen //and (strategy.openprofit>0) strategy.entry(id="enter long", long=true, when=buy)strategy.close(id="enter long", comment="exit long", when=sell)strategy.entry(id="enter short", long=false, when=short)strategy.close(id="enter short", comment="exit short", when=cover)