Zeal Terminal Open in Zeal Terminal

Pine Script v5 · Strategy

5 Minute Scalping Strategy

A Pine Script v5 strategy built on SMA or EMA (close, 12), EMA (close, 9) and SMA (srcBB, 94). It has 4 order rules, 2 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. 31 settings; defaults include Fast Length 12, Slow Length 26 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 5 Minute Scalping Strategy repaint?
Yes
At least one pattern in the source can repaint: intrabar recalculation.
How did 5 Minute Scalping Strategy do on BTCUSDT 1D with default settings?
Not measured
It closed no trades there from 26 Jan 2024 to 21 Oct 2026 with the default settings, so there is no result to report. Its entry conditions never all held on this data. It closed no trades on the other markets either. A backtest, not investment advice.
Does 5 Minute Scalping Strategy run in Pine Script v6?
Not tested
Neither version placed a trade on any of the 8 markets, so there was nothing to compare. The v6 version is shown for reference and is not offered as a download.
Does 5 Minute Scalping Strategy use a stop loss?
Yes
strategy.exit sets a stop on line 84, 92.
Does 5 Minute Scalping Strategy run in Zeal Terminal?
Yes
It compiles in 29 ms and runs 1,000 bars in 62 ms, in the browser.

BTCUSDT · 1D · default settings

  • Zero Line
  • EMA9
  • EMA50
  • EMA200
  • Winning trade
  • Losing trade
  • Equity
  • Buy and hold
0.0050,000100,000AprJulOct2025AprJulOct2026AprJulOct$1,000,000$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. The live re-run is not offered here: the script requests BINANCE:BTCUSDT 1, which this page cannot load in your browser.

Needs BINANCE:BTCUSDT 1 data, not available: a lower timeframe than the chart; the engine does not evaluate intrabar data Values that depend on it are empty on this chart.

Net profit
0.00%
$0.00
Buy and hold
+102.5%
same period
Closed trades
0
0 won · 0 lost
Profitable
0.0%
of closed trades
Profit factor
—
gross profit ÷ gross loss
Max drawdown
0.00%
$0.00

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

    7 settings do nothing

    “MACD Line ”, “Signal Line ”, “Above Grow”, “Fall”, “Below Grow”, “Fall”, “Offset” are 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.

Settings

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

SettingDefaultType and rangeFeeds
Fast Length12intfast_ma
Slow Length26intslow_ma
Sourceclosesourcefast_ma slow_ma
Signal Smoothing9int · min 1 · max 50signal
Oscillator MA TypeEMAstring · options ["SMA", "EMA"]fast_ma slow_ma
Signal Line MA TypeEMAstring · options ["SMA", "EMA"]signal
Length9int · min 1out1
Sourceclosesourceout1
Offset0int · min -500 · max 500EMA9
Length50int · min 1out2
Sourceclosesourceout2
Offset0int · min -500 · max 500EMA50
Length200int · min 1out3
Sourceclosesourceout3
Offset0int · min -500 · max 500EMA200
LengthBB Long94int · min 1basisBBLong devBBLong
LengthBB Short83int · min 1basisBBShort devBBShort
StdDev2.0float · min 0.001 · max 50devBBLong devBBShort
Offset0int · min -500 · max 500unused
Rsi Length Long11int · min 1rlong
Rsi Length Short29int · min 1rshort
Take Profit %0.5float · step 0.1longprofit shortprofit
Stop Loss %0.3float · step 0.1longstop shortstop
MacdTick Low-10intentry Long line 79
MacdTick High35intentry short line 87
Color Settings
MACD Line #2962FFvalueunused
Signal Line #FF6D00valueunused
Histogram
Above Grow#26A69Avalueunused
Fall#B2DFDBvalueunused
Below Grow#FFCDD2valueunused
Fall#FF5252valueunused

