Zeal Terminal Open in Zeal Terminal

Pine Script v5 · Strategy

Vortex Cross w-MA Confirmation

A Pine Script v5 strategy built on ATR (1) and SMA (close, 9). It has 2 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. 6 settings; defaults include Vortex Length 14, MA Length 9 and Source close.

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 Vortex Cross w-MA Confirmation repaint?
No
No repainting patterns were found in the source, and a live tick-by-tick replay matched history on 17 of 17 trades.
How did Vortex Cross w-MA Confirmation do on BTCUSDT 1D with default settings?
+2.41%
From 26 Jan 2024 to 21 Oct 2026, over 52 closed trades, against +102.5% for buy and hold. A backtest, not investment advice.
Does Vortex Cross w-MA Confirmation 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, 47 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 Vortex Cross w-MA Confirmation use a stop loss?
No
Every exit waits for a signal; nothing limits a losing trade before it fires.
Does Vortex Cross w-MA Confirmation run in Zeal Terminal?
Yes
It compiles in 13 ms and runs 1,000 bars in 36 ms, in the browser.

BTCUSDT · 1D · default settings

  • VI +
  • VI -
  • MA
  • Smoothing Line
  • 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 (6)
0.0050,000100,000AprJulOct2025AprJulOct2026AprJulOct$1,022,730$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. Lines are what the script plots.
Net profit
+2.41%
$24,125.70
Buy and hold
+102.5%
same period
Closed trades
52
21 won · 31 lost
Profitable
40.4%
of closed trades
Profit factor
1.21
gross profit ÷ gross loss
Max drawdown
4.71%
−$47,054.60

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

    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.

Settings

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

SettingDefaultType and rangeFeeds
Vortex Length14int · min 2VMP VMM STR
MA Length9int · min 1out
Sourceclosesourceout
Offset0int · min -500 · max 500MA Smoothing Line
Smoothing
MethodSMAstring · options ["SMA", "EMA", "SMMA (RMA)", "WMA", "VWMA"]smoothingLine
Length5int · min 1 · max 100smoothingLine

What it calculates

  • ATR1STR · line 9
  • SMASource (close), MA Length (9)out · line 17

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 dataperiod_Vortex Lengthsetting · 14closecloseprice datalenMA Lengthsetting · 9lowlowprice datahighhighprice datasmoothingLengthLengthsetting · 5typeMAMethodsetting · SMASTRATR→ STRoutSMA→ outVMP, VMMVMP · VMM2 valuesVIPVIPvalueVIMVIMvaluesmoothingLinesmoothingLinevaluelongConditionlongConditionconditionshortConditionshortConditionconditioncrossConditioncrossConditionconditionentry:LongOpen Longstrategy.entryentry:ShortOpen Shortstrategy.entryplot:12VI +plotplot:13VI -plotplot:18MAplotplot:29Smoothing Lineplotbgcolor:39bgcolorbgcolor

Order rules

OrderFires whenBy defaultLine
Open Long longlongConditionOn36
Open Short shortshortConditionOn38

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.

17/17trades 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+2.4%+102.5%5240%1.214.7%26 Jan 2024 – 21 Oct 2026
BTCUSDT 4h+0.8%+5.5%5332%1.201.1%8 May 2026 – 21 Oct 2026
ETHUSDT 1D−0.2%+9.8%6121%0.730.3%26 Jan 2024 – 21 Oct 2026
ETHUSDT 4h+0.0%+8.4%6932%1.310.1%8 May 2026 – 21 Oct 2026
SOLUSDT 1D+0.0%+16.7%5238%1.290.0%26 Jan 2024 – 21 Oct 2026
SOLUSDT 4h+0.0%+21.5%5330%1.750.0%8 May 2026 – 21 Oct 2026
BNBUSDT 1D+0.0%+148.3%5639%1.280.0%26 Jan 2024 – 21 Oct 2026
BNBUSDT 4h+0.0%+17.1%6535%1.250.0%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 market1533%−$35,177.30
Sideways market2255%$40,044.50
Falling market1527%$19,258.50

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

How bad could the drawdown be?

6.5%

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

