Zeal Terminal Open in Zeal Terminal

Pine Script v5 · Strategy

Tendency EMA + RSI [Alorse]

A Pine Script v5 strategy built on RSI (close, 14), EMA (close, 10) and Valuewhen (bought, open). It has 4 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 commits 20% of equity and pays 0.01% commission. 9 settings; defaults include Length 14, Source close and EMA A Length 10.

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 Tendency EMA + RSI [Alorse] repaint?
No
No repainting patterns were found in the source. The live replay was not measured: it had no trades to compare.
How did Tendency EMA + RSI [Alorse] do on BTCUSDT 1D with default settings?
+4.29%
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 Tendency EMA + RSI [Alorse] 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 Tendency EMA + RSI [Alorse] use a stop loss?
No
Every exit waits for a signal; nothing limits a losing trade before it fires.
Does Tendency EMA + RSI [Alorse] run in Zeal Terminal?
Yes
It compiles in 15 ms and runs 1,000 bars in 35 ms, in the browser.

BTCUSDT · 1D · default settings

  • EMA A
  • EMA B
  • EMA B
  • 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 (9)
40,00060,00080,000100,000120,000AprJulOct2025AprJulOct2026AprJulOct$1,043$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
+4.29%
$42.92
Buy and hold
+102.5%
same period
Closed trades
4
4 won · 0 lost
Profitable
100.0%
of closed trades
Profit factor
—
gross profit ÷ gross loss
Max drawdown
1.91%
−$19.44

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.

  • Note

    Uses an argument v6 removed

    when = on line 44, 45, 47, 48. 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
RSI
Length14int · min 1rsi
Sourceclosesourcersi
Moving Averages
EMA A Length10int · min 1out_a
EMA B Length20int · min 1out_b
EMA C Length100int · min 1out_c
Strategy
Long entriestrueboolentry Long
Short entriesfalseboolentry Short
Close after X # barsIf trade is in profittrueboolline 38
# bars24intexitLong exitShort

What it calculates

  • RSISource (close), Length (14)rsi · line 8
  • EMAclose, EMA A Length (10)out_a · line 11
  • EMAclose, EMA B Length (20)out_b · line 14
  • EMAclose, EMA C Length (100)out_c · line 17
  • Valuewhenbought, open, 0entry_price · 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 datalenLengthsetting · 14len_aEMA A Lengthsetting · 10len_bEMA B Lengthsetting · 20len_cEMA C Lengthsetting · 100openopenprice dataxBars# barssetting · 24rsiRSI→ rsiout_aEMA→ out_aout_bEMA→ out_bout_cEMA→ out_centry_priceValuewhen→ entry_priceexitLongexitLongvalueexitShortexitShortvaluenPastBarsnPastBarsvalueentryLong, entryShortentryLong · entryShort2 conditionsboughtboughtconditionentry:LongOpen Longstrategy.entryclose:LongClose Longstrategy.closeentry:ShortOpen Shortstrategy.entryclose:ShortClose Shortstrategy.closeplot:12EMA Aplotplot:15EMA Bplotplot:18EMA Bplot

Order rules

OrderFires whenBy defaultLine
Open Long longentryLong and showLongOn44
Close LongexitLongOn45
Open Short shortentryShort and showShortOn47
Close ShortexitShortOn48

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+4.3%+102.5%4100%—1.9%26 Jan 2024 – 21 Oct 2026
BTCUSDT 4h+2.4%+5.5%4100%—0.9%8 May 2026 – 21 Oct 2026
ETHUSDT 1D−4.6%+9.8%475%0.4312.5%26 Jan 2024 – 21 Oct 2026
ETHUSDT 4h+1.1%+8.4%6100%527.453.0%8 May 2026 – 21 Oct 2026
SOLUSDT 1D+7.8%+16.7%3100%—0.7%26 Jan 2024 – 21 Oct 2026
SOLUSDT 4h+1.6%+21.5%2100%782.243.5%8 May 2026 – 21 Oct 2026
BNBUSDT 1D+3.8%+148.3%4100%—2.1%26 Jan 2024 – 21 Oct 2026
BNBUSDT 4h+1.9%+17.1%5100%—0.8%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 market2100%$11.34
Sideways market2100%$31.58
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?

0.0%

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, 0.0% to 0.0%; the tick is what actually happened, 0.0%. Order luck alone moves it this much.

0%1%
All 4 trades
SideEntryExitBarsP&L
long13 Oct 2024 63,206.2021 Oct 2024 69,032.008$18.39
long25 Dec 2024 98,663.6018 Jan 2025 104,077.0024$11.13
long8 Jun 2025 105,552.002 Jul 2025 105,681.0024$0.21
long13 Sep 2025 116,029.006 Oct 2025 123,482.0023$13.18

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
Tendency EMA + RSI [Alorse] this page—v5 strategy+4.3%41.9%
Momentum Strategy (BTC-USDT; 30m) - STOCH RSI (with source code) by Drun30rsi ema valuewhenv4 strategy+13.3%1213.6%
RSI Cross [xaurr] by livetrendrsi emav4 strategy+24.4%5335.3%
Bitpanda Coinrule Template by joshuajcoop01rsi emav5 strategy−2.8%44.6%
RSI with Slow and Fast MA Crossing Strategy (by Coinrule) by Coinrulersi emav5 strategy−2.8%44.6%
RSI of VWAP by mohaneersi emav4 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.

  • 4 strategy calls use the when = argument (line 44, 45, 47, 48). 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 44: when = entryLong and showLong → if block
  • Line 45: when = exitLong → if block
  • Line 47: when = entryShort and showShort → if block
  • Line 48: when = exitShort → if block
⋯// Long Entry-strategy.entry('Long', strategy.long, when=entryLong and showLong)+if entryLong and showLong+    strategy.entry('Long', strategy.long)-strategy.close('Long', when=exitLong)+if exitLong+    strategy.close('Long')// Short Entry-strategy.entry('Short', strategy.short, when=entryShort and showShort)+if entryShort and showShort+    strategy.entry('Short', strategy.short)-strategy.close('Short', when=exitShort)+if exitShort+    strategy.close('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.

⋯//@author Alorse-//@version=5+//@version=6strategy(title='Tendency EMA + RSI [Alorse]', shorttitle='Tendece EMA + RSI [Alorse]', overlay=true, pyramiding=0, currency=currency.USD, default_qty_type=strategy.percent_of_equity, initial_capital=1000, default_qty_value=20, commission_type=strategy.commission.percent, commission_value=0.01)⋯

Where it runs

EngineCompilesRunsMatches TradingView
Zeal Terminal · OpenPineScript v2Yes 15 msYes 1,000 bars in 35 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///@author Alorse//@version=5strategy(title='Tendency EMA + RSI [Alorse]', shorttitle='Tendece EMA + RSI [Alorse]', overlay=true, pyramiding=0, currency=currency.USD, default_qty_type=strategy.percent_of_equity, initial_capital=1000, default_qty_value=20, commission_type=strategy.commission.percent, commission_value=0.01)// Bollinger Bandslen = input.int(14, minval=1, title='Length', group='RSI')src = input.source(close, 'Source', group='RSI')rsi = ta.rsi(src, len)// Moving Averageslen_a = input.int(10, minval=1, title='EMA A Length', group='Moving Averages')out_a = ta.ema(close, len_a)plot(out_a, title='EMA A', color=color.purple)len_b = input.int(20, minval=1, title='EMA B Length', group='Moving Averages')out_b = ta.ema(close, len_b)plot(out_b, title='EMA B', color=color.orange)len_c = input.int(100, minval=1, title='EMA C Length', group='Moving Averages')out_c = ta.ema(close, len_c)plot(out_c, title='EMA B', color=color.green)// Strategy ConditionsstratGroup = 'Strategy'showLong = input.bool(true, title='Long entries', group=stratGroup)showShort = input.bool(false, title='Short entries', group=stratGroup)closeAfterXBars = input.bool(true, title='Close after X # bars', tooltip='If trade is in profit', group=stratGroup)xBars = input.int(24, title='# bars')entryLong = ta.crossover(out_a, out_b) and out_a > out_c and close > openexitLong = rsi > 70entryShort = ta.crossunder(out_a, out_b) and out_a < out_c and close < openexitShort = rsi < 30bought = strategy.opentrades[0] == 1 and strategy.position_size[0] > strategy.position_size[1]entry_price = ta.valuewhen(bought, open, 0)var int nPastBars = 0if strategy.position_size > 0    nPastBars := nPastBars + 1    nPastBarsif strategy.position_size == 0    nPastBars := 0    nPastBarsif closeAfterXBars    exitLong := nPastBars >= xBars and close > entry_price ? true : exitLong    exitLong    exitShort := nPastBars >= xBars and close < entry_price ? true : exitShort    exitShort// Long Entrystrategy.entry('Long', strategy.long, when=entryLong and showLong)strategy.close('Long', when=exitLong)// Short Entrystrategy.entry('Short', strategy.short, when=entryShort and showShort)strategy.close('Short', when=exitShort)