Zeal Terminal Open in Zeal Terminal

Pine Script v5 · Strategy

The Impeccable by zyberal

A Pine Script v5 strategy built on MACD (close, 3). It has 2 order rules and no entry of its own. Exits wait for a signal; there is no stop loss. Each trade is one contract and pays no commission. 16 settings; defaults include Ichimoku Tenkan Period 9, Ichimoku Kijun Period 190 and Ichimoku Senkou Period 52.

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 The Impeccable by zyberal repaint?
Yes
At least one pattern in the source can repaint: intrabar recalculation.
How did The Impeccable by zyberal do on BTCUSDT 1D with default settings?
+1.05%
From 26 Jan 2024 to 21 Oct 2026, over 9 closed trades, against +102.5% for buy and hold. A backtest, not investment advice.
Does The Impeccable by zyberal run in Pine Script v6?
No
The v6 version runs in Zeal Terminal's engine, but its results differ from the v5 version: Trades differ: 9 before, 8 after on BTCUSDT 1D, 1,000 bars, in Zeal Terminal's engine. It is shown for reference and is not offered as a download.
Does The Impeccable by zyberal use a stop loss?
No
Every exit waits for a signal; nothing limits a losing trade before it fires.
Does The Impeccable by zyberal run in Zeal Terminal?
Yes
It compiles in 31 ms and runs 1,000 bars in 86 ms, in the browser.

BTCUSDT · 1D · default settings

  • Winning trade
  • Losing trade
  • Equity
  • Buy and hold
40,00060,00080,000100,000120,000AprJulOct2025AprJulOct2026AprJulOct$1,009,150$2,025,273Equity from $1,000,000
Binance BTCUSDT 1D candles, 26 Jan 2024 to 21 Oct 2026, 1,000 bars, default settings. Triangles mark entries; circles mark exits. The script plots nothing itself; the lines and the lower pane are its own calculations, drawn for reference. Zeal Terminal's engine currently reads an order side written as direction = strategy.long, direction = strategy.short as a short, whatever it says; this page passes the same side as strategy.long or strategy.short (lines 61, 62) so the engine trades the way the script says. The engine's host API cannot yet declare a chart's symbol and timeframe, so this page sets them on the engine directly for each market. The live re-run is not offered here: the script requests BINANCE:BTCUSDT W, which this page cannot load in your browser.
Net profit
+1.05%
$10,527.20
Buy and hold
+102.5%
same period
Closed trades
9
5 won · 4 lost
Profitable
55.6%
of closed trades
Profit factor
1.17
gross profit ÷ gross loss
Max drawdown
4.41%
−$44,274.80

One run with the author's default settings, $1,000,000 starting capital, commission as the script sets it. A short 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

    5 settings do nothing

    “Ichimoku Kijun Period”, “Ichimoku Senkou Period”, “Exit After Bars”, “Profit Target”, “Stop Loss” 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

    16 settings have no label

    In the settings dialog IchimokuTenkanPeriod (line 7), IchimokuKijunPeriod (line 8), IchimokuSenkouPeriod (line 9), MACDMainFast (line 10), MACDMainSlow (line 11), MACDMainSmooth (line 12), ExitAfterBars (line 13), ProfitTarget (line 14), StopLoss (line 15), DontTradeOnWeekends (line 17), ExitAtEndOfDay (line 18), DayExitTimeHour (line 19), DayExitTimeMinute (line 20), ExitOnFriday (line 21), FridayExitTimeHour (line 22), FridayExitTimeMinute (line 23) show an empty name. The labels on this page come from the variable names.

  • 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 61, 62. 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.

