Pine Script v4 · Strategy
Yusram Mount MaV - Day MaV CrossOver Strgty
A Pine Script v4 strategy built on SMA or EMA or WMA (close, length). 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. 11 settings; defaults include Kaynak close, Hareketli Ortlama Tipi SMA and Günlük Bar Sayısı 7.
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 Yusram Mount MaV - Day MaV CrossOver Strgty repaint?
- Yes
- In a live replay, it did not match history on 11 of 11 trades, and it produced 13 trades that history does not have.
- How did Yusram Mount MaV - Day MaV CrossOver Strgty do on BTCUSDT 1D with default settings?
- −27.60%
- From 26 Jan 2024 to 21 Oct 2026, over 42 closed trades, against +102.5% for buy and hold. A backtest, not investment advice.
- Can Yusram Mount MaV - Day MaV CrossOver Strgty be converted to Pine Script v5?
- Yes
- The upgrade takes 1 step, from v4; each was run before and after on the same candles with identical results, and the v5 script can be downloaded below.
- Does Yusram Mount MaV - Day MaV CrossOver Strgty use a stop loss?
- No
- Every exit waits for a signal; nothing limits a losing trade before it fires.
- Does Yusram Mount MaV - Day MaV CrossOver Strgty run in Zeal Terminal?
- Yes
- It compiles in 15 ms and runs 1,000 bars in 50 ms, in the browser.
BTCUSDT · 1D · default settings
- MhO
- DhO
- Giriş
- Çıkış
- Winning trade
- Losing trade
- Equity
- Buy and hold
- Net profit
- −27.60%
- −$27,602.80
- Buy and hold
- +102.5%
- same period
- Closed trades
- 42
- 15 won · 27 lost
- Profitable
- 35.7%
- of closed trades
- Profit factor
- 0.80
- gross profit ÷ gross loss
- Max drawdown
- 46.39%
- −$50,924.80
One run with the author's default settings, $100,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.
-
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 48, 50. The upgraded version below moves each call inside an if block.
-
Note
Uses transp =, which v5 removed line 31
transp = on line 31, 35, 36. v5 folds the transparency into the colour with color.new(c, transp).
Upgrade and export
Written in Pine Script v4. The upgrade to v5 takes 1 step, one per version, each applied to the result of the one before. A last clean-v5 pass then types the settings and moves when = into if blocks, which v6 requires. Every step runs before and after on the same candles in Zeal Terminal's engine; a step whose results differ is shown but not offered as a download. Upgrades preserve behaviour: bugs are fixed in the Review, never silently here.
- Upgrading to v5 renames sma → ta.sma, ema → ta.ema, wma → ta.wma, security → request.security, crossover → ta.crossover.
- 2 strategy calls use the when = argument (line 48, 50). It is deprecated in v5 and removed in v6, where each call moves inside an if block.
v4 → v5
VerifiedSame 42 trades and the same P&L on BTCUSDT 1D, 1,000 bars, in Zeal Terminal's engine.
- Line 3: //@version=4 → //@version=5
- Line 5: input(type = input.source) → input.source()
- Line 13: sma → ta.sma
- Line 16: ema → ta.ema
- Line 19: wma → ta.wma
- Line 23: security → request.security
5 more edits
- Line 31: transp = 90 → color.new(lnma < gnma ? color.green : color.red, 90)
- Line 33: crossover → ta.crossover
- Line 34: crossover → ta.crossover
- Line 35: transp = 0 → color.new(color.green, 0)
- Line 36: transp = 0 → color.new(color.red, 0)
⋯// © dadashkadir-//@version=4+//@version=5strategy("Mount MaV - Day MaV CrossOver Strgty", shorttitle="Yusram Str.", overlay=true)-src = input(title= "Kaynak", type=input.source, defval=close)+src = input.source(title= "Kaynak", defval=close)mav = input(title="Hareketli Ortlama Tipi", defval="SMA", options=["SMA", "EMA", "WMA"])⋯ if mav == "SMA"- ma := sma(src, length)+ ma := ta.sma(src, length) ma if mav == "EMA"- ma := ema(src, length)+ ma := ta.ema(src, length) ma if mav == "WMA"- ma := wma(src, length)+ ma := ta.wma(src, length) ma⋯long = "M" //Aylık-ln = security(syminfo.ticker, long, src)+ln = request.security(syminfo.ticker, long, src)lnma = getMA(ln, Abar)⋯l2 = plot(gnma, title="DhO", trackprice = true, style=plot.style_line, color=colorM, linewidth=3)-fill(l1, l2, color = lnma < gnma ? color.green : color.red, title="Gölgelendirme", transp=90)+fill(l1, l2, color = color.new(lnma < gnma ? color.green : color.red, 90), title="Gölgelendirme")zamanaralik = input (2020, title="Backtest Başlangıç Tarihi")-al = crossover (gnma, lnma) and zamanaralik <= year+al = ta.crossover (gnma, lnma) and zamanaralik <= year-sat = crossover (lnma, gnma) and zamanaralik <= year+sat = ta.crossover (lnma, gnma) and zamanaralik <= year-plotshape(al, title = "Giriş", text = 'Al', style = shape.labelup, location = location.belowbar, color= color.green, textcolor = color.white, transp = 0, size = size.tiny)+plotshape(al, title = "Giriş", text = 'Al', style = shape.labelup, location = location.belowbar, color= color.new(color.green, 0), textcolor = color.white, size = size.tiny)-plotshape(sat, title = "Çıkış", text = 'Sat', style = shape.labeldown, location = location.abovebar, color= color.red, textcolor = color.white, transp = 0, size = size.tiny)+plotshape(sat, title = "Çıkış", text = 'Sat', style = shape.labeldown, location = location.abovebar, color= color.new(color.red, 0), textcolor = color.white, size = size.tiny)FromDay = input(defval = 1, title = "Str. Başlama Tarihi Gün", minval = 1, maxval = 31)⋯Same 42 trades and the same P&L on BTCUSDT 1D, 1,000 bars, in Zeal Terminal's engine.
- Line 6: input() → input.string()
- Line 7: input() → input.int()
- Line 8: input() → input.int()
- Line 32: input() → input.int()
- Line 37: input() → input.int()
- Line 38: input() → input.int()
6 more edits
- Line 39: input() → input.int()
- Line 40: input() → input.int()
- Line 41: input() → input.int()
- Line 42: input() → input.int()
- Line 48: when = Timerange() → if block
- Line 50: when = Timerange() → if block
⋯src = input.source(title= "Kaynak", defval=close)-mav = input(title="Hareketli Ortlama Tipi", defval="SMA", options=["SMA", "EMA", "WMA"])+mav = input.string(title="Hareketli Ortlama Tipi", defval="SMA", options=["SMA", "EMA", "WMA"])-Gbar = input(title="Günlük Bar Sayısı", defval=7, minval=1, maxval=999)+Gbar = input.int(title="Günlük Bar Sayısı", defval=7, minval=1, maxval=999)-Abar = input(title="Aylık Bar Sayısı", defval=5, minval=1, maxval=999)+Abar = input.int(title="Aylık Bar Sayısı", defval=5, minval=1, maxval=999)//displacement = input(20, minval=1, title="Displacement")⋯fill(l1, l2, color = color.new(lnma < gnma ? color.green : color.red, 90), title="Gölgelendirme")-zamanaralik = input (2020, title="Backtest Başlangıç Tarihi")+zamanaralik = input.int (2020, title="Backtest Başlangıç Tarihi")al = ta.crossover (gnma, lnma) and zamanaralik <= year⋯plotshape(sat, title = "Çıkış", text = 'Sat', style = shape.labeldown, location = location.abovebar, color= color.new(color.red, 0), textcolor = color.white, size = size.tiny)-FromDay = input(defval = 1, title = "Str. Başlama Tarihi Gün", minval = 1, maxval = 31)+FromDay = input.int(defval = 1, title = "Str. Başlama Tarihi Gün", minval = 1, maxval = 31)-FromMonth = input(defval = 1, title = "Str. Başlama Tarihi Ay", minval = 1, maxval = 12)+FromMonth = input.int(defval = 1, title = "Str. Başlama Tarihi Ay", minval = 1, maxval = 12)-FromYear = input(defval = 2015, title = "Str. Başlama Tarihi Yıl", minval = 2005)+FromYear = input.int(defval = 2015, title = "Str. Başlama Tarihi Yıl", minval = 2005)-ToDay = input(defval = 1, title = "Str. Bitiş Tarihi Gün", minval = 1, maxval = 31)+ToDay = input.int(defval = 1, title = "Str. Bitiş Tarihi Gün", minval = 1, maxval = 31)-ToMonth = input(defval = 1, title = "Str. Bitiş Tarihi Ay", minval = 1, maxval = 12)+ToMonth = input.int(defval = 1, title = "Str. Bitiş Tarihi Ay", minval = 1, maxval = 12)-ToYear = input(defval = 9999, title = "Str. Bitiş Tarihi Yıl", minval = 2006)+ToYear = input.int(defval = 9999, title = "Str. Bitiş Tarihi Yıl", minval = 2006)Start = timestamp(FromYear, FromMonth, FromDay, 00, 00)⋯if al- strategy.entry("Al", strategy.long, when=Timerange())+ if Timerange()+ strategy.entry("Al", strategy.long)if sat- strategy.entry("Sat", strategy.short, when=Timerange())+ if Timerange()+ strategy.entry("Sat", 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: 42 before, 29 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.
⋯// © dadashkadir-//@version=5+//@version=6strategy("Mount MaV - Day MaV CrossOver Strgty", shorttitle="Yusram Str.", overlay=true)⋯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 |
|---|---|---|---|
| Kaynak | close | source | ma ln gnma |
| Hareketli Ortlama Tipi | SMA | string · options ["SMA", "EMA", "WMA"] | line 12 line 15 line 18 |
| Günlük Bar Sayısı | 7 | int · min 1 · max 999 | gnma |
| Aylık Bar Sayısı | 5 | int · min 1 · max 999 | lnma |
| Backtest Başlangıç Tarihi | 2020 | int | al sat |
| Str. Başlama Tarihi Gün | 1 | int · min 1 · max 31 | Start |
| Str. Başlama Tarihi Ay | 1 | int · min 1 · max 12 | Start |
| Str. Başlama Tarihi Yıl | 2015 | int · min 2005 | Start |
| Str. Bitiş Tarihi Gün | 1 | int · min 1 · max 31 | Finish |
| Str. Bitiş Tarihi Ay | 1 | int · min 1 · max 12 | Finish |
| Str. Bitiş Tarihi Yıl | 9999 | int · min 2006 | Finish |
What it calculates
- SMA / EMA / WMA (
sma,ta.smain v5)Kaynak (close), lengthma · 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 Al long | Timerange() | On | 48 |
| Open Sat short | Timerange() | On | 50 |
Each order is guarded by the setting shown. “Off” orders never fire unless that setting is switched on.
Does it repaint?
Yes
The live replay did not match history.
- ClearHigher-timeframe data1 security call(s), none with lookahead on.
- 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 | −27.6% | +102.5% | 42 | 36% | 0.80 | 46.4% | 26 Jan 2024 – 21 Oct 2026 |
| BTCUSDT 4h | +21.2% | +5.5% | 10 | 30% | 2.49 | 9.4% | 8 May 2026 – 21 Oct 2026 |
| ETHUSDT 1D | −1.2% | +9.8% | 48 | 33% | 0.86 | 3.4% | 26 Jan 2024 – 21 Oct 2026 |
| ETHUSDT 4h | +0.7% | +8.4% | 20 | 20% | 1.80 | 0.6% | 8 May 2026 – 21 Oct 2026 |
| SOLUSDT 1D | +0.1% | +16.7% | 43 | 44% | 1.47 | 0.1% | 26 Jan 2024 – 21 Oct 2026 |
| SOLUSDT 4h | −0.0% | +21.5% | 18 | 22% | 0.87 | 0.0% | 8 May 2026 – 21 Oct 2026 |
| BNBUSDT 1D | −0.2% | +148.3% | 47 | 32% | 0.85 | 0.7% | 26 Jan 2024 – 21 Oct 2026 |
| BNBUSDT 4h | +0.2% | +17.1% | 8 | 50% | 4.59 | 0.0% | 8 May 2026 – 21 Oct 2026 |
Higher-timeframe data for request.security(): BTCUSDT M (Binance BTCUSDT 1M), fetched from Binance's public market data for each market.
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 | 14 | 36% | $687.02 |
| Sideways market | 14 | 50% | $6,471.73 |
| Falling market | 14 | 21% | −$34,761.50 |
Rising and falling mean the market moved more than 15% over the 90 bars before entry.
How bad could the drawdown be?
62.7%
The 95th percentile of the worst drawdown when the same 42 trades are reshuffled 5,000 times. The bar spans the 5th to 95th percentile, 37.2% to 62.7%; the tick is what actually happened, 45.1%. Order luck alone moves it this much.
All 42 trades
| Side | Entry | Exit | Bars | P&L |
|---|---|---|---|---|
| short | 4 Apr 2024 65,963.30 | 5 May 2024 63,892.00 | 31 | $2,071.24 |
| long | 5 May 2024 63,892.00 | 17 Jun 2024 66,676.90 | 43 | $2,784.83 |
| short | 17 Jun 2024 66,676.90 | 20 Jul 2024 66,660.00 | 33 | $16.85 |
| long | 20 Jul 2024 66,660.00 | 5 Aug 2024 58,161.00 | 16 | −$8,499.01 |
| short | 5 Aug 2024 58,161.00 | 18 Sep 2024 60,314.00 | 44 | −$2,152.99 |
| long | 18 Sep 2024 60,314.00 | 5 Oct 2024 62,086.00 | 17 | $1,772.01 |
| short | 5 Oct 2024 62,086.00 | 17 Oct 2024 67,620.00 | 12 | −$5,534.00 |
| long | 17 Oct 2024 67,620.00 | 5 Nov 2024 67,850.00 | 19 | $230.01 |
| short | 5 Nov 2024 67,850.00 | 8 Nov 2024 75,857.90 | 3 | −$8,007.88 |
| long | 8 Nov 2024 75,857.90 | 29 Dec 2024 95,300.00 | 51 | $19,442.10 |
| short | 29 Dec 2024 95,300.00 | 4 Jan 2025 98,174.20 | 6 | −$2,874.17 |
| long | 4 Jan 2025 98,174.20 | 5 Feb 2025 97,763.10 | 32 | −$411.03 |
| short | 5 Feb 2025 97,763.10 | 5 Mar 2025 87,282.00 | 28 | $10,481.20 |
| long | 5 Mar 2025 87,282.00 | 13 Mar 2025 83,680.10 | 8 | −$3,601.86 |
| short | 13 Mar 2025 83,680.10 | 24 Mar 2025 86,082.50 | 11 | −$2,402.38 |
| long | 24 Mar 2025 86,082.50 | 8 Apr 2025 79,163.20 | 15 | −$6,919.26 |
| short | 8 Apr 2025 79,163.20 | 16 Apr 2025 83,644.00 | 8 | −$4,480.75 |
| long | 16 Apr 2025 83,644.00 | 6 Jun 2025 101,509.00 | 51 | $17,864.70 |
| short | 6 Jun 2025 101,509.00 | 8 Jun 2025 105,552.00 | 2 | −$4,043.46 |
| long | 8 Jun 2025 105,552.00 | 22 Jun 2025 102,120.00 | 14 | −$3,432.13 |
| short | 22 Jun 2025 102,120.00 | 28 Jun 2025 107,048.00 | 6 | −$4,927.56 |
| long | 28 Jun 2025 107,048.00 | 5 Aug 2025 115,055.00 | 38 | $8,007.45 |
| short | 5 Aug 2025 115,055.00 | 11 Aug 2025 119,294.00 | 6 | −$4,239.24 |
| long | 11 Aug 2025 119,294.00 | 22 Aug 2025 112,500.00 | 11 | −$6,794.27 |
| short | 22 Aug 2025 112,500.00 | 4 Sep 2025 111,706.00 | 13 | $794.28 |
| long | 4 Sep 2025 111,706.00 | 17 Oct 2025 108,194.00 | 43 | −$3,511.45 |
| short | 17 Oct 2025 108,194.00 | 5 Dec 2025 92,078.10 | 49 | $16,116.20 |
| long | 5 Dec 2025 92,078.10 | 7 Dec 2025 89,236.80 | 2 | −$2,841.26 |
| short | 7 Dec 2025 89,236.80 | 9 Dec 2025 90,634.40 | 2 | −$1,397.55 |
| long | 9 Dec 2025 90,634.40 | 16 Dec 2025 86,432.10 | 7 | −$4,202.27 |
| short | 16 Dec 2025 86,432.10 | 4 Jan 2026 90,628.00 | 19 | −$4,195.93 |
| long | 4 Jan 2026 90,628.00 | 31 Jan 2026 84,260.50 | 27 | −$6,367.51 |
| short | 31 Jan 2026 84,260.50 | 1 Feb 2026 78,741.10 | 1 | $5,519.40 |
| long | 1 Feb 2026 78,741.10 | 6 Feb 2026 62,909.90 | 5 | −$15,831.20 |
| short | 6 Feb 2026 62,909.90 | 5 Mar 2026 72,666.80 | 27 | −$9,756.90 |
| long | 5 Mar 2026 72,666.80 | 2 Apr 2026 68,113.90 | 28 | −$4,552.85 |
| short | 2 Apr 2026 68,113.90 | 8 Apr 2026 71,924.20 | 6 | −$3,810.30 |
| long | 8 Apr 2026 71,924.20 | 29 May 2026 73,617.50 | 51 | $1,693.30 |
| short | 29 May 2026 73,617.50 | 5 Jul 2026 63,144.00 | 37 | $10,473.50 |
| long | 5 Jul 2026 63,144.00 | 12 Sep 2026 77,225.70 | 69 | $14,081.70 |
| short | 12 Sep 2026 77,225.70 | 22 Sep 2026 86,620.00 | 10 | −$9,394.30 |
| long | 22 Sep 2026 86,620.00 | 13 Oct 2026 81,850.00 | 21 | −$4,770.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 |
|---|---|---|---|---|---|
| Yusram Mount MaV - Day MaV CrossOver Strgty this page | — | v4 strategy | −27.6% | 42 | 46.4% |
| Forex SWING Trader by SoftKill21 | wma ema sma | v4 strategy | No trades on this market | ||
| DRSI DMA Scalping Strategy No Repaint by allenlk | sma wma ema | v4 strategy | −99.5% | 44 | 137.7% |
| MACD Long Strat by TheGrindToday | ema sma | v4 strategy | +24.0% | 79 | 20.1% |
| Stock trending strategy by exlux99 | ema sma | v4 strategy | +35.3% | 21 | 14.7% |
| 4-Hour Stochastic EMA Trend by slymnturkoglu | ema sma | v4 strategy | No trades on this market | ||
Where it runs
| Engine | Compiles | Runs | Matches TradingView |
|---|---|---|---|
| Zeal Terminal · OpenPineScript v2 | Yes 15 ms | With a workaround 1,000 bars in 50 ms | Not measured |
| PineTS | No v5 and v6 only | — | Not measured |
The engine's host API cannot yet declare a chart's symbol and timeframe, so this page sets them on the engine directly for each market.
“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. PineTS runs Pine Script v5 and v6 only.
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/// © dadashkadir//@version=4strategy("Mount MaV - Day MaV CrossOver Strgty", shorttitle="Yusram Str.", overlay=true)src = input(title= "Kaynak", type=input.source, defval=close)mav = input(title="Hareketli Ortlama Tipi", defval="SMA", options=["SMA", "EMA", "WMA"])Gbar = input(title="Günlük Bar Sayısı", defval=7, minval=1, maxval=999)Abar = input(title="Aylık Bar Sayısı", defval=5, minval=1, maxval=999)//displacement = input(20, minval=1, title="Displacement")getMA(src, length) => ma = 0.0 if mav == "SMA" ma := sma(src, length) ma if mav == "EMA" ma := ema(src, length) ma if mav == "WMA" ma := wma(src, length) ma malong = "M" //Aylıkln = security(syminfo.ticker, long, src)lnma = getMA(ln, Abar)gnma = getMA(src, Gbar)col1= gnma>gnma[1]col3= gnma<gnma[1]colorM = col1 ? color.green : col3 ? color.navy : color.yellowl1 = plot(lnma, title="MhO", trackprice = true, style=plot.style_line, color=color.red, linewidth=3)l2 = plot(gnma, title="DhO", trackprice = true, style=plot.style_line, color=colorM, linewidth=3)fill(l1, l2, color = lnma < gnma ? color.green : color.red, title="Gölgelendirme", transp=90)zamanaralik = input (2020, title="Backtest Başlangıç Tarihi")al = crossover (gnma, lnma) and zamanaralik <= yearsat = crossover (lnma, gnma) and zamanaralik <= yearplotshape(al, title = "Giriş", text = 'Al', style = shape.labelup, location = location.belowbar, color= color.green, textcolor = color.white, transp = 0, size = size.tiny)plotshape(sat, title = "Çıkış", text = 'Sat', style = shape.labeldown, location = location.abovebar, color= color.red, textcolor = color.white, transp = 0, size = size.tiny)FromDay = input(defval = 1, title = "Str. Başlama Tarihi Gün", minval = 1, maxval = 31)FromMonth = input(defval = 1, title = "Str. Başlama Tarihi Ay", minval = 1, maxval = 12)FromYear = input(defval = 2015, title = "Str. Başlama Tarihi Yıl", minval = 2005)ToDay = input(defval = 1, title = "Str. Bitiş Tarihi Gün", minval = 1, maxval = 31)ToMonth = input(defval = 1, title = "Str. Bitiş Tarihi Ay", minval = 1, maxval = 12)ToYear = input(defval = 9999, title = "Str. Bitiş Tarihi Yıl", minval = 2006)Start = timestamp(FromYear, FromMonth, FromDay, 00, 00)Finish = timestamp(ToYear, ToMonth, ToDay, 23, 59)Timerange() => time >= Start and time <= Finish ? true : falseif al strategy.entry("Al", strategy.long, when=Timerange())if sat strategy.entry("Sat", strategy.short, when=Timerange())