Zeal Terminal Open in Zeal Terminal

Pine Script v5 · Strategy

Slight Swing Momentum Strategy.

A Pine Script v5 strategy built on SMA (close, 60), Highest (volume, 60) and Crossover (volume, highestVol[1]). It has 4 order rules, 1 entry among them, and trades long only with the default settings. Exits use a stop loss and a profit target. Each trade is one contract and pays no commission. It has no settings.

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 Slight Swing Momentum Strategy. repaint?
No
No repainting patterns were found in the source, and a live tick-by-tick replay matched history on 2 of 2 trades.
How did Slight Swing Momentum Strategy. do on BTCUSDT 1D with default settings?
+3.12%
From 26 Jan 2024 to 21 Oct 2026, over 7 closed trades, against +102.5% for buy and hold. A backtest, not investment advice.
Does Slight Swing Momentum Strategy. 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: 7 before, 5 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 Slight Swing Momentum Strategy. use a stop loss?
Yes
strategy.exit sets a stop on line 44.
Does Slight Swing Momentum Strategy. run in Zeal Terminal?
Yes
It compiles in 13 ms and runs 1,000 bars in 38 ms, in the browser.

BTCUSDT · 1D · default settings

  • Shape
  • Shape
  • EMA
  • 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 (0)
40,00060,00080,000100,000120,000AprJulOct2025AprJulOct2026AprJulOct$1,031,180$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
+3.12%
$31,175.40
Buy and hold
+102.5%
same period
Closed trades
7
6 won · 1 lost
Profitable
85.7%
of closed trades
Profit factor
7.74
gross profit ÷ gross loss
Max drawdown
0.60%
−$6,003.23

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

    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.

The script declares no settings.

What it calculates

  • SMAclose, 60ma60 · line 8
  • Highestvolume, 60highestVol · line 14
  • Crossovervolume, highestVol[1]A3 · line 15
  • EMAclose, 5ema5 · line 17
  • Crossover / SMAB1, ta.sma(B1, 9)XG · line 21
  • SMAclose, 50weeklyMa · line 23
  • EMAclose, 5ema · line 50

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 datavolumevolumeprice datalowlowprice dataopenopenprice datahighhighprice datama60SMA→ ma60highestVolHighest→ highestVolA3Crossover→ A3ema5EMA→ ema5XGCrossover / SMA→ XGweeklyMaSMA→ weeklyMaemaEMA→ emaB1B1valuestopLoss, takeProfitstopLoss · takeProfit2 valuesbuyConditionbuyConditionconditionsellConditionsellConditionconditionA1A1conditionA2A2conditionA1andA2A1andA2conditionweeklySlopeweeklySlopeconditionbuySignalbuySignalconditionsellSignalsellSignalconditionentry:BuyOpen Buystrategy.entryclose:BuyClose Buystrategy.closeexit:Long Stop Lossexit Long Stop Lossstrategy.exitexit:Long Take Profitexit Long Take Profitstrategy.exitplotshape:47plotshapeplotshapeplotshape:48plotshapeplotshapeplot:52EMAplot

Order rules

OrderFires whenBy defaultLine
Open Buy long(buyCondition)On34
Close Buy(sellCondition)On37
Exit Long Stop Loss stopinPositionOn44
Exit Long Take Profit limitinPositionOn45

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.

2/2trades 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+3.1%+102.5%786%7.740.6%26 Jan 2024 – 21 Oct 2026
BTCUSDT 4h+0.7%+5.5%1100%—0.1%8 May 2026 – 21 Oct 2026
ETHUSDT 1D+0.0%+9.8%2241%1.120.1%26 Jan 2024 – 21 Oct 2026
ETHUSDT 4h+0.0%+8.4%1100%—0.0%8 May 2026 – 21 Oct 2026
SOLUSDT 1D−0.0%+16.7%2825%0.950.0%26 Jan 2024 – 21 Oct 2026
SOLUSDT 4h+0.0%+21.5%250%5.880.0%8 May 2026 – 21 Oct 2026
BNBUSDT 1D−0.1%+148.3%157%0.020.1%26 Jan 2024 – 21 Oct 2026
BNBUSDT 4h0.0%+17.1%00%—0.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 market3100%$21,321.90
Sideways market475%$9,853.57
Falling market0—$0.00

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

