Zeal Terminal Open in Zeal Terminal

Pine Script v5 · Strategy

GENESIS

A Pine Script v5 strategy built on EMA (close, lenght1), Crossover (ema1, ema2) and Crossunder (ema1, ema2). It has 4 order rules, 2 entries among them, and trades long and short with the default settings. Exits use a stop loss and a profit target. Each trade is one contract and pays no commission. It has no settings.

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 GENESIS repaint?
No
No repainting patterns were found in the source, and a live tick-by-tick replay matched history on 4 of 4 trades.
How did GENESIS do on BTCUSDT 1D with default settings?
+0.13%
From 26 Jan 2024 to 21 Oct 2026, over 19 closed trades, against +102.5% for buy and hold. A backtest, not investment advice.
Does GENESIS 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: 19 before, 15 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 GENESIS use a stop loss?
Yes
strategy.exit sets a stop on line 16, 18.
Does GENESIS run in Zeal Terminal?
Yes
It compiles in 16 ms and runs 1,000 bars in 19 ms, in the browser.

BTCUSDT · 1D · default settings

  • Señal para Long
  • Señal para Short
  • 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 (0)
40,00060,00080,000100,000120,000AprJulOct2025AprJulOct2026AprJulOct$1,013,000$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
+0.13%
$1,317.21
Buy and hold
+102.5%
same period
Closed trades
19
7 won · 12 lost
Profitable
36.8%
of closed trades
Profit factor
1.03
gross profit ÷ gross loss
Max drawdown
2.68%
−$27,535.90

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

The script declares no settings.

What it calculates

  • EMAclose, lenght1ema1 · line 7
  • EMAclose, lenght2ema2 · line 8
  • Crossoverema1, ema2long · line 9
  • Crossoverema2, ema1short · line 10
  • Crossoverema1, ema2LongSignal · line 11
  • Crossunderema1, ema2ShortSignal · line 12

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 dataema1EMA→ ema1ema2EMA→ ema2longCrossover→ longshortCrossover→ shortLongSignalCrossover→ LongSignalShortSignalCrossunder→ ShortSignalentry:longOpen longstrategy.entryexit:Exitexit Exitstrategy.exitentry:shortOpen shortstrategy.entryplotshape:13Señal para Longplotshapeplotshape:14Señal para Shortplotshape

Order rules

OrderFires whenBy defaultLine
Open long longlongOn15
Exit Exit stop and limitevery barOn16
Open short shortshortOn17
Exit Exit stop and limitevery barOn18

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.

4/4trades 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+0.1%+102.5%1937%1.032.7%26 Jan 2024 – 21 Oct 2026
BTCUSDT 4h+1.3%+5.5%1242%3.450.3%8 May 2026 – 21 Oct 2026
ETHUSDT 1D+0.0%+9.8%1533%1.320.1%26 Jan 2024 – 21 Oct 2026
ETHUSDT 4h+0.0%+8.4%1644%1.320.0%8 May 2026 – 21 Oct 2026
SOLUSDT 1D−0.0%+16.7%2343%0.420.0%26 Jan 2024 – 21 Oct 2026
SOLUSDT 4h+0.0%+21.5%1250%8.330.0%8 May 2026 – 21 Oct 2026
BNBUSDT 1D+0.0%+148.3%1164%2.110.0%26 Jan 2024 – 21 Oct 2026
BNBUSDT 4h−0.0%+17.1%2524%0.960.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 market425%−$5,393.87
Sideways market1242%$14,566.70
Falling market333%−$7,855.61

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

How bad could the drawdown be?

4.4%

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

0%5%
All 19 trades
SideEntryExitBarsP&L
short4 May 2024 62,882.004 May 2024 62,881.900$0.10
long5 May 2024 63,892.008 May 2024 62,312.103−$1,579.96
short8 May 2024 62,312.108 May 2024 62,312.100−$0.02
long18 May 2024 67,024.0024 Jun 2024 63,210.0037−$3,813.99
short24 Jun 2024 63,210.0024 Jun 2024 63,210.000−$0.02
long23 Jul 2024 67,532.006 Aug 2024 54,018.8014−$13,513.20
short6 Aug 2024 54,018.806 Aug 2024 54,018.700$0.10
long23 Sep 2024 63,578.8018 Feb 2025 95,780.00148$32,201.20
short18 Feb 2025 95,780.0018 Feb 2025 95,780.000−$0.02
long25 Apr 2025 93,980.5030 Aug 2025 108,377.00127$14,396.90
short30 Aug 2025 108,377.0030 Aug 2025 108,377.000−$0.02
long16 Sep 2025 115,350.0026 Sep 2025 108,994.0010−$6,355.22
short26 Sep 2025 108,994.0026 Sep 2025 108,994.000$0.10
long2 Oct 2025 118,595.0018 Oct 2025 106,432.0016−$12,163.30
short18 Oct 2025 106,432.0018 Oct 2025 106,432.000$0.10
long18 Jan 2026 95,147.8021 Jan 2026 88,427.703−$6,720.11
short21 Jan 2026 88,427.7021 Jan 2026 88,427.600$0.10
long16 Apr 2026 74,810.001 Jun 2026 73,674.4046−$1,135.60
short1 Jun 2026 73,674.401 Jun 2026 73,674.400−$0.02

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
GENESIS this page—v5 strategy+0.1%192.7%
EMA Slope AyE by fajardoarelysemav4 strategyNo trades on this market
ROoT by realisticDove62527emav5 strategy−4.7%2259.4%
sachin5986 by mohitesachin78emav4 strategy+32.1%3517.6%
sonu1997 by Sonu1997emav4 strategy+960.7%21,103.8%
Moving Average Crossover by Muh4mm4demav4 strategy+19,990.1%301,274.2%

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 15, 17). 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 19 trades and the same P&L on BTCUSDT 1D, 1,000 bars, in Zeal Terminal's engine.

  • Line 15: when = long → if block
  • Line 17: when = short → if block
⋯plotshape(ShortSignal , title="Señal para Short", color= color.red, location=location.abovebar, size=size.tiny, text="Short", textcolor=color.white)-strategy.entry("long", strategy.long, when = long)+if long+    strategy.entry("long", strategy.long)strategy.exit("Exit", "Long", profit = 10, loss = 2)-strategy.entry("short", strategy.short, when = short)+if short+    strategy.entry("short", strategy.short)strategy.exit("Exit", "short", profit = 10, loss = 2)

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

⋯// © genesisjgonzalezh-//@version=5+//@version=6strategy("GENESIS", overlay=true)⋯

Where it runs

EngineCompilesRunsMatches TradingView
Zeal Terminal · OpenPineScript v2Yes 16 msYes 1,000 bars in 19 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/// © genesisjgonzalezh//@version=5strategy("GENESIS", overlay=true)lenght1= (20)lenght2= (50)ema1= ta.ema(close, lenght1)ema2 = ta.ema(close, lenght2)long = ta.crossover(ema1,ema2)short = ta.crossover(ema2,ema1)LongSignal  = ta.crossover (ema1,ema2)ShortSignal = ta.crossunder (ema1,ema2)plotshape(LongSignal , title="Señal para Long", color= color.green, location=location.belowbar, size=size.tiny, text="Long", textcolor=color.white)plotshape(ShortSignal , title="Señal para Short", color= color.red, location=location.abovebar, size=size.tiny, text="Short", textcolor=color.white)strategy.entry("long", strategy.long, when = long)strategy.exit("Exit", "Long", profit = 10, loss = 2)strategy.entry("short", strategy.short, when = short)strategy.exit("Exit", "short", profit = 10, loss = 2)