Zeal Terminal Open in Zeal Terminal

Pine Script v4 · Strategy

Momentum Strategy Idea

A Pine Script v4 strategy built on MOM (close, 5). It has 6 order rules, 2 entries among them, and trades long and short with the default settings. Exits use a stop loss. Each trade commits 100% of equity and pays 0.075% commission. 5 settings; defaults include Fast Period 5, Slow Period 10 and Stop-loss (%) 5.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 Momentum Strategy Idea repaint?
No
No repainting patterns were found in the source, and a live tick-by-tick replay matched history on 49 of 49 trades.
How did Momentum Strategy Idea do on BTCUSDT 1D with default settings?
−23.56%
From 26 Jan 2024 to 21 Oct 2026, over 170 closed trades, against +102.5% for buy and hold. A backtest, not investment advice.
Can Momentum Strategy Idea 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 Momentum Strategy Idea use a stop loss?
Yes
strategy.exit sets a stop on line 37, 38.
Does Momentum Strategy Idea run in Zeal Terminal?
Yes
It compiles in 10 ms and runs 1,000 bars in 44 ms, in the browser.

BTCUSDT · 1D · default settings

  • Plot
  • Plot
  • 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 (5)
40,00060,00080,000100,000120,000AprJulOct2025AprJulOct2026AprJulOctPlot$780$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. Lines are what the script plots.
Net profit
−23.56%
−$235.59
Buy and hold
+102.5%
same period
Closed trades
170
56 won · 114 lost
Profitable
32.9%
of closed trades
Profit factor
0.91
gross profit ÷ gross loss
Max drawdown
52.12%
−$704.88

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

    Every trade uses all the equity

    default_qty_value is 100% of equity.

  • 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 27, 28, 30, 31. The upgraded version below moves each call inside an if block.

  • Note

    Uses transp =, which v5 removed line 47

    transp = on line 47. 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 mom → ta.mom.
  • 4 strategy calls use the when = argument (line 27, 28, 30, 31). It is deprecated in v5 and removed in v6, where each call moves inside an if block.

v4 → v5

Verified

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

  • Line 3: //@version=4 → //@version=5
  • Line 20: mom → ta.mom
  • Line 21: mom → ta.mom
  • Line 47: transp = 50 → color.new(colors, 50)
⋯// © QuantCT-//@version=4+//@version=5strategy("Momentum Strategy Idea",⋯// ____ Logic-mom_fast = mom(close, fast_period)+mom_fast = ta.mom(close, fast_period)-mom_slow = mom(close, slow_period)+mom_slow = ta.mom(close, slow_period)    ⋯mom_slow_plot = plot(mom_slow, color=colors)-fill(mom_fast_plot, mom_slow_plot, color=colors, transp=50)+fill(mom_fast_plot, mom_slow_plot, color=color.new(colors, 50))

Clean v5

VerifiedDownload the v5 script

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

  • Line 14: input() → input.int()
  • Line 15: input() → input.int()
  • Line 16: input() → input.bool()
  • Line 17: input() → input.float()
  • Line 18: input() → input.bool()
  • Line 27: when = enter_long → if block
3 more edits
  • Line 28: when = exit_long → if block
  • Line 30: when = enter_short → if block
  • Line 31: when = exit_short → if block
⋯// ____ Inputs-fast_period = input(title="Fast Period", defval=5) +fast_period = input.int(title="Fast Period", defval=5) -slow_period = input(title="Slow Period", defval=10)+slow_period = input.int(title="Slow Period", defval=10)-long_only = input(title="Long Only", defval=false)+long_only = input.bool(title="Long Only", defval=false)-slp = input(title="Stop-loss (%)", minval=1.0, maxval=25.0, defval=5.0)+slp = input.float(title="Stop-loss (%)", minval=1.0, maxval=25.0, defval=5.0)-use_sl = input(title="Use Stop-Loss", defval=false)+use_sl = input.bool(title="Use Stop-Loss", defval=false)// ____ Logic⋯exit_short = (mom_slow > 0 or mom_fast > 0)-strategy.entry("Long", strategy.long, when=enter_long)+if enter_long+    strategy.entry("Long", strategy.long)-strategy.close("Long", when=exit_long) +if exit_long+    strategy.close("Long") if (not long_only)-    strategy.entry("Short", strategy.short, when=enter_short)+    if enter_short+        strategy.entry("Short", strategy.short)-    strategy.close("Short", when=exit_short) +    if exit_short+        strategy.close("Short")    ⋯

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: 170 before, 440 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.