SettingDefaultType and rangeFeeds
Ichimoku Tenkan Period (no label in the script)9intTenkan
Ichimoku Kijun Period (no label in the script)190intunused
Ichimoku Senkou Period (no label in the script)52intunused
MACDMain Fast (no label in the script)3intmacdLine signalLine
MACDMain Slow (no label in the script)10intmacdLine signalLine
MACDMain Smooth (no label in the script)9intmacdLine signalLine
Exit After Bars (no label in the script)2intunused
Profit Target (no label in the script)135intunused
Stop Loss (no label in the script)70intunused
Dont Trade On Weekends (no label in the script)trueboolline 28
Exit At End Of Day (no label in the script)trueboolline 34
Day Exit Time Hour (no label in the script)23intline 36
Day Exit Time Minute (no label in the script)04intline 36
Exit On Friday (no label in the script)trueboolline 40
Friday Exit Time Hour (no label in the script)20intline 42
Friday Exit Time Minute (no label in the script)40intline 42

What it calculates

  • MACDclose, MACDMain Fast (3), MACDMain Slow (10), MACDMain Smooth (9)macdLine · line 49
  • MACDclose, MACDMain Fast (3), MACDMain Slow (10), MACDMain Smooth (9)signalLine · line 49

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 dataMACDMainFastMACDMain Fastsetting · 3MACDMainSlowMACDMain Slowsetting · 10MACDMainSmoothMACDMain Smoothsetting · 9openopenprice dataIchimokuTenkanPeriodIchimoku Tenkan Periodsetting · 9macdLineMACD→ macdLinesignalLineMACD→ signalLineopenW3openW3valueTenkanTenkanvaluelongConditionlongConditionconditionshortConditionshortConditionconditionLongEntrySignal, ShortEntrySignalLongEntrySignal · Short…2 conditionsorder:buyorder buystrategy.orderorder:sellorder sellstrategy.order

Order rules

OrderFires whenBy defaultLine
order buy longlongConditionOpenOrdersAllowed and not IsLong() and LongEntrySignalOn61
order sell shortshortConditionOpenOrdersAllowed and not IsShort() and ShortEntrySignalOn62

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

Does it repaint?

Yes

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

1/3trades identical when replayed liveThe last 300 bars, from 26 Dec 2025, were fed to the engine as live ticks, four per bar, and compared with the historical run. On 0 of them the position changed while the bar was forming before it settled. Anyone watching live sees those changes; once the bar closes it matches history.
  • ClearHigher-timeframe data1 request.security call(s), none with lookahead on.
  • ClearFuture-bar referencesNo negative history offsets such as close[-1].
  • CheckIntrabar recalculationreads realtime-only state. Live values can differ from history.
  • 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.

MarketNetBuy and holdTradesWonProfit factorMax drawdownPeriod
BTCUSDT 1D+1.1%+102.5%956%1.174.4%26 Jan 2024 – 21 Oct 2026
BTCUSDT 4h+1.5%+5.5%1182%2.251.8%8 May 2026 – 21 Oct 2026
ETHUSDT 1D−0.1%+9.8%838%0.540.4%26 Jan 2024 – 21 Oct 2026
ETHUSDT 4h+0.0%+8.4%1080%1.350.1%8 May 2026 – 21 Oct 2026
SOLUSDT 1D+0.0%+16.7%875%1.280.0%26 Jan 2024 – 21 Oct 2026
SOLUSDT 4h−0.0%+21.5%956%0.690.0%8 May 2026 – 21 Oct 2026
BNBUSDT 1D+0.0%+148.3%1182%2.230.1%26 Jan 2024 – 21 Oct 2026
BNBUSDT 4h+0.0%+17.1%1182%2.160.0%8 May 2026 – 21 Oct 2026

Higher-timeframe data for request.security(): BINANCE:BTCUSDT W (Binance BTCUSDT 1w), fetched from Binance's public market data for each market.

Backtests are simulations on historical data and are not investment advice.

The trades

By market direction

At entry, last 90 barsTradesWonP&L
Rising market333%−$23,479.40
Sideways market560%$23,173.90
Falling market1100%$10,832.70

Rising and falling mean the market moved more than 15% over the 90 bars before entry.

How bad could the drawdown be?

5.7%

The 95th percentile of the worst drawdown when the same 9 trades are reshuffled 5,000 times. The bar spans the 5th to 95th percentile, 2.8% to 5.7%; the tick is what actually happened, 3.5%. Order luck alone moves it this much.