0%8%
All 52 trades
SideEntryExitBarsP&L
short21 Mar 2024 67,840.5030 Mar 2024 69,850.509−$2,010.02
long30 Mar 2024 69,850.5013 Apr 2024 67,116.5014−$2,734.01
short13 Apr 2024 67,116.506 Jun 2024 71,108.0054−$3,991.48
long6 Jun 2024 71,108.0012 Jun 2024 67,314.206−$3,793.77
short12 Jun 2024 67,314.2017 Jul 2024 65,044.0035$2,270.23
long17 Jul 2024 65,044.002 Aug 2024 65,354.0016$310.02
short2 Aug 2024 65,354.0014 Sep 2024 60,498.0043$4,856.03
long14 Sep 2024 60,498.004 Oct 2024 60,752.7020$254.73
short4 Oct 2024 60,752.7015 Oct 2024 66,084.0011−$5,331.28
long15 Oct 2024 66,084.004 Nov 2024 68,776.0020$2,691.99
short4 Nov 2024 68,776.004 Jan 2025 98,174.2061−$29,398.20
long4 Jan 2025 98,174.209 Jan 2025 95,060.605−$3,113.56
short9 Jan 2025 95,060.6015 Jan 2025 96,560.906−$1,500.24
long15 Jan 2025 96,560.902 Feb 2025 100,636.0018$4,074.81
short2 Feb 2025 100,636.0021 Feb 2025 98,305.0019$2,330.65
long21 Feb 2025 98,305.0022 Feb 2025 96,182.001−$2,123.02
short22 Feb 2025 96,182.0024 Mar 2025 86,082.5030$10,099.50
long24 Mar 2025 86,082.5030 Mar 2025 82,648.506−$3,433.97
short30 Mar 2025 82,648.5013 Apr 2025 85,276.9014−$2,628.38
long13 Apr 2025 85,276.902 Jun 2025 105,643.0050$20,366.00
short2 Jun 2025 105,643.0011 Jun 2025 110,274.009−$4,631.46
long11 Jun 2025 110,274.0014 Jun 2025 106,067.003−$4,207.80
short14 Jun 2025 106,067.0027 Jun 2025 106,947.0013−$880.47
long27 Jun 2025 106,947.0026 Jul 2025 117,614.0029$10,667.30
short26 Jul 2025 117,614.009 Aug 2025 116,675.0014$939.57
long9 Aug 2025 116,675.0021 Aug 2025 114,271.0012−$2,403.51
short21 Aug 2025 114,271.009 Sep 2025 112,065.0019$2,206.00
long9 Sep 2025 112,065.0025 Sep 2025 113,307.0016$1,241.78
short25 Sep 2025 113,307.002 Oct 2025 118,595.007−$5,287.98
long2 Oct 2025 118,595.0015 Oct 2025 113,028.0013−$5,566.86
short15 Oct 2025 113,028.0027 Oct 2025 114,559.0012−$1,531.28
long27 Oct 2025 114,559.0030 Oct 2025 110,021.003−$4,538.11
short30 Oct 2025 110,021.004 Dec 2025 93,429.9035$16,591.40
long4 Dec 2025 93,429.9013 Dec 2025 90,268.409−$3,161.52
short13 Dec 2025 90,268.4027 Feb 2026 67,485.2076$22,783.20
long27 Feb 2026 67,485.2028 Feb 2026 65,872.101−$1,613.10
short28 Feb 2026 65,872.105 Mar 2026 72,666.805−$6,794.68
long5 Mar 2026 72,666.808 Mar 2026 67,262.903−$5,403.86
short8 Mar 2026 67,262.9010 Mar 2026 68,432.202−$1,169.25
long10 Mar 2026 68,432.2020 Mar 2026 69,930.0010$1,497.85
short20 Mar 2026 69,930.008 Apr 2026 71,924.2019−$1,994.21
long8 Apr 2026 71,924.2017 May 2026 78,148.1039$6,223.83
short17 May 2026 78,148.108 Jul 2026 63,364.0052$14,784.10
long8 Jul 2026 63,364.0026 Jul 2026 64,375.0018$1,011.01
short26 Jul 2026 64,375.0027 Jul 2026 65,400.001−$1,024.99
long27 Jul 2026 65,400.0029 Jul 2026 63,915.002−$1,485.00
short29 Jul 2026 63,915.008 Aug 2026 64,923.2010−$1,008.20
long8 Aug 2026 64,923.2011 Aug 2026 63,970.003−$953.19
short11 Aug 2026 63,970.0018 Aug 2026 64,532.107−$562.10
long18 Aug 2026 64,532.109 Sep 2026 78,455.8022$13,923.70
short9 Sep 2026 78,455.8020 Sep 2026 81,250.0011−$2,794.19
long20 Sep 2026 81,250.008 Oct 2026 83,321.8018$2,071.82

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
Vortex Cross w-MA Confirmation this page—v5 strategy+2.4%524.7%
I11L - Better Buy Low Volatility or High Volatility- by I11Latr smav5 strategy+19.2%8337.4%
Configurable Multi MA Crossover Voting System by levieuxsma atrv5 strategy+28.5%539.4%
Swing Trend Strategy by Inkedlausma atrv5 strategy+11.2%516.2%
SSL Backtester With ATR SL TP and Money Management by JBTrippinsma atrv4 strategy+8.5%553.9%
Baseline Cross Qualifier Volatility Strategy with HMA Trend Bias by sevencampbellsma atrv5 strategy−1.4%2141.8%

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.

  • 1 setting uses the untyped input() (line 15). 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 52 trades and the same P&L on BTCUSDT 1D, 1,000 bars, in Zeal Terminal's engine.

  • Line 15: input() → input.source()
