Zeal Terminal Open in Zeal Terminal

Pine Script v4 · Strategy

Escaping of Rate from Avarage By Mustafa OZVER Strategy

A Pine Script v4 strategy built on WMA (ohlc4, 3), Stdev (FPrice, 17) and EMA (FPrice, 17). It has 2 order rules and no entry of its own. Exits wait for a signal; there is no stop loss. Each trade is one contract and pays no commission. 2 settings; defaults include Source ohlc4 and Length 17.

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 Escaping of Rate from Avarage By Mustafa OZVER Strategy repaint?
No
No repainting patterns were found in the source, and a live tick-by-tick replay matched history on 29 of 29 trades.
How did Escaping of Rate from Avarage By Mustafa OZVER Strategy do on BTCUSDT 1D with default settings?
+122.03%
From 26 Jan 2024 to 21 Oct 2026, over 96 closed trades, against +102.5% for buy and hold. A backtest, not investment advice.
Can Escaping of Rate from Avarage By Mustafa OZVER Strategy 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 Escaping of Rate from Avarage By Mustafa OZVER Strategy use a stop loss?
No
Every exit waits for a signal; nothing limits a losing trade before it fires.
Does Escaping of Rate from Avarage By Mustafa OZVER Strategy run in Zeal Terminal?
Yes
It compiles in 8 ms and runs 1,000 bars in 25 ms, in the browser.

BTCUSDT · 1D · default settings

  • HLine
  • HLine
  • HLine
  • ESC1
  • 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 (2)
40,00060,00080,000100,000120,000AprJulOct2025AprJulOct2026AprJulOctHLine$223,756$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. Zeal Terminal's engine currently reads an order side written as true as a short, whatever it says; this page passes the same side as strategy.long or strategy.short (line 24) so the engine trades the way the script says.
Net profit
+122.03%
$122,030.00
Buy and hold
+102.5%
same period
Closed trades
96
68 won · 28 lost
Profitable
70.8%
of closed trades
Profit factor
1.57
gross profit ÷ gross loss
Max drawdown
79.06%
−$192,541.00

One run with the author's default settings, $100,000 starting capital, commission as the script sets it. A long 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 transp =, which v5 removed line 18

    transp = on line 18. 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 wma → ta.wma, stdev → ta.stdev, ema → ta.ema, change → ta.change.

v4 → v5

Verified

Same 96 trades and the same P&L on BTCUSDT 1D, 1,000 bars, in Zeal Terminal's engine.

  • Line 3: //@version=4 → //@version=5
  • Line 7: wma → ta.wma
  • Line 9: stdev → ta.stdev
  • Line 10: ema → ta.ema
  • Line 18: transp = 85 → color.new(color.silver, 85)
  • Line 21: change → ta.change
  • Line 22: change → ta.change
  • Line 24: strategy.order(…, true) → strategy.order(…, strategy.long)
⋯// © Mustafaozver-//@version=4+//@version=5strategy("Escaping of Rate from Avarage By Mustafa OZVER", "EoRfA", overlay=false)⋯src = input(ohlc4,"Source")-FPrice = wma(src,3)+FPrice = ta.wma(src,3)len = input(17,"Length")-stdev = stdev(FPrice,len)+stdev = ta.stdev(FPrice,len)-ema2 = ema(FPrice,len)+ema2 = ta.ema(FPrice,len)Rate1 = (FPrice - ema2) / stdev⋯hlinen1=hline(-1,linestyle=hline.style_dotted,editable=false)-fill(hline1,hlinen1,color=color.silver,transp=85,editable=true)+fill(hline1,hlinen1,color=color.new(color.silver, 85),editable=true)//plot(Rate,color=(Rate>0?colorG:colorR),transp=75,style=plot.style_area,editable=false)plot(Rate1,title="ESC1",color=(Rate1>0?colorG:colorR),style=plot.style_line,linewidth=1,editable=true)-BUYSIGNAL = Rate1 < -1 and change(Rate1) > 0+BUYSIGNAL = Rate1 < -1 and ta.change(Rate1) > 0-SELLSIGNAL = Rate1 > 1 and change(Rate1) < 0+SELLSIGNAL = Rate1 > 1 and ta.change(Rate1) < 0if (BUYSIGNAL)-    strategy.order("LONG1",true)+    strategy.order("LONG1",strategy.long)    //strategy.close("SHORT1")⋯

Clean v5

VerifiedDownload the v5 script

Same 96 trades and the same P&L on BTCUSDT 1D, 1,000 bars, in Zeal Terminal's engine.

  • Line 6: input() → input.source()
  • Line 8: input() → input.int()
⋯//strategy("Escaping of Rate from Avarage By Mustafa OZVER", "EoRfA", overlay=false)-src = input(ohlc4,"Source")+src = input.source(ohlc4,"Source")FPrice = ta.wma(src,3)-len = input(17,"Length")+len = input.int(17,"Length")stdev = ta.stdev(FPrice,len)⋯

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: 96 before, 14 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.

⋯// © Mustafaozver-//@version=5+//@version=6strategy("Escaping of Rate from Avarage By Mustafa OZVER", "EoRfA", overlay=false)⋯

Settings

Every input the script declares, with its default and what it feeds. Bounds are the ones the script enforces.

SettingDefaultType and rangeFeeds
Sourceohlc4sourceFPrice
Length17intstdev ema2

What it calculates

  • WMA (wma, ta.wma in v5)Source (ohlc4), 3FPrice · line 7
  • Stdev (stdev, ta.stdev in v5)FPrice, Length (17)stdev · line 9
  • EMA (ema, ta.ema in v5)FPrice, Length (17)ema2 · line 10

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.

ohlc4ohlc4price datalenLengthsetting · 17FPriceWMA→ FPricestdevStdev→ stdevema2EMA→ ema2Rate1Rate1valueBUYSIGNALBUYSIGNALconditionSELLSIGNALSELLSIGNALconditioncolorG, colorRColourcolorG · colorRorder:LONG1order LONG1strategy.orderclose:LONG1Close LONG1strategy.closehline:15hlinehlinehline:16hlinehlinehline:17hlinehlinefill:18Fillfillplot:20ESC1plot

Order rules

OrderFires whenBy defaultLine
order LONG1 long(BUYSIGNAL)On24
Close LONG1(SELLSIGNAL)On28

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, and the live replay matched history.

29/29trades 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 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+122.0%+102.5%9671%1.5779.1%26 Jan 2024 – 21 Oct 2026
BTCUSDT 4h−220.3%+5.5%14565%0.41489.8%8 May 2026 – 21 Oct 2026
ETHUSDT 1D−9.6%+9.8%12352%0.6729.2%26 Jan 2024 – 21 Oct 2026
ETHUSDT 4h−11.8%+8.4%11254%0.2621.5%8 May 2026 – 21 Oct 2026
SOLUSDT 1D+0.2%+16.7%10872%1.221.1%26 Jan 2024 – 21 Oct 2026
SOLUSDT 4h−0.1%+21.5%12065%0.660.3%8 May 2026 – 21 Oct 2026
BNBUSDT 1D+2.1%+148.3%8079%3.281.2%26 Jan 2024 – 21 Oct 2026
BNBUSDT 4h+0.9%+17.1%10378%3.420.4%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 market1573%$2,266.96
Sideways market4967%$37,889.30
Falling market3275%$81,873.70

Rising and falling mean the market moved more than 15% over the 90 bars before entry.

How bad could the drawdown be?

24.7%

The 95th percentile of the worst drawdown when the same 96 trades are reshuffled 5,000 times. The bar spans the 5th to 95th percentile, 11.0% to 24.7%; the tick is what actually happened, 29.2%. Order luck alone moves it this much.

0%34%
All 96 trades
SideEntryExitBarsP&L
long16 Apr 2024 63,420.0020 May 2024 66,274.0034$2,854.01
long17 Apr 2024 63,793.4020 May 2024 66,274.0033$2,480.60
long18 Apr 2024 61,277.4020 May 2024 66,274.0032$4,996.62
long19 Apr 2024 63,470.1020 May 2024 66,274.0031$2,803.91
long20 Apr 2024 63,818.0020 May 2024 66,274.0030$2,455.99
long3 May 2024 59,060.6020 May 2024 66,274.0017$7,213.40
long4 May 2024 62,882.0020 May 2024 66,274.0016$3,391.99
long17 Jun 2024 66,676.9019 Jul 2024 63,987.9032−$2,688.94
long18 Jun 2024 66,504.3019 Jul 2024 63,987.9031−$2,516.41
long21 Jun 2024 64,870.0019 Jul 2024 63,987.9028−$882.07
long23 Jun 2024 64,262.0019 Jul 2024 63,987.9026−$274.09
long27 Jun 2024 60,865.0019 Jul 2024 63,987.9022$3,122.94
long28 Jun 2024 61,706.5019 Jul 2024 63,987.9021$2,281.46
long29 Jun 2024 60,427.8019 Jul 2024 63,987.9020$3,560.08
long30 Jun 2024 60,986.7019 Jul 2024 63,987.9019$3,001.24
long1 Jul 2024 62,772.0019 Jul 2024 63,987.9018$1,215.91
long7 Jul 2024 58,230.1019 Jul 2024 63,987.9012$5,757.79
long8 Jul 2024 55,857.8019 Jul 2024 63,987.9011$8,130.11
long9 Jul 2024 56,714.6019 Jul 2024 63,987.9010$7,273.31
long10 Jul 2024 58,050.0019 Jul 2024 63,987.909$5,937.92
long11 Jul 2024 57,725.8019 Jul 2024 63,987.908$6,262.07
long7 Aug 2024 56,022.0027 Aug 2024 62,834.0020$6,812.00
long8 Aug 2024 55,133.8027 Aug 2024 62,834.0019$7,700.24
long9 Aug 2024 61,686.0027 Aug 2024 62,834.0018$1,148.00
long9 Sep 2024 54,869.9022 Sep 2024 63,349.0013$8,479.02
long12 Jan 2025 94,600.0020 Jan 2025 101,332.008$6,731.58
long5 Feb 2025 97,763.1027 Mar 2025 86,909.2050−$10,854.00
long6 Feb 2025 96,612.4027 Mar 2025 86,909.2049−$9,703.27
long7 Feb 2025 96,554.4027 Mar 2025 86,909.2048−$9,645.18
long8 Feb 2025 96,506.8027 Mar 2025 86,909.2047−$9,597.63
long9 Feb 2025 96,444.8027 Mar 2025 86,909.2046−$9,535.58
long10 Feb 2025 96,462.8027 Mar 2025 86,909.2045−$9,553.58
long27 Feb 2025 84,250.1027 Mar 2025 86,909.2028$2,659.08
long28 Feb 2025 84,708.6027 Mar 2025 86,909.2027$2,200.60
long1 Mar 2025 84,349.9027 Mar 2025 86,909.2026$2,559.22
long2 Mar 2025 86,064.5027 Mar 2025 86,909.2025$844.63
long13 Mar 2025 83,680.1027 Mar 2025 86,909.2014$3,229.05
long14 Mar 2025 81,115.8027 Mar 2025 86,909.2013$5,793.39
long15 Mar 2025 83,983.2027 Mar 2025 86,909.2012$2,925.98
long2 Apr 2025 85,158.4025 Apr 2025 93,980.5023$8,822.12
long9 Apr 2025 76,322.4025 Apr 2025 93,980.5016$17,658.10
long10 Apr 2025 82,615.2025 Apr 2025 93,980.5015$11,365.30
long24 Jun 2025 105,334.001 Jul 2025 107,147.007$1,812.57
long4 Aug 2025 114,209.0015 Aug 2025 118,295.0011$4,086.28
long5 Aug 2025 115,055.0015 Aug 2025 118,295.0010$3,240.06
long23 Aug 2025 116,936.0014 Sep 2025 115,918.0022−$1,017.71
long28 Aug 2025 111,262.0014 Sep 2025 115,918.0017$4,656.28
long2 Sep 2025 109,237.0014 Sep 2025 115,918.0012$6,680.86
long3 Sep 2025 111,240.0014 Sep 2025 115,918.0011$4,678.28
long28 Sep 2025 109,636.005 Oct 2025 122,391.007$12,755.10
long29 Sep 2025 112,164.005 Oct 2025 122,391.006$10,227.00
long19 Oct 2025 107,185.007 Jan 2026 93,748.0080−$13,437.00
long20 Oct 2025 108,643.007 Jan 2026 93,748.0079−$14,894.80
long7 Nov 2025 101,346.007 Jan 2026 93,748.0061−$7,598.07
long8 Nov 2025 103,339.007 Jan 2026 93,748.0060−$9,591.12
long9 Nov 2025 102,313.007 Jan 2026 93,748.0059−$8,564.98
long10 Nov 2025 104,723.007 Jan 2026 93,748.0058−$10,975.00
long17 Nov 2025 94,261.407 Jan 2026 93,748.0051−$513.48
long18 Nov 2025 92,215.107 Jan 2026 93,748.0050$1,532.83
long19 Nov 2025 92,960.807 Jan 2026 93,748.0049$787.14
long20 Nov 2025 91,555.007 Jan 2026 93,748.0048$2,193.01
long23 Nov 2025 84,739.807 Jan 2026 93,748.0045$9,008.22
long24 Nov 2025 86,830.007 Jan 2026 93,748.0044$6,917.97
long25 Nov 2025 88,300.007 Jan 2026 93,748.0043$5,447.96
long18 Dec 2025 86,243.207 Jan 2026 93,748.0020$7,504.74
long19 Dec 2025 85,516.407 Jan 2026 93,748.0019$8,231.56
long20 Dec 2025 88,136.907 Jan 2026 93,748.0018$5,611.02
long24 Jan 2026 89,600.307 Mar 2026 68,114.0042−$21,486.20
long3 Feb 2026 78,738.607 Mar 2026 68,114.0032−$10,624.60
long4 Feb 2026 75,770.207 Mar 2026 68,114.0031−$7,656.19
long5 Feb 2026 73,165.807 Mar 2026 68,114.0030−$5,051.82
long7 Feb 2026 70,580.307 Mar 2026 68,114.0028−$2,466.24
long8 Feb 2026 69,289.407 Mar 2026 68,114.0027−$1,175.35
long9 Feb 2026 70,330.407 Mar 2026 68,114.0026−$2,216.36
long26 Feb 2026 67,988.007 Mar 2026 68,114.009$125.98
long27 Feb 2026 67,485.207 Mar 2026 68,114.008$628.83
long28 Feb 2026 65,872.107 Mar 2026 68,114.007$2,241.93
long2 Mar 2026 65,776.507 Mar 2026 68,114.005$2,337.54
long31 Mar 2026 66,797.4011 Apr 2026 72,962.7011$6,165.33
long21 May 2026 77,552.2024 Jul 2026 65,099.0064−$12,453.30
long31 May 2026 73,884.4024 Jul 2026 65,099.0054−$8,785.40
long1 Jun 2026 73,674.4024 Jul 2026 65,099.0053−$8,575.41
long5 Jun 2026 63,886.0024 Jul 2026 65,099.0049$1,212.99
long6 Jun 2026 61,056.5024 Jul 2026 65,099.0048$4,042.51
long7 Jun 2026 60,884.6024 Jul 2026 65,099.0047$4,214.36
long8 Jun 2026 63,332.0024 Jul 2026 65,099.0046$1,766.97
long9 Jun 2026 63,086.0024 Jul 2026 65,099.0045$2,012.98
long10 Jun 2026 61,730.0024 Jul 2026 65,099.0044$3,368.98
long22 Jun 2026 63,312.0024 Jul 2026 65,099.0032$1,786.98
long27 Jun 2026 60,097.3024 Jul 2026 65,099.0027$5,001.71
long28 Jun 2026 60,029.0024 Jul 2026 65,099.0026$5,069.97
long29 Jun 2026 59,577.0024 Jul 2026 65,099.0025$5,521.97
long30 Jun 2026 60,260.2024 Jul 2026 65,099.0024$4,838.78
long1 Jul 2026 58,624.7024 Jul 2026 65,099.0023$6,474.27
long2 Jul 2026 60,024.0024 Jul 2026 65,099.0022$5,074.98
long17 Aug 2026 62,900.0022 Aug 2026 78,338.005$15,438.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
Escaping of Rate from Avarage By Mustafa OZVER Strategy this page—v4 strategy+122.0%9679.1%
No-lose trading targets (Based on EoRfA) By Mustafa ÖZVER by Mustafaozverwma stdev emav4 strategyNo trades on this market
SL1 Pips after TP2 (MA) by gpadiharema wmav4 strategy+0.4%330.1%
Bollinger Band with Fib Golden Ratio (0.618) by mohaneestdev emav4 strategyNo trades on this market
Volume Weighted Bollinger Bands Strategy by Ankit_1618ema stdevv4 strategy+10.0%1527.5%
BB21_MA200_Strategy by mohaneeema stdevv4 strategyNo trades on this market

Where it runs

EngineCompilesRunsMatches TradingView
Zeal Terminal · OpenPineScript v2Yes 8 msWith a workaround 1,000 bars in 25 msNot measured
PineTSNo v5 and v6 only—Not measured

Zeal Terminal's engine currently reads an order side written as true as a short, whatever it says; this page passes the same side as strategy.long or strategy.short (line 24) so the engine trades the way the script says.

“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/// © Mustafaozver//@version=4strategy("Escaping of Rate from Avarage By Mustafa OZVER", "EoRfA", overlay=false)//strategy("Escaping of Rate from Avarage By Mustafa OZVER", "EoRfA", overlay=false)src = input(ohlc4,"Source")FPrice = wma(src,3)len = input(17,"Length")stdev = stdev(FPrice,len)ema2 = ema(FPrice,len)Rate1 = (FPrice - ema2) / stdev//bgcolor(color=((stdev/ema)>0.0015)?color.green:#00000000,transp=80)colorG = color.limecolorR = color.redhline(0,linestyle=hline.style_solid,editable=false)hline1=hline(1,linestyle=hline.style_dotted,editable=false)hlinen1=hline(-1,linestyle=hline.style_dotted,editable=false)fill(hline1,hlinen1,color=color.silver,transp=85,editable=true)//plot(Rate,color=(Rate>0?colorG:colorR),transp=75,style=plot.style_area,editable=false)plot(Rate1,title="ESC1",color=(Rate1>0?colorG:colorR),style=plot.style_line,linewidth=1,editable=true)BUYSIGNAL = Rate1 < -1 and change(Rate1) > 0SELLSIGNAL = Rate1 > 1 and change(Rate1) < 0if (BUYSIGNAL)    strategy.order("LONG1",true)    //strategy.close("SHORT1")if (SELLSIGNAL)   // strategy.order("SHORT1",false)    strategy.close("LONG1")