⋯// © QuantCT-//@version=5+//@version=6strategy("Momentum Strategy Idea",⋯

Settings

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

SettingDefaultType and rangeFeeds
Fast Period5intmom_fast
Slow Period10intmom_slow
Long Onlyfalseboolentry Short close Short line 29
Stop-loss (%)5.0float · min 1.0 · max 25.0sl_long sl_short
Use Stop-Lossfalseboolexit SL exit SL line 36

What it calculates

  • MOM (mom, ta.mom in v5)close, Fast Period (5)mom_fast · line 20
  • MOM (mom, ta.mom in v5)close, Slow Period (10)mom_slow · 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.

closecloseprice datafast_periodFast Periodsetting · 5slow_periodSlow Periodsetting · 10slpStop-loss (%)setting · 5.0mom_fastMOM→ mom_fastmom_slowMOM→ mom_slowsl_long, sl_shortsl_long · sl_short2 valuesenter_longenter_longconditionexit_longexit_longconditionenter_shortenter_shortconditionexit_shortexit_shortconditioncolorsColourcolorsentry:LongOpen Longstrategy.entryclose:LongClose Longstrategy.closeentry:ShortOpen Shortstrategy.entryclose:ShortClose Shortstrategy.closeexit:SLexit SLstrategy.exitplot:45plotplotplot:46plotplotfill:47Fillfill

Order rules

OrderFires whenBy defaultLine
Open Long longenter_long(mom_slow > 0 and mom_fast > 0)On27
Close Longexit_long(mom_slow < 0 or mom_fast < 0)On28
Open Short shortenter_short(mom_slow < 0 and mom_fast < 0)On30
Close Shortexit_short(mom_slow > 0 or mom_fast > 0)On31
Exit SL stop(use_sl)On37
Exit SL stop(use_sl)On38

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.

49/49trades 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−23.6%+102.5%17033%0.9152.1%26 Jan 2024 – 21 Oct 2026
BTCUSDT 4h−11.1%+5.5%17230%0.8721.7%8 May 2026 – 21 Oct 2026
ETHUSDT 1D−20.4%+9.8%17931%0.9658.8%26 Jan 2024 – 21 Oct 2026
ETHUSDT 4h−3.1%+8.4%18726%0.9725.5%8 May 2026 – 21 Oct 2026
SOLUSDT 1D−22.6%+16.7%16142%0.9466.9%26 Jan 2024 – 21 Oct 2026
SOLUSDT 4h+3.7%+21.5%16529%1.0326.7%8 May 2026 – 21 Oct 2026
BNBUSDT 1D+3.7%+148.3%16334%1.0147.4%26 Jan 2024 – 21 Oct 2026
BNBUSDT 4h+5.0%+17.1%15730%1.0518.9%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 (Fast Period 4, Slow Period 14) made +39.6% before 26 Dec 2025 and −9.3% after it, worse than the defaults' −7.4% after. Tuning on the past did not carry forward. 23% of the 48 combinations made money in-sample and 40% out-of-sample.

