Pine Script v5 · Strategy
D-BoT Alpha 'Short' SMA and RSI Strategy
A Pine Script v5 strategy built on SMA (close, 200) and RSI (close, 14). It has 4 order rules, 1 entry among them, and trades short only with the default settings. Exits wait for a signal; there is no stop loss. Each trade is 100 contracts and pays no commission. 5 settings; defaults include SMA Length 200, RSI Length 14 and RSI Entry Level 51.
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 D-BoT Alpha 'Short' SMA and RSI Strategy repaint?
- No
- No repainting patterns were found in the source, and a live tick-by-tick replay matched history on 11 of 11 trades.
- How did D-BoT Alpha 'Short' SMA and RSI Strategy do on BTCUSDT 1D with default settings?
- +6,662.78%
- From 26 Jan 2024 to 21 Oct 2026, over 17 closed trades, against +102.5% for buy and hold. A backtest, not investment advice.
- Does D-BoT Alpha 'Short' SMA and RSI 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: 17 before, 11 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 D-BoT Alpha 'Short' SMA and RSI Strategy use a stop loss?
- No
- Every exit waits for a signal; nothing limits a losing trade before it fires.
- Does D-BoT Alpha 'Short' SMA and RSI Strategy run in Zeal Terminal?
- Yes
- It compiles in 12 ms and runs 1,000 bars in 21 ms, in the browser.
BTCUSDT · 1D · default settings
- Plot
- Winning trade
- Losing trade
- Equity
- Buy and hold
- Net profit
- +6,662.78%
- $666,278.00
- Buy and hold
- +102.5%
- same period
- Closed trades
- 17
- 8 won · 9 lost
- Profitable
- 47.1%
- of closed trades
- Profit factor
- 1.90
- gross profit ÷ gross loss
- Max drawdown
- 5,480.51%
- −$548,051.00
One run with the author's default settings, $10,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 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.
| Setting | Default | Type and range | Feeds |
|---|---|---|---|
| SMA Length | 200 | int | sma_value |
| RSI Length | 14 | int | rsi_value |
| RSI Entry Level | 51 | int | shortCondition |
| RSI Stop Level | 54 | int | close Sell line 28 |
| RSI Take Profit Level | 32 | int | close Sell line 30 |
What it calculates
- SMAclose, SMA Length (200)
sma_value · line 12 - RSIclose, RSI Length (14)
rsi_value · line 13
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.
Order rules
| Order | Fires when | By default | Line |
|---|---|---|---|
| Open Sell short | (shortCondition) | On | 19 |
| Close Sell | not na(trailingStop) and close > trailingStop | On | 27 |
| Close Sell | (rsi_value >= rsi_stop) | On | 29 |
| Close Sell | (rsi_value <= rsi_take_profit) | On | 31 |
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.
- 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.
| Market | Net | Buy and hold | Trades | Won | Profit factor | Max drawdown | Period |
|---|---|---|---|---|---|---|---|
| BTCUSDT 1D | +6,662.8% | +102.5% | 17 | 47% | 1.90 | 5,480.5% | 26 Jan 2024 – 21 Oct 2026 |
| BTCUSDT 4h | −1,952.5% | +5.5% | 9 | 11% | 0.39 | 1,112.5% | 8 May 2026 – 21 Oct 2026 |
| ETHUSDT 1D | −806.6% | +9.8% | 21 | 19% | 0.30 | 818.0% | 26 Jan 2024 – 21 Oct 2026 |
| ETHUSDT 4h | −20.4% | +8.4% | 13 | 38% | 0.80 | 82.3% | 8 May 2026 – 21 Oct 2026 |
| SOLUSDT 1D | +22.6% | +16.7% | 24 | 42% | 1.66 | 14.6% | 26 Jan 2024 – 21 Oct 2026 |
| SOLUSDT 4h | −0.2% | +21.5% | 13 | 31% | 0.97 | 5.2% | 8 May 2026 – 21 Oct 2026 |
| BNBUSDT 1D | +51.2% | +148.3% | 20 | 40% | 1.35 | 97.7% | 26 Jan 2024 – 21 Oct 2026 |
| BNBUSDT 4h | +19.5% | +17.1% | 14 | 43% | 1.80 | 14.1% | 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 (SMA Length 100, RSI Length 7) made +21,965.0% before 26 Dec 2025 and −1,201.8% after it, worse than the defaults' +9,753.9% after. Tuning on the past did not carry forward. 34% of the 64 combinations made money in-sample and 44% out-of-sample.
| RSI Length ↓ · SMA Length → | 100 | 120 | 140 | 170 | 200 | 240 | 280 | 340 |
|---|---|---|---|---|---|---|---|---|
| 7 | +21,965% | +21,397% | +14,409% | +4,817% | +5,526% | +3,839% | +3,559% | +3,559% |
| 8 | −3,022% | −3,022% | −10,010% | −9,730% | −6,749% | −1,209% | −1,489% | −1,489% |
| 10 | −2,485% | −2,936% | −9,924% | −10,311% | −5,732% | +2,814% | +3,200% | +3,200% |
| 12 | +5,671% | +5,220% | −1,768% | −2,155% | +742% | +7,464% | +7,850% | +7,850% |
| 14 | +14,183% | +8,911% | +1,923% | +1,857% | −3,091% | −386% | 0% | 0% |
| 17 | +4,143% | −1,128% | −1,862% | −2,328% | −2,208% | −1,400% | 0% | 0% |
| 20 | −2,237% | −7,509% | −8,243% | −8,709% | −8,589% | −1,400% | 0% | 0% |
| 24 | −2,237% | −7,509% | −8,243% | −11,587% | −11,467% | −4,278% | 0% | 0% |
| RSI Length ↓ · SMA Length → | 100 | 120 | 140 | 170 | 200 | 240 | 280 | 340 |
|---|---|---|---|---|---|---|---|---|
| 7 | −1,202% | −1,202% | −1,202% | −1,658% | +1,880% | +1,880% | +1,880% | +3,863% |
| 8 | −6,083% | −6,083% | −7,967% | −7,967% | −4,430% | −4,430% | −4,430% | −2,446% |
| 10 | −8,171% | −8,171% | −8,171% | −8,171% | −4,634% | −4,634% | −4,634% | −2,650% |
| 12 | +4,799% | +4,799% | +4,799% | +4,799% | +4,799% | +4,799% | +4,799% | +3,835% |
| 14 | +9,754% | +9,754% | +9,754% | +9,754% | +9,754% | +9,754% | +9,754% | +9,754% |
| 17 | −788% | −788% | −788% | −788% | −788% | −788% | −788% | −5,466% |
| 20 | −11,305% | −11,305% | −11,305% | −11,305% | −11,305% | −11,305% | −11,305% | −11,305% |
| 24 | +3,860% | +3,860% | +3,860% | +4,660% | +4,660% | +4,660% | +4,660% | +4,660% |
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 bars | Trades | Won | P&L |
|---|---|---|---|
| Rising market | 0 | — | $0.00 |
| Sideways market | 7 | 43% | −$342,429.00 |
| Falling market | 10 | 50% | $1,008,710.00 |
Rising and falling mean the market moved more than 15% over the 90 bars before entry.
How bad could the drawdown be?
717,534.0%
The 95th percentile of the worst drawdown when the same 17 trades are reshuffled 5,000 times. The bar spans the 5th to 95th percentile, 100.8% to 717,534.0%; the tick is what actually happened, 4,208.6%. Order luck alone moves it this much.
All 17 trades
| Side | Entry | Exit | Bars | P&L |
|---|---|---|---|---|
| short | 22 Aug 2024 61,156.00 | 24 Aug 2024 64,037.20 | 2 | −$288,121.00 |
| short | 14 Sep 2024 60,498.00 | 15 Sep 2024 59,993.00 | 1 | $50,497.00 |
| short | 18 Sep 2024 60,314.00 | 19 Sep 2024 61,760.00 | 1 | −$144,599.00 |
| short | 7 Oct 2024 62,819.90 | 13 Oct 2024 63,206.20 | 6 | −$38,632.00 |
| short | 13 Apr 2025 85,276.90 | 17 Apr 2025 84,030.40 | 4 | $124,653.00 |
| short | 18 Apr 2025 84,947.90 | 20 Apr 2025 85,077.00 | 2 | −$12,908.00 |
| short | 3 Jan 2026 89,995.10 | 4 Jan 2026 90,628.00 | 1 | −$63,287.00 |
| short | 5 Mar 2026 72,666.80 | 10 Mar 2026 68,432.20 | 5 | $423,461.00 |
| short | 11 Mar 2026 69,948.60 | 13 Mar 2026 70,541.30 | 2 | −$59,270.00 |
| short | 24 Mar 2026 70,906.40 | 31 Mar 2026 66,797.40 | 7 | $410,907.00 |
| short | 8 Apr 2026 71,924.20 | 9 Apr 2026 71,069.90 | 1 | $85,429.00 |
| short | 6 Jul 2026 63,650.00 | 10 Jul 2026 63,230.00 | 4 | $42,000.00 |
| short | 11 Jul 2026 64,161.70 | 15 Jul 2026 65,044.00 | 4 | −$88,227.00 |
| short | 27 Jul 2026 65,400.00 | 29 Jul 2026 63,915.00 | 2 | $148,500.00 |
| short | 31 Jul 2026 64,780.00 | 3 Aug 2026 63,570.00 | 3 | $121,002.00 |
| short | 6 Aug 2026 64,665.20 | 8 Aug 2026 64,923.20 | 2 | −$25,796.00 |
| short | 18 Aug 2026 64,532.10 | 19 Aug 2026 64,725.40 | 1 | −$19,331.00 |
Similar scripts
Indicators and strategies built from the same calculations, run on BTCUSDT 1D with their own defaults so they can be compared directly.
| Script | Shares | Type | Net | Trades | Max drawdown |
|---|---|---|---|---|---|
| D-BoT Alpha 'Short' SMA and RSI Strategy this page | — | v5 strategy | +6,662.8% | 17 | 5,480.5% |
| SRJ RSI Outperformer Strategy by Sapt_Jash | rsi sma | v5 strategy | +0.6% | 8 | 2.4% |
| RSI SMA Crossover Strategy by reees | rsi sma | v5 strategy | +39.8% | 42 | 30.8% |
| Short In Downtrend Below MA100 (Coinrule) by Coinrule | sma rsi | v4 strategy | −34.5% | 99 | 45.4% |
| Simple RSI and SMA Long and Short (by Coinrule) by Coinrule | rsi sma | v5 strategy | −3.0% | 2 | 17.7% |
| Maximized Moving Average Crossing (by Coinrule) by Coinrule | sma rsi | v4 strategy | −6.6% | 9 | 13.3% |
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.
- 5 settings use the untyped input() (line 6, 7, 8, 9, 10). 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.
Same 17 trades and the same P&L on BTCUSDT 1D, 1,000 bars, in Zeal Terminal's engine.
- Line 6: input() → input.int()
- Line 7: input() → input.int()
- Line 8: input() → input.int()
- Line 9: input() → input.int()
- Line 10: input() → input.int()
⋯// Inputs-sma_length = input(200, title="SMA Length")+sma_length = input.int(200, title="SMA Length")-rsi_length = input(14, title="RSI Length")+rsi_length = input.int(14, title="RSI Length")-rsi_entry = input(51, title="RSI Entry Level")+rsi_entry = input.int(51, title="RSI Entry Level")-rsi_stop = input(54, title="RSI Stop Level")+rsi_stop = input.int(54, title="RSI Stop Level")-rsi_take_profit = input(32, title="RSI Take Profit Level")+rsi_take_profit = input.int(32, title="RSI Take Profit Level")// Indicators⋯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: 17 before, 11 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.
⋯// © abdllhatn-//@version=5+//@version=6strategy("Alpha Short SMA and RSI Strategy", overlay=true, initial_capital=10000, default_qty_value=100)⋯Where it runs
| Engine | Compiles | Runs | Matches TradingView |
|---|---|---|---|
| Zeal Terminal · OpenPineScript v2 | Yes 12 ms | Yes 1,000 bars in 21 ms | Not measured |
| PineTS | Not tested | Not tested | 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.
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/// © abdllhatn//@version=5strategy("Alpha Short SMA and RSI Strategy", overlay=true, initial_capital=10000, default_qty_value=100)// Inputssma_length = input(200, title="SMA Length")rsi_length = input(14, title="RSI Length")rsi_entry = input(51, title="RSI Entry Level")rsi_stop = input(54, title="RSI Stop Level")rsi_take_profit = input(32, title="RSI Take Profit Level")// Indicatorssma_value = ta.sma(close, sma_length)rsi_value = ta.rsi(close, rsi_length)var float trailingStop = navar float lastLow = na// ConditionsshortCondition = ta.crossover(rsi_value, rsi_entry) and close < sma_valueif (shortCondition) strategy.entry("Sell", strategy.short) trailingStop := na lastLow := naif (strategy.position_size < 0) if (na(lastLow) or close < lastLow) lastLow := close trailingStop := closeif not na(trailingStop) and close > trailingStop strategy.close("Sell")if (rsi_value >= rsi_stop) strategy.close("Sell")if (rsi_value <= rsi_take_profit) strategy.close("Sell")// Plotplot(sma_value, color=color.red, linewidth=2)