Pine Script v5 · Strategy
EMA SCALPEUR LONG V2
A Pine Script v5 strategy built on EMA (close, 9), Crossover (EMA1, EMA2) and Crossunder (EMA3, EMA4). It has 2 order rules, 1 entry among them, and trades long only with the default settings. Exits wait for a signal; there is no stop loss. Each trade is one contract and pays no commission. 4 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 LONG V2 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 LONG V2 do on BTCUSDT 1D with default settings?
- −3,162.42%
- From 26 Jan 2024 to 21 Oct 2026, over 4 closed trades, against +102.5% for buy and hold. A backtest, not investment advice.
- Does EMA SCALPEUR LONG V2 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: 4 before, 4 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 LONG V2 use a stop loss?
- No
- Every exit waits for a signal; nothing limits a losing trade before it fires.
- Does EMA SCALPEUR LONG V2 run in Zeal Terminal?
- Yes
- It compiles in 12 ms and runs 1,000 bars in 26 ms, in the browser.
BTCUSDT · 1D · default settings
- Plot
- Plot
- Plot
- Plot
- Plot
- Winning trade
- Losing trade
- Equity
- Buy and hold
- Net profit
- −3,162.42%
- −$31,624.20
- Buy and hold
- +102.5%
- same period
- Closed trades
- 4
- 1 won · 3 lost
- Profitable
- 25.0%
- of closed trades
- Profit factor
- 0.06
- gross profit ÷ gross loss
- Max drawdown
- 2,076.98%
- −$53,232.90
One run with the author's default settings, $1,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.
-
Likely bug
ta.ema(close, 9) ignores the settings line 11
Line 11 hard-codes 9 where line 21 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 12
Line 12 hard-codes 26 where line 21 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 13
Line 13 hard-codes 100 where line 21 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 14
Line 14 hard-codes 55 where line 21 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 30, 33. 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 |
What it calculates
- EMAclose, 9
shortest · line 11 - EMAclose, 26
short · line 12 - EMAclose, 100
longer · line 13 - EMAclose, 55
longest · line 14 - EMAclose, EMA_L (9)
EMA1 · line 21 - EMAclose, EMA_L2 (26)
EMA2 · line 22 - EMAclose, EMA_S (100)
EMA3 · line 23 - EMAclose, EMA_S2 (55)
EMA4 · line 24 - CrossoverEMA1, EMA2
buy · line 25 - CrossunderEMA3, EMA4
buyexit · line 27
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 long long | buy | On | 30 |
| Close long | buyexit | On | 33 |
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 | −3,162.4% | +102.5% | 4 | 25% | 0.06 | 2,077.0% | 26 Jan 2024 – 21 Oct 2026 |
| BTCUSDT 4h | −1,311.4% | +5.5% | 4 | 50% | 0.32 | 2,325.9% | 8 May 2026 – 21 Oct 2026 |
| ETHUSDT 1D | −133.3% | +9.8% | 4 | 25% | 0.10 | 225.2% | 26 Jan 2024 – 21 Oct 2026 |
| ETHUSDT 4h | −35.7% | +8.4% | 1 | 0% | 0.00 | 62.1% | 8 May 2026 – 21 Oct 2026 |
| SOLUSDT 1D | −7.7% | +16.7% | 5 | 60% | 0.31 | 13.4% | 26 Jan 2024 – 21 Oct 2026 |
| SOLUSDT 4h | −1.1% | +21.5% | 3 | 67% | 0.12 | 2.8% | 8 May 2026 – 21 Oct 2026 |
| BNBUSDT 1D | +16.7% | +148.3% | 4 | 100% | — | 18.0% | 26 Jan 2024 – 21 Oct 2026 |
| BNBUSDT 4h | +5.9% | +17.1% | 3 | 67% | 3.62 | 6.3% | 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 bars | Trades | Won | P&L |
|---|---|---|---|
| Rising market | 3 | 0% | −$33,551.20 |
| Sideways market | 1 | 100% | $1,926.98 |
| Falling market | 0 | — | $0.00 |
Rising and falling mean the market moved more than 15% over the 90 bars before entry.
How bad could the drawdown be?
4,915.1%
The 95th percentile of the worst drawdown when the same 4 trades are reshuffled 5,000 times. The bar spans the 5th to 95th percentile, 137.8% to 4,915.1%; the tick is what actually happened, 1,294.9%. Order luck alone moves it this much.
All 4 trades
| Side | Entry | Exit | Bars | P&L |
|---|---|---|---|---|
| long | 18 May 2024 67,024.00 | 20 Jul 2024 66,660.00 | 63 | −$363.99 |
| long | 25 Aug 2024 64,157.00 | 15 Oct 2024 66,084.00 | 51 | $1,926.98 |
| long | 6 Jan 2025 98,363.60 | 5 May 2025 94,277.60 | 119 | −$4,086.00 |
| long | 27 Jun 2025 106,947.00 | 29 Aug 2026 77,845.90 | 428 | −$29,101.20 |
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 LONG V2 this page | — | v5 strategy | −3,162.4% | 4 | 2,077.0% |
| EMA Slope AyE by fajardoarelys | ema | v4 strategy | No trades on this market | ||
| ROoT by realisticDove62527 | ema | v5 strategy | −4.7% | 225 | 9.4% |
| sachin5986 by mohitesachin78 | ema | v4 strategy | +32.1% | 35 | 17.6% |
| sonu1997 by Sonu1997 | ema | v4 strategy | +960.7% | 2 | 1,103.8% |
| Moving Average Crossover by Muh4mm4d | ema | v4 strategy | +19,990.1% | 30 | 1,274.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 30, 33). 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 4 trades and the same P&L on BTCUSDT 1D, 1,000 bars, in Zeal Terminal's engine.
- Line 30: when = buy → if block
- Line 33: when = buyexit → if block
⋯/////strategy-strategy.entry ("long", strategy.long, when = buy, comment = "EXIT-LONG")+if buy+ strategy.entry ("long", strategy.long, comment = "EXIT-LONG")//strategy.entry ("short", strategy.short, when = sell, comment = "ENTER-SHORT")///// market exit-strategy.close ("long", when = buyexit, comment = "ENTER-LONG")+if buyexit+ strategy.close ("long", comment = "ENTER-LONG")//strategy.close ("short", when = sellexit, 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: 4 before, 4 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 12 ms | Yes 1,000 bars in 26 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)/// mise en place de emashortest = 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)//sell = ta.crossunder(EMA1, EMA2)buyexit = ta.crossunder(EMA3, EMA4)//sellexit = ta.crossover(EMA3, EMA4)/////strategystrategy.entry ("long", strategy.long, when = buy, comment = "EXIT-LONG")//strategy.entry ("short", strategy.short, when = sell, comment = "ENTER-SHORT")///// market exitstrategy.close ("long", when = buyexit, comment = "ENTER-LONG")//strategy.close ("short", when = sellexit, comment = "EXIT-SHORT")