Pine Script v5 · Strategy
EMA SCALPEUR + RSi - SHORT
A Pine Script v5 strategy built on RSI (close, 5), EMA (close, 9) and Crossover (EMA3, EMA4). It has 2 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 one contract and pays no commission. 5 settings; defaults include EMA_L 9, EMA_L2 26 and EMA_S 100.
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 EMA SCALPEUR + RSi - SHORT repaint?
- No
- No repainting patterns were found in the source. The live replay was not measured: it had no trades to compare.
- How did EMA SCALPEUR + RSi - SHORT 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; it opened a short position that was still open on the last bar, so there is no result to report. On BTCUSDT 4h it did trade; that row of the markets table below has its figures. A backtest, not investment advice.
- Does EMA SCALPEUR + RSi - SHORT 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: 0 before, 1 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 EMA SCALPEUR + RSi - SHORT use a stop loss?
- No
- Every exit waits for a signal; nothing limits a losing trade before it fires.
- Does EMA SCALPEUR + RSi - SHORT run in Zeal Terminal?
- Yes
- It compiles in 16 ms and runs 1,000 bars in 29 ms, in the browser.
BTCUSDT · 1D · default settings
- Plot
- Plot
- Plot
- Plot
- Plot
- Winning trade
- Losing trade
- Equity
- Buy and hold
- 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
- 978.01%
- −$9,780.15
One run with the author's default settings, $1,000 starting capital, commission as the script sets it. A short 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.
-
Likely bug
ta.ema(close, 9) ignores the settings line 13
Line 13 hard-codes 9 where line 23 uses “EMA_L”. Changing those settings moves one band but not this one.
ta.ema(close, 9)ta.ema(close, EMA_L) -
Likely bug
ta.ema(close, 26) ignores the settings line 14
Line 14 hard-codes 26 where line 23 uses “EMA_L”. Changing those settings moves one band but not this one.
ta.ema(close, 26)ta.ema(close, EMA_L) -
Likely bug
ta.ema(close, 100) ignores the settings line 15
Line 15 hard-codes 100 where line 23 uses “EMA_L”. Changing those settings moves one band but not this one.
ta.ema(close, 100)ta.ema(close, EMA_L) -
Likely bug
ta.ema(close, 55) ignores the settings line 16
Line 16 hard-codes 55 where line 23 uses “EMA_L”. Changing those settings moves one band but not this one.
ta.ema(close, 55)ta.ema(close, EMA_L) -
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 32, 34. 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.
| Setting | Default | Type and range | Feeds |
|---|---|---|---|
| EMA_L | 9 | int · min 1 · max 100 · step 1 | EMA1 |
| EMA_L2 | 26 | int · min 1 · max 100 · step 1 | EMA2 |
| EMA_S | 100 | int · min 1 · max 100 · step 1 | EMA3 |
| EMA_S2 | 55 | int · min 1 · max 100 · step 1 | EMA4 |
| RSI | 5 | int · min 1 · max 20 · step 1 | RSI |
What it calculates
- RSIclose, RSI (5)
RSI · line 12 - EMAclose, 9
shortest · line 13 - EMAclose, 26
short · line 14 - EMAclose, 100
longer · line 15 - EMAclose, 55
longest · line 16 - EMAclose, EMA_L (9)
EMA1 · line 23 - EMAclose, EMA_L2 (26)
EMA2 · line 24 - EMAclose, EMA_S (100)
EMA3 · line 25 - EMAclose, EMA_S2 (55)
EMA4 · line 26 - CrossoverEMA3, EMA4
sellexit · line 30
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 short short | sellta.crossunder(EMA1, EMA2) and RSI > 40 | On | 32 |
| Close short | sellexit | On | 34 |
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.
- 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 | 0.0% | +102.5% | 0 | 0% | — | 978.0% | 26 Jan 2024 – 21 Oct 2026 |
| BTCUSDT 4h | +443.6% | +5.5% | 2 | 100% | — | 54.4% | 8 May 2026 – 21 Oct 2026 |
| ETHUSDT 1D | −12.5% | +9.8% | 1 | 0% | 0.00 | 160.0% | 26 Jan 2024 – 21 Oct 2026 |
| ETHUSDT 4h | −57.2% | +8.4% | 1 | 0% | 0.00 | 90.4% | 8 May 2026 – 21 Oct 2026 |
| SOLUSDT 1D | +7.4% | +16.7% | 1 | 100% | — | 0.4% | 26 Jan 2024 – 21 Oct 2026 |
| SOLUSDT 4h | −0.7% | +21.5% | 1 | 0% | 0.00 | 2.2% | 8 May 2026 – 21 Oct 2026 |
| BNBUSDT 1D | −28.6% | +148.3% | 1 | 0% | 0.00 | 76.4% | 26 Jan 2024 – 21 Oct 2026 |
| BNBUSDT 4h | −17.4% | +17.1% | 1 | 0% | 0.00 | 23.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 (EMA_L 5, EMA_L2 44) made +2,133.5% before 26 Dec 2025 and 0.0% after it, against 0.0% for the defaults. 59% of the 56 combinations made money in-sample and 0% out-of-sample.
| EMA_L2 ↓ · EMA_L → | 5 | 6 | 8 | 9 | 11 | 13 | 15 |
|---|---|---|---|---|---|---|---|
| 13 | +793% | +171% | +176% | +1,142% | −511% | 0% | −2,002% |
| 16 | +932% | +1,213% | −1,615% | +1,717% | +1,128% | +40% | 0% |
| 18 | +1,208% | 0% | +1,107% | +1,107% | +40% | 0% | 0% |
| 22 | 0% | 0% | +1,128% | +1,128% | +1,117% | +1,111% | 0% |
| 26 | 0% | +1,107% | +1,128% | 0% | 0% | 0% | 0% |
| 31 | −2,612% | +1,107% | 0% | 0% | 0% | +1,039% | +1,026% |
| 36 | 0% | +1,128% | +1,039% | +1,026% | +1,026% | +1,579% | +593% |
| 44 | +2,134% | +1,021% | +558% | +593% | 0% | 0% | +1,309% |
| EMA_L2 ↓ · EMA_L → | 5 | 6 | 8 | 9 | 11 | 13 | 15 |
|---|---|---|---|---|---|---|---|
| 13 | 0% | 0% | 0% | 0% | 0% | 0% | 0% |
| 16 | 0% | 0% | 0% | 0% | 0% | 0% | 0% |
| 18 | 0% | 0% | 0% | 0% | 0% | 0% | 0% |
| 22 | 0% | 0% | 0% | 0% | 0% | 0% | 0% |
| 26 | 0% | 0% | 0% | 0% | 0% | 0% | 0% |
| 31 | 0% | 0% | 0% | 0% | 0% | 0% | 0% |
| 36 | 0% | 0% | 0% | 0% | 0% | 0% | 0% |
| 44 | 0% | 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.
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 |
|---|---|---|---|---|---|
| EMA SCALPEUR + RSi - SHORT this page | — | v5 strategy | 0.0% | 0 | 978.0% |
| RSI Cross [xaurr] by livetrend | rsi ema | v4 strategy | +24.4% | 53 | 35.3% |
| Bitpanda Coinrule Template by joshuajcoop01 | rsi ema | v5 strategy | −2.8% | 4 | 4.6% |
| RSI with Slow and Fast MA Crossing Strategy (by Coinrule) by Coinrule | rsi ema | v5 strategy | −2.8% | 4 | 4.6% |
| RSI of VWAP by mohanee | rsi ema | v4 strategy | No trades on this market | ||
| BTC Sentiment analysis RSI 2xEMA by exlux99 | rsi ema | v4 strategy | No trades on this market | ||
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 32, 34). It is deprecated in v5 and removed in v6, where each call moves inside an if block.
- No v6-only features. v6 is not needed to run this script.
Same 2 trades and the same P&L on BTCUSDT 4h, 1,000 bars, in Zeal Terminal's engine.
- Line 32: when = sell → if block
- Line 34: when = sellexit → if block
⋯/////strategy-strategy.entry ("short", strategy.short, when = sell, comment = "ENTER-SHORT")+if sell+ strategy.entry ("short", strategy.short, comment = "ENTER-SHORT")///// market exit-strategy.close ("short", when = sellexit, comment = "EXIT-SHORT")+if sellexit+ strategy.close ("short", comment = "EXIT-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: 0 before, 1 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.
⋯// © YukalMoon-//@version=5+//@version=6strategy(title="EMA SCALPEUR", overlay=true, initial_capital = 1000)⋯Where it runs
| Engine | Compiles | Runs | Matches TradingView |
|---|---|---|---|
| Zeal Terminal · OpenPineScript v2 | Yes 16 ms | Yes 1,000 bars in 29 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/// © YukalMoon//@version=5strategy(title="EMA SCALPEUR", overlay=true, initial_capital = 1000)//// input controlsEMA_L = input.int (title = "EMA_L", defval = 9, minval = 1, maxval = 100, step =1)EMA_L2 = input.int (title = "EMA_L2", defval = 26, minval = 1, maxval = 100, step =1)EMA_S = input.int (title = "EMA_S", defval = 100, minval = 1, maxval = 100, step =1)EMA_S2 = input.int (title = "EMA_S2", defval = 55, minval = 1, maxval = 100, step =1)RSI1 = input.int (title = "RSI", defval = 5, minval = 1, maxval = 20 , step = 1)/// mise en place de emaRSI = ta.rsi(close, RSI1)shortest = ta.ema(close, 9)short = ta.ema(close, 26)longer = ta.ema(close, 100)longest = ta.ema(close, 55)plot(shortest, color = color.red)plot(short, color = color.orange)plot(longer, color = color.aqua)plot(longest, color = color.yellow)plot(close)//// trading indicatorsEMA1 = ta.ema (close,EMA_L)EMA2 = ta.ema (close,EMA_L2)EMA3 = ta.ema (close, EMA_S)EMA4 = ta.ema (close, EMA_S2)//buy = ta.crossover(EMA1, EMA2) and RSI > 60 and RSI <70sell = ta.crossunder(EMA1, EMA2) and RSI > 40//buyexit = ta.crossunder(EMA3, EMA4)sellexit = ta.crossover(EMA3, EMA4)/////strategystrategy.entry ("short", strategy.short, when = sell, comment = "ENTER-SHORT")///// market exitstrategy.close ("short", when = sellexit, comment = "EXIT-SHORT")