Zeal Terminal Open in Zeal Terminal

Pine Script v4 · Strategy

Galileo Galilei

A Pine Script v4 strategy built on EMA (open, 11). It has 3 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 100000 in cash and pays no commission. 4 settings; defaults include Length 11 and Source open.

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

BTCUSDT · 1D · default settings

  • EMA
  • Shape
  • Shape
  • 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 (4)
40,00060,00080,000100,000120,000AprJulOct2025AprJulOct2026AprJulOct$116,925$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.
Net profit
+16.93%
$16,925.50
Buy and hold
+102.5%
same period
Closed trades
61
17 won · 44 lost
Profitable
27.9%
of closed trades
Profit factor
1.16
gross profit ÷ gross loss
Max drawdown
42.25%
−$52,810.30

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

  • Check

    No commission

    The backtest assumes free trading. Results on any real exchange will be lower.

  • Note

    2 settings have no label

    In the settings dialog startDate (line 14), finishDate (line 15) show an empty name. The labels on this page come from the variable names.

  • 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 23, 27. The upgraded version below moves each call inside an if block.

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 ema → ta.ema, cross → ta.cross.
  • 2 strategy calls use the when = argument (line 23, 27). It is deprecated in v5 and removed in v6, where each call moves inside an if block.

v4 → v5

Verified

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

  • Line 1: //@version=4 → //@version=5
  • Line 7: ema → ta.ema
  • Line 14: input(type = input.time) → input.time()
  • Line 15: input(type = input.time) → input.time()
  • Line 18: cross → ta.cross
  • Line 19: cross → ta.cross
-//@version=4+//@version=5// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/⋯src = input(open, title="Source")-out = ema(src, len)+out = ta.ema(src, len)plot(out, title="EMA", color=color.yellow)⋯/////////// BACKTESTING start//////////-startDate = input(timestamp("2020-01-01"), type = input.time)+startDate = input.time(timestamp("2020-01-01"))-finishDate = input(timestamp("2025-01-01"), type = input.time)+finishDate = input.time(timestamp("2025-01-01"))time_cond = time >= startDate and time <= finishDate/////////// BACKTESTING end//////////-bearish = cross(close, out) == 1 and close[1] > close+bearish = ta.cross(close, out) == 1 and close[1] > close-bullish = cross(close, out) == 1 and close[1] < close+bullish = ta.cross(close, out) == 1 and close[1] < closeplotshape(bearish, color=color.white, style=shape.arrowdown, text="BEAR", location=location.abovebar)⋯

Clean v5

VerifiedDownload the v5 script

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

  • Line 5: input() → input.int()
  • Line 6: input() → input.source()
  • Line 23: when = time_cond → if block
  • Line 27: when = time_cond → if block
⋯strategy(title="Galileo Galilei", shorttitle="Galileo Galilei", overlay=true, initial_capital=100000, default_qty_type=strategy.cash, default_qty_value=100000)-len = input(11, minval=1, title="Length")+len = input.int(11, minval=1, title="Length")-src = input(open, title="Source")+src = input.source(open, title="Source")out = ta.ema(src, len)⋯if bullish-    strategy.entry("BUY", strategy.long, when=time_cond)+    if time_cond+        strategy.entry("BUY", strategy.long)        //strategy.close_all(when=bearish)⋯if bearish-    strategy.entry("SELL", strategy.short, when=time_cond)+    if time_cond+        strategy.entry("SELL", strategy.short)        //sell = if bearish⋯

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

-//@version=5+//@version=6// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/⋯

Settings

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

SettingDefaultType and rangeFeeds
Length11int · min 1out
Sourceopensourceout
Start Date (no label in the script)timestamp("2020-01-01")timetime_cond
Finish Date (no label in the script)timestamp("2025-01-01")timetime_cond

What it calculates

  • EMA (ema, ta.ema in v5)Source (open), Length (11)out · line 7

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.

openopenprice datalenLengthsetting · 11timetimeprice datastartDateStart Datesetting · timestamp("2020-01-…finishDateFinish Datesetting · timestamp("2025-01-…closecloseprice dataoutEMA→ outprofitprofitvaluetime_condtime_condconditionbearishbearishconditionbullishbullishconditionentry:BUYOpen BUYstrategy.entryentry:SELLOpen SELLstrategy.entryclose_all:close_all strategy.close_allplot:8EMAplotplotshape:20plotshapeplotshapeplotshape:21plotshapeplotshape

Order rules

OrderFires whenBy defaultLine
Open BUY longtime_condtime >= startDate and time <= finishDateOn23
Open SELL shorttime_condtime >= startDate and time <= finishDateOn27
Close not time_condOn33

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+16.9%+102.5%6128%1.1642.2%26 Jan 2024 – 21 Oct 2026
BTCUSDT 4h0.0%+5.5%00%—0.0%8 May 2026 – 21 Oct 2026
ETHUSDT 1D+12.4%+9.8%4340%1.1341.8%26 Jan 2024 – 21 Oct 2026
ETHUSDT 4h0.0%+8.4%00%—0.0%8 May 2026 – 21 Oct 2026
SOLUSDT 1D+67.0%+16.7%5531%1.4447.0%26 Jan 2024 – 21 Oct 2026
SOLUSDT 4h0.0%+21.5%00%—0.0%8 May 2026 – 21 Oct 2026
BNBUSDT 1D+16.2%+148.3%5931%1.1625.5%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 market3123%$6,588.47
Sideways market2733%$11,802.60
Falling market333%−$1,465.57

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

How bad could the drawdown be?

43.2%

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

0%50%
All 61 trades
SideEntryExitBarsP&L
short24 Feb 2024 50,744.2025 Feb 2024 51,568.201−$1,623.95
long25 Feb 2024 51,568.2017 Mar 2024 65,300.6021$26,629.60
short17 Mar 2024 65,300.6018 Mar 2024 68,393.501−$4,736.29
long18 Mar 2024 68,393.5019 Mar 2024 67,610.001−$1,145.53
short19 Mar 2024 67,610.0021 Mar 2024 67,840.502−$340.94
long21 Mar 2024 67,840.5022 Mar 2024 65,501.301−$3,448.13
short22 Mar 2024 65,501.3025 Mar 2024 67,210.003−$2,608.68
long25 Mar 2024 67,210.003 Apr 2024 65,464.009−$2,597.84
short3 Apr 2024 65,464.005 Apr 2024 68,487.802−$4,619.04
long5 Apr 2024 68,487.806 Apr 2024 67,820.601−$974.14
short6 Apr 2024 67,820.607 Apr 2024 68,896.001−$1,585.61
long7 Apr 2024 68,896.0013 Apr 2024 67,116.506−$2,582.85
short13 Apr 2024 67,116.5023 Apr 2024 66,819.3010$442.81
long23 Apr 2024 66,819.3025 Apr 2024 64,289.602−$3,785.94
short25 Apr 2024 64,289.604 May 2024 62,882.009$2,189.42
long4 May 2024 62,882.008 May 2024 62,312.104−$906.36
short8 May 2024 62,312.1010 May 2024 63,074.002−$1,222.76
long10 May 2024 63,074.0011 May 2024 60,800.001−$3,605.30
short11 May 2024 60,800.0014 May 2024 62,940.103−$3,519.90
long14 May 2024 62,940.1015 May 2024 61,577.501−$2,164.92
short15 May 2024 61,577.5016 May 2024 66,206.501−$7,517.39
long16 May 2024 66,206.5030 May 2024 67,652.4014$2,183.92
short30 May 2024 67,652.4031 May 2024 68,352.201−$1,034.35
long31 May 2024 68,352.201 Jun 2024 67,540.001−$1,188.20
short1 Jun 2024 67,540.004 Jun 2024 68,809.903−$1,880.19
long4 Jun 2024 68,809.9012 Jun 2024 67,314.208−$2,173.61
short12 Jun 2024 67,314.201 Jul 2024 62,772.0019$6,747.78
long1 Jul 2024 62,772.003 Jul 2024 62,135.502−$1,014.07
short3 Jul 2024 62,135.5014 Jul 2024 59,204.0011$4,717.84
long14 Jul 2024 59,204.0031 Jul 2024 66,188.0017$11,796.50
short31 Jul 2024 66,188.009 Aug 2024 61,686.009$6,801.84
long9 Aug 2024 61,686.0012 Aug 2024 58,712.603−$4,820.24
short12 Aug 2024 58,712.6014 Aug 2024 60,587.202−$3,192.79
long14 Aug 2024 60,587.2015 Aug 2024 58,683.401−$3,142.20
short15 Aug 2024 58,683.4018 Aug 2024 59,492.003−$1,377.90
long18 Aug 2024 59,492.0019 Aug 2024 58,427.301−$1,789.55
short19 Aug 2024 58,427.3020 Aug 2024 59,438.501−$1,730.61
long20 Aug 2024 59,438.5021 Aug 2024 59,013.801−$714.52
short21 Aug 2024 59,013.8022 Aug 2024 61,156.001−$3,630.05
long22 Aug 2024 61,156.0028 Aug 2024 59,415.006−$2,846.87
short28 Aug 2024 59,415.0010 Sep 2024 57,042.0013$3,993.92
long10 Sep 2024 57,042.0017 Sep 2024 58,214.007$2,054.59
short17 Sep 2024 58,214.0018 Sep 2024 60,314.001−$3,607.38
long18 Sep 2024 60,314.001 Oct 2024 63,327.6013$4,996.54
short1 Oct 2024 63,327.607 Oct 2024 62,819.906$801.69
long7 Oct 2024 62,819.908 Oct 2024 62,224.001−$948.59
short8 Oct 2024 62,224.0012 Oct 2024 62,540.004−$507.81
long12 Oct 2024 62,540.0024 Oct 2024 66,668.6012$6,601.63
short24 Oct 2024 66,668.6025 Oct 2024 68,198.301−$2,294.36
long25 Oct 2024 68,198.3026 Oct 2024 66,698.301−$2,199.40
short26 Oct 2024 66,698.3027 Oct 2024 67,092.801−$591.38
long27 Oct 2024 67,092.804 Nov 2024 68,776.008$2,508.81
short4 Nov 2024 68,776.006 Nov 2024 69,372.002−$866.61
long6 Nov 2024 69,372.0026 Nov 2024 93,010.0020$34,074.30
short26 Nov 2024 93,010.0028 Nov 2024 95,863.102−$3,067.52
long28 Nov 2024 95,863.1010 Dec 2024 97,276.5012$1,474.36
short10 Dec 2024 97,276.5012 Dec 2024 101,125.002−$3,956.27
long12 Dec 2024 101,125.0019 Dec 2024 100,204.007−$910.74
short19 Dec 2024 100,204.0025 Dec 2024 98,663.606$1,537.29
long25 Dec 2024 98,663.6027 Dec 2024 95,791.602−$2,910.88
short27 Dec 2024 95,791.603 Jan 2025 96,984.807−$1,245.61

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
Galileo Galilei this page—v4 strategy+16.9%6142.2%
STR-EMA Oscilator [Azzrael] by Azzraelema crossv5 strategy+2.3%630.6%
Double EMA CROSS by EmreErturk_ema crossv4 strategy+5.1%934.5%
EMA Stoch Strategy For ProfitView by treigenema crossv5 strategy−69.8%580.6%
5 Minute EMA Cross Strategy by jordanfrayema crossv5 strategy+3.4%97.5%
Moving Average Crossover Strategy by Decam9ema crossv5 strategy+0.0%754.3%

Where it runs

EngineCompilesRunsMatches TradingView
Zeal Terminal · OpenPineScript v2Yes 9 msYes 1,000 bars in 27 msNot measured
PineTSNo v5 and v6 only—Not 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. 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.

//@version=4// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/// © armigoldmanstrategy(title="Galileo Galilei", shorttitle="Galileo Galilei", overlay=true, initial_capital=100000, default_qty_type=strategy.cash, default_qty_value=100000)len = input(11, minval=1, title="Length")src = input(open, title="Source")out = ema(src, len)plot(out, title="EMA", color=color.yellow)//last8h = highest(close, 8)//lastl8 = lowest(close, 8)//plot(last8h, color=red, linewidth=2)//plot(lastl8, color=green, linewidth=2)/////////// BACKTESTING start//////////startDate = input(timestamp("2020-01-01"), type = input.time)finishDate = input(timestamp("2025-01-01"), type = input.time)time_cond = time >= startDate and time <= finishDate/////////// BACKTESTING end//////////bearish = cross(close, out) == 1 and close[1] > closebullish = cross(close, out) == 1 and close[1] < closeplotshape(bearish, color=color.white, style=shape.arrowdown, text="BEAR", location=location.abovebar)plotshape(bullish, color=color.white, style=shape.arrowup, text="BULL", location=location.belowbar)if bullish    strategy.entry("BUY", strategy.long, when=time_cond)        //strategy.close_all(when=bearish)        // strategy.exit("exit", "Long", profit =, loss = 35)if bearish    strategy.entry("SELL", strategy.short, when=time_cond)        //sell = if bearish        //strategy.close_all(when=bullish)        // strategy.exit("exit", "Long", profit = bullish, loss = 100)profit = strategy.netprofitif not time_cond    strategy.close_all()//plotshape(true, style=shape.triangleup, location=location.abovebar)