0%7%
All 9 trades
SideEntryExitBarsP&L
short1 Mar 2024 61,131.0016 Apr 2024 63,420.0046−$2,289.00
long30 Apr 2024 63,866.008 Jun 2024 69,355.6039$5,489.60
long2 Jul 2024 62,900.0020 Aug 2024 59,438.5049−$3,461.50
short1 Nov 2024 70,292.0021 Feb 2025 98,305.00112−$28,013.00
long28 Feb 2025 84,708.6024 May 2025 107,318.0085$22,609.70
long11 Jul 2025 116,010.006 Dec 2025 89,330.00148−$26,680.00
short17 Jan 2026 95,550.9027 Feb 2026 67,485.2041$28,065.80
short14 Mar 2026 70,930.0027 Jun 2026 60,097.30105$10,832.70
long4 Jul 2026 62,583.3022 Jul 2026 66,556.1018$3,972.89

Similar scripts

Indicators and strategies built from the same calculations, run on BTCUSDT 1D with their own defaults so they can be compared directly.

ScriptSharesTypeNetTradesMax drawdown
The Impeccable by zyberal this page—v5 strategy+1.1%94.4%
Ichimoku Cloud with MACD (By Coinrule) by Coinrulemacdv5 strategy−8.4%619.3%
Dual MACD Strategy by Trading_Solutions_macdv4 strategyNo trades on this market
Short Swing Bearish MACD Cross (By Coinrule) by Coinrulemacdv5 strategy−6.9%86.9%
[blackcat] L2 Reversal Labels Strategy by blackcat1402macdv5 strategy+13.9%72.7%
MACD Trend Strategy by Zeal Terminalmacdv5 strategy−1.0%213.5%

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.

  • 2 strategy calls use the when = argument (line 61, 62). It is deprecated in v5 and removed in v6, where each call moves inside an if block.
  • 16 settings use the untyped input() (line 7, 8, 9, 10, 11, 12, 13, 14, 15, 17, 18, 19, 20, 21, 22, 23). 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.

Clean v5

VerifiedDownload the v5 script

Same 9 trades and the same P&L on BTCUSDT 1D, 1,000 bars, in Zeal Terminal's engine.

  • 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 12: input() → input.int()
12 more edits
  • Line 13: input() → input.int()
  • Line 14: input() → input.int()
  • Line 15: input() → input.int()
  • Line 17: input() → input.bool()
  • Line 18: input() → input.bool()
  • Line 19: input() → input.int()
  • Line 20: input() → input.int()
  • Line 21: input() → input.bool()
  • Line 22: input() → input.int()
  • Line 23: input() → input.int()
  • Line 61: when = longCondition → if block
  • Line 62: when = shortCondition → if block
⋯// Strategy variables-IchimokuTenkanPeriod = input(9)+IchimokuTenkanPeriod = input.int(9)-IchimokuKijunPeriod = input(190)+IchimokuKijunPeriod = input.int(190)-IchimokuSenkouPeriod = input(52)+IchimokuSenkouPeriod = input.int(52)-MACDMainFast = input(3)+MACDMainFast = input.int(3)-MACDMainSlow = input(10)+MACDMainSlow = input.int(10)-MACDMainSmooth = input(9)+MACDMainSmooth = input.int(9)-ExitAfterBars = input(2)+ExitAfterBars = input.int(2)-ProfitTarget = input(135)+ProfitTarget = input.int(135)-StopLoss = input(70)+StopLoss = input.int(70)// Trading Options-DontTradeOnWeekends = input(true)+DontTradeOnWeekends = input.bool(true)-ExitAtEndOfDay = input(true)+ExitAtEndOfDay = input.bool(true)-DayExitTimeHour   = input(23)+DayExitTimeHour   = input.int(23)-DayExitTimeMinute = input(04)+DayExitTimeMinute = input.int(04)-ExitOnFriday = input(true)+ExitOnFriday = input.bool(true)-FridayExitTimeHour   = input(20)+FridayExitTimeHour   = input.int(20)-FridayExitTimeMinute = input(40)+FridayExitTimeMinute = input.int(40)// }⋯// Open positions based on conditions {-strategy.order(id = "buy", direction = strategy.long, qty = 1, when = longCondition)+if longCondition+    strategy.order(id = "buy", direction = strategy.long, qty = 1)-strategy.order(id = "sell", direction = strategy.short, qty = 1, when = shortCondition)+if shortCondition+    strategy.order(id = "sell", direction = strategy.short, qty = 1)// }