What it calculates

  • SMA / EMASource (close), Fast Length (12) · chosen by Oscillator MA Typefast_ma · line 19
  • SMA / EMASource (close), Slow Length (26) · chosen by Oscillator MA Typeslow_ma · line 20
  • SMA / EMAmacd, Signal Smoothing (9) · chosen by Signal Line MA Typesignal · line 22
  • EMASource (close), Length (9)out1 · line 31
  • EMASource (close), Length (50)out2 · line 36
  • EMASource (close), Length (200)out3 · line 41
  • SMAsrcBB, LengthBB Long (94)basisBBLong · line 50
  • SMAsrcBB, LengthBB Short (83)basisBBShort · line 51
  • StdevsrcBB, LengthBB Long (94)devBBLong · line 52
  • StdevsrcBB, LengthBB Short (83)devBBShort · line 53
  • RSIclose, Rsi Length Long (11)rlong · line 61
  • RSIclose, Rsi Length Short (29)rshort · line 63

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 datasma_sourceOscillator MA Typesetting · EMAfast_lengthFast Lengthsetting · 12slow_lengthSlow Lengthsetting · 26sma_signalSignal Line MA Typesetting · EMAsignal_lengthSignal Smoothingsetting · 9len1Lengthsetting · 9len2Lengthsetting · 50len3Lengthsetting · 200lengthBBLongLengthBB Longsetting · 94lengthBBShortLengthBB Shortsetting · 83multBBStdDevsetting · 2.0rsilengthlongRsi Length Longsetting · 11rsilengthshortRsi Length Shortsetting · 29SLStop Loss %setting · 0.3TPTake Profit %setting · 0.5longhightMacdTick Lowsetting · -10shorthightMacdTick Highsetting · 35fast_maSMA / EMA→ fast_ma · by Oscillator MA …slow_maSMA / EMA→ slow_ma · by Oscillator MA …signalSMA / EMA→ signal · by Signal Line MA …out1EMA→ out1out2EMA→ out2out3EMA→ out3basisBBLongSMA→ basisBBLongbasisBBShortSMA→ basisBBShortdevBBLongStdev→ devBBLongdevBBShortStdev→ devBBShortrlongRSI→ rlongrshortRSI→ rshortmacdmacdvaluehisthistvaluehist_1mhist_1mvaluesrcBBsrcBBvalueupperBBupperBBvaluelowerBBlowerBBvaluelongstop, shortstoplongstop · shortstop2 valueslongprofit, shortprofitlongprofit · shortprofit2 valuesrsilongrsilongconditionrsishortrsishortconditionlonglongconditionshortshortconditionlongConditionlongConditionconditionshortConditionshortConditionconditionentry:LongOpen Longstrategy.entryexit:close longexit close longstrategy.exitentry:short Open short strategy.entryexit:close shortexit close shortstrategy.exithline:25hlinehlineplot:32EMA9plotplot:37EMA50plotplot:42EMA200plot

Order rules

OrderFires whenBy defaultLine
Open Long long(longCondition and long and rsilong and hist_1m <= longhight)On80
Exit close long stop and limit(strategy.position_size>0)On84
Open short short(shortCondition and short and rsishort and hist_1m >= shorthight)On88
Exit close short stop and limit(strategy.position_size<0)On92

Each order is guarded by the setting shown. “Off” orders never fire unless that setting is switched on.

Does it repaint?

Yes

At least one pattern in the source can repaint; it is marked Check below.

Not measuredNo trades to compareThe last 300 bars, from 26 Dec 2025, were fed to the engine as live ticks, but neither the live nor the historical run produced any trades in them, so the replay says nothing either way.
  • ClearHigher-timeframe data1 request.security call(s), none with lookahead on.
  • ClearFuture-bar referencesNo negative history offsets such as close[-1].
  • CheckIntrabar recalculationreads realtime-only state. Live values can differ from history.
  • 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

Not run on other markets: the script requests BINANCE:BTCUSDT 1, and that data is not available here (a lower timeframe than the chart; the engine does not evaluate intrabar data). Its results would rest on empty values.

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
5 Minute Scalping Strategy this page—v5 strategy0.0%00.0%
Take Profit On Trend (by BHD_Trade_Bot) by BHD_Trade_Botema rsi stdev smav4 strategy+54.8%913.1%
Bollinger Band + RSI + ADX + MACD + Heikinashi by TradeUsingPivotssma stdev rsi emav4 strategyNo trades on this market
RSI Rising Crypto Trending Strategy by exlux99sma stdev ema rsiv4 strategyNo trades on this market
[KL] Bollinger bands + RSI Strategy by DojiEmojisma stdev ema rsiv4 strategy+28.2%3014.7%
[KL] Bollinger Bands Consolidation Strategy by DojiEmojisma stdev ema rsiv4 strategy+39.1%3319.6%

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.

  • 14 settings use the untyped input() (line 5, 6, 7, 12, 13, 14, 15, 16, 17, 29, 34, 39, 78, 86). 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

Not verified

Neither version placed a trade on any of the 8 markets, so there was nothing to compare.

  • Line 5: input() → input.int()
  • Line 6: input() → input.int()
  • Line 7: input() → input.source()
  • Line 12: input() → input.color()
  • Line 13: input() → input.color()
  • Line 14: input() → input.color()
