Zeal Terminal Open in Zeal Terminal

Pine Script v4 · Strategy

EURUSD 5min london session strategy

A Pine Script v4 strategy built on SMA (high, 5) and RSI (close, 5). It has 5 order rules, 2 entries among them, and trades long only with the default settings. Exits use a stop loss and a profit target. Each trade is one contract and pays no commission. 14 settings; defaults include Length 5, Source high and Offset 0.

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 EURUSD 5min london session strategy repaint?
No
No repainting patterns were found in the source. The live replay was not measured: it had no trades to compare.
How did EURUSD 5min london session strategy do on BTCUSDT 1D with default settings?
Not measured
It closed no trades there from 26 Jan 2024 to 21 Oct 2026 with the default settings, so there is no result to report. Its entry conditions never all held on this data. On BTCUSDT 4h it did trade; that row of the markets table below has its figures. A backtest, not investment advice.
Can EURUSD 5min london session strategy be converted to Pine Script v5?
No
The automatic step from v4 to v5 changes the results, so no v5 download is offered; the edits are shown below.
Does EURUSD 5min london session strategy use a stop loss?
Yes
strategy.exit sets a stop on line 27, 30.
Does EURUSD 5min london session strategy run in Zeal Terminal?
Yes
It compiles in 14 ms and runs 1,000 bars in 45 ms, in the browser.

BTCUSDT · 1D · default settings

  • MA
  • MA
  • 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 (14)
40,00060,00080,000100,000120,000AprJulOct2025AprJulOct2026AprJulOct$100,000$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. Zeal Terminal's engine currently reads an order side written as 1 as a short, whatever it says; this page passes the same side as strategy.long or strategy.short (lines 25, 28) so the engine trades the way the script says. 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
0.00%
$0.00
Buy and hold
+102.5%
same period
Closed trades
0
0 won · 0 lost
Profitable
0.0%
of closed trades
Profit factor
—
gross profit ÷ gross loss
Max drawdown
0.00%
$0.00

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 commission

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

  • Note

    3 settings have no label

    In the settings dialog length (line 16), overSold (line 17), overBought (line 18) 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 25, 28, 35. 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 sma → ta.sma, rsi → ta.rsi.
  • 3 strategy calls use the when = argument (line 25, 28, 35). It is deprecated in v5 and removed in v6, where each call moves inside an if block.

v4 → v5

Differs

Trades differ: 11 before, 11 after on BTCUSDT 4h, 1,000 bars, in Zeal Terminal's engine.

  • Line 3: //@version=4 → //@version=5
  • Line 8: input(type = input.integer) → input.int()
  • Line 9: sma → ta.sma
  • Line 13: input(type = input.integer) → input.int()
  • Line 14: sma → ta.sma
  • Line 20: rsi → ta.rsi
3 more edits
  • Line 25: strategy.entry(…, 1) → strategy.entry(…, strategy.long)
  • Line 28: strategy.entry(…, 1) → strategy.entry(…, strategy.long)
  • Line 32: input(type = input.float) → input.float()
⋯// © SoftKill21-//@version=4+//@version=5strategy(title="Moving Average", shorttitle="MA", overlay=true)⋯src = input(high, title="Source")-offset = input(title="Offset", type=input.integer, defval=0, minval=-500, maxval=500)+offset = input.int(title="Offset", defval=0, minval=-500, maxval=500)-out = sma(src, len)+out = ta.sma(src, len)plot(out, color=color.white, title="MA", offset=offset)⋯src2 = input(low, title="Source")-offset2 = input(title="Offset", type=input.integer, defval=0, minval=-500, maxval=500)+offset2 = input.int(title="Offset", defval=0, minval=-500, maxval=500)-out2 = sma(src2, len2)+out2 = ta.sma(src2, len2)plot(out2, color=color.white, title="MA", offset=offset2)⋯price = input(close, title="Source RSI")-vrsi = rsi(price, length)+vrsi = ta.rsi(price, length)longcond= close > out and close > out2 and vrsi > overBought and timeinrange(timeframe.period, "0300-1100")⋯sl=input(80,title="sl")-strategy.entry("long",1,when=longcond)+strategy.entry("long",strategy.long,when=longcond)//strategy.close("long",when= close < out2)strategy.exit("long_exit","long",profit=tp,loss=sl)-strategy.entry("short",1,when=shortcont)+strategy.entry("short",strategy.long,when=shortcont)//strategy.close("short",when=close >out)⋯maxOrder = input(6, title="max trades per day")-maxRisk = input(2,type=input.float, title="maxrisk per day")+maxRisk = input.float(2, title="maxrisk per day")strategy.risk.max_intraday_filled_orders(maxOrder)⋯

Clean v5

Verified

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

  • Line 6: input() → input.int()
  • Line 7: input() → input.source()
  • Line 11: input() → input.int()
  • Line 12: input() → input.source()
  • Line 16: input() → input.int()
  • Line 17: input() → input.int()
8 more edits
  • Line 18: input() → input.int()
  • Line 19: input() → input.source()
  • Line 23: input() → input.int()
  • Line 24: input() → input.int()
  • Line 25: when = longcond → if block
  • Line 28: when = shortcont → if block
  • Line 31: input() → input.int()
  • Line 35: when = not timeinrange(timeframe.period, "0300-1100") → if block
⋯timeinrange(res, sess) => time(res, sess) != 0-len = input(5, minval=1, title="Length")+len = input.int(5, minval=1, title="Length")-src = input(high, title="Source")+src = input.source(high, title="Source")offset = input.int(title="Offset", defval=0, minval=-500, maxval=500)⋯plot(out, color=color.white, title="MA", offset=offset)-len2 = input(5, minval=1, title="Length")+len2 = input.int(5, minval=1, title="Length")-src2 = input(low, title="Source")+src2 = input.source(low, title="Source")offset2 = input.int(title="Offset", defval=0, minval=-500, maxval=500)⋯plot(out2, color=color.white, title="MA", offset=offset2)-length = input( 5 )+length = input.int( 5 )-overSold = input( 10 )+overSold = input.int( 10 )-overBought = input( 80 )+overBought = input.int( 80 )-price = input(close, title="Source RSI")+price = input.source(close, title="Source RSI")vrsi = ta.rsi(price, length)⋯shortcont = close < out and close < out2 and vrsi < overSold and timeinrange(timeframe.period, "0300-1100")-tp=input(150,title="tp")+tp=input.int(150,title="tp")-sl=input(80,title="sl")+sl=input.int(80,title="sl")-strategy.entry("long",strategy.long,when=longcond)+if longcond+    strategy.entry("long",strategy.long)//strategy.close("long",when= close < out2)strategy.exit("long_exit","long",profit=tp,loss=sl)-strategy.entry("short",strategy.long,when=shortcont)+if shortcont+    strategy.entry("short",strategy.long)//strategy.close("short",when=close >out)strategy.exit("short_exit","short",profit=tp,loss=sl)-maxOrder = input(6, title="max trades per day")+maxOrder = input.int(6, title="max trades per day")maxRisk = input.float(2, title="maxrisk per day")⋯strategy.risk.max_intraday_loss(maxRisk, strategy.percent_of_equity)-strategy.close_all(when =not timeinrange(timeframe.period, "0300-1100"))+if not timeinrange(timeframe.period, "0300-1100")+    strategy.close_all()

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: 11 before, 8 after on BTCUSDT 4h, 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.

⋯// © SoftKill21-//@version=5+//@version=6strategy(title="Moving Average", shorttitle="MA", overlay=true)⋯

Settings

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

SettingDefaultType and rangeFeeds
Length5int · min 1out
Sourcehighsourceout
Offset0int (written input.integer) · min -500 · max 500MA
Length5int · min 1out2
Sourcelowsourceout2
Offset0int (written input.integer) · min -500 · max 500MA
Length (no label in the script)5intvrsi
Over Sold (no label in the script)10intshortcont
Over Bought (no label in the script)80intlongcond
Source RSIclosesourcevrsi
tp150intexit long_exit exit short_exit
sl80intexit long_exit exit short_exit
max trades per day6intline 33
maxrisk per day2floatline 34

What it calculates

  • SMA (sma, ta.sma in v5)Source (high), Length (5)out · line 9
  • SMA (sma, ta.sma in v5)Source (low), Length (5)out2 · line 14
  • RSI (rsi, ta.rsi in v5)Source RSI (close), Length (5)vrsi · line 20

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.

highhighprice datalenLengthsetting · 5lowlowprice datalen2Lengthsetting · 5closecloseprice datalengthLengthsetting · 5overBoughtOver Boughtsetting · 80overSoldOver Soldsetting · 10outSMA→ outout2SMA→ out2vrsiRSI→ vrsilongcondlongcondconditionshortcontshortcontconditionentry:longOpen longstrategy.entryexit:long_exitexit long_exitstrategy.exitentry:shortOpen shortstrategy.entryexit:short_exitexit short_exitstrategy.exitclose_all:close_all strategy.close_allplot:10MAplotplot:15MAplot

Order rules

OrderFires whenBy defaultLine
Open long longlongcondclose > out and close > out2 and vrsi > overBought and timeinrange(timeframe.period, "0300-1100")On25
Exit long_exit stop and limitevery barOn27
Open short longshortcontclose < out and close < out2 and vrsi < overSold and timeinrange(timeframe.period, "0300-1100")On28
Exit short_exit stop and limitevery barOn30
Close not timeinrange(timeframe.period, "0300-1100")On35

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 1D0.0%+102.5%00%—0.0%26 Jan 2024 – 21 Oct 2026
BTCUSDT 4h−2.0%+5.5%1118%0.002.0%8 May 2026 – 21 Oct 2026
ETHUSDT 1D0.0%+9.8%00%—0.0%26 Jan 2024 – 21 Oct 2026
ETHUSDT 4h−0.0%+8.4%1217%0.380.0%8 May 2026 – 21 Oct 2026
SOLUSDT 1D0.0%+16.7%00%—0.0%26 Jan 2024 – 21 Oct 2026
SOLUSDT 4h+0.0%+21.5%1369%4.790.0%8 May 2026 – 21 Oct 2026
BNBUSDT 1D0.0%+148.3%00%—0.0%26 Jan 2024 – 21 Oct 2026
BNBUSDT 4h+0.0%+17.1%1242%1.340.0%8 May 2026 – 21 Oct 2026

Backtests are simulations on historical data and are not investment advice.

Settings heatmap

Two settings that feed the entry signal, moved around their defaults. The best in-sample pair (Length 3, Length 3) made 0.0% before 26 Dec 2025 and 0.0% after it, against 0.0% for the defaults. 0% of the 36 combinations made money in-sample and 0% out-of-sample.

Before 26 Dec 2025 · in-sample
Length ↓ · Length →345679
30%0%0%0%0%0%
40%0%0%0%0%0%
50%0%0%0%0%0%
60%0%0%0%0%0%
70%0%0%0%0%0%
90%0%0%0%0%0%
From 26 Dec 2025 · out-of-sample
Length ↓ · Length →345679
30%0%0%0%0%0%
40%0%0%0%0%0%
50%0%0%0%0%0%
60%0%0%0%0%0%
70%0%0%0%0%0%
90%0%0%0%0%0%

Net P&L of trades opened in each period, as a share of starting capital. marks the defaults and the best in-sample cell. Hover a cell for its trade count. Backtests are simulations on historical data and are not investment advice.

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
EURUSD 5min london session strategy this page—v4 strategy0.0%00.0%
SRJ RSI Outperformer Strategy by Sapt_Jashrsi smav5 strategy+0.6%82.4%
RSI SMA Crossover Strategy by reeesrsi smav5 strategy+39.8%4230.8%
Short In Downtrend Below MA100 (Coinrule) by Coinrulesma rsiv4 strategy−34.5%9945.4%
Simple RSI and SMA Long and Short (by Coinrule) by Coinrulersi smav5 strategy−3.0%217.7%
Maximized Moving Average Crossing (by Coinrule) by Coinrulesma rsiv4 strategy−6.6%913.3%

Where it runs

EngineCompilesRunsMatches TradingView
Zeal Terminal · OpenPineScript v2Yes 14 msWith a workaround 1,000 bars in 45 msNot measured
PineTSNo v5 and v6 only—Not measured

Zeal Terminal's engine currently reads an order side written as 1 as a short, whatever it says; this page passes the same side as strategy.long or strategy.short (lines 25, 28) so the engine trades the way the script says. 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. 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.

// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/// © SoftKill21//@version=4strategy(title="Moving Average", shorttitle="MA", overlay=true)timeinrange(res, sess) => time(res, sess) != 0len = input(5, minval=1, title="Length")src = input(high, title="Source")offset = input(title="Offset", type=input.integer, defval=0, minval=-500, maxval=500)out = sma(src, len)plot(out, color=color.white, title="MA", offset=offset)len2 = input(5, minval=1, title="Length")src2 = input(low, title="Source")offset2 = input(title="Offset", type=input.integer, defval=0, minval=-500, maxval=500)out2 = sma(src2, len2)plot(out2, color=color.white, title="MA", offset=offset2)length = input( 5 )overSold = input( 10 )overBought = input( 80 )price = input(close, title="Source RSI")vrsi = rsi(price, length)longcond= close > out and close > out2 and vrsi > overBought and timeinrange(timeframe.period, "0300-1100")shortcont = close < out and close < out2 and vrsi < overSold and timeinrange(timeframe.period, "0300-1100")tp=input(150,title="tp")sl=input(80,title="sl")strategy.entry("long",1,when=longcond)//strategy.close("long",when= close < out2)strategy.exit("long_exit","long",profit=tp,loss=sl)strategy.entry("short",1,when=shortcont)//strategy.close("short",when=close >out)strategy.exit("short_exit","short",profit=tp,loss=sl)maxOrder = input(6, title="max trades per day")maxRisk = input(2,type=input.float, title="maxrisk per day")strategy.risk.max_intraday_filled_orders(maxOrder)strategy.risk.max_intraday_loss(maxRisk, strategy.percent_of_equity)strategy.close_all(when =not timeinrange(timeframe.period, "0300-1100"))