Does it run in Pine Script v6?

No

The v6 version runs in Zeal Terminal's engine, but its results differ from the v5 version: Trades differ: 9 before, 8 after on BTCUSDT 1D, 1,000 bars, in Zeal Terminal's engine. It is shown for reference and is not offered as a download. It differs from the v5 version by 1 edit.

⋯// © Revazi-//@version=5+//@version=6strategy("The Impeccable by zyberal", overlay = true)⋯

Where it runs

EngineCompilesRunsMatches TradingView
Zeal Terminal · OpenPineScript v2Yes 31 msWith a workaround 1,000 bars in 86 msNot measured
PineTSNot testedNot testedNot measured

Zeal Terminal's engine currently reads an order side written as direction = strategy.long, direction = strategy.short as a short, whatever it says; this page passes the same side as strategy.long or strategy.short (lines 61, 62) so the engine trades the way the script says. The engine's host API cannot yet declare a chart's symbol and timeframe, so this page sets them on the engine directly for each market.

“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/// © Revazi//@version=5strategy("The Impeccable by zyberal", overlay = true)// Inputs {// Strategy variablesIchimokuTenkanPeriod = input(9)IchimokuKijunPeriod = input(190)IchimokuSenkouPeriod = input(52)MACDMainFast = input(3)MACDMainSlow = input(10)MACDMainSmooth = input(9)ExitAfterBars = input(2)ProfitTarget = input(135)StopLoss = input(70)// Trading OptionsDontTradeOnWeekends = input(true)ExitAtEndOfDay = input(true)DayExitTimeHour   = input(23)DayExitTimeMinute = input(04)ExitOnFriday = input(true)FridayExitTimeHour   = input(20)FridayExitTimeMinute = input(40)// }// TRADING OPTIONS LOGIC {OpenOrdersAllowed = true// Dont trade on weekends {if DontTradeOnWeekends    if dayofweek == dayofweek.saturday or       dayofweek == dayofweek.sunday        OpenOrdersAllowed := false// }// Exit on close (end of day) {if ExitAtEndOfDay    if timeframe.isintraday and       time >= timestamp(year(timenow), month(timenow), dayofmonth(timenow), DayExitTimeHour, DayExitTimeMinute)        OpenOrdersAllowed := false// }// Exit on Friday {if ExitOnFriday    if timeframe.isintraday and       time >= timestamp(year(timenow), month(timenow), dayofmonth(timenow), FridayExitTimeHour, FridayExitTimeMinute)        OpenOrdersAllowed := false// }// Rule: Trading signals {openW3 = request.security(syminfo.tickerid, "W", open)[3]middleDonchian(Length) => math.avg(ta.highest(Length), ta.lowest(Length))Tenkan = middleDonchian(IchimokuTenkanPeriod)[2][macdLine, signalLine, _] = ta.macd(close, MACDMainFast, MACDMainSlow, MACDMainSmooth)LongEntrySignal = openW3 > Tenkan and ta.crossunder(macdLine, signalLine)[3] //macdLine[3] < signalLine[3]ShortEntrySignal = openW3 < Tenkan and ta.crossover(macdLine, signalLine)[3] //macdLine[3] > signalLine[3]// }// Calculate conditions {IsFlat() => strategy.position_size == 0IsLong() => strategy.position_size > 0IsShort() => strategy.position_size < 0longCondition  = OpenOrdersAllowed and not IsLong() and LongEntrySignalshortCondition = OpenOrdersAllowed and not IsShort() and ShortEntrySignal// }// Open positions based on conditions {strategy.order(id = "buy", direction = strategy.long, qty = 1, when = longCondition)strategy.order(id = "sell", direction = strategy.short, qty = 1, when = shortCondition)// }