Zeal Terminal Open in Zeal Terminal

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
40,00060,00080,000100,000120,000AprJulOct2025AprJulOct2026AprJulOct$69,542$202,527Equity from $100,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. 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. The live re-run is not offered here: the script requests BTCUSDT M, which this page cannot load in your browser.
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

Verified

Same 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)⋯

Clean v5

VerifiedDownload the v5 script

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.

SettingDefaultType and rangeFeeds
Kaynakclosesourcema ln gnma
Hareketli Ortlama TipiSMAstring · options ["SMA", "EMA", "WMA"]line 12 line 15 line 18
Günlük Bar Sayısı7int · min 1 · max 999gnma
Aylık Bar Sayısı5int · min 1 · max 999lnma
Backtest Başlangıç Tarihi2020intal sat
Str. Başlama Tarihi Gün1int · min 1 · max 31Start
Str. Başlama Tarihi Ay1int · min 1 · max 12Start
Str. Başlama Tarihi Yıl2015int · min 2005Start
Str. Bitiş Tarihi Gün1int · min 1 · max 31Finish
Str. Bitiş Tarihi Ay1int · min 1 · max 12Finish
Str. Bitiş Tarihi Yıl9999int · min 2006Finish

What it calculates

  • SMA / EMA / WMA (sma, ta.sma in 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.

closecloseprice dataAbarAylık Bar Sayısısetting · 5GbarGünlük Bar Sayısısetting · 7FromYearStr. Başlama Tarihi Yılsetting · 2015FromMonthStr. Başlama Tarihi Aysetting · 1FromDayStr. Başlama Tarihi Günsetting · 1ToYearStr. Bitiş Tarihi Yılsetting · 9999ToMonthStr. Bitiş Tarihi Aysetting · 1ToDayStr. Bitiş Tarihi Günsetting · 1zamanaralikBacktest Başlangıç Tari…setting · 2020maSMA / EMA / WMA→ malnlnvaluelnmalnmavaluegnmagnmavalueStartStartvalueFinishFinishvaluealalconditionsatsatconditioncol1, col3col1 · col32 conditionscolorMColourcolorMentry:AlOpen Alstrategy.entryentry:SatOpen Satstrategy.entryplot:29MhOplotplot:30DhOplotfill:GölgelendirmeGölgelendirmefillplotshape:35Girişplotshapeplotshape:36Çıkışplotshape

Order rules

OrderFires whenBy defaultLine
Open Al longTimerange()On48
Open Sat shortTimerange()On50

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.

0/11trades identical when replayed liveThe last 300 bars, from 26 Dec 2025, were fed to the engine as live ticks, four per bar, and compared with the historical run. Orders are decided once per closed bar, so nothing can change mid-bar.
  • 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.

MarketNetBuy and holdTradesWonProfit factorMax drawdownPeriod
BTCUSDT 1D−27.6%+102.5%4236%0.8046.4%26 Jan 2024 – 21 Oct 2026
BTCUSDT 4h+21.2%+5.5%1030%2.499.4%8 May 2026 – 21 Oct 2026
ETHUSDT 1D−1.2%+9.8%4833%0.863.4%26 Jan 2024 – 21 Oct 2026
ETHUSDT 4h+0.7%+8.4%2020%1.800.6%8 May 2026 – 21 Oct 2026
SOLUSDT 1D+0.1%+16.7%4344%1.470.1%26 Jan 2024 – 21 Oct 2026
SOLUSDT 4h−0.0%+21.5%1822%0.870.0%8 May 2026 – 21 Oct 2026
BNBUSDT 1D−0.2%+148.3%4732%0.850.7%26 Jan 2024 – 21 Oct 2026
BNBUSDT 4h+0.2%+17.1%850%4.590.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 barsTradesWonP&L
Rising market1436%$687.02
Sideways market1450%$6,471.73
Falling market1421%−$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.

0%72%
All 42 trades
SideEntryExitBarsP&L
short4 Apr 2024 65,963.305 May 2024 63,892.0031$2,071.24
long5 May 2024 63,892.0017 Jun 2024 66,676.9043$2,784.83
short17 Jun 2024 66,676.9020 Jul 2024 66,660.0033$16.85
long20 Jul 2024 66,660.005 Aug 2024 58,161.0016−$8,499.01
short5 Aug 2024 58,161.0018 Sep 2024 60,314.0044−$2,152.99
long18 Sep 2024 60,314.005 Oct 2024 62,086.0017$1,772.01
short5 Oct 2024 62,086.0017 Oct 2024 67,620.0012−$5,534.00
long17 Oct 2024 67,620.005 Nov 2024 67,850.0019$230.01
short5 Nov 2024 67,850.008 Nov 2024 75,857.903−$8,007.88
long8 Nov 2024 75,857.9029 Dec 2024 95,300.0051$19,442.10
short29 Dec 2024 95,300.004 Jan 2025 98,174.206−$2,874.17
long4 Jan 2025 98,174.205 Feb 2025 97,763.1032−$411.03
short5 Feb 2025 97,763.105 Mar 2025 87,282.0028$10,481.20
long5 Mar 2025 87,282.0013 Mar 2025 83,680.108−$3,601.86
short13 Mar 2025 83,680.1024 Mar 2025 86,082.5011−$2,402.38
long24 Mar 2025 86,082.508 Apr 2025 79,163.2015−$6,919.26
short8 Apr 2025 79,163.2016 Apr 2025 83,644.008−$4,480.75
long16 Apr 2025 83,644.006 Jun 2025 101,509.0051$17,864.70
short6 Jun 2025 101,509.008 Jun 2025 105,552.002−$4,043.46
long8 Jun 2025 105,552.0022 Jun 2025 102,120.0014−$3,432.13
short22 Jun 2025 102,120.0028 Jun 2025 107,048.006−$4,927.56
long28 Jun 2025 107,048.005 Aug 2025 115,055.0038$8,007.45
short5 Aug 2025 115,055.0011 Aug 2025 119,294.006−$4,239.24
long11 Aug 2025 119,294.0022 Aug 2025 112,500.0011−$6,794.27
short22 Aug 2025 112,500.004 Sep 2025 111,706.0013$794.28
long4 Sep 2025 111,706.0017 Oct 2025 108,194.0043−$3,511.45
short17 Oct 2025 108,194.005 Dec 2025 92,078.1049$16,116.20
long5 Dec 2025 92,078.107 Dec 2025 89,236.802−$2,841.26
short7 Dec 2025 89,236.809 Dec 2025 90,634.402−$1,397.55
long9 Dec 2025 90,634.4016 Dec 2025 86,432.107−$4,202.27
short16 Dec 2025 86,432.104 Jan 2026 90,628.0019−$4,195.93
long4 Jan 2026 90,628.0031 Jan 2026 84,260.5027−$6,367.51
short31 Jan 2026 84,260.501 Feb 2026 78,741.101$5,519.40
long1 Feb 2026 78,741.106 Feb 2026 62,909.905−$15,831.20
short6 Feb 2026 62,909.905 Mar 2026 72,666.8027−$9,756.90
long5 Mar 2026 72,666.802 Apr 2026 68,113.9028−$4,552.85
short2 Apr 2026 68,113.908 Apr 2026 71,924.206−$3,810.30
long8 Apr 2026 71,924.2029 May 2026 73,617.5051$1,693.30
short29 May 2026 73,617.505 Jul 2026 63,144.0037$10,473.50
long5 Jul 2026 63,144.0012 Sep 2026 77,225.7069$14,081.70
short12 Sep 2026 77,225.7022 Sep 2026 86,620.0010−$9,394.30
long22 Sep 2026 86,620.0013 Oct 2026 81,850.0021−$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.

ScriptSharesTypeNetTradesMax drawdown
Yusram Mount MaV - Day MaV CrossOver Strgty this page—v4 strategy−27.6%4246.4%
Forex SWING Trader by SoftKill21wma ema smav4 strategyNo trades on this market
DRSI DMA Scalping Strategy No Repaint by allenlksma wma emav4 strategy−99.5%44137.7%
MACD Long Strat by TheGrindTodayema smav4 strategy+24.0%7920.1%
Stock trending strategy by exlux99ema smav4 strategy+35.3%2114.7%
4-Hour Stochastic EMA Trend by slymnturkogluema smav4 strategyNo trades on this market

Where it runs

EngineCompilesRunsMatches TradingView
Zeal Terminal · OpenPineScript v2Yes 15 msWith a workaround 1,000 bars in 50 msNot measured
PineTSNo 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())