Zeal Terminal Open in Zeal Terminal

Pine Script v4 · Strategy

AMRS_LongOnly_PartTimer

A Pine Script v4 strategy built on EMA (close, 11) and Highest (high, 504). It has 3 order rules, 1 entry among them, and trades long only with the default settings. Exits use a stop loss. Each trade is one contract and pays no commission. 6 settings; defaults include Start Year 2000, Start Month 01 and Start Date 01.

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 AMRS_LongOnly_PartTimer repaint?
No
No repainting patterns were found in the source. The live replay was not measured: it had no trades to compare.
How did AMRS_LongOnly_PartTimer do on BTCUSDT 1D with default settings?
0.00%
From 26 Jan 2024 to 21 Oct 2026, over 11 closed trades, against +102.5% for buy and hold. A backtest, not investment advice.
Can AMRS_LongOnly_PartTimer 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 AMRS_LongOnly_PartTimer use a stop loss?
Yes
strategy.exit sets a stop on line 40.
Does AMRS_LongOnly_PartTimer run in Zeal Terminal?
Yes
It compiles in 14 ms and runs 1,000 bars in 35 ms, in the browser.

BTCUSDT · 1D · default settings

  • 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 (6)
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.
Net profit
0.00%
$0.00
Buy and hold
+102.5%
same period
Closed trades
11
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

    No slippage

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

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, highest → ta.highest.

v4 → v5

VerifiedDownload the v5 script

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

  • Line 5: //@version=4 → //@version=5
  • Line 8: input(type = input.integer) → input.int()
  • Line 9: input(type = input.integer) → input.int()
  • Line 10: input(type = input.integer) → input.int()
  • Line 11: input(type = input.integer) → input.int()
  • Line 12: input(type = input.integer) → input.int()
6 more edits
  • Line 13: input(type = input.integer) → input.int()
  • Line 14: ema → ta.ema
  • Line 15: ema → ta.ema
  • Line 16: ema → ta.ema
  • Line 24: highest → ta.highest
  • Line 27: highest → ta.highest
⋯//This script generates white arrow for each buying signal-//@version=4+//@version=5strategy("AMRS_LongOnly_PartTimer", overlay = true)//i_endTime = input(defval = timestamp("02 Jun 2021 15:30 +0000"), title = "End Time", type=input.time)-StartYear=input(defval = 2000, title ="Start Year", type=input.integer)+StartYear=input.int(defval = 2000, title ="Start Year")-StartMonth=input(defval = 01, title ="Start Month", type=input.integer)+StartMonth=input.int(defval = 01, title ="Start Month")-StartDate=input(defval = 01, title ="Start Date", type=input.integer)+StartDate=input.int(defval = 01, title ="Start Date")-endYear=input(defval = 2021, title ="End Year", type=input.integer)+endYear=input.int(defval = 2021, title ="End Year")-endMonth=input(defval = 06, title ="End Month", type=input.integer)+endMonth=input.int(defval = 06, title ="End Month")-endDate=input(defval = 03, title ="End Date", type=input.integer)+endDate=input.int(defval = 03, title ="End Date")-ema11=ema(close,11)+ema11=ta.ema(close,11)-ema13=ema(close,13)+ema13=ta.ema(close,13)-ema21=ema(close,21)+ema21=ta.ema(close,21)afterStartDate = (time >= timestamp(syminfo.timezone,StartYear, StartMonth, StartDate, 0, 0))⋯//a = security(syminfo.tickerid, 'M', ath(),lookahead=barmerge.lookahead_on)-newHigh = (high > highest(high,504)[1])+newHigh = (high > ta.highest(high,504)[1])//plot down arrows whenever it's a new highplotshape(newHigh, style=shape.triangleup, location=location.abovebar, color=color.green, size=size.tiny)-b=highest(high,504)[1]+b=ta.highest(high,504)[1]VarChk=((b-ema13)/b)*100⋯

Clean v5

Verified

Nothing to change.

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, 6 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.

⋯//This script generates white arrow for each buying signal-//@version=5+//@version=6strategy("AMRS_LongOnly_PartTimer", 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
Start Year2000int (written input.integer)afterStartDate
Start Month01int (written input.integer)afterStartDate
Start Date01int (written input.integer)afterStartDate
End Year2021int (written input.integer)beforeEndDate
End Month06int (written input.integer)beforeEndDate
End Date03int (written input.integer)beforeEndDate

What it calculates

  • EMA (ema, ta.ema in v5)close, 11ema11 · line 14
  • EMA (ema, ta.ema in v5)close, 13ema13 · line 15
  • EMA (ema, ta.ema in v5)close, 21ema21 · line 16
  • Highest (highest, ta.highest in v5)high, 504b · line 27

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 datahighhighprice datatimetimeprice dataStartYearStart Yearsetting · 2000StartMonthStart Monthsetting · 01StartDateStart Datesetting · 01lowlowprice dataendYearEnd Yearsetting · 2021endMonthEnd Monthsetting · 06endDateEnd Datesetting · 03ema11EMA→ ema11ema13EMA→ ema13ema21EMA→ ema21bHighest→ bVarChkVarChkvalueExitPriceExitPricevalueDrawPriceDrawPricevaluestoppricestoppricevalueafterStartDateafterStartDateconditionTrigLowTrigLowconditionbeforeEndDatebeforeEndDateconditionnewHighnewHighconditionentry:LongOpen Longstrategy.entryexit:exitexit exitstrategy.exitclose_all:close_all strategy.close_allplotshape:26plotshapeplotshapeplotshape:30plotshapeplotshape

Order rules

OrderFires whenBy defaultLine
Open Long long(TrigLow and afterStartDate)On39
Exit exit stopevery barOn40
Close (beforeEndDate)On44

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%110%—0.0%26 Jan 2024 – 21 Oct 2026
BTCUSDT 4h0.0%+5.5%330%—0.0%8 May 2026 – 21 Oct 2026
ETHUSDT 1D0.0%+9.8%30%—0.0%26 Jan 2024 – 21 Oct 2026
ETHUSDT 4h0.0%+8.4%260%—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%320%—0.0%8 May 2026 – 21 Oct 2026
BNBUSDT 1D0.0%+148.3%110%—0.0%26 Jan 2024 – 21 Oct 2026
BNBUSDT 4h0.0%+17.1%270%—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 market80%$0.00
Sideways market30%$0.00
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?

0.0%

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

0%1%
All 11 trades
SideEntryExitBarsP&L
long8 Jul 2025 108,263.008 Jul 2025 108,263.000$0.00
long9 Jul 2025 108,923.009 Jul 2025 108,923.000$0.00
long10 Jul 2025 111,234.0010 Jul 2025 111,234.000$0.00
long23 Jul 2025 119,954.0023 Jul 2025 119,954.000$0.00
long25 Jul 2025 118,341.0025 Jul 2025 118,341.000$0.00
long27 Jul 2025 117,920.0027 Jul 2025 117,920.000$0.00
long29 Jul 2025 118,062.0029 Jul 2025 118,062.000$0.00
long30 Jul 2025 117,951.0030 Jul 2025 117,951.000$0.00
long9 Aug 2025 116,675.009 Aug 2025 116,675.000$0.00
long11 Aug 2025 119,294.0011 Aug 2025 119,294.000$0.00
long10 Oct 2025 121,662.0010 Oct 2025 121,662.000$0.00

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
AMRS_LongOnly_PartTimer this page—v4 strategy0.0%110.0%
BTC Good Signal by Majaztradesema highestv4 strategy−32.5%638.9%
Automated Bitcoin (BTC) Investment Strategy from Wunderbit by Wunderbitema highestv4 strategy−32.5%638.9%
CC Trend strategy 2- Downtrend Short by CheatCode1ema highestv5 strategyNo trades on this market
Slight Swing Momentum Strategy. by fzj20020403highest emav5 strategy+3.1%70.6%
Momentum Strategy by PrattyChartsema highestv4 strategyNo trades on this market

Where it runs

EngineCompilesRunsMatches TradingView
Zeal Terminal · OpenPineScript v2Yes 14 msYes 1,000 bars in 35 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.

// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/// © Part Timer//This script accepts from and to date parameter for backtesting. //This script generates white arrow for each buying signal//@version=4strategy("AMRS_LongOnly_PartTimer", overlay = true)//i_endTime = input(defval = timestamp("02 Jun 2021 15:30 +0000"), title = "End Time", type=input.time)StartYear=input(defval = 2000, title ="Start Year", type=input.integer)StartMonth=input(defval = 01, title ="Start Month", type=input.integer)StartDate=input(defval = 01, title ="Start Date", type=input.integer)endYear=input(defval = 2021, title ="End Year", type=input.integer)endMonth=input(defval = 06, title ="End Month", type=input.integer)endDate=input(defval = 03, title ="End Date", type=input.integer)ema11=ema(close,11)ema13=ema(close,13)ema21=ema(close,21)afterStartDate = (time >= timestamp(syminfo.timezone,StartYear, StartMonth, StartDate, 0, 0))//g=bar_index==1//ath()=>    //a=0.0    //a:=g ? high : high>a[1] ? high:a[1]    //a = security(syminfo.tickerid, 'M', ath(),lookahead=barmerge.lookahead_on)newHigh = (high > highest(high,504)[1])//plot down arrows whenever it's a new highplotshape(newHigh, style=shape.triangleup, location=location.abovebar, color=color.green, size=size.tiny)b=highest(high,504)[1]VarChk=((b-ema13)/b)*100TrigLow = (low <= ema13) and (low >= ema21) and (VarChk <= 10)plotshape(TrigLow, style=shape.triangleup, location=location.belowbar, color=color.white, size=size.tiny)ExitPrice=(ema21 - (ema21*0.05))DrawPrice=(b - (b*0.20))stopprice=0.0if (close <= ExitPrice)    stopprice := ExitPriceif (close <= DrawPrice)    stopprice := DrawPriceif (TrigLow and afterStartDate)    strategy.entry("Long", strategy.long)strategy.exit("exit","Long", stop=stopprice)//beforeEndDate = (time < i_endTime)beforeEndDate = (time >= timestamp(syminfo.timezone,endYear, endMonth, endDate, 0, 0))if (beforeEndDate)    strategy.close_all()