Before 26 Dec 2025 · in-sample
Slow Period ↓ · Fast Period →345679
5+3%+7%−21%−23%−37%−8%
6−5%−2%−23%−29%−40%−11%
7−23%−18%−37%−40%−52%−28%
9+14%+20%−8%−11%−28%−1%
10+4%+9%−16%−19%−34%−6%
12−17%−13%−34%−37%−49%−27%
14+29%+40%+4%+2%−16%+17%
17−14%−7%−31%−32%−45%−21%
From 26 Dec 2025 · out-of-sample
Slow Period ↓ · Fast Period →345679
5−16%−25%−1%+7%−0%+5%
6−9%−17%+7%+12%+5%+13%
7−14%−21%−0%+5%−2%+2%
9−14%−26%+5%+13%+2%+9%
10−26%−35%−7%−1%−8%−5%
12−15%−23%−1%+4%−3%+2%
14+5%−9%+24%+33%+17%+35%
17−26%−35%−11%−7%−11%−8%

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 market5929%−$413.39
Sideways market6942%$385.84
Falling market4224%−$207.47

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

How bad could the drawdown be?

66.4%

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

0%76%
The first 150 of 170 trades
SideEntryExitBarsP&L
long6 Feb 2024 42,708.7020 Feb 2024 51,774.7014$210.46
long21 Feb 2024 52,258.8022 Feb 2024 51,849.401−$11.28
short25 Feb 2024 51,568.2027 Feb 2024 54,476.502−$69.43
long27 Feb 2024 54,476.5017 Mar 2024 65,300.6019$222.63
short17 Mar 2024 65,300.6018 Mar 2024 68,393.501−$66.13
short19 Mar 2024 67,610.0022 Mar 2024 65,501.303$38.19
short23 Mar 2024 63,796.6025 Mar 2024 67,210.002−$72.85
long26 Mar 2024 69,880.0031 Mar 2024 69,582.205−$7.20
long1 Apr 2024 71,280.003 Apr 2024 65,464.002−$103.25
short4 Apr 2024 65,963.308 Apr 2024 69,360.404−$60.48
long9 Apr 2024 71,620.0010 Apr 2024 69,146.001−$38.89
long12 Apr 2024 70,006.2013 Apr 2024 67,116.501−$44.50
short14 Apr 2024 63,924.5021 Apr 2024 64,940.607−$17.35
long24 Apr 2024 66,414.0025 Apr 2024 64,289.601−$32.77
short27 Apr 2024 63,770.0028 Apr 2024 63,462.001$3.16
short29 Apr 2024 63,118.6030 Apr 2024 63,866.001−$12.68
short1 May 2024 60,672.005 May 2024 63,892.004−$51.17
short9 May 2024 61,193.0011 May 2024 60,800.002$4.37
long14 May 2024 62,940.1015 May 2024 61,577.501−$20.59
short15 May 2024 61,577.5016 May 2024 66,206.501−$66.77
long16 May 2024 66,206.5026 May 2024 69,290.6010$36.20
long28 May 2024 69,436.4030 May 2024 67,652.402−$22.80
short31 May 2024 68,352.204 Jun 2024 68,809.904−$6.69
long4 Jun 2024 68,809.9010 Jun 2024 69,648.106$8.65
short12 Jun 2024 67,314.2013 Jun 2024 68,264.001−$12.78
short14 Jun 2024 66,773.0030 Jun 2024 60,986.7016$68.64
short4 Jul 2024 60,208.6010 Jul 2024 58,050.006$30.05
short12 Jul 2024 57,339.9013 Jul 2024 57,889.101−$10.02
long15 Jul 2024 60,797.9025 Jul 2024 65,376.0010$65.93
long28 Jul 2024 67,896.5031 Jul 2024 66,188.003−$25.58
short1 Aug 2024 64,628.009 Aug 2024 61,686.008$41.16
short14 Aug 2024 60,587.2015 Aug 2024 58,683.401$29.21
long17 Aug 2024 58,874.6019 Aug 2024 58,427.302−$9.13
short19 Aug 2024 58,427.3020 Aug 2024 59,438.501−$18.75
long22 Aug 2024 61,156.0028 Aug 2024 59,415.006−$29.25
short28 Aug 2024 59,415.0029 Aug 2024 59,034.901$4.65
short30 Aug 2024 59,359.0031 Aug 2024 59,124.001$2.34
short1 Sep 2024 58,974.003 Sep 2024 59,132.102−$3.99
short4 Sep 2024 57,487.7011 Sep 2024 57,636.007−$3.88
long12 Sep 2024 57,338.0013 Sep 2024 58,132.301$11.69
long14 Sep 2024 60,498.0026 Sep 2024 63,152.0012$40.57
long27 Sep 2024 65,174.002 Oct 2024 60,804.905−$68.41
short2 Oct 2024 60,804.907 Oct 2024 62,819.905−$32.28
short10 Oct 2024 60,636.0012 Oct 2024 62,540.002−$29.58
long13 Oct 2024 63,206.2022 Oct 2024 67,377.509$55.99
long23 Oct 2024 67,426.0024 Oct 2024 66,668.601−$11.77
short26 Oct 2024 66,698.3028 Oct 2024 68,021.702−$19.50
long28 Oct 2024 68,021.703 Nov 2024 69,374.706$16.43
long7 Nov 2024 75,572.0026 Nov 2024 93,010.0019$208.43
long1 Dec 2024 96,408.002 Dec 2024 97,185.201$7.33
short3 Dec 2024 95,840.604 Dec 2024 95,849.701−$1.79
long5 Dec 2024 98,587.3010 Dec 2024 97,276.505−$16.62
short10 Dec 2024 97,276.5011 Dec 2024 96,593.001$6.13
long12 Dec 2024 101,125.0019 Dec 2024 100,204.007−$11.80
short19 Dec 2024 100,204.0020 Dec 2024 97,461.901$28.53
short22 Dec 2024 97,292.0025 Dec 2024 98,663.603−$17.64
short27 Dec 2024 95,791.6029 Dec 2024 95,300.002$4.04
short30 Dec 2024 93,738.202 Jan 2025 94,591.803−$11.85
long3 Jan 2025 96,984.804 Jan 2025 98,174.201$11.88
long6 Jan 2025 98,363.608 Jan 2025 96,954.602−$17.65
short10 Jan 2025 92,552.5011 Jan 2025 94,726.101−$27.47
short13 Jan 2025 94,545.1015 Jan 2025 96,560.902−$24.46
long16 Jan 2025 100,497.0017 Jan 2025 99,987.301−$6.88
long18 Jan 2025 104,077.0023 Jan 2025 103,707.005−$5.26
long25 Jan 2025 104,871.0027 Jan 2025 102,620.002−$23.74
short28 Jan 2025 102,083.0030 Jan 2025 103,733.002−$17.87
short1 Feb 2025 102,430.0011 Feb 2025 97,430.8010$47.01
short12 Feb 2025 95,778.2013 Feb 2025 97,870.001−$24.29
long13 Feb 2025 97,870.0014 Feb 2025 96,608.101−$14.62
long16 Feb 2025 97,569.7017 Feb 2025 96,118.101−$16.39
short18 Feb 2025 95,780.0020 Feb 2025 96,644.402−$10.37
long21 Feb 2025 98,305.0023 Feb 2025 96,551.002−$18.84
short25 Feb 2025 91,552.903 Mar 2025 94,270.006−$29.82
short8 Mar 2025 86,801.709 Mar 2025 86,222.501$4.79
long9 Mar 2025 86,222.5010 Mar 2025 80,734.501−$60.63
short10 Mar 2025 80,734.5015 Mar 2025 83,983.205−$36.37
short17 Mar 2025 82,574.5018 Mar 2025 84,010.001−$15.76
long20 Mar 2025 86,845.9021 Mar 2025 84,223.401−$25.91
long22 Mar 2025 84,088.8023 Mar 2025 83,840.601−$3.52
long24 Mar 2025 86,082.5029 Mar 2025 84,424.405−$16.36
short30 Mar 2025 82,648.502 Apr 2025 85,158.403−$24.63
short3 Apr 2025 82,516.304 Apr 2025 83,213.101−$7.44
short7 Apr 2025 78,430.0010 Apr 2025 82,615.203−$40.64
short11 Apr 2025 79,607.3012 Apr 2025 83,423.801−$34.61
long13 Apr 2025 85,276.9018 Apr 2025 84,947.905−$3.56
long19 Apr 2025 84,474.701 May 2025 94,172.0012$74.88
long2 May 2025 96,489.9016 May 2025 103,764.0014$54.36
long18 May 2025 103,127.0027 May 2025 109,435.009$47.14
long29 May 2025 107,782.0030 May 2025 105,590.001−$18.28
short31 May 2025 103,985.005 Jun 2025 104,697.005−$6.84
short6 Jun 2025 101,509.009 Jun 2025 105,734.003−$35.07
long9 Jun 2025 105,734.0013 Jun 2025 105,672.004−$1.63
long14 Jun 2025 106,067.0015 Jun 2025 105,415.001−$5.93
short18 Jun 2025 104,551.0024 Jun 2025 105,334.006−$6.92
long25 Jun 2025 106,083.001 Jul 2025 107,147.006$6.50
long3 Jul 2025 108,850.005 Jul 2025 107,984.002−$7.27
long6 Jul 2025 108,198.008 Jul 2025 108,263.002−$0.69
long10 Jul 2025 111,234.0019 Jul 2025 117,925.009$44.63
short22 Jul 2025 117,380.0023 Jul 2025 119,954.001−$18.90
long23 Jul 2025 119,954.0024 Jul 2025 118,756.001−$9.05
long31 Jul 2025 117,840.001 Aug 2025 115,764.001−$14.87
short1 Aug 2025 115,764.007 Aug 2025 114,992.006$3.95
long11 Aug 2025 119,294.0016 Aug 2025 117,342.005−$13.70
short18 Aug 2025 117,405.0025 Aug 2025 113,494.007$24.00
short26 Aug 2025 110,112.004 Sep 2025 111,706.009−$12.43
long5 Sep 2025 110,731.006 Sep 2025 110,660.001−$1.64
short8 Sep 2025 111,137.009 Sep 2025 112,065.001−$7.53
long9 Sep 2025 112,065.0022 Sep 2025 115,232.0013$20.23
short22 Sep 2025 115,232.0029 Sep 2025 112,164.007$19.54
long2 Oct 2025 118,595.0010 Oct 2025 121,662.008$19.37
short11 Oct 2025 112,774.0022 Oct 2025 108,298.0011$31.16
long26 Oct 2025 111,646.0030 Oct 2025 110,021.004−$13.58
short31 Oct 2025 108,323.001 Nov 2025 109,608.001−$11.14
short4 Nov 2025 106,583.0010 Nov 2025 104,723.006$13.12
short13 Nov 2025 101,654.0026 Nov 2025 87,370.0013$116.13
long1 Dec 2025 90,360.002 Dec 2025 86,286.001−$44.26
long4 Dec 2025 93,429.906 Dec 2025 89,330.002−$41.11
short8 Dec 2025 90,395.3010 Dec 2025 92,678.802−$23.18
long10 Dec 2025 92,678.8013 Dec 2025 90,268.403−$23.17
short13 Dec 2025 90,268.4021 Dec 2025 88,360.908$16.11
short25 Dec 2025 87,669.4026 Dec 2025 87,225.301$2.98
short27 Dec 2025 87,369.6028 Dec 2025 87,877.001−$6.13
long29 Dec 2025 87,952.7030 Dec 2025 87,237.101−$8.01
short30 Dec 2025 87,237.1031 Dec 2025 88,485.501−$13.05
long31 Dec 2025 88,485.501 Jan 2026 87,648.201−$8.89
long2 Jan 2026 88,839.1010 Jan 2026 90,641.308$15.06
long14 Jan 2026 95,414.0019 Jan 2026 93,673.105−$16.12
short21 Jan 2026 88,427.7011 Feb 2026 68,841.3021$176.37
short12 Feb 2026 67,082.5016 Feb 2026 68,832.604−$26.98
short19 Feb 2026 66,461.0022 Feb 2026 67,975.903−$23.11
long23 Feb 2026 67,643.4024 Feb 2026 64,656.001−$42.31
short24 Feb 2026 64,656.001 Mar 2026 66,973.305−$33.09
long1 Mar 2026 66,973.302 Mar 2026 65,776.501−$16.50
long3 Mar 2026 68,830.108 Mar 2026 67,262.905−$20.26
short8 Mar 2026 67,262.9010 Mar 2026 68,432.202−$15.42
long12 Mar 2026 70,191.9015 Mar 2026 71,211.903$10.41
long16 Mar 2026 72,815.3020 Mar 2026 69,930.004−$33.29
short22 Mar 2026 68,918.1025 Mar 2026 70,556.703−$19.65
short27 Mar 2026 68,820.302 Apr 2026 68,113.906$6.64
long2 Apr 2026 68,113.903 Apr 2026 66,902.001−$14.74
long6 Apr 2026 69,034.2013 Apr 2026 70,741.607$17.39
long14 Apr 2026 74,418.0020 Apr 2026 73,801.806−$7.49
long21 Apr 2026 75,841.0028 Apr 2026 77,371.307$14.17
long3 May 2026 78,686.8014 May 2026 79,313.6011$4.99
long15 May 2026 81,090.0016 May 2026 79,113.201−$20.13
short16 May 2026 79,113.2025 May 2026 77,065.009$18.52
short26 May 2026 77,322.0011 Jun 2026 61,511.0016$157.76
long14 Jun 2026 64,458.0019 Jun 2026 62,958.005−$23.13
short19 Jun 2026 62,958.0020 Jun 2026 63,543.901−$9.86
short22 Jun 2026 63,312.0023 Jun 2026 64,020.001−$11.44

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
Momentum Strategy Idea this page—v4 strategy−23.6%17052.1%
Momentum by Zeal Terminalmomv5 indicatorindicator

