Zeal Terminal Open in Zeal Terminal

Pine Script v5 · Strategy

STR-EMA Oscilator [Azzrael]

A Pine Script v5 strategy built on EMA (close, 200), Stdev (v, 200) and Crossunder or Crossover (v, dev_limit). It has 3 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 commits 30% of equity and pays 0.1% commission. 5 settings; defaults include Period 200 and Factor 1.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 STR-EMA Oscilator [Azzrael] repaint?
No
No repainting patterns were found in the source. The live replay was not measured: the script acts only when barstate.isconfirmed is true, which Zeal Terminal's engine never reports during a live replay (it does not run a bar's closing update in live mode), so the replay cannot test this script.
How did STR-EMA Oscilator [Azzrael] do on BTCUSDT 1D with default settings?
+2.28%
From 26 Jan 2024 to 21 Oct 2026, over 6 closed trades, against +102.5% for buy and hold. A backtest, not investment advice.
Does STR-EMA Oscilator [Azzrael] run in Pine Script v6?
Yes
Same 6 trades and the same P&L on BTCUSDT 1D, 1,000 bars, in Zeal Terminal's engine. Both versions were run on Zeal Terminal's engine, and the results are identical. The v6 script can be downloaded below.
Does STR-EMA Oscilator [Azzrael] use a stop loss?
No
Every exit waits for a signal; nothing limits a losing trade before it fires.
Does STR-EMA Oscilator [Azzrael] run in Zeal Terminal?
Yes
It compiles in 21 ms and runs 1,000 bars in 53 ms, in the browser.

BTCUSDT · 1D · default settings

  • Plot
  • Plot
  • Plot
  • HLine
  • 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 (5)
40,00060,00080,000100,000120,000AprJulOct2025AprJulOct2026AprJulOctPlot$1,023$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. 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.
Net profit
+2.28%
$22.83
Buy and hold
+102.5%
same period
Closed trades
6
3 won · 3 lost
Profitable
50.0%
of closed trades
Profit factor
1.25
gross profit ÷ gross loss
Max drawdown
30.58%
−$305.80

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.

  • Check

    No stop loss

    Every exit waits for a signal. Nothing limits a losing trade before the exit condition fires.

  • Note

    No slippage

    Fills are assumed at the exact open price. Add slippage in the properties for a more realistic test.

Settings

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

SettingDefaultType and rangeFeeds
Period200int · min 2 · step 10v dev
Factor1.7float · min 1 · max 10 · step 0.1dev_limit
ModelBuy on enter to OverSellstring · options ["Buy on enter to OverSell", "Buy on enter to OverBuy"]k cond_long sig_col
Backtest period
Starttimestamp('01 January 2001 00:00 +0000')timebar_in_period
Finishtimestamp('01 January 2030 00:00 +0000')timebar_in_period close_all last line 44

What it calculates

  • EMAclose, Period (200)v · line 26
  • Stdevv, Period (200)dev · line 27
  • Crossunder / Crossoverv, dev_limit · chosen by Modelcond_long · line 30

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_lengthPeriodsetting · 200dnoModelsetting · Buy on enter to Ove…limitFactorsetting · 1.7timetimeprice datadt_startStartsetting · timestamp('01 Janua…dt_endFinishsetting · timestamp('01 Janua…vEMA→ vdevStdev→ devcond_longCrossunder / Crossover→ cond_long · by Modelkkvaluedev_limitdev_limitvalueentry_nameentry_namevaluecond_closecond_closeconditionbar_in_periodbar_in_periodconditionsig_colColoursig_colentry:entry_nameOpen entry_namestrategy.entryclose_all:sclose_all sstrategy.close_allclose_all:lastclose_all laststrategy.close_allplot:34plotplotplot:35plotplotplot:36plotplothline:37hlinehline

Order rules

OrderFires whenBy defaultLine
Open entry_name longcond_longOn41
Close scond_close and strategy.position_size > 0On43
Close lasttime >= dt_end or barstate.islastconfirmedhistoryOn45

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 measuredAn engine gap, not the scriptThe script acts only when barstate.isconfirmed is true, which Zeal Terminal's engine never reports during a live replay (it does not run a bar's closing update in live mode), so the replay cannot test this script. The answer comes from the checks on the source alone.
  • 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+2.3%+102.5%650%1.2530.6%26 Jan 2024 – 21 Oct 2026
BTCUSDT 4h0.0%+5.5%00%—0.0%8 May 2026 – 21 Oct 2026
ETHUSDT 1D+36.0%+9.8%5100%—30.4%26 Jan 2024 – 21 Oct 2026
ETHUSDT 4h−0.0%+8.4%00%0.001.5%8 May 2026 – 21 Oct 2026
SOLUSDT 1D−20.2%+16.7%425%0.3148.8%26 Jan 2024 – 21 Oct 2026
SOLUSDT 4h0.0%+21.5%00%—0.0%8 May 2026 – 21 Oct 2026
BNBUSDT 1D+23.8%+148.3%4100%—3.8%26 Jan 2024 – 21 Oct 2026
BNBUSDT 4h0.0%+17.1%00%—0.0%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 market0—$0.00
Sideways market3100%$115.42
Falling market30%−$92.59

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

How bad could the drawdown be?

9.1%

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

0%10%
All 6 trades
SideEntryExitBarsP&L
long15 Nov 2025 94,594.0011 May 2026 82,210.10177−$39.80
long17 Nov 2025 94,261.4011 May 2026 82,210.10175−$38.83
long2 Dec 2025 86,286.0011 May 2026 82,210.10160−$13.97
long3 Jun 2026 66,760.8021 Aug 2026 73,027.0079$24.96
long9 Jul 2026 62,290.0021 Aug 2026 73,027.0043$45.34
long14 Jul 2026 62,334.5021 Aug 2026 73,027.0038$45.13

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
STR-EMA Oscilator [Azzrael] this page—v5 strategy+2.3%630.6%
Galileo Galilei by armigoldmanema crossv4 strategy+16.9%6142.2%
Escaping of Rate from Avarage By Mustafa OZVER Strategy by Mustafaozverstdev emav4 strategy+122.0%9679.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

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.

  • No v6-only features. v6 is not needed to run this script.

Clean v5

Verified

Nothing to change.

Does it run in Pine Script v6?

Yes

Same 6 trades and the same P&L on BTCUSDT 1D, 1,000 bars, in Zeal Terminal's engine. Both versions were run on Zeal Terminal's engine, and the results are identical. It differs from the v5 version by 1 edit.

Download the v6 script

⋯// Exit - crossing zero of (EMA - close)-//@version=5+//@version=6strategy("STR:EMA Oscilator [Azzrael]", overlay=false, ⋯

Where it runs

EngineCompilesRunsMatches TradingView
Zeal Terminal · OpenPineScript v2Yes 21 msWith a workaround 1,000 bars in 53 msNot measured
PineTSNot testedNot testedNot 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.

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/// © Azzrael// Based on EMA and EMA Oscilator https://www.tradingview.com/script/qM9wm0PW-EMA-Oscilator-Azzrael/// (EMA - close) + Std Dev + Factor = detecting oversell/overbuy// Long only!// Pyramiding - sometimes, depends on ...// There 2 enter strategies in one script // 1 - Classic, buy on entering to OverSell zone (more profitable ~> 70%)// 2 - Crazy, buy on entering to OverBuy zone (catching trend and pyramiding, more net profit)// Exit - crossing zero of (EMA - close)//@version=5strategy("STR:EMA Oscilator [Azzrael]", overlay=false,  initial_capital=1000, default_qty_type=strategy.percent_of_equity, default_qty_value=30, pyramiding=3, commission_type=strategy.commission.percent, commission_value=0.1 )ema_length = input.int(200, "Period", minval=2, step=10)limit = input.float(1.7, "Factor", minval=1, step=0.1, maxval=10)dno = input.string(defval="Buy on enter to OverSell", title="Model", options=["Buy on enter to OverSell", "Buy on enter to OverBuy"]) == "Buy on enter to OverSell"dt_start = input.time(defval=timestamp('01 January 2001 00:00 +0000'), title='Start', group ="Backtest period")dt_end = input.time(defval=timestamp('01 January 2030 00:00 +0000'), title='Finish', group ="Backtest period")bar_in_period = time >= dt_start and time <= dt_endv = close - ta.ema(close, ema_length)dev = ta.stdev(v, ema_length)k = dno ? -1 : 1dev_limit = k*dev*limitcond_long = barstate.isconfirmed and bar_in_period and (dno ? ta.crossunder(v, dev_limit) : ta.crossover(v, dev_limit))cond_close = barstate.isconfirmed and bar_in_period and ta.cross(v, 0) // dev visualizationsig_col = (dno and v <= dev_limit) or (not dno and v >= dev_limit) ? color.green : color.new(color.blue, 80)plot(dev_limit, color=color.green)plot(k*dev, color=color.new(color.blue, 60))plot(v, color=sig_col )hline(0)// Make love not warif cond_long    entry_name="b" + str.tostring(strategy.opentrades)    strategy.entry(entry_name, strategy.long)if cond_close and strategy.position_size > 0    strategy.close_all("s")if time >= dt_end or barstate.islastconfirmedhistory    strategy.close_all("last")