Zeal Terminal Open in Zeal Terminal

Pine Script v5 · Strategy

Scalping Trading System bot Crypto and Stocks

A Pine Script v5 strategy built on SMA (low, 25), EMA (low, 200) and TR or ATR or RMA (true). 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. 15 settings; defaults include Source low, Length SMA 25 and Length EMA 200.

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 Scalping Trading System bot Crypto and Stocks repaint?
No
No repainting patterns were found in the source. The live replay was not measured: it had no trades to compare.
How did Scalping Trading System bot Crypto and Stocks do on BTCUSDT 1D with default settings?
+6.49%
From 26 Jan 2024 to 21 Oct 2026, over 5 closed trades, against +102.5% for buy and hold. A backtest, not investment advice.
Does Scalping Trading System bot Crypto and Stocks 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: 5 before, 8 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 Scalping Trading System bot Crypto and Stocks use a stop loss?
No
Every exit waits for a signal; nothing limits a losing trade before it fires.
Does Scalping Trading System bot Crypto and Stocks run in Zeal Terminal?
Yes
It compiles in 12 ms and runs 1,000 bars in 42 ms, in the browser.

BTCUSDT · 1D · default settings

  • SMA
  • EMA
  • SMA
  • TR
  • SMA
  • SMA
  • SMA
  • SMA
  • SMA
  • 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 (15)
0.0050,000100,000AprJulOct2025AprJulOct2026AprJulOct$1,072,200$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. The script plots nothing itself; the lines and the lower pane are its own calculations, drawn for reference.
Net profit
+6.49%
$64,925.00
Buy and hold
+102.5%
same period
Closed trades
5
3 won · 2 lost
Profitable
60.0%
of closed trades
Profit factor
13.59
gross profit ÷ gross loss
Max drawdown
1.04%
−$10,556.70

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

    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.

  • Note

    Uses an argument v6 removed

    when = on line 39, 40. The upgraded version below moves each call inside an if block.

Settings

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

SettingDefaultType and rangeFeeds
Sourcelowsourceout out2 ma fast_ma slow_ma
Moving Averages
Length SMA25int · min 1out
Length EMA200int · min 1out2
Keltner
Length Keltner Channel10int · min 1ma rangema
Multiplier2.0floatupper lower
Bands StyleAverage True Rangestring · options ["Average True Range", "True Range", "Range"]rangema
ATR Length14intrangema
Stochastic
%K Length10int · min 1k
%K Smoothing1int · min 1k
%D Smoothing1int · min 1d
MACD Fast
Fast Length MACD4intfast_ma
Slow Length MACD34intslow_ma
Signal Smoothing MACD5int · min 1 · max 50signal
Oscillator MA Type MACDEMAstring · options ["SMA", "EMA"]fast_ma slow_ma
Signal Line MA Type MACDEMAstring · options ["SMA", "EMA"]signal

What it calculates

  • SMASource (low), Length SMA (25)out · line 9
  • EMASource (low), Length EMA (200)out2 · line 10
  • SMASource (low), Length Keltner Channel (10)ma · line 16
  • TR / ATR / RMAtrue · chosen by Bands Stylerangema · line 17
  • SMA / Stochta.stoch(close, high, low, periodK), %K Smoothing (1)k · line 24
  • SMAk, %D Smoothing (1)d · line 25
  • SMA / EMASource (low), Fast Length MACD (4) · chosen by Oscillator MA Type MACDfast_ma · line 32
  • SMA / EMASource (low), Slow Length MACD (34) · chosen by Oscillator MA Type MACDslow_ma · line 33
  • SMA / EMAmacd, Signal Smoothing MACD (5) · chosen by Signal Line MA Type MACDsignal · line 35

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.

lowlowprice datalenLength SMAsetting · 25len2Length EMAsetting · 200lengthkLength Keltner Channelsetting · 10highhighprice datahigh · low · closehigh · low · closeprice dataBandsStyleBands Stylesetting · Average True RangeatrlengthATR Lengthsetting · 14closecloseprice dataperiodK%K Lengthsetting · 10smoothK%K Smoothingsetting · 1periodD%D Smoothingsetting · 1sma_sourceOscillator MA Type MACDsetting · EMAfast_lengthFast Length MACDsetting · 4slow_lengthSlow Length MACDsetting · 34sma_signalSignal Line MA Type MACDsetting · EMAsignal_lengthSignal Smoothing MACDsetting · 5multMultipliersetting · 2.0outSMA→ outout2EMA→ out2maSMA→ marangemaTR / ATR / RMA→ rangema · by Bands StylekSMA / Stoch→ kdSMA→ dfast_maSMA / EMA→ fast_ma · by Oscillator MA …slow_maSMA / EMA→ slow_ma · by Oscillator MA …signalSMA / EMA→ signal · by Signal Line MA …upper, lowerupper · lower2 valuesmacdmacdvaluehisthistvaluelonglongconditionshortshortconditionentry:longOpen longstrategy.entryentry:shortOpen shortstrategy.entry