⋯len = input.int(9, minval=1, title="MA Length")-src = input(close, title="Source")+src = input.source(close, title="Source")offset = input.int(title="Offset", defval=0, minval=-500, maxval=500)⋯

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

⋯// © DraftVenture-//@version=5+//@version=6strategy("Vortex + Moving Average Strategy", overlay=true)⋯

Where it runs

EngineCompilesRunsMatches TradingView
Zeal Terminal · OpenPineScript v2Yes 13 msYes 1,000 bars in 36 msNot measured
PineTSNot testedNot testedNot measured

“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/// © DraftVenture//@version=5strategy("Vortex + Moving Average Strategy", overlay=true)//Vortex settingsperiod_ = input.int(14, title="Vortex Length", minval=2)VMP = math.sum( math.abs( high - low[1]), period_ )VMM = math.sum( math.abs( low - high[1]), period_ )STR = math.sum( ta.atr(1), period_ )VIP = VMP / STRVIM = VMM / STRplot(VIP, title="VI +", color=color.white)plot(VIM, title="VI -", color=color.white)len = input.int(9, minval=1, title="MA Length")src = input(close, title="Source")offset = input.int(title="Offset", defval=0, minval=-500, maxval=500)out = ta.sma(src, len)plot(out, color=color.blue, title="MA", offset=offset)ma(source, length, type) =>    switch type        "SMA" => ta.sma(source, length)        "EMA" => ta.ema(source, length)        "SMMA (RMA)" => ta.rma(source, length)        "WMA" => ta.wma(source, length)        "VWMA" => ta.vwma(source, length)typeMA = input.string(title = "Method", defval = "SMA", options=["SMA", "EMA", "SMMA (RMA)", "WMA", "VWMA"], group="Smoothing")smoothingLength = input.int(title = "Length", defval = 5, minval = 1, maxval = 100, group="Smoothing")smoothingLine = ma(out, smoothingLength, typeMA)plot(smoothingLine, title="Smoothing Line", color=#f37f20, offset=offset, display=display.none)// Determine long and short conditionslongCondition = ta.crossover(VIP, VIM) and close > smoothingLineshortCondition = ta.crossunder(VIP, VIM) and close < smoothingLinecrossCondition = ta.crossunder(VIP, VIM) or ta.crossunder(VIM, VIP)// Strategy entry and exit logicif longCondition    strategy.entry("Long", strategy.long)if shortCondition    strategy.entry("Short", strategy.short)bgcolor(crossCondition ? color.new(color.white, 80) : na)// Strategy by KP