8 more edits
  • Line 15: input() → input.color()
  • Line 16: input() → input.color()
  • Line 17: input() → input.color()
  • Line 29: input() → input.source()
  • Line 34: input() → input.source()
  • Line 39: input() → input.source()
  • Line 78: input() → input.int()
  • Line 86: input() → input.int()
⋯strategy("5 Minute Scalp", overlay=true, margin_long=100, margin_short=100)-fast_length = input(title="Fast Length", defval=12)+fast_length = input.int(title="Fast Length", defval=12)-slow_length = input(title="Slow Length", defval=26)+slow_length = input.int(title="Slow Length", defval=26)-src = input(title="Source", defval=close)+src = input.source(title="Source", defval=close)signal_length = input.int(title="Signal Smoothing",  minval = 1, maxval = 50, defval = 9)⋯// Plot colors-col_macd = input(#2962FF, "MACD Line  ", group="Color Settings", inline="MACD")+col_macd = input.color(#2962FF, "MACD Line  ", group="Color Settings", inline="MACD")-col_signal = input(#FF6D00, "Signal Line  ", group="Color Settings", inline="Signal")+col_signal = input.color(#FF6D00, "Signal Line  ", group="Color Settings", inline="Signal")-col_grow_above = input(#26A69A, "Above   Grow", group="Histogram", inline="Above")+col_grow_above = input.color(#26A69A, "Above   Grow", group="Histogram", inline="Above")-col_fall_above = input(#B2DFDB, "Fall", group="Histogram", inline="Above")+col_fall_above = input.color(#B2DFDB, "Fall", group="Histogram", inline="Above")-col_grow_below = input(#FFCDD2, "Below Grow", group="Histogram", inline="Below")+col_grow_below = input.color(#FFCDD2, "Below Grow", group="Histogram", inline="Below")-col_fall_below = input(#FF5252, "Fall", group="Histogram", inline="Below")+col_fall_below = input.color(#FF5252, "Fall", group="Histogram", inline="Below")// Calculating⋯len1 = input.int(9, minval=1, title="Length")-src1 = input(close, title="Source")+src1 = input.source(close, title="Source")offset1 = input.int(title="Offset", defval=0, minval=-500, maxval=500)⋯len2 = input.int(50, minval=1, title="Length")-src2 = input(close, title="Source")+src2 = input.source(close, title="Source")offset2 = input.int(title="Offset", defval=0, minval=-500, maxval=500)⋯len3 = input.int(200, minval=1, title="Length")-src3 = input(close, title="Source")+src3 = input.source(close, title="Source")offset3 = input.int(title="Offset", defval=0, minval=-500, maxval=500)⋯longCondition = hist_1m <= lowerBB-longhight = input(defval=-10,title = "MacdTick Low")+longhight = input.int(defval=-10,title = "MacdTick Low")if (longCondition and long and rsilong and hist_1m <= longhight) ⋯shortCondition = hist_1m >= upperBB-shorthight = input(defval=35,title = "MacdTick High")+shorthight = input.int(defval=35,title = "MacdTick High")if (shortCondition and short and rsishort and hist_1m >= shorthight)⋯

Does it run in Pine Script v6?

Not tested

Neither version placed a trade on any of the 8 markets, so there was nothing to compare. The v6 version is shown for reference and is not offered as a download. It differs from the v5 version by 1 edit.

⋯// © pluckyCraft54926-//@version=5+//@version=6strategy("5 Minute Scalp", overlay=true, margin_long=100, margin_short=100)⋯

Where it runs