Order rules

OrderFires whenBy defaultLine
Open long longlongclose > out and close < upper and close > lower and hist < 0 and k < 50 and close > out2On39
Open short shortshortclose < out and close < upper and close > lower and hist > 0 and k > 50 and close < out2On40

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.

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 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+6.5%+102.5%560%13.591.0%26 Jan 2024 – 21 Oct 2026
BTCUSDT 4h+1.4%+5.5%633%5.170.4%8 May 2026 – 21 Oct 2026
ETHUSDT 1D+0.0%+9.8%560%1.710.1%26 Jan 2024 – 21 Oct 2026
ETHUSDT 4h+0.1%+8.4%250%20.770.0%8 May 2026 – 21 Oct 2026
SOLUSDT 1D−0.0%+16.7%813%0.220.0%26 Jan 2024 – 21 Oct 2026
SOLUSDT 4h+0.0%+21.5%825%2.720.0%8 May 2026 – 21 Oct 2026
BNBUSDT 1D−0.0%+148.3%825%0.570.0%26 Jan 2024 – 21 Oct 2026
BNBUSDT 4h+0.0%+17.1%425%19.950.0%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 (Length SMA 18, Length EMA 200) made +6.7% before 26 Dec 2025 and 0.0% after it, against 0.0% for the defaults. 78% of the 64 combinations made money in-sample and 0% out-of-sample.

Before 26 Dec 2025 · in-sample
Length EMA ↓ · Length SMA →1315182125303543
1000%−0%+5%+5%+5%+5%+5%+5%
1200%−1%+4%+4%+4%+4%+3%+3%
1400%−1%+3%+3%+3%+3%+3%+3%
1700%−1%+6%+6%+3%+3%+3%+3%
2000%+1%+7%+7%+6%+6%+6%+6%
2400%+1%+4%+4%+4%+4%+4%+4%
2800%−0%+3%+3%+3%+3%+3%+3%
3400%−3%+1%+1%+1%+0%+0%+0%
From 26 Dec 2025 · out-of-sample
Length EMA ↓ · Length SMA →1315182125303543
1000%−3%−3%−3%−3%−3%−3%−3%
1200%−3%−3%−3%−3%−3%−3%−3%
1400%−4%−3%−3%−3%−3%−3%−3%
1700%−4%−0%−0%−0%−0%−0%−3%
2000%−1%0%0%0%0%0%0%
2400%−1%0%0%0%0%0%0%
2800%−1%0%0%0%0%0%0%
3400%−1%0%0%0%0%0%0%

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 market0—$0.00
Sideways market333%$14,231.60
Falling market2100%$50,693.40

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 5 trades are reshuffled 5,000 times. The bar spans the 5th to 95th percentile, 0.4% to 0.5%; the tick is what actually happened, 0.4%. Order luck alone moves it this much.

0%1%
All 5 trades
SideEntryExitBarsP&L
short13 Aug 2024 59,346.601 Oct 2024 63,327.6049−$3,980.96
long1 Oct 2024 63,327.6019 Mar 2025 82,715.00169$19,387.40
short19 Mar 2025 82,715.005 Apr 2025 83,889.9017−$1,174.84
long5 Apr 2025 83,889.9011 Nov 2025 106,011.00220$22,121.30
short11 Nov 2025 106,011.002 Sep 2026 77,439.00295$28,572.10

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
Scalping Trading System bot Crypto and Stocks this page—v5 strategy+6.5%51.0%
Stochastic Moving Average by LucasVivienstoch sma ema atrv5 strategy+2.8%74.4%
Strategy - Trend Chaser - PSe by ElvinKennedyHernandezLatayantr atr rma ema smav5 strategyNo trades on this market
Indicators & Conditions Test Framework [DTU] by dturkulerstoch sma tr atrv5 strategydoes not run in Zeal Terminal
ATR with EOM and VORTEX by SoftKill21atr ema smav4 strategy+66.2%2229.9%
cATRpillar Strategy by Obi-wanClintobeatr sma emav4 strategy+1.02827e+24%2788,097.2%

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.

  • 2 strategy calls use the when = argument (line 39, 40). It is deprecated in v5 and removed in v6, where each call moves inside an if block.
  • 5 settings use the untyped input() (line 5, 13, 15, 27, 28). 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 5 trades and the same P&L on BTCUSDT 1D, 1,000 bars, in Zeal Terminal's engine.

  • Line 5: input() → input.source()
  • Line 13: input() → input.float()
  • Line 15: input() → input.int()
  • Line 27: input() → input.int()
  • Line 28: input() → input.int()
  • Line 39: when = long → if block
  • Line 40: when = short → if block
