Zeal Terminal Open in Zeal Terminal

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
Prerendered with the defaults. Change anything and run it here. The script runs in your browser.
Settings (4)
40,00060,00080,000100,000120,000AprJulOct2025AprJulOct2026AprJulOct$-30,623$2,025Equity from $1,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.
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.

SettingDefaultType and rangeFeeds
EMA_L9int · min 1 · max 100 · step 1EMA1
EMA_L226int · min 1 · max 100 · step 1EMA2
EMA_S100int · min 1 · max 100 · step 1EMA3
EMA_S255int · min 1 · max 100 · step 1EMA4

What it calculates

  • EMAclose, 9shortest · line 11
  • EMAclose, 26short · line 12
  • EMAclose, 100longer · line 13
  • EMAclose, 55longest · 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, EMA2buy · line 25
  • CrossunderEMA3, EMA4buyexit · 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.

closecloseprice dataEMA_LEMA_Lsetting · 9EMA_L2EMA_L2setting · 26EMA_SEMA_Ssetting · 100EMA_S2EMA_S2setting · 55shortestEMA→ shortestshortEMA→ shortlongerEMA→ longerlongestEMA→ longestEMA1EMA→ EMA1EMA2EMA→ EMA2EMA3EMA→ EMA3EMA4EMA→ EMA4buyCrossover→ buybuyexitCrossunder→ buyexitentry:longOpen longstrategy.entryclose:longClose longstrategy.closeplot:15plotplotplot:16plotplotplot:17plotplotplot:18plotplotplot:19plotplot

Order rules

OrderFires whenBy defaultLine
Open long longbuyOn30
Close longbuyexitOn33

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−3,162.4%+102.5%425%0.062,077.0%26 Jan 2024 – 21 Oct 2026
BTCUSDT 4h−1,311.4%+5.5%450%0.322,325.9%8 May 2026 – 21 Oct 2026
ETHUSDT 1D−133.3%+9.8%425%0.10225.2%26 Jan 2024 – 21 Oct 2026
ETHUSDT 4h−35.7%+8.4%10%0.0062.1%8 May 2026 – 21 Oct 2026
SOLUSDT 1D−7.7%+16.7%560%0.3113.4%26 Jan 2024 – 21 Oct 2026
SOLUSDT 4h−1.1%+21.5%367%0.122.8%8 May 2026 – 21 Oct 2026
BNBUSDT 1D+16.7%+148.3%4100%—18.0%26 Jan 2024 – 21 Oct 2026
BNBUSDT 4h+5.9%+17.1%367%3.626.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 barsTradesWonP&L
Rising market30%−$33,551.20
Sideways market1100%$1,926.98
Falling market0—$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.

0%5,652%
All 4 trades
SideEntryExitBarsP&L
long18 May 2024 67,024.0020 Jul 2024 66,660.0063−$363.99
long25 Aug 2024 64,157.0015 Oct 2024 66,084.0051$1,926.98
long6 Jan 2025 98,363.605 May 2025 94,277.60119−$4,086.00
long27 Jun 2025 106,947.0029 Aug 2026 77,845.90428−$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.

ScriptSharesTypeNetTradesMax drawdown
EMA SCALPEUR LONG V2 this page—v5 strategy−3,162.4%42,077.0%
EMA Slope AyE by fajardoarelysemav4 strategyNo trades on this market
ROoT by realisticDove62527emav5 strategy−4.7%2259.4%
sachin5986 by mohitesachin78emav4 strategy+32.1%3517.6%
sonu1997 by Sonu1997emav4 strategy+960.7%21,103.8%
Moving Average Crossover by Muh4mm4demav4 strategy+19,990.1%301,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.

Clean v5

VerifiedDownload the v5 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

EngineCompilesRunsMatches TradingView
Zeal Terminal · OpenPineScript v2Yes 12 msYes 1,000 bars in 26 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/// © 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")