How bad could the drawdown be?

0.5%

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

0%1%
All 7 trades
SideEntryExitBarsP&L
long16 May 2024 66,206.5030 May 2024 67,652.4014$1,445.90
long24 Aug 2024 64,037.2028 Aug 2024 59,415.004−$4,622.24
long7 Nov 2024 75,572.0026 Nov 2024 93,010.0019$17,438.00
long23 Apr 2025 93,443.005 May 2025 94,277.6012$834.62
long9 May 2025 103,262.0029 May 2025 107,782.0020$4,520.17
long20 Aug 2026 69,334.809 Sep 2026 78,455.8020$9,121.02
long19 Sep 2026 80,883.908 Oct 2026 83,321.8019$2,437.95

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
Slight Swing Momentum Strategy. this page—v5 strategy+3.1%70.6%
Davin's 10-200MA Pullback on SPY Strategy v2.0 by Gold_D_Rogersma ema highestv5 strategy+6.5%324.8%
Forex bot full strategy with risk management by exlux99highest ema smav4 strategy−26.4%1138.9%
LowFinder_PyraMider_V2 by A3Shema sma highestv5 strategy+1.9%150.8%
MACD Long Strat by TheGrindTodayema smav4 strategy+24.0%7920.1%
Stock trending strategy by exlux99ema smav4 strategy+35.3%2114.7%

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.

  • No v6-only features. v6 is not needed to run this script.

Clean v5

Verified

Nothing to change.

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

⋯// © fzj20020403-//@version=5+//@version=6strategy("Slight Swing Momentum Strategy.", overlay=true)⋯

Where it runs

EngineCompilesRunsMatches TradingView
Zeal Terminal · OpenPineScript v2Yes 13 msYes 1,000 bars in 38 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/// © fzj20020403//@version=5strategy("Slight Swing Momentum Strategy.", overlay=true)// Position Status Definitionvar inPosition = false// Moving Average Definitionma60 = ta.sma(close, 60)// A1 Condition DefinitionA1 = high / close < 1.03 and open / low < 1.03 and high / close[1] > 1.06// A2 Condition DefinitionA2 = close / open > 1.05 or close / close[1] > 1.05// A3 Condition DefinitionhighestVol = ta.highest(volume, 60)A3 = ta.crossover(volume, highestVol[1])// B1 Condition Definitionema5 = ta.ema(close, 5)B1 = close / ema5// XG Condition DefinitionA1andA2 = (A1 and A2) and (A1[1] and A2[1])XG = ta.crossover(B1, ta.sma(B1, 9))// Weekly Trend Factor DefinitionweeklyMa = ta.sma(close, 50)weeklySlope = (weeklyMa - weeklyMa[4]) / 4 > 0// Buy Signal using XG ConditionbuySignal = A1 and close > ma60 or A2 and A3 and XG and close > ma60 and weeklySlope // Sell Signal ConditionsellSignal = close < ta.ema(close, 10)// Buy and Sell ConditionsbuyCondition = buySignal and not inPositionsellCondition = sellSignal and inPosition// Execute Buy and Sell Operationsif (buyCondition)    strategy.entry("Buy", strategy.long)    inPosition := trueif (sellCondition)    strategy.close("Buy")    inPosition := false// Stop Loss and Take Profit LevelsstopLoss = strategy.position_avg_price * 0.5takeProfit = strategy.position_avg_price * 1.30// Apply Stop Loss and Take Profit Levelsif inPosition    strategy.exit("Long Stop Loss", "Buy", stop=stopLoss)    strategy.exit("Long Take Profit", "Buy", limit=takeProfit)// Plot Buy and Sell Signal Shapesplotshape(buyCondition, style=shape.arrowdown, location=location.belowbar, color=color.green, size=size.small)plotshape(sellCondition, style=shape.arrowup, location=location.abovebar, color=color.red, size=size.small)// EMA Variable Definitionema = ta.ema(close, 5)// Plot Indicator Lineplot(ema, color=color.green, title="EMA")