⋯strategy(title="Scalping Trading System Crypto and Stocks", overlay=true)-src = input(low, title="Source")+src = input.source(low, title="Source")//sma and ema⋯lengthk = input.int(10, minval=1, title="Length Keltner Channel",group="Keltner")-mult = input(2.0, "Multiplier",group="Keltner")+mult = input.float(2.0, "Multiplier",group="Keltner")BandsStyle = input.string("Average True Range", options = ["Average True Range", "True Range", "Range"], title="Bands Style",group="Keltner")-atrlength = input(14, "ATR Length",group="Keltner")+atrlength = input.int(14, "ATR Length",group="Keltner")ma = ta.sma(src, lengthk)⋯//macd 1-fast_length = input(title="Fast Length MACD", defval=4,group="MACD Fast")+fast_length = input.int(title="Fast Length MACD", defval=4,group="MACD Fast")-slow_length = input(title="Slow Length MACD", defval=34,group="MACD Fast")+slow_length = input.int(title="Slow Length MACD", defval=34,group="MACD Fast")signal_length = input.int(title="Signal Smoothing MACD",  minval = 1, maxval = 50, defval = 5,group="MACD Fast")⋯short= close < out and close < upper and close > lower and hist > 0 and k > 50 and close < out2 -strategy.entry("long",strategy.long,when= long)+if long+    strategy.entry("long",strategy.long)-strategy.entry("short",strategy.short,when=short)+if short+    strategy.entry("short",strategy.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: 5 before, 8 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.

⋯// © exlux99-//@version=5+//@version=6strategy(title="Scalping Trading System Crypto and Stocks", overlay=true)⋯

Where it runs

EngineCompilesRunsMatches TradingView
Zeal Terminal · OpenPineScript v2Yes 12 msYes 1,000 bars in 42 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/// © exlux99//@version=5strategy(title="Scalping Trading System Crypto and Stocks", overlay=true)src = input(low, title="Source")//sma and emalen = input.int(25, minval=1, title="Length SMA" , group="Moving Averages")len2 = input.int(200, minval=1, title="Length EMA", group="Moving Averages")out = ta.sma(src, len)out2 = ta.ema(src, len2)//keltnerlengthk = input.int(10, minval=1, title="Length Keltner Channel",group="Keltner")mult = input(2.0, "Multiplier",group="Keltner")BandsStyle = input.string("Average True Range", options = ["Average True Range", "True Range", "Range"], title="Bands Style",group="Keltner")atrlength = input(14, "ATR Length",group="Keltner")ma = ta.sma(src, lengthk)rangema = BandsStyle == "True Range" ? ta.tr(true) : BandsStyle == "Average True Range" ? ta.atr(atrlength) : ta.rma(high - low, lengthk)upper = ma + rangema * multlower = ma - rangema * mult//stochperiodK = input.int(10, title="%K Length", minval=1,group="Stochastic")smoothK = input.int(1, title="%K Smoothing", minval=1,group="Stochastic")periodD = input.int(1, title="%D Smoothing", minval=1,group="Stochastic")k = ta.sma(ta.stoch(close, high, low, periodK), smoothK)d = ta.sma(k, periodD)//macd 1fast_length = input(title="Fast Length MACD", defval=4,group="MACD Fast")slow_length = input(title="Slow Length MACD", defval=34,group="MACD Fast")signal_length = input.int(title="Signal Smoothing MACD",  minval = 1, maxval = 50, defval = 5,group="MACD Fast")sma_source = input.string(title="Oscillator MA Type MACD",  defval="EMA", options=["SMA", "EMA"],group="MACD Fast")sma_signal = input.string(title="Signal Line MA Type MACD", defval="EMA", options=["SMA", "EMA"],group="MACD Fast")fast_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 - signallong= close > out and close < upper and close > lower and hist < 0 and k < 50 and close > out2 short= close < out and close < upper and close > lower and hist > 0 and k > 50 and close < out2 strategy.entry("long",strategy.long,when= long)strategy.entry("short",strategy.short,when=short)