Zeal Terminal Open in Zeal Terminal

Pine Script v5 · Strategy

EMA Cross V1 for eth 4H

A Pine Script v5 strategy built on RSI (price, 26), Crossunder (vrsi, 70) and EMA (price, 17). It has 2 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 is one contract and pays no commission. 13 settings; defaults include Rsi Lenght 26, Rsi OVS line 30 and Rsi OVB line 70.

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 EMA Cross V1 for eth 4H repaint?
No
No repainting patterns were found in the source. The live replay was not measured: it had no trades to compare.
How did EMA Cross V1 for eth 4H do on BTCUSDT 1D with default settings?
+1.80%
From 26 Jan 2024 to 21 Oct 2026, over 3 closed trades, against +102.5% for buy and hold. A backtest, not investment advice.
Does EMA Cross V1 for eth 4H 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: 3 before, 3 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 EMA Cross V1 for eth 4H use a stop loss?
No
Every exit waits for a signal; nothing limits a losing trade before it fires.
Does EMA Cross V1 for eth 4H run in Zeal Terminal?
Yes
It compiles in 13 ms and runs 1,000 bars in 32 ms, in the browser.

BTCUSDT · 1D · default settings

  • Plot
  • Plot
  • Plot
  • 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 (13)
40,00060,00080,000100,000120,000AprJulOct2025AprJulOct2026AprJulOct$1,018,050$2,025,273Equity from $1,000,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
+1.80%
$18,047.40
Buy and hold
+102.5%
same period
Closed trades
3
1 won · 2 lost
Profitable
33.3%
of closed trades
Profit factor
2.08
gross profit ÷ gross loss
Max drawdown
1.95%
−$19,451.30

One run with the author's default settings, $1,000,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

    1 setting does nothing

    “Rsi OVS line” is declared but never read.

  • 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 52, 54. 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 Lenght26int · min 1 · max 50vrsi
Rsi OVS line30int · min 1 · max 40unused
Rsi OVB line70int · min 1 · max 100co cu
Rsi Medium line42int · min 1 · max 60co exitLong2
EMA Fast17int · min 1 · max 50emaF
EMA Medium35int · min 1 · max 100emaM
EMA Slow142int · min 1 · max 200emaS
Start Year2011int · min 2011 · max 2025entry Buy line 51
Start Month1int · min 1 · max 12entry Buy line 51
Start Day1int · min 1 · max 31entry Buy line 51
End Year2025int · min 2011 · max 2025entry Buy line 51
End Month1int · min 1 · max 12entry Buy line 51
End Day1int · min 1 · max 31entry Buy line 51

What it calculates

  • RSIprice, Rsi Lenght (26)vrsi · line 11
  • Crossundervrsi, Rsi OVB line (70)cu · line 13
  • EMAprice, EMA Fast (17)emaF · line 18
  • EMAprice, EMA Medium (35)emaM · line 19
  • EMAprice, EMA Slow (142)emaS · line 20
  • CrossunderemaF, emaMexitLong1 · line 47
  • Crossundervrsi, Rsi Medium line (42)exitLong2 · line 48

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.

lengthRsi Lenghtsetting · 26overBRsi OVB linesetting · 70FEMA Fastsetting · 17MEMA Mediumsetting · 35SEMA Slowsetting · 142mLineRsi Medium linesetting · 42closecloseprice datavrsiRSI→ vrsicuCrossunder→ cuemaFEMA→ emaFemaMEMA→ emaMemaSEMA→ emaSexitLong1Crossunder→ exitLong1exitLong2Crossunder→ exitLong2pricepricevaluecococonditionlongC1longC1conditionlongC2longC2conditionentry:BuyOpen Buystrategy.entryclose:BuyClose Buystrategy.closeplot:22plotplotplot:23plotplotplot:24plotplot

Order rules

OrderFires whenBy defaultLine
Open Buy longlongC1 and longC2On52
Close BuyexitLong1 or exitLong2On54

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+1.8%+102.5%333%2.081.9%26 Jan 2024 – 21 Oct 2026
BTCUSDT 4h0.0%+5.5%00%—0.0%8 May 2026 – 21 Oct 2026
ETHUSDT 1D+0.0%+9.8%333%1.100.1%26 Jan 2024 – 21 Oct 2026
ETHUSDT 4h0.0%+8.4%00%—0.0%8 May 2026 – 21 Oct 2026
SOLUSDT 1D−0.0%+16.7%333%0.880.0%26 Jan 2024 – 21 Oct 2026
SOLUSDT 4h0.0%+21.5%00%—0.0%8 May 2026 – 21 Oct 2026
BNBUSDT 1D+0.0%+148.3%450%1.510.0%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 market333%$18,047.40
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?

1.7%

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

0%2%
All 3 trades
SideEntryExitBarsP&L
long16 Jul 2024 64,724.105 Aug 2024 58,161.0020−$6,563.06
long24 Aug 2024 64,037.207 Sep 2024 53,963.0014−$10,074.30
long19 Sep 2024 61,760.009 Feb 2025 96,444.80143$34,684.80

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
EMA Cross V1 for eth 4H this page—v5 strategy+1.8%31.9%
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
EMA SCALPEUR + RSi - SHORT by YukalMoonrsi emav5 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.

  • 2 strategy calls use the when = argument (line 52, 54). 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 3 trades and the same P&L on BTCUSDT 1D, 1,000 bars, in Zeal Terminal's engine.

  • Line 52: when = longC1 and longC2 → if block
  • Line 54: when = exitLong1 or exitLong2 → if block
⋯if time >=start and time <=end-    strategy.entry("Buy", strategy.long , when = longC1 and longC2)+    if longC1 and longC2+        strategy.entry("Buy", strategy.long )// if(exitLong1 or exitLong2)-strategy.close("Buy" , when = exitLong1 or exitLong2)+if exitLong1 or exitLong2+    strategy.close("Buy" )    ⋯

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

⋯// © chadsadachai-//@version=5+//@version=6strategy("EMA Cross V1", overlay= true)⋯

Where it runs

EngineCompilesRunsMatches TradingView
Zeal Terminal · OpenPineScript v2Yes 13 msYes 1,000 bars in 32 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/// © chadsadachai//@version=5strategy("EMA Cross V1", overlay= true)//rsilength = input.int(title = "Rsi Lenght" , defval=26 , minval=1, maxval=50)overS = input.int(title = "Rsi OVS line" , defval=30 , minval=1, maxval=40)overB = input.int(title = "Rsi OVB line" , defval=70 , minval=1, maxval=100)mLine = input.int(title = "Rsi Medium line" , defval=42 , minval=1, maxval=60)price = closevrsi = ta.rsi(price, length)co = vrsi >= mLine and vrsi < overB cu = ta.crossunder(vrsi, overB)//emaF = input.int(title = "EMA Fast" , defval=17 , minval=1, maxval=50)M = input.int(title = "EMA Medium" , defval=35, minval=1, maxval=100)S = input.int(title = "EMA Slow" , defval=142, minval=1, maxval=200)emaF = ta.ema(price , F)emaM = ta.ema(price , M)emaS = ta.ema(price , S)//plotplot(emaF , color = color.green , linewidth=1)plot(emaM , color = color.yellow , linewidth=1)plot(emaS , color = color.red , linewidth=1)//Time Stampstart = timestamp(input.int(title = "Start Year" , defval=2011 , minval=2011, maxval=2025), input.int(title = "Start Month" , defval=1 , minval=1, maxval=12), input.int(title = "Start Day" , defval=1 , minval=1, maxval=31), 0, 0)end = timestamp(input.int(title = "End Year" , defval=2025 , minval=2011, maxval=2025), input.int(title = "End Month" , defval=1 , minval=1, maxval=12), input.int(title = "End Day" , defval=1 , minval=1, maxval=31), 0, 0)// years = input.int(title = "Year" , defval=2018 , minval=2011, maxval=2025)// months = input.int(title = "Month" , defval=1 , minval=1, maxval=12)// days = input.int(title = "Day" , defval=1 , minval=1, maxval=31)//longCondition Default// longCondition1 = EMA_Fast >= EMA_Slow and EMA_Fast >= EMA_Medium//ta.crossover(EMA_Fast, EMA_Slow)  EMA_Fast > EMA_Slow and EMA_Medium > EMA_Slow// longCondition3 = price >= EMA_Medium and price > EMA_Slow// longCondition2 = vrsi >= overSold and vrsi <= overBought //longCondition & shortCondition ETHUSD// 1.price > emaF > emaM > emaS// 2.rsi overcross overSlongC1 = price > emaF and price > emaM and price > emaS // longC1 = ta.crossover(emaF, emaM)longC2 = if longC1    co// shortC1 = EMA_Fast < EMA_Medium //and EMA_Fast < EMA_Slow and EMA_Medium < EMA_Slow //and cu// shortC2 = overBought > vrsi //and vrsi < overBought //overSold < vrsi and vrsi < mediumLine// exitLong Condition// 1.price < emaF < emaM < emaS// 2.rsi overcross mediumLineexitLong1 = ta.crossunder(emaF, emaM) //or emaF < emaM//and price < emaM and price < emaFexitLong2 = ta.crossunder(vrsi,mLine)//exitLong3 = price < emaM//strategy.entryif time >=start and time <=end    strategy.entry("Buy", strategy.long , when = longC1 and longC2)// if(exitLong1 or exitLong2)strategy.close("Buy" , when = exitLong1 or exitLong2)    // exitShort1 = EMA_Fast > EMA_Medium// //exitShort2 = ta.crossover(vrsi , mediumLine) // exitShort2 = ta.crossunder (vrsi,mediumLine)// strategy.close("Short" , when = exitShort1 or exitShort2)// //shortCondition = cu// //if (shortCondition1 and shortCondition2)//     //strategy.entry("My Short Entry Id", strategy.short)