Where it runs

EngineCompilesRunsMatches TradingView
Zeal Terminal · OpenPineScript v2Yes 10 msYes 1,000 bars in 44 msNot measured
PineTSNo v5 and v6 only—Not 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. 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/// © QuantCT//@version=4strategy("Momentum Strategy Idea",         shorttitle="Momentum",          overlay=false,         pyramiding=0,              default_qty_type=strategy.percent_of_equity,          default_qty_value=100,          initial_capital=1000,                    commission_type=strategy.commission.percent,          commission_value=0.075)// ____ Inputsfast_period = input(title="Fast Period", defval=5) slow_period = input(title="Slow Period", defval=10)long_only = input(title="Long Only", defval=false)slp = input(title="Stop-loss (%)", minval=1.0, maxval=25.0, defval=5.0)use_sl = input(title="Use Stop-Loss", defval=false)// ____ Logicmom_fast = mom(close, fast_period)mom_slow = mom(close, slow_period)    enter_long = (mom_slow > 0 and mom_fast > 0)exit_long = (mom_slow < 0 or mom_fast < 0)enter_short = (mom_slow < 0 and mom_fast < 0)exit_short = (mom_slow > 0 or mom_fast > 0)strategy.entry("Long", strategy.long, when=enter_long)strategy.close("Long", when=exit_long) if (not long_only)    strategy.entry("Short", strategy.short, when=enter_short)    strategy.close("Short", when=exit_short)    // ____ SLsl_long = strategy.position_avg_price * (1- (slp/100))sl_short = strategy.position_avg_price * (1 + (slp/100))if (use_sl)    strategy.exit(id="SL", from_entry="Long", stop=sl_long)    strategy.exit(id="SL", from_entry="Short", stop=sl_short)    // ____ Plotscolors =  enter_long ? #27D600 : enter_short ? #E30202 : color.orangemom_fast_plot = plot(mom_fast, color=colors)mom_slow_plot = plot(mom_slow, color=colors)fill(mom_fast_plot, mom_slow_plot, color=colors, transp=50)