EngineCompilesRunsMatches TradingView
Zeal Terminal · OpenPineScript v2Yes 29 msYes 1,000 bars in 62 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/// © pluckyCraft54926//@version=5strategy("5 Minute Scalp", overlay=true, margin_long=100, margin_short=100)fast_length = input(title="Fast Length", defval=12)slow_length = input(title="Slow Length", defval=26)src = input(title="Source", defval=close)signal_length = input.int(title="Signal Smoothing",  minval = 1, maxval = 50, defval = 9)sma_source = input.string(title="Oscillator MA Type",  defval="EMA", options=["SMA", "EMA"])sma_signal = input.string(title="Signal Line MA Type", defval="EMA", options=["SMA", "EMA"])// Plot colorscol_macd = input(#2962FF, "MACD Line  ", group="Color Settings", inline="MACD")col_signal = input(#FF6D00, "Signal Line  ", group="Color Settings", inline="Signal")col_grow_above = input(#26A69A, "Above   Grow", group="Histogram", inline="Above")col_fall_above = input(#B2DFDB, "Fall", group="Histogram", inline="Above")col_grow_below = input(#FFCDD2, "Below Grow", group="Histogram", inline="Below")col_fall_below = input(#FF5252, "Fall", group="Histogram", inline="Below")// Calculatingfast_ma = sma_source == "SMA" ? ta.sma(src, fast_length) : ta.ema(src, fast_length)slow_ma = sma_source == "SMA" ? ta.sma(src, slow_length) : ta.ema(src, slow_length)macd = fast_ma - slow_masignal = sma_signal == "SMA" ? ta.sma(macd, signal_length) : ta.ema(macd, signal_length)hist = macd - signalhist_1m = request.security(syminfo.tickerid,"1",hist [barstate.isrealtime ? 1 : 0])hline(0, "Zero Line", color=color.new(#787B86, 50))//////////////////////////////////////////////////////plotting emas on the chartlen1 = input.int(9, minval=1, title="Length")src1 = input(close, title="Source")offset1 = input.int(title="Offset", defval=0, minval=-500, maxval=500)out1 = ta.ema(src1, len1)plot(out1, title="EMA9", color=color.blue, offset=offset1)len2 = input.int(50, minval=1, title="Length")src2 = input(close, title="Source")offset2 = input.int(title="Offset", defval=0, minval=-500, maxval=500)out2 = ta.ema(src2, len2)plot(out2, title="EMA50", color=color.yellow, offset=offset2)len3 = input.int(200, minval=1, title="Length")src3 = input(close, title="Source")offset3 = input.int(title="Offset", defval=0, minval=-500, maxval=500)out3 = ta.ema(src3, len3)plot(out3, title="EMA200", color=color.white, offset=offset3)////////////////////////////////////////////////////////////////////Setting up the BB/////////////////////////////////////////////////////////////srcBB = hist_1mlengthBBLong = input.int(94,title = "LengthBB Long", minval=1)lengthBBShort = input.int(83,title = "LengthBB Short", minval=1)multBB = input.float(2.0, minval=0.001, maxval=50, title="StdDev")basisBBLong = ta.sma(srcBB, lengthBBLong)basisBBShort = ta.sma(srcBB, lengthBBShort)devBBLong = multBB * ta.stdev(srcBB, lengthBBLong)devBBShort = multBB * ta.stdev(srcBB, lengthBBShort)upperBB = basisBBShort + devBBShortlowerBB = basisBBLong - devBBLongoffsetBB = input.int(0, "Offset", minval = -500, maxval = 500)///////////////////////////////////////////aetting up rsi///////////////////////////////////////////rsilengthlong = input.int(defval = 11, title = "Rsi Length Long", minval = 1)rlong=ta.rsi(close,rsilengthlong)rsilengthshort = input.int(defval = 29, title = "Rsi Length Short", minval = 1)rshort=ta.rsi(close,rsilengthshort)/////////////////////////////Only taking long and shorts, if RSI is above 51 or bellow 49rsilong = rlong >= 51rsishort = rshort <= 49////////////////////////////////////////only taking trades if all 3 emas are in the correct orderlong = out1 > out2 and out2 > out3short = out1 < out2 and out2 < out3//////////////////////////////////////////////////////////////////////////////////setting up TP and SLTP = input.float(defval = 0.5, title = "Take Profit %",step = 0.1) / 100SL = input.float(defval = 0.3, title = "Stop Loss %", step = 0.1) / 100longCondition = hist_1m <= lowerBBlonghight = input(defval=-10,title = "MacdTick Low")if (longCondition and long and rsilong and hist_1m <= longhight)     strategy.entry("Long", strategy.long)if (strategy.position_size>0)    longstop = strategy.position_avg_price * (1-SL)    longprofit = strategy.position_avg_price * (1+TP)    strategy.exit(id ="close long",from_entry="Long",stop=longstop,limit=longprofit)shortCondition = hist_1m >= upperBBshorthight = input(defval=35,title = "MacdTick High")if (shortCondition and short and rsishort and hist_1m >= shorthight)    strategy.entry("short ", strategy.short)shortstop = strategy.position_avg_price * (1+SL)shortprofit = strategy.position_avg_price * (1-TP)if (strategy.position_size<0)    strategy.exit(id ="close short",stop=shortstop,limit=shortprofit)