Zeal Terminal Open in Zeal Terminal

Pine Script v4 · Strategy

Oath

A Pine Script v4 strategy built on EMA (close, 21), SMA (close, 20) and DEV (close, 20). It has 12 order rules, 6 entries among them, and trades long and short with the default settings. Exits use a stop loss and a profit target. Each trade is one contract and pays no commission. 22 settings; defaults include Short EMA 21, Long EMA 55 and Overbought/sold detector period 20.

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 Oath repaint?
No
No repainting patterns were found in the source, and a live tick-by-tick replay matched history on 28 of 28 trades.
How did Oath do on BTCUSDT 1D with default settings?
+0.18%
From 26 Jan 2024 to 21 Oct 2026, over 45 closed trades, against +102.5% for buy and hold. A backtest, not investment advice.
Can Oath be converted to Pine Script v5?
No
The automatic step from v4 to v5 changes the results, so no v5 download is offered; the edits are shown below.
Does Oath use a stop loss?
Yes
strategy.exit sets a stop on line 75, 83, 91, 97, 103, 109.
Does Oath run in Zeal Terminal?
Yes
It compiles in 27 ms and runs 1,000 bars in 73 ms, in the browser.

BTCUSDT · 1D · default settings

  • Shape
  • Shape
  • Winning trade
  • Losing trade
  • Equity
  • Buy and hold
Prerendered with the defaults. Change anything and run it here. The script runs in your browser.
Settings (22)
40,00060,00080,000100,000120,000AprJulOct2025AprJulOct2026AprJulOct$100,180$202,527Equity from $100,000
Binance BTCUSDT 1D candles, 26 Jan 2024 to 21 Oct 2026, 1,000 bars, default settings. Triangles mark entries; circles mark exits. Lines are what the script plots. 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.
Net profit
+0.18%
$180.00
Buy and hold
+102.5%
same period
Closed trades
45
45 won · 0 lost
Profitable
100.0%
of closed trades
Profit factor
—
gross profit ÷ gross loss
Max drawdown
0.00%
$0.00

One run with the author's default settings, $100,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

    1 setting does nothing

    “Illuminate Trend” is 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.

  • Note

    Uses transp =, which v5 removed line 110

    transp = on line 110, 111, 112, 113, 114, 115. v5 folds the transparency into the colour with color.new(c, transp).

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 ema → ta.ema, sma → ta.sma, dev → ta.dev, atr → ta.atr, max → math.max, min → math.min, floor → math.floor, barssince → ta.barssince.

v4 → v5

Differs

Trades differ: 45 before, 52 after on BTCUSDT 1D, 1,000 bars, in Zeal Terminal's engine.

  • Line 3: //@version=4 → //@version=5
  • Line 7: ema → ta.ema
  • Line 10: ema → ta.ema
  • Line 14: sma → ta.sma
  • Line 15: dev → ta.dev
  • Line 30: input(type = input.integer) → input.int()
26 more edits
  • Line 31: input(type = input.float) → input.float()
  • Line 32: input(type = input.bool) → input.bool()
  • Line 33: input(type = input.bool) → input.bool()
  • Line 34: atr → ta.atr
  • Line 37: max → math.max
  • Line 40: min → math.min
  • Line 57: floor → math.floor
  • Line 58: input(type = input.bool) → input.bool()
  • Line 59: input(type = input.bool) → input.bool()
  • Line 61: input(type = input.bool) → input.bool()
  • Line 62: input(type = input.bool) → input.bool()
  • Line 63: input(type = input.bool) → input.bool()
  • Line 64: input(type = input.bool) → input.bool()
  • Line 65: input(type = input.integer) → input.int()
  • Line 70: barssince → ta.barssince
  • Line 78: barssince → ta.barssince
  • Line 86: barssince → ta.barssince
  • Line 93: barssince → ta.barssince
  • Line 99: barssince → ta.barssince
  • Line 105: barssince → ta.barssince
  • Line 110: transp = 0 → color.new(color.green, 0)
  • Line 111: transp = 0 → color.new(color.red, 0)
  • Line 112: transp = 0 → color.new(color.green, 0)
  • Line 113: transp = 0 → color.new(color.red, 0)
  • Line 114: transp = 0 → color.new(color.green, 0)
  • Line 115: transp = 0 → color.new(color.red, 0)
⋯// © greenmask9-//@version=4+//@version=5strategy("Oath", overlay=true)⋯emalength = input(21, title="Short EMA")-emashort = ema(close, emalength)+emashort = ta.ema(close, emalength)// 55 EMAemalength2 = input(55, title="Long EMA")-ema = ema(close, emalength2)+ema = ta.ema(close, emalength2)//CCI calculation and inputs⋯src = input(close, title="Overbought/sold detector source")-ma = sma(src, lengthcci)+ma = ta.sma(src, lengthcci)-ccivalue = (src - ma) / (0.015 * dev(src, lengthcci))+ccivalue = (src - ma) / (0.015 * ta.dev(src, lengthcci))//CCI plotting⋯//Supertrend-length = input(title="ATR Period", type=input.integer, defval=55)+length = input.int(title="ATR Period", defval=55)-mult = input(title="ATR Multiplier", type=input.float, step=0.1, defval=5.0)+mult = input.float(title="ATR Multiplier", step=0.1, defval=5.0)-wicks = input(title="Take Wicks into Account ?", type=input.bool, defval=true)+wicks = input.bool(title="Take Wicks into Account ?", defval=true)-illuminate = input(title="Illuminate Trend", type=input.bool, defval=false)+illuminate = input.bool(title="Illuminate Trend", defval=false)-atr = mult * atr(length)+atr = mult * ta.atr(length)longStop = hl2 - atrlongStopPrev = nz(longStop[1], longStop)-longStop := (wicks ? low[1] : close[1]) > longStopPrev ? max(longStop, longStopPrev) : longStop+longStop := (wicks ? low[1] : close[1]) > longStopPrev ? math.max(longStop, longStopPrev) : longStopshortStop = hl2 + atrshortStopPrev = nz(shortStop[1], shortStop)-shortStop := (wicks ? high[1] : close[1]) < shortStopPrev ? min(shortStop, shortStopPrev) : shortStop+shortStop := (wicks ? high[1] : close[1]) < shortStopPrev ? math.min(shortStop, shortStopPrev) : shortStopdir = 1⋯downstoploss = shortStop + spread-ordersize=floor(strategy.initial_capital/close)+ordersize=math.floor(strategy.initial_capital/close)-testlong = input(title="Test longs", type=input.bool, defval=true)+testlong = input.bool(title="Test longs", defval=true)-testshort = input(title="Test shorts", type=input.bool, defval=true)+testshort = input.bool(title="Test shorts", defval=true)//new-degree = input(title="Test level 1 overbought/sold levels", type=input.bool, defval=true)+degree = input.bool(title="Test level 1 overbought/sold levels", defval=true)-degree2 = input(title="Test level 2 overbought/sold levels", type=input.bool, defval=false)+degree2 = input.bool(title="Test level 2 overbought/sold levels", defval=false)-degree3 = input(title="Test level 3 overbought/sold levels", type=input.bool, defval=false)+degree3 = input.bool(title="Test level 3 overbought/sold levels", defval=false)-statictarget = input(title="Use static target", type=input.bool, defval=true)+statictarget = input.bool(title="Use static target", defval=true)-statictargetvalue = input(title="Static target in pips", type=input.integer, defval=400)+statictargetvalue = input.int(title="Static target in pips", defval=400)//timetrade = input(title="Open trades only withing specified time", type=input.bool, defval=true)⋯buy1 = uptrend and upsignal and strategy.opentrades==0 and testlong and degree-x1 = barssince (buy1)+x1 = ta.barssince (buy1)if (buy1)⋯buy2 = uptrend and upsignal2 and strategy.opentrades==0 and testlong and degree2-x2 = barssince (buy2)+x2 = ta.barssince (buy2)if (buy2)⋯buy3 = uptrend and upsignal3 and strategy.opentrades==0 and testlong and degree3-x3 = barssince (buy3)+x3 = ta.barssince (buy3)if (buy3)⋯sell1 = downtrend and downsignal and strategy.opentrades==0 and testshort and degree-y1 = barssince (sell1)+y1 = ta.barssince (sell1)if (sell1)⋯sell2 = downtrend and downsignal2 and strategy.opentrades==0 and testshort and degree2-y2 = barssince (sell2)+y2 = ta.barssince (sell2)if (sell2)⋯sell3 = downtrend and downsignal3 and strategy.opentrades==0 and testshort and degree3-y3 = barssince (sell3)+y3 = ta.barssince (sell3)if (sell3)⋯        strategy.exit( "Oath3 Close", from_entry="Oath3.s" , profit=statictargetvalue,stop=downstoploss[y3])-plotshape(uptrend and upsignal and degree, location=location.belowbar, color=color.green, transp=0, style=shape.triangleup, size=size.tiny, text="Oath up")+plotshape(uptrend and upsignal and degree, location=location.belowbar, color=color.new(color.green, 0), style=shape.triangleup, size=size.tiny, text="Oath up")-plotshape(downtrend and downsignal and degree, location=location.abovebar, color=color.red, transp=0, style=shape.triangledown, size=size.tiny, text="Oath down")+plotshape(downtrend and downsignal and degree, location=location.abovebar, color=color.new(color.red, 0), style=shape.triangledown, size=size.tiny, text="Oath down")-plotshape(uptrend and upsignal2 and degree2, location=location.belowbar, color=color.green, transp=0, style=shape.triangleup, size=size.tiny, text="Oath up+")+plotshape(uptrend and upsignal2 and degree2, location=location.belowbar, color=color.new(color.green, 0), style=shape.triangleup, size=size.tiny, text="Oath up+")-plotshape(downtrend and downsignal2 and degree2, location=location.abovebar, color=color.red, transp=0, style=shape.triangledown, size=size.tiny, text="Oath down+")+plotshape(downtrend and downsignal2 and degree2, location=location.abovebar, color=color.new(color.red, 0), style=shape.triangledown, size=size.tiny, text="Oath down+")-plotshape(uptrend and upsignal3 and degree3, location=location.belowbar, color=color.green, transp=0, style=shape.triangleup, size=size.tiny, text="Oath up++")+plotshape(uptrend and upsignal3 and degree3, location=location.belowbar, color=color.new(color.green, 0), style=shape.triangleup, size=size.tiny, text="Oath up++")-plotshape(downtrend and downsignal3 and degree3, location=location.abovebar, color=color.red, transp=0, style=shape.triangledown, size=size.tiny, text="Oath down++")+plotshape(downtrend and downsignal3 and degree3, location=location.abovebar, color=color.new(color.red, 0), style=shape.triangledown, size=size.tiny, text="Oath down++")

Clean v5

Verified

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

  • Line 6: input() → input.int()
  • Line 9: input() → input.int()
  • Line 12: input() → input.int()
  • Line 13: input() → input.source()
  • Line 17: input() → input.int()
  • Line 18: input() → input.int()
5 more edits
  • Line 19: input() → input.int()
  • Line 20: input() → input.int()
  • Line 21: input() → input.int()
  • Line 22: input() → input.int()
  • Line 54: input() → input.float()
⋯// 21 EMA-emalength = input(21, title="Short EMA")+emalength = input.int(21, title="Short EMA")emashort = ta.ema(close, emalength)// 55 EMA-emalength2 = input(55, title="Long EMA")+emalength2 = input.int(55, title="Long EMA")ema = ta.ema(close, emalength2)//CCI calculation and inputs-lengthcci = input(20, minval=1, title="Overbought/sold detector period")+lengthcci = input.int(20, minval=1, title="Overbought/sold detector period")-src = input(close, title="Overbought/sold detector source")+src = input.source(close, title="Overbought/sold detector source")ma = ta.sma(src, lengthcci)⋯//CCI plotting-ccioverbought = input(defval=100, title="Overbought level 1")+ccioverbought = input.int(defval=100, title="Overbought level 1")-ccioverbought2 = input(defval=140, title="Overbought level 2")+ccioverbought2 = input.int(defval=140, title="Overbought level 2")-ccioverbought3 = input(defval=180, title="Overbought level 3")+ccioverbought3 = input.int(defval=180, title="Overbought level 3")-ccioversold = input(defval=-100, title="Oversold level 1")+ccioversold = input.int(defval=-100, title="Oversold level 1")-ccioversold2 = input(defval=-140, title="Oversold level 2")+ccioversold2 = input.int(defval=-140, title="Oversold level 2")-ccioversold3 = input(defval=-180, title="Oversold level 3")+ccioversold3 = input.int(defval=-180, title="Oversold level 3")//cciOB = (ccivalue >= ccioverbought and ccivalue < ccioverbought2)⋯//adapts to the current bar, I need to save the bars number when the condition for buy was true, static number is spread-spread = input (0.00020, title="Spread")+spread = input.float (0.00020, title="Spread")upstoploss = longStop - spread⋯

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: 52 before, 45 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.

⋯// © greenmask9-//@version=5+//@version=6strategy("Oath", overlay=true)⋯

Settings

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

SettingDefaultType and rangeFeeds
Short EMA21intemashort
Long EMA55intema
Overbought/sold detector period20int · min 1ma ccivalue
Overbought/sold detector sourceclosesourcema ccivalue
Overbought level 1100intdownsignal
Overbought level 2140intdownsignal downsignal2
Overbought level 3180intdownsignal2 downsignal3
Oversold level 1-100intupsignal
Oversold level 2-140intupsignal upsignal2
Oversold level 3-180intupsignal2 upsignal3
ATR Period55int (written input.integer)atr
ATR Multiplier5.0float · step 0.1atr
Take Wicks into Account ?trueboollongStop shortStop dir
Illuminate Trendfalseboolunused
Spread0.00020floatupstoploss downstoploss
Test longstrueboolbuy1 buy2 buy3
Test shortstrueboolsell1 sell2 sell3
Test level 1 overbought/sold levelstrueboolbuy1 sell1 plotshape
Test level 2 overbought/sold levelsfalseboolbuy2 sell2 plotshape
Test level 3 overbought/sold levelsfalseboolbuy3 sell3 plotshape
Use static targettrueboolentry Oath1 exit Oath1 Close entry Oath2 exit Oath2 Close entry Oath3 exit Oath3 Close entry Oath1.s exit Oath1 Close entry Oath2.s exit Oath2 Close entry Oath3.s exit Oath3 Close line 73 line 81 line 89 line 95 line 101 line 107
Static target in pips400int (written input.integer)exit Oath1 Close exit Oath2 Close exit Oath3 Close

What it calculates

  • EMA (ema, ta.ema in v5)close, Short EMA (21)emashort · line 7
  • EMA (ema, ta.ema in v5)close, Long EMA (55)ema · line 10
  • SMA (sma, ta.sma in v5)Overbought/sold detector source (close), Overbought/sold detector period (20)ma · line 14
  • DEV (dev, ta.dev in v5)Overbought/sold detector source (close), Overbought/sold detector period (20)ccivalue · line 15
  • ATR (atr, ta.atr in v5)ATR Period (55)atr · line 34
  • Barssince (barssince, ta.barssince in v5)buy1x1 · line 70
  • Barssince (barssince, ta.barssince in v5)buy2x2 · line 78
  • Barssince (barssince, ta.barssince in v5)buy3x3 · line 86
  • Barssince (barssince, ta.barssince in v5)sell1y1 · line 93
  • Barssince (barssince, ta.barssince in v5)sell2y2 · line 99
  • Barssince (barssince, ta.barssince in v5)sell3y3 · line 105

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.

The script has 64 named inputs, calculations, conditions and outputs, too many to draw legibly here; the tables above list them.

Order rules

OrderFires whenBy defaultLine
Open Oath1 long(statictarget)On74
Exit Oath1 Close stop and limit(statictarget)On75
Open Oath2 long(statictarget)On82
Exit Oath2 Close stop and limit(statictarget)On83
Open Oath3 long(statictarget)On90
Exit Oath3 Close stop and limit(statictarget)On91
Open Oath1.s short(statictarget)On96
Exit Oath1 Close stop and limit(statictarget)On97
Open Oath2.s short(statictarget)On102
Exit Oath2 Close stop and limit(statictarget)On103
Open Oath3.s short(statictarget)On108
Exit Oath3 Close stop and limit(statictarget)On109

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.

28/28trades 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. Orders are decided once per closed bar, so nothing can change mid-bar.
  • 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.

MarketNetBuy and holdTradesWonProfit factorMax drawdownPeriod
BTCUSDT 1D+0.2%+102.5%45100%—0.0%26 Jan 2024 – 21 Oct 2026
BTCUSDT 4h+0.3%+5.5%72100%—0.6%8 May 2026 – 21 Oct 2026
ETHUSDT 1D+8.4%+9.8%57100%—6.2%26 Jan 2024 – 21 Oct 2026
ETHUSDT 4h+6.2%+8.4%32100%—3.4%8 May 2026 – 21 Oct 2026
SOLUSDT 1D−61.7%+16.7%2774%0.48110.1%26 Jan 2024 – 21 Oct 2026
SOLUSDT 4h+15.6%+21.5%1464%1.6116.4%8 May 2026 – 21 Oct 2026
BNBUSDT 1D+10.1%+148.3%3895%1.828.7%26 Jan 2024 – 21 Oct 2026
BNBUSDT 4h−7.1%+17.1%3376%0.689.8%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 barsTradesWonP&L
Rising market19100%$76.00
Sideways market12100%$48.00
Falling market14100%$56.00

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

How bad could the drawdown be?

0.0%

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

0%1%
All 45 trades
SideEntryExitBarsP&L
long23 Mar 2024 63,796.6023 Mar 2024 63,800.600$4.00
long24 Mar 2024 63,990.0024 Mar 2024 63,994.000$4.00
long13 Apr 2024 67,116.5013 Apr 2024 67,120.500$4.00
long15 Apr 2024 65,661.9015 Apr 2024 65,665.900$4.00
long17 Apr 2024 63,793.4017 Apr 2024 63,797.400$4.00
short18 Jul 2024 64,088.0018 Jul 2024 64,084.000$4.00
short18 Sep 2024 60,314.0018 Sep 2024 60,310.000$4.00
short22 Sep 2024 63,349.0022 Sep 2024 63,345.000$4.00
short23 Sep 2024 63,578.8023 Sep 2024 63,574.800$4.00
long23 Dec 2024 95,186.3023 Dec 2024 95,190.300$4.00
long24 Dec 2024 94,881.5024 Dec 2024 94,885.500$4.00
long28 Dec 2024 94,299.0028 Dec 2024 94,303.000$4.00
long30 Dec 2024 93,738.2030 Dec 2024 93,742.200$4.00
long31 Dec 2024 92,792.1031 Dec 2024 92,796.100$4.00
long10 Jan 2025 92,552.5010 Jan 2025 92,556.500$4.00
short28 Mar 2025 87,232.0028 Mar 2025 87,228.000$4.00
short10 Dec 2025 92,678.8010 Dec 2025 92,674.800$4.00
short17 Jan 2026 95,550.9017 Jan 2026 95,546.900$4.00
short11 Mar 2026 69,948.6011 Mar 2026 69,944.600$4.00
short12 Mar 2026 70,191.9012 Mar 2026 70,187.900$4.00
short13 Mar 2026 70,541.3013 Mar 2026 70,537.300$4.00
short14 Mar 2026 70,930.0014 Mar 2026 70,926.000$4.00
short15 Mar 2026 71,211.9015 Mar 2026 71,207.900$4.00
short16 Mar 2026 72,815.3016 Mar 2026 72,811.300$4.00
short18 Mar 2026 73,909.4018 Mar 2026 73,905.400$4.00
short9 Apr 2026 71,069.909 Apr 2026 71,065.900$4.00
short10 Apr 2026 71,788.0010 Apr 2026 71,784.000$4.00
short12 Apr 2026 73,043.2012 Apr 2026 73,039.200$4.00
short15 Apr 2026 74,131.6015 Apr 2026 74,127.600$4.00
short16 Apr 2026 74,810.0016 Apr 2026 74,806.000$4.00
short17 Apr 2026 75,154.3017 Apr 2026 75,150.300$4.00
long19 May 2026 77,001.9019 May 2026 77,005.900$4.00
long20 May 2026 76,834.4020 May 2026 76,838.400$4.00
long27 May 2026 75,930.0027 May 2026 75,934.000$4.00
long31 May 2026 73,884.4031 May 2026 73,888.400$4.00
long1 Jun 2026 73,674.401 Jun 2026 73,678.400$4.00
short15 Jul 2026 65,044.0015 Jul 2026 65,040.000$4.00
short16 Jul 2026 64,756.3016 Jul 2026 64,752.300$4.00
short21 Jul 2026 65,255.5021 Jul 2026 65,251.500$4.00
long14 Sep 2026 76,842.0014 Sep 2026 76,846.000$4.00
long17 Sep 2026 76,206.0017 Sep 2026 76,210.000$4.00
long10 Oct 2026 82,635.6010 Oct 2026 82,639.600$4.00
long15 Oct 2026 81,682.0015 Oct 2026 81,686.000$4.00
long17 Oct 2026 81,615.9017 Oct 2026 81,619.900$4.00
long18 Oct 2026 81,491.0018 Oct 2026 81,495.000$4.00

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
Oath this page—v4 strategy+0.2%450.0%
Dazzling Bolts by OrcChieftainsma ema atr barssincev4 strategy+8.5%1413.0%
ATR with EOM and VORTEX by SoftKill21atr ema smav4 strategy+66.2%2229.9%
cATRpillar Strategy by Obi-wanClintobeatr sma emav4 strategy+1.02827e+24%2788,097.2%
Optimized Zhaocaijinbao strategy by fzj20020403sma ema atrv5 strategy+15.6%129.8%
pomila by cryptostartegysma atr barssincev4 strategy−54.6%2586.6%

Where it runs

EngineCompilesRunsMatches TradingView
Zeal Terminal · OpenPineScript v2Yes 27 msWith a workaround 1,000 bars in 73 msNot measured
PineTSNo v5 and v6 only—Not measured

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

// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/// © greenmask9//@version=4strategy("Oath", overlay=true)// 21 EMAemalength = input(21, title="Short EMA")emashort = ema(close, emalength)// 55 EMAemalength2 = input(55, title="Long EMA")ema = ema(close, emalength2)//CCI calculation and inputslengthcci = input(20, minval=1, title="Overbought/sold detector period")src = input(close, title="Overbought/sold detector source")ma = sma(src, lengthcci)ccivalue = (src - ma) / (0.015 * dev(src, lengthcci))//CCI plottingccioverbought = input(defval=100, title="Overbought level 1")ccioverbought2 = input(defval=140, title="Overbought level 2")ccioverbought3 = input(defval=180, title="Overbought level 3")ccioversold = input(defval=-100, title="Oversold level 1")ccioversold2 = input(defval=-140, title="Oversold level 2")ccioversold3 = input(defval=-180, title="Oversold level 3")//cciOB = (ccivalue >= ccioverbought and ccivalue < ccioverbought2)//cciOS = (ccivalue <= ccioversold and ccivalue > ccioversold2)//cciOB2 = (ccivalue >= ccioverbought2 and ccivalue < ccioverbought3)//cciOS2 = (ccivalue <= ccioversold and ccivalue > ccioversold3)//cciOB3 = (ccivalue >= ccioverbought3)//cciOS3 = (ccivalue <= ccioversold3)//Supertrendlength = input(title="ATR Period", type=input.integer, defval=55)mult = input(title="ATR Multiplier", type=input.float, step=0.1, defval=5.0)wicks = input(title="Take Wicks into Account ?", type=input.bool, defval=true)illuminate = input(title="Illuminate Trend", type=input.bool, defval=false)atr = mult * atr(length)longStop = hl2 - atrlongStopPrev = nz(longStop[1], longStop)longStop := (wicks ? low[1] : close[1]) > longStopPrev ? max(longStop, longStopPrev) : longStopshortStop = hl2 + atrshortStopPrev = nz(shortStop[1], shortStop)shortStop := (wicks ? high[1] : close[1]) < shortStopPrev ? min(shortStop, shortStopPrev) : shortStopdir = 1dir := nz(dir[1], dir)dir := dir == -1 and (wicks ? high : close) > shortStopPrev ? 1 : dir == 1 and (wicks ? low : close) < longStopPrev ? -1 : dir//entriesuptrend = emashort>ema and dir == 1upsignal = ccivalue<=ccioversold and ccivalue>ccioversold2upsignal2 = ccivalue<=ccioversold2 and ccivalue>ccioversold3upsignal3 = ccivalue<=ccioversold3downtrend = emashort<ema and dir == -1downsignal = ccivalue>=ccioverbought and ccivalue<ccioverbought2downsignal2 = ccivalue>=ccioverbought2 and ccivalue<ccioverbought3downsignal3 = ccivalue>=ccioverbought3//adapts to the current bar, I need to save the bars number when the condition for buy was true, static number is spreadspread = input (0.00020, title="Spread")upstoploss = longStop - spreaddownstoploss = shortStop + spreadordersize=floor(strategy.initial_capital/close)testlong = input(title="Test longs", type=input.bool, defval=true)testshort = input(title="Test shorts", type=input.bool, defval=true)//newdegree = input(title="Test level 1 overbought/sold levels", type=input.bool, defval=true)degree2 = input(title="Test level 2 overbought/sold levels", type=input.bool, defval=false)degree3 = input(title="Test level 3 overbought/sold levels", type=input.bool, defval=false)statictarget = input(title="Use static target", type=input.bool, defval=true)statictargetvalue = input(title="Static target in pips", type=input.integer, defval=400)//timetrade = input(title="Open trades only withing specified time", type=input.bool, defval=true)//timtrade = input()//přidat možnost TP podle ATR a sl podle ATRbuy1 = uptrend and upsignal and strategy.opentrades==0 and testlong and degreex1 = barssince (buy1)if (buy1)//bodlo by zakázat atrtarget v tomto případě    if (statictarget)        strategy.entry("Oath1", strategy.long, ordersize)        strategy.exit( "Oath1 Close", from_entry="Oath1" , profit=statictargetvalue,stop=upstoploss[x1]) buy2 = uptrend and upsignal2 and strategy.opentrades==0 and testlong and degree2x2 = barssince (buy2)if (buy2)//bodlo by zakázat atrtarget v tomto případě    if (statictarget)        strategy.entry("Oath2", strategy.long, ordersize)        strategy.exit( "Oath2 Close", from_entry="Oath2" , profit=statictargetvalue,stop=upstoploss[x2])  buy3 = uptrend and upsignal3 and strategy.opentrades==0 and testlong and degree3x3 = barssince (buy3)if (buy3)//bodlo by zakázat atrtarget v tomto případě    if (statictarget)        strategy.entry("Oath3", strategy.long, ordersize)        strategy.exit( "Oath3 Close", from_entry="Oath3" , profit=statictargetvalue,stop=upstoploss[x3])sell1 = downtrend and downsignal and strategy.opentrades==0 and testshort and degreey1 = barssince (sell1)if (sell1)    if (statictarget)        strategy.entry("Oath1.s", strategy.short, ordersize)        strategy.exit( "Oath1 Close", from_entry="Oath1.s" , profit=statictargetvalue,stop=downstoploss[y1])sell2 = downtrend and downsignal2 and strategy.opentrades==0 and testshort and degree2y2 = barssince (sell2)if (sell2)    if (statictarget)        strategy.entry("Oath2.s", strategy.short, ordersize)        strategy.exit( "Oath2 Close", from_entry="Oath2.s" , profit=statictargetvalue,stop=downstoploss[y2])sell3 = downtrend and downsignal3 and strategy.opentrades==0 and testshort and degree3y3 = barssince (sell3)if (sell3)    if (statictarget)        strategy.entry("Oath3.s", strategy.short, ordersize)        strategy.exit( "Oath3 Close", from_entry="Oath3.s" , profit=statictargetvalue,stop=downstoploss[y3])plotshape(uptrend and upsignal and degree, location=location.belowbar, color=color.green, transp=0, style=shape.triangleup, size=size.tiny, text="Oath up")plotshape(downtrend and downsignal and degree, location=location.abovebar, color=color.red, transp=0, style=shape.triangledown, size=size.tiny, text="Oath down")plotshape(uptrend and upsignal2 and degree2, location=location.belowbar, color=color.green, transp=0, style=shape.triangleup, size=size.tiny, text="Oath up+")plotshape(downtrend and downsignal2 and degree2, location=location.abovebar, color=color.red, transp=0, style=shape.triangledown, size=size.tiny, text="Oath down+")plotshape(uptrend and upsignal3 and degree3, location=location.belowbar, color=color.green, transp=0, style=shape.triangleup, size=size.tiny, text="Oath up++")plotshape(downtrend and downsignal3 and degree3, location=location.abovebar, color=color.red, transp=0, style=shape.triangledown, size=size.tiny, text="Oath down++")