Zeal Terminal Open in Zeal Terminal

Pine Script v4 · Strategy

ATR with EOM and VORTEX

A Pine Script v4 strategy built on ATR (10), EMA (atrvalue, 5) and SMA or Change (10). It has 2 order rules, 1 entry among them, and trades long only with the default settings. Exits wait for a signal; there is no stop loss. Each trade commits 100% of equity and pays 0.01% commission. 4 settings; defaults include ATR lenght 10, EMA atr length 5 and Length EOM 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 ATR with EOM and VORTEX repaint?
No
No repainting patterns were found in the source, and a live tick-by-tick replay matched history on 7 of 7 trades.
How did ATR with EOM and VORTEX do on BTCUSDT 1D with default settings?
+66.16%
From 26 Jan 2024 to 21 Oct 2026, over 22 closed trades, against +102.5% for buy and hold. A backtest, not investment advice.
Can ATR with EOM and VORTEX be converted to Pine Script v5?
Yes
The upgrade takes 1 step, from v4; each was run before and after on the same candles with identical results, and the v5 script can be downloaded below.
Does ATR with EOM and VORTEX use a stop loss?
No
Every exit waits for a signal; nothing limits a losing trade before it fires.
Does ATR with EOM and VORTEX run in Zeal Terminal?
Yes
It compiles in 7 ms and runs 1,000 bars in 32 ms, in the browser.

BTCUSDT · 1D · default settings

  • ATR
  • EMA
  • SMA
  • ATR
  • 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 (4)
0.0050,000100,000AprJulOct2025AprJulOct2026AprJulOct$1,662$2,025Equity from $1,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 1 as a short, whatever it says; this page passes the same side as strategy.long or strategy.short (line 28) so the engine trades the way the script says.
Net profit
+66.16%
$661.59
Buy and hold
+102.5%
same period
Closed trades
22
7 won · 15 lost
Profitable
31.8%
of closed trades
Profit factor
1.62
gross profit ÷ gross loss
Max drawdown
29.93%
−$675.67

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

  • Likely bug

    atr(1) ignores the settings line 21

    Line 21 hard-codes 1 where line 7 uses “ATR lenght”. Changing those settings moves one band but not this one.

    atr(1)atr(atr_lenght)
  • Check

    No stop loss

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

  • Check

    Every trade uses all the equity

    default_qty_value is 100% of equity.

  • Note

    3 settings have no label

    In the settings dialog atr_lenght (line 6), ema_atr_length (line 9), lengthEOM (line 13) 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 28, 30. 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 atr → ta.atr, ema → ta.ema, sma → ta.sma, change → ta.change, sum → math.sum, abs → math.abs.
  • 2 strategy calls use the when = argument (line 28, 30). It is deprecated in v5 and removed in v6, where each call moves inside an if block.

v4 → v5

Verified

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

  • Line 3: //@version=4 → //@version=5
  • Line 7: atr → ta.atr
  • Line 10: ema → ta.ema
  • Line 15: sma → ta.sma
  • Line 15: change → ta.change
  • Line 19: sum → math.sum
6 more edits
  • Line 19: abs → math.abs
  • Line 20: sum → math.sum
  • Line 20: abs → math.abs
  • Line 21: sum → math.sum
  • Line 21: atr → ta.atr
  • Line 28: strategy.entry(…, 1) → strategy.entry(…, strategy.long)
⋯// © SoftKill21-//@version=4+//@version=5strategy("atr+eom+vortex strat", overlay=true,initial_capital = 1000, default_qty_type=strategy.percent_of_equity, default_qty_value=100, commission_type=strategy.commission.percent , commission_value=0.01 )⋯atr_lenght=input(10)-atrvalue = atr(atr_lenght)+atrvalue = ta.atr(atr_lenght)//plot(atrvalue)ema_atr_length=input(5)-ema_atr = ema(atrvalue,ema_atr_length)+ema_atr = ta.ema(atrvalue,ema_atr_length)//plot(ema_atr,color=color.white)⋯div = 10//input(10000, title="Divisor", minval=1)-eom = sma(div * change(hl2) * (high - low) / volume, lengthEOM)+eom = ta.sma(div * ta.change(hl2) * (high - low) / volume, lengthEOM)// + - 0 long/short⋯period_ = input(10, title="Length", minval=2)-VMP = sum( abs( high - low[1]), period_ )+VMP = math.sum( math.abs( high - low[1]), period_ )-VMM = sum( abs( low - high[1]), period_ )+VMM = math.sum( math.abs( low - high[1]), period_ )-STR = sum( atr(1), period_ )+STR = math.sum( ta.atr(1), period_ )VIP = VMP / STR⋯short=atrvalue < ema_atr and eom < 0 and avg_vortex<1 -strategy.entry("long",1,when=long)+strategy.entry("long",strategy.long,when=long)//strategy.entry("short",0,when=short)⋯

Clean v5

VerifiedDownload the v5 script

Same 22 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 13: input() → input.int()
  • Line 18: input() → input.int()
  • Line 28: when = long → if block
  • Line 30: when = short → if block
⋯//atr and ema-atr_lenght=input(10)+atr_lenght=input.int(10)atrvalue = ta.atr(atr_lenght)//plot(atrvalue)-ema_atr_length=input(5)+ema_atr_length=input.int(5)ema_atr = ta.ema(atrvalue,ema_atr_length)⋯//EOM and ema-lengthEOM = input(10, minval=1)+lengthEOM = input.int(10, minval=1)div = 10//input(10000, title="Divisor", minval=1)⋯//VORTEX-period_ = input(10, title="Length", minval=2)+period_ = input.int(10, title="Length", minval=2)VMP = math.sum( math.abs( high - low[1]), period_ )⋯short=atrvalue < ema_atr and eom < 0 and avg_vortex<1 -strategy.entry("long",strategy.long,when=long)+if long+    strategy.entry("long",strategy.long)//strategy.entry("short",0,when=short)-strategy.close("long",when=short)+if short+    strategy.close("long")

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: 22 before, 26 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.

⋯// © SoftKill21-//@version=5+//@version=6strategy("atr+eom+vortex strat", overlay=true,initial_capital = 1000, default_qty_type=strategy.percent_of_equity, default_qty_value=100, commission_type=strategy.commission.percent , commission_value=0.01 )⋯

Settings

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

SettingDefaultType and rangeFeeds
ATR lenght (no label in the script)10intatrvalue
EMA atr length (no label in the script)5intema_atr
Length EOM (no label in the script)10int · min 1eom
Length10int · min 2VMP VMM STR

What it calculates

  • ATR (atr, ta.atr in v5)ATR lenght (10)atrvalue · line 7
  • EMA (ema, ta.ema in v5)atrvalue, EMA atr length (5)ema_atr · line 10
  • SMA / Change (sma, ta.sma in v5)div * change(hl2) * (high - low) / volume, Length EOM (10)eom · line 15
  • ATR (atr, ta.atr in v5)1STR · line 21

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.

high · low · closehigh · low · closeprice dataatr_lenghtATR lenghtsetting · 10ema_atr_lengthEMA atr lengthsetting · 5volumevolumeprice datahl2hl2price datalowlowprice datahighhighprice datalengthEOMLength EOMsetting · 10period_Lengthsetting · 10atrvalueATR→ atrvalueema_atrEMA→ ema_atreomSMA / Change→ eomSTRATR→ STRVMP, VMMVMP · VMM2 valuesVIPVIPvalueVIMVIMvalueavg_vortexavg_vortexvaluelonglongconditionshortshortconditionentry:longOpen longstrategy.entryclose:longClose longstrategy.close

Order rules

OrderFires whenBy defaultLine
Open long longlongatrvalue > ema_atr and eom > 0 and avg_vortex>1On28
Close longshortatrvalue < ema_atr and eom < 0 and avg_vortex<1On30

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.

7/7trades 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+66.2%+102.5%2232%1.6229.9%26 Jan 2024 – 21 Oct 2026
BTCUSDT 4h−14.1%+5.5%1926%0.6027.4%8 May 2026 – 21 Oct 2026
ETHUSDT 1D+21.9%+9.8%1457%1.1557.7%26 Jan 2024 – 21 Oct 2026
ETHUSDT 4h+0.6%+8.4%2129%1.0216.4%8 May 2026 – 21 Oct 2026
SOLUSDT 1D−0.1%+16.7%2343%1.0054.2%26 Jan 2024 – 21 Oct 2026
SOLUSDT 4h+25.2%+21.5%2040%1.7023.3%8 May 2026 – 21 Oct 2026
BNBUSDT 1D+154.2%+148.3%1650%4.5915.8%26 Jan 2024 – 21 Oct 2026
BNBUSDT 4h+9.2%+17.1%1953%1.507.6%8 May 2026 – 21 Oct 2026

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

Settings heatmap

Two settings that feed the entry signal, moved around their defaults. The best in-sample pair (ATR lenght 7, EMA atr length 3) made +141.3% before 26 Dec 2025 and −18.8% after it, worse than the defaults' −10.4% after. Tuning on the past did not carry forward. 100% of the 48 combinations made money in-sample and 8% out-of-sample.

Before 26 Dec 2025 · in-sample
EMA atr length ↓ · ATR lenght →567910121417
3+94%+106%+141%+96%+100%+90%+80%+78%
4+126%+93%+93%+93%+87%+81%+92%+63%
5+84%+84%+67%+75%+77%+82%+68%+56%
6+74%+73%+68%+93%+86%+61%+69%+60%
7+67%+64%+68%+66%+66%+69%+65%+58%
9+65%+68%+66%+97%+75%+65%+60%+48%
From 26 Dec 2025 · out-of-sample
EMA atr length ↓ · ATR lenght →567910121417
3+9%−13%−19%−23%−23%−22%−23%−26%
4+3%−18%−18%−11%−11%−12%−6%−23%
5+4%−7%−3%−1%−10%−15%−16%−22%
6+4%−3%−1%−0%−13%−13%−24%−22%
7−3%−1%−1%−8%−12%−14%−23%−22%
9−1%−0%−8%−14%−12%−20%−22%−21%

Net P&L of trades opened in each period, as a share of starting capital. marks the defaults and the best in-sample cell. Hover a cell for its trade count. Backtests are simulations on historical data and are not investment advice.

The trades

By market direction

At entry, last 90 barsTradesWonP&L
Rising market650%$17.70
Sideways market944%$940.45
Falling market70%−$296.56

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

How bad could the drawdown be?

36.7%

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

0%42%
All 22 trades
SideEntryExitBarsP&L
long9 Feb 2024 45,288.7024 Mar 2024 63,990.0044$412.65
long26 Mar 2024 69,880.006 Apr 2024 67,820.6011−$41.91
long5 May 2024 63,892.0020 Jun 2024 64,974.4046$22.94
long18 Jul 2024 64,088.0012 Aug 2024 58,712.6025−$117.15
long16 Aug 2024 57,541.1021 Aug 2024 59,013.805$32.41
long20 Sep 2024 62,948.008 Oct 2024 62,224.0018−$15.31
long12 Oct 2024 62,540.003 Dec 2024 95,840.6052$688.42
long8 Dec 2024 99,832.0024 Dec 2024 94,881.5016−$98.66
long11 Jan 2025 94,726.1029 Jan 2025 101,336.0018$131.01
long7 Mar 2025 89,931.9019 Mar 2025 82,715.0012−$162.02
long24 Apr 2025 93,691.104 Aug 2025 114,209.00102$405.21
long16 Aug 2025 117,342.003 Sep 2025 111,240.0018−$117.83
long3 Oct 2025 120,529.0024 Oct 2025 110,078.0021−$185.93
long4 Dec 2025 93,429.908 Dec 2025 90,395.304−$63.84
long12 Dec 2025 92,513.4016 Dec 2025 86,432.104−$124.59
long9 Jan 2026 91,100.0028 Jan 2026 89,250.0019−$36.20
long27 Feb 2026 67,485.209 Mar 2026 65,971.2010−$39.13
long20 Mar 2026 69,930.0022 Mar 2026 68,918.102−$24.79
long18 Apr 2026 77,072.0019 May 2026 77,001.9031−$1.85
long25 Jul 2026 64,140.0029 Jul 2026 63,915.004−$6.17
long5 Sep 2026 79,660.8015 Sep 2026 78,189.2010−$30.94
long20 Sep 2026 81,250.0021 Oct 2026 83,028.1031$35.26

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
ATR with EOM and VORTEX this page—v4 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%
EMA & Supertrend by bhavikmotaema sma atrv4 strategy+2,123.6%13980.9%
Koala System EURUSD 15min by SoftKill21sma ema atrv4 strategyNo trades on this market
Buy&Sell Bullish Engulfing - The Quant Science by thequantsciencesma ema atrv5 strategyNo trades on this market

Where it runs

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

Zeal Terminal's engine currently reads an order side written as 1 as a short, whatever it says; this page passes the same side as strategy.long or strategy.short (line 28) 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.

// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/// © SoftKill21//@version=4strategy("atr+eom+vortex strat", overlay=true,initial_capital = 1000, default_qty_type=strategy.percent_of_equity, default_qty_value=100, commission_type=strategy.commission.percent , commission_value=0.01 )//atr and emaatr_lenght=input(10)atrvalue = atr(atr_lenght)//plot(atrvalue)ema_atr_length=input(5)ema_atr = ema(atrvalue,ema_atr_length)//plot(ema_atr,color=color.white)//EOM and emalengthEOM = input(10, minval=1)div = 10//input(10000, title="Divisor", minval=1)eom = sma(div * change(hl2) * (high - low) / volume, lengthEOM)// + - 0 long/short//VORTEXperiod_ = input(10, title="Length", minval=2)VMP = sum( abs( high - low[1]), period_ )VMM = sum( abs( low - high[1]), period_ )STR = sum( atr(1), period_ )VIP = VMP / STRVIM = VMM / STRavg_vortex=(VIP+VIM)/2//plot(avg_vortex)long= atrvalue > ema_atr and eom > 0 and avg_vortex>1 short=atrvalue < ema_atr and eom < 0 and avg_vortex<1 strategy.entry("long",1,when=long)//strategy.entry("short",0,when=short)strategy.close("long",when=short)