Zeal Terminal Open in Zeal Terminal

Pine Script v4 · Strategy

Forex Daytrade T3 MA session

A Pine Script v4 strategy built on EMA (xPrice, 9). It has 12 order rules, 8 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. 14 settings; defaults include From Day 1, From Month 1 and From Year 2000.

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 Forex Daytrade T3 MA session repaint?
No
No repainting patterns were found in the source. The live replay was not measured: it had no trades to compare.
How did Forex Daytrade T3 MA session 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 code limits trading to a date window, which can leave this period out. It closed no trades on the other markets either. A backtest, not investment advice.
Can Forex Daytrade T3 MA session be converted to Pine Script v5?
Not tested
The steps are shown below, but neither version placed a trade on any market tested, so there was nothing to compare and no download is offered.
Does Forex Daytrade T3 MA session use a stop loss?
Yes
strategy.exit sets a stop on line 63, 64, 79, 80.
Does Forex Daytrade T3 MA session run in Zeal Terminal?
Yes
It compiles in 24 ms and runs 1,000 bars in 59 ms, in the browser.

BTCUSDT · 1D · default settings

  • T3
  • 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, 0 as a short, whatever it says; this page passes the same side as strategy.long or strategy.short (lines 51, 52, 57, 58, 67, 68 and more) 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

    6 settings have no label

    In the settings dialog Length (line 17), tp (line 43), sl (line 44), modified (line 45), inverse (line 46), exit (line 47) 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 51, 52, 57, 58, 67, 68, 73, 74. 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.
  • 8 strategy calls use the when = argument (line 51, 52, 57, 58, 67, 68, 73, 74). It is deprecated in v5 and removed in v6, where each call moves inside an if block.

v4 → v5

Not verified

Neither version placed a trade on any of the 8 markets, so there was nothing to compare.

  • Line 3: //@version=4 → //@version=5
  • Line 19: ema → ta.ema
  • Line 20: ema → ta.ema
  • Line 21: ema → ta.ema
  • Line 22: ema → ta.ema
  • Line 23: ema → ta.ema
11 more edits
  • Line 24: ema → ta.ema
  • Line 32: input(type = input.session) → input.session()
  • Line 34: input(type = input.session) → input.session()
  • Line 51: strategy.entry(…, 1) → strategy.entry(…, strategy.long)
  • Line 52: strategy.entry(…, 0) → strategy.entry(…, strategy.short)
  • Line 57: strategy.entry(…, 1) → strategy.entry(…, strategy.long)
  • Line 58: strategy.entry(…, 0) → strategy.entry(…, strategy.short)
  • Line 67: strategy.entry(…, 1) → strategy.entry(…, strategy.long)
  • Line 68: strategy.entry(…, 0) → strategy.entry(…, strategy.short)
  • Line 73: strategy.entry(…, 1) → strategy.entry(…, strategy.long)
  • Line 74: strategy.entry(…, 0) → strategy.entry(…, strategy.short)
⋯// © exlux99-//@version=4+//@version=5strategy("FOREX Daytrade T3 MA session",overlay=true)⋯xPrice = close-xe1 = ema(xPrice, Length)+xe1 = ta.ema(xPrice, Length)-xe2 = ema(xe1, Length)+xe2 = ta.ema(xe1, Length)-xe3 = ema(xe2, Length)+xe3 = ta.ema(xe2, Length)-xe4 = ema(xe3, Length)+xe4 = ta.ema(xe3, Length)-xe5 = ema(xe4, Length)+xe5 = ta.ema(xe4, Length)-xe6 = ema(xe5, Length)+xe6 = ta.ema(xe5, Length)b = 0.7⋯plot(nT3Average, color=color.blue, title="T3")-myspecifictradingtimes = input('1000-1900', type=input.session, title="My Defined Hours")+myspecifictradingtimes = input.session('1000-1900', title="My Defined Hours")//myspecifictradingtimes2 = input('1000-1900', type=input.session, title="My Defined Hours")-exittime = input('2100-2115', type=input.session, title="exit time")+exittime = input.session('2100-2115', title="exit time")optionmacd=true⋯        if(inverse)-            strategy.entry("long",1,when=short)+            strategy.entry("long",strategy.long,when=short)-            strategy.entry("short",0,when=long)+            strategy.entry("short",strategy.short,when=long)           /// strategy.exit("xlong","long",profit=200, loss=200)⋯        if(inverse==false)-            strategy.entry("long",1,when=long)+            strategy.entry("long",strategy.long,when=long)-            strategy.entry("short",0,when=short)+            strategy.entry("short",strategy.short,when=short)            ⋯    if(inverse)-        strategy.entry("long",1,when=short)+        strategy.entry("long",strategy.long,when=short)-        strategy.entry("short",0,when=long)+        strategy.entry("short",strategy.short,when=long)           /// strategy.exit("xlong","long",profit=200, loss=200)⋯    if(inverse==false)-        strategy.entry("long",1,when=long)+        strategy.entry("long",strategy.long,when=long)-        strategy.entry("short",0,when=short)+        strategy.entry("short",strategy.short,when=short)            ⋯

Clean v5

Not verified

Neither version placed a trade on any of the 8 markets, so there was nothing to compare.

  • Line 5: input() → input.int()
  • Line 6: input() → input.int()
  • Line 7: input() → input.int()
  • Line 10: input() → input.int()
  • Line 11: input() → input.int()
  • Line 12: input() → input.int()
14 more edits
  • Line 17: input() → input.int()
  • Line 43: input() → input.float()
  • Line 44: input() → input.float()
  • Line 45: input() → input.bool()
  • Line 46: input() → input.bool()
  • Line 47: input() → input.bool()
  • Line 51: when = short → if block
  • Line 52: when = long → if block
  • Line 57: when = long → if block
  • Line 58: when = short → if block
  • Line 67: when = short → if block
  • Line 68: when = long → if block
  • Line 73: when = long → if block
  • Line 74: when = short → if block
⋯strategy("FOREX Daytrade T3 MA session",overlay=true)-fromDay = input(defval = 1, title = "From Day", minval = 1, maxval = 31)+fromDay = input.int(defval = 1, title = "From Day", minval = 1, maxval = 31)-fromMonth = input(defval = 1, title = "From Month", minval = 1, maxval = 12)+fromMonth = input.int(defval = 1, title = "From Month", minval = 1, maxval = 12)-fromYear = input(defval = 2000, title = "From Year", minval = 1970)+fromYear = input.int(defval = 2000, title = "From Year", minval = 1970) //monday and session // To Date Inputs-toDay = input(defval = 31, title = "To Day", minval = 1, maxval = 31)+toDay = input.int(defval = 31, title = "To Day", minval = 1, maxval = 31)-toMonth = input(defval = 12, title = "To Month", minval = 1, maxval = 12)+toMonth = input.int(defval = 12, title = "To Month", minval = 1, maxval = 12)-toYear = input(defval = 2021, title = "To Year", minval = 1970)+toYear = input.int(defval = 2021, title = "To Year", minval = 1970)startDate = timestamp(fromYear, fromMonth, fromDay, 00, 00)⋯timeinrange(res, sess) => time(res, sess) != 0-Length = input(9, minval=1)+Length = input.int(9, minval=1)xPrice = close⋯short =time_cond and (entrytime) and close < low[1]  and close < nT3Average -tp = input(0.01)+tp = input.float(0.01)-sl = input(0.01)+sl = input.float(0.01)-modified=input(true)+modified=input.bool(true)-inverse=input(true)+inverse=input.bool(true)-exit  = input(false)+exit  = input.bool(false)if(modified)⋯        if(inverse)-            strategy.entry("long",strategy.long,when=short)+            if short+                strategy.entry("long",strategy.long)-            strategy.entry("short",strategy.short,when=long)+            if long+                strategy.entry("short",strategy.short)           /// strategy.exit("xlong","long",profit=200, loss=200)⋯        if(inverse==false)-            strategy.entry("long",strategy.long,when=long)+            if long+                strategy.entry("long",strategy.long)-            strategy.entry("short",strategy.short,when=short)+            if short+                strategy.entry("short",strategy.short)            ⋯    if(inverse)-        strategy.entry("long",strategy.long,when=short)+        if short+            strategy.entry("long",strategy.long)-        strategy.entry("short",strategy.short,when=long)+        if long+            strategy.entry("short",strategy.short)           /// strategy.exit("xlong","long",profit=200, loss=200)⋯    if(inverse==false)-        strategy.entry("long",strategy.long,when=long)+        if long+            strategy.entry("long",strategy.long)-        strategy.entry("short",strategy.short,when=short)+        if short+            strategy.entry("short",strategy.short)            ⋯

Does it run in Pine Script v6?

Not tested

Neither version placed a trade on any of the 8 markets, so there was nothing to compare. The v6 version is shown for reference and is not offered as a download. It differs from the v5 version by 1 edit.

⋯// © exlux99-//@version=5+//@version=6strategy("FOREX Daytrade T3 MA session",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
From Day1int · min 1 · max 31startDate
From Month1int · min 1 · max 12startDate
From Year2000int · min 1970startDate
To Day31int · min 1 · max 31finishDate
To Month12int · min 1 · max 12finishDate
To Year2021int · min 1970finishDate
Length (no label in the script)9int · min 1xe1 xe2 xe3 xe4 xe5 xe6
My Defined Hours1000-1900sessionentrytime
exit time2100-2115sessionexiton
Tp (no label in the script)0.01floatexit closelong exit closeshort
Sl (no label in the script)0.01floatexit closelong exit closeshort
Modified (no label in the script)trueboolline 48 line 65
Inverse (no label in the script)trueboolentry long entry short entry long entry short entry long entry short entry long entry short line 50 line 56 line 66 line 72
Exit (no label in the script)falseboolexit closelong exit closeshort line 60

What it calculates

  • EMA (ema, ta.ema in v5)xPrice, Length (9)xe1 · line 19
  • EMA (ema, ta.ema in v5)xe1, Length (9)xe2 · line 20
  • EMA (ema, ta.ema in v5)xe2, Length (9)xe3 · line 21
  • EMA (ema, ta.ema in v5)xe3, Length (9)xe4 · line 22
  • EMA (ema, ta.ema in v5)xe4, Length (9)xe5 · line 23
  • EMA (ema, ta.ema in v5)xe5, Length (9)xe6 · line 24

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.

LengthLengthsetting · 9fromYearFrom Yearsetting · 2000fromMonthFrom Monthsetting · 1fromDayFrom Daysetting · 1toYearTo Yearsetting · 2021toMonthTo Monthsetting · 12toDayTo Daysetting · 31closecloseprice datahighhighprice datalowlowprice datatimetimeprice datamyspecifictradingtimesMy Defined Hourssetting · 1000-1900exittimeexit timesetting · 2100-2115xe1EMA→ xe1xe2EMA→ xe2xe3EMA→ xe3xe4EMA→ xe4xe5EMA→ xe5xe6EMA→ xe6startDatestartDatevaluefinishDatefinishDatevaluexPricexPricevaluec1, c2, c3, c4c1 · c2 +24 valuesnT3AveragenT3Averagevaluelonglongconditionshortshortconditiontime_condtime_condconditionentrytimeentrytimeconditionexitonexitonconditionentry:longOpen longstrategy.entryentry:shortOpen shortstrategy.entryexit:closelongexit closelongstrategy.exitexit:closeshortexit closeshortstrategy.exitplot:31T3plot

Order rules

OrderFires whenBy defaultLine
Open long longshorttime_cond and (entrytime) and close < low[1] and close < nT3AverageOn51
Open short shortlongtime_cond and (entrytime ) and close > high[1] and close > nT3AverageOn52
Open long longlongtime_cond and (entrytime ) and close > high[1] and close > nT3AverageOn57
Open short shortshorttime_cond and (entrytime) and close < low[1] and close < nT3AverageOn58
Exit closelong stop and limit(exit)On63
Exit closeshort stop and limit(exit)On64
Open long longshorttime_cond and (entrytime) and close < low[1] and close < nT3AverageOn67
Open short shortlongtime_cond and (entrytime ) and close > high[1] and close > nT3AverageOn68
Open long longlongtime_cond and (entrytime ) and close > high[1] and close > nT3AverageOn73
Open short shortshorttime_cond and (entrytime) and close < low[1] and close < nT3AverageOn74
Exit closelong stopevery barOn79
Exit closeshort stopevery barOn80

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 4h0.0%+5.5%00%—0.0%8 May 2026 – 21 Oct 2026
ETHUSDT 1D0.0%+9.8%00%—0.0%26 Jan 2024 – 21 Oct 2026
ETHUSDT 4h0.0%+8.4%00%—0.0%8 May 2026 – 21 Oct 2026
SOLUSDT 1D0.0%+16.7%00%—0.0%26 Jan 2024 – 21 Oct 2026
SOLUSDT 4h0.0%+21.5%00%—0.0%8 May 2026 – 21 Oct 2026
BNBUSDT 1D0.0%+148.3%00%—0.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.

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
Forex Daytrade T3 MA session this page—v4 strategy0.0%00.0%
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%

Where it runs

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

Zeal Terminal's engine currently reads an order side written as 1, 0 as a short, whatever it says; this page passes the same side as strategy.long or strategy.short (lines 51, 52, 57, 58, 67, 68 and more) 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/// © exlux99//@version=4strategy("FOREX Daytrade T3 MA session",overlay=true)fromDay = input(defval = 1, title = "From Day", minval = 1, maxval = 31)fromMonth = input(defval = 1, title = "From Month", minval = 1, maxval = 12)fromYear = input(defval = 2000, title = "From Year", minval = 1970) //monday and session // To Date InputstoDay = input(defval = 31, title = "To Day", minval = 1, maxval = 31)toMonth = input(defval = 12, title = "To Month", minval = 1, maxval = 12)toYear = input(defval = 2021, title = "To Year", minval = 1970)startDate = timestamp(fromYear, fromMonth, fromDay, 00, 00)finishDate = timestamp(toYear, toMonth, toDay, 00, 00)time_cond = time >= startDate and time <= finishDate timeinrange(res, sess) => time(res, sess) != 0Length = input(9, minval=1)xPrice = closexe1 = ema(xPrice, Length)xe2 = ema(xe1, Length)xe3 = ema(xe2, Length)xe4 = ema(xe3, Length)xe5 = ema(xe4, Length)xe6 = ema(xe5, Length)b = 0.7c1 = -b*b*bc2 = 3*b*b+3*b*b*bc3 = -6*b*b-3*b-3*b*b*bc4 = 1+3*b+b*b*b+3*b*bnT3Average = c1 * xe6 + c2 * xe5 + c3 * xe4 + c4 * xe3plot(nT3Average, color=color.blue, title="T3")myspecifictradingtimes = input('1000-1900', type=input.session, title="My Defined Hours")//myspecifictradingtimes2 = input('1000-1900', type=input.session, title="My Defined Hours")exittime = input('2100-2115', type=input.session, title="exit time")optionmacd=trueentrytime = time(timeframe.period, myspecifictradingtimes) != 0exiton = time(timeframe.period, exittime) != 0//entrytime2 = time(timeframe.period, myspecifictradingtimes2) != 0// long =time_cond and (entrytime or entrytime2) and close > high[1] and close > nT3Average // short =time_cond and (entrytime or entrytime2) and close < low[1]  and close < nT3Average long =time_cond and (entrytime ) and close > high[1] and close > nT3Average short =time_cond and (entrytime) and close < low[1]  and close < nT3Average tp = input(0.01)sl = input(0.01)modified=input(true)inverse=input(true)exit  = input(false)if(modified)    if(not exiton)        if(inverse)            strategy.entry("long",1,when=short)            strategy.entry("short",0,when=long)           /// strategy.exit("xlong","long",profit=200, loss=200)           // strategy.exit("xshort","short",profit=200, loss=200)                if(inverse==false)            strategy.entry("long",1,when=long)            strategy.entry("short",0,when=short)                    if(exit)          //  strategy.close("long", when = crossover(close,nT3Average))           // strategy.close("short", when = crossunder(close,nT3Average))            strategy.exit("closelong", "long" , profit = close * tp / syminfo.mintick, loss = close * sl / syminfo.mintick, alert_message = "closelong")            strategy.exit("closeshort", "short" , profit = close * tp / syminfo.mintick, loss = close * sl / syminfo.mintick, alert_message = "closeshort")if(modified==false)    if(inverse)        strategy.entry("long",1,when=short)        strategy.entry("short",0,when=long)           /// strategy.exit("xlong","long",profit=200, loss=200)           // strategy.exit("xshort","short",profit=200, loss=200)            if(inverse==false)        strategy.entry("long",1,when=long)        strategy.entry("short",0,when=short)                // if(exit)    //       //  strategy.close("long", when = crossover(close,nT3Average))    //       // strategy.close("short", when = crossunder(close,nT3Average))strategy.exit("closelong", "long" , loss = close * sl / syminfo.mintick, alert_message = "closelong")strategy.exit("closeshort", "short" , loss = close * sl / syminfo.mintick, alert_message = "closeshort")//strategy.close_all(when =exiton )//gbpnzd 10-20//gbpcad 10-19//gbpaud 07-19//euruad 10-19  / 16-20//eurnzd 08-21  / 10-20//eurchf 08-20//gbpchf 06-18// 18-19settings entry gbp aud, gbpcad gbpnzd ??? 1 entry only big spread//test