Zeal Terminal Open in Zeal Terminal

Pine Script v5 · Strategy

rt maax EMA cross strategy

A Pine Script v5 strategy built on EMA (close, 50), Crossover (fema, fastema) and Crossunder (fema, fastema). 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 commits 100000 in cash and pays 0.27% commission. 7 settings; defaults include From Month 1, From Day 1 and From Year 2021.

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 rt maax EMA cross 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 rt maax EMA cross strategy do on BTCUSDT 1D with default settings?
−6.70%
From 26 Jan 2024 to 21 Oct 2026, over 1 closed trade, against +102.5% for buy and hold. A backtest, not investment advice.
Does rt maax EMA cross strategy 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: 1 before, 1 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 rt maax EMA cross strategy use a stop loss?
Yes
strategy.exit sets a stop on line 27, 36.
Does rt maax EMA cross strategy run in Zeal Terminal?
Yes
It compiles in 12 ms and runs 1,000 bars in 22 ms, in the browser.

BTCUSDT · 1D · default settings

  • EMA
  • EMA
  • EMA
  • Crossover
  • Crossunder
  • 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 (7)
0.0050,000100,000AprJulOct2025AprJulOct2026AprJulOct$97,508$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. The script plots nothing itself; the lines and the lower pane are its own calculations, drawn for reference.
Net profit
−6.70%
−$6,702.52
Buy and hold
+102.5%
same period
Closed trades
1
0 won · 1 lost
Profitable
0.0%
of closed trades
Profit factor
0.00
gross profit ÷ gross loss
Max drawdown
14.51%
−$14,507.50

One run with the author's default settings, $100,000 starting capital, commission as the script sets it. A short 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

    7 settings do nothing

    “From Month”, “From Day”, “From Year”, “Thru Month”, “Thru Day”, “Thru Year”, “Show Date Range” are declared but never read.

  • Note

    No slippage

    Fills are assumed at the exact open price. Add slippage in the properties for a more realistic test.

Settings

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

SettingDefaultType and rangeFeeds
From Month1int · min 1 · max 12unused
From Day1int · min 1 · max 31unused
From Year2021int · min 1970unused
Thru Month10int · min 1 · max 12unused
Thru Day25int · min 1 · max 31unused
Thru Year2112int · min 1970unused
Show Date Rangetrueboolunused

What it calculates

  • EMAclose, 50fastema · line 6
  • EMAclose, 20fema · line 7
  • EMAclose, 200slowema · line 8
  • Crossoverfema, fastemalongCondition1 · line 20
  • Crossunderfema, fastemashortCondition1 · line 29

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 datalowlowprice datahighhighprice datafastemaEMA→ fastemafemaEMA→ femaslowemaEMA→ slowemalongCondition1Crossover→ longCondition1shortCondition1Crossunder→ shortCondition1pricepricevaluestoplossstoplossvaluetakeprofittakeprofitvaluelongcondition2longcondition2conditionlongcondition3longcondition3conditionshortcondition2shortcondition2conditionshortcondition3shortcondition3conditionentry:Long EntryOpen Long Entrystrategy.entryexit:exitexit exitstrategy.exitentry:Short EntryOpen Short Entrystrategy.entry

Order rules

OrderFires whenBy defaultLine
Open Long Entry long(longCondition1 and longcondition2 and longcondition3 )On26
Exit exit stop and limit(longCondition1 and longcondition2 and longcondition3 )On27
Open Short Entry short(shortCondition1 and shortcondition2 and shortcondition3 )On35
Exit exit stop and limit(shortCondition1 and shortcondition2 and shortcondition3 )On36

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−6.7%+102.5%10%0.0014.5%26 Jan 2024 – 21 Oct 2026
BTCUSDT 4h−4.4%+5.5%10%0.008.9%8 May 2026 – 21 Oct 2026
ETHUSDT 1D−0.3%+9.8%00%0.00103.4%26 Jan 2024 – 21 Oct 2026
ETHUSDT 4h−13.1%+8.4%10%0.0016.7%8 May 2026 – 21 Oct 2026
SOLUSDT 1D−134.7%+16.7%20%0.00209.9%26 Jan 2024 – 21 Oct 2026
SOLUSDT 4h−9.8%+21.5%10%0.0021.0%8 May 2026 – 21 Oct 2026
BNBUSDT 1D+0.1%+148.3%1100%1.5341.1%26 Jan 2024 – 21 Oct 2026
BNBUSDT 4h−3.3%+17.1%10%0.003.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 market0—$0.00
Sideways market10%−$6,432.52
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?

6.4%

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

0%7%
All 1 trades
SideEntryExitBarsP&L
long25 Apr 2025 93,980.5021 Jan 2026 88,427.70271−$6,432.52

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
rt maax EMA cross strategy this page—v5 strategy−6.7%114.5%
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.

  • 1 setting uses the untyped input() (line 18). It still compiles in v6; input.int, input.float or input.source state the type.
  • No v6-only features. v6 is not needed to run this script.

Clean v5

VerifiedDownload the v5 script

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

  • Line 18: input() → input.bool()
⋯// === INPUT SHOW PLOT ===-showDate  = input(defval = true, title = "Show Date Range")+showDate  = input.bool(defval = true, title = "Show Date Range")// === FUNCTION EXAMPLE ===⋯

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

⋯// © rt-maax-//@version=5+//@version=6strategy(title = "rt maax EMA cross strategy", shorttitle = "rt maax ema ", overlay = true, precision = 8, max_bars_back = 200, pyramiding = 0, initial_capital = 100000, ⋯

Where it runs

EngineCompilesRunsMatches TradingView
Zeal Terminal · OpenPineScript v2Yes 12 msYes 1,000 bars in 22 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/// © rt-maax//@version=5strategy(title = "rt maax EMA cross strategy", shorttitle = "rt maax ema ", overlay = true, precision = 8, max_bars_back = 200, pyramiding = 0, initial_capital = 100000,      currency = currency.USD, default_qty_type = strategy.cash, default_qty_value = 100000, commission_type = "percent", commission_value = 0.27)fastema = ta.ema (close , 50)fema=ta.ema(close,20)slowema= ta.ema(close,200)price = close// === INPUT BACKTEST RANGE ===fromMonth = input.int(defval = 1,    title = "From Month",  minval = 1, maxval = 12)fromDay   = input.int(defval = 1,    title = "From Day",    minval = 1, maxval = 31)fromYear  = input.int(defval = 2021, title = "From Year",   minval = 1970)thruMonth = input.int(defval = 10,    title = "Thru Month",  minval = 1, maxval = 12)thruDay   = input.int(defval = 25,    title = "Thru Day",    minval = 1, maxval = 31)thruYear  = input.int(defval = 2112, title = "Thru Year",   minval = 1970)// === INPUT SHOW PLOT ===showDate  = input(defval = true, title = "Show Date Range")// === FUNCTION EXAMPLE ===longCondition1= ta.crossover (fema , fastema) longcondition2= fema> slowemalongcondition3=fastema>slowemaif (longCondition1 and longcondition2 and longcondition3 )    stoploss=low*0.97    takeprofit=high*1.12    strategy.entry("Long Entry", strategy.long)    strategy.exit ("exit","long",stop=stoploss,limit=takeprofit)   shortCondition1 = ta.crossunder (fema , fastema )shortcondition2= fastema< slowemashortcondition3= fema< slowemaif (shortCondition1 and shortcondition2 and shortcondition3 )    stoploss=low*0.97     takeprofit=high*1.5    strategy.entry("Short Entry", strategy.short)    strategy.exit("exit","short",stop=stoploss,limit=takeprofit)