Zeal Terminal Open in Zeal Terminal

Pine Script v4 · Strategy

Simple and efficient 1h strategy

A Pine Script v4 strategy built on RMA or Change (max(change(src), 0), 10). It has 5 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 is one contract and pays no commission. 10 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 Simple and efficient 1h 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 Simple and efficient 1h 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 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 Simple and efficient 1h strategy 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 Simple and efficient 1h strategy use a stop loss?
Yes
strategy.exit sets a stop on line 41, 46.
Does Simple and efficient 1h strategy run in Zeal Terminal?
Yes
It compiles in 12 ms and runs 1,000 bars in 52 ms, in the browser.

BTCUSDT · 1D · default settings

  • RMA
  • RMA
  • 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 (10)
0.0050,000100,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. The script plots nothing itself; the lines and the lower pane are its own calculations, drawn for reference. 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

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

  • Note

    Uses iff(), which v5 removed line 16

    iff() on line 16, 18, 20, 22. v5 writes it as the ternary c ? a : b.

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 rma → ta.rma, max → math.max, change → ta.change, min → math.min, crossover → ta.crossover, ema → ta.ema, crossunder → ta.crossunder.
  • 1 strategy call uses the when = argument (line 49). 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 16: iff(c, a, b) → (c ? a : b)
  • Line 18: iff(c, a, b) → (c ? a : b)
  • Line 20: iff(c, a, b) → (c ? a : b)
  • Line 22: iff(c, a, b) → (c ? a : b)
  • Line 32: input(type = input.source) → input.source()
14 more edits
  • Line 33: rma → ta.rma
  • Line 33: max → math.max
  • Line 33: change → ta.change
  • Line 34: rma → ta.rma
  • Line 34: min → math.min
  • Line 34: change → ta.change
  • Line 38: crossover → ta.crossover
  • Line 38: ema → ta.ema
  • Line 38: ema → ta.ema
  • Line 38: crossover → ta.crossover
  • Line 43: crossunder → ta.crossunder
  • Line 43: ema → ta.ema
  • Line 43: ema → ta.ema
  • Line 43: crossunder → ta.crossunder
⋯// © SoftKill21-//@version=4+//@version=5fromDay = input(defval = 1, title = "From Day", minval = 1, maxval = 31)⋯//--- Europe-London = iff(DST==0,"0000-0900","0100-1000")+London = (DST==0 ? "0000-0900" : "0100-1000")//--- America-NewYork = iff(DST==0,"0400-1300","0500-1400")+NewYork = (DST==0 ? "0400-1300" : "0500-1400")//--- Pacific-Sydney = iff(DST==0,"1300-2200","1400-2300")+Sydney = (DST==0 ? "1300-2200" : "1400-2300")//--- Asia-Tokyo = iff(DST==0,"1500-2400","1600-0100")+Tokyo = (DST==0 ? "1500-2400" : "1600-0100")//-- Time In Range⋯len = input(10, minval=1, title="Length")-src = input(hl2, "Source", type = input.source)+src = input.source(hl2, "Source")-up = rma(max(change(src), 0), len)+up = ta.rma(math.max(ta.change(src), 0), len)-down = rma(-min(change(src), 0), len)+down = ta.rma(-math.min(ta.change(src), 0), len)rsi = down == 0 ? 100 : up == 0 ? 0 : 100 - (100 / (1 + up / down))⋯sl=input(500,"sl pip")-longCondition = crossover(ema(close, 4), ema(close, 8)) and rsi > rsi[1] and crossover(rsi,50) and time_cond+longCondition = ta.crossover(ta.ema(close, 4), ta.ema(close, 8)) and rsi > rsi[1] and ta.crossover(rsi,50) and time_condif (longCondition)⋯  // strategy.close("long",when=crossunder(ema(close, 4), ema(close, 8)) or crossover(rsi,50), comment="cross_short")-shortCondition = crossunder(ema(close, 4), ema(close, 8))  and rsi < rsi[1] and crossunder(rsi,50) and time_cond+shortCondition = ta.crossunder(ta.ema(close, 4), ta.ema(close, 8))  and rsi < rsi[1] and ta.crossunder(rsi,50) and time_condif (shortCondition)⋯

Clean v5

Not verified

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

  • Line 4: input() → input.int()
  • Line 5: input() → input.int()
  • Line 6: input() → input.int()
  • Line 9: input() → input.int()
  • Line 10: input() → input.int()
  • Line 11: input() → input.int()
4 more edits
  • Line 31: input() → input.int()
  • Line 36: input() → input.int()
  • Line 37: input() → input.int()
  • Line 49: when = not time_cond → if block
⋯//@version=5-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) // To Date Inputs-toDay = input(defval = 1, title = "To Day", minval = 1, maxval = 31)+toDay = input.int(defval = 1, title = "To Day", minval = 1, maxval = 31)-toMonth = input(defval = 8, title = "To Month", minval = 1, maxval = 12)+toMonth = input.int(defval = 8, 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) ⋯strategy("4 8 RSI", overlay=true)-len = input(10, minval=1, title="Length")+len = input.int(10, minval=1, title="Length")src = input.source(hl2, "Source")⋯rsi = down == 0 ? 100 : up == 0 ? 0 : 100 - (100 / (1 + up / down))-tp=input(500,"tp pip")+tp=input.int(500,"tp pip")-sl=input(500,"sl pip")+sl=input.int(500,"sl pip")longCondition = ta.crossover(ta.ema(close, 4), ta.ema(close, 8)) and rsi > rsi[1] and ta.crossover(rsi,50) and time_cond⋯    -strategy.close_all(when = not time_cond, comment="time", alert_message="time")+if not time_cond+    strategy.close_all(comment="time", alert_message="time")

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.

⋯// © SoftKill21-//@version=5+//@version=6fromDay = input.int(defval = 1, title = "From Day", minval = 1, maxval = 31)⋯

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 Day1int · min 1 · max 31finishDate
To Month8int · min 1 · max 12finishDate
To Year2021int · min 1970finishDate
Length10int · min 1up down
Sourcehl2sourceup down
tp pip500intexit longtp exit shorttp
sl pip500intexit longtp exit shorttp

What it calculates

  • RMA / Change (rma, ta.rma in v5)max(change(src), 0), Length (10)up · line 33
  • RMA / Change (rma, ta.rma in v5)-min(change(src), 0), Length (10)down · line 34

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.

hl2hl2price datalenLengthsetting · 10fromYearFrom Yearsetting · 2000fromMonthFrom Monthsetting · 1fromDayFrom Daysetting · 1toYearTo Yearsetting · 2021toMonthTo Monthsetting · 8toDayTo Daysetting · 1closecloseprice datatimetimeprice dataupRMA / Change→ updownRMA / Change→ downlondonlondonvaluenewyorknewyorkvaluestartDatestartDatevaluefinishDatefinishDatevaluersirsivaluelongConditionlongConditionconditionshortConditionshortConditionconditionLondon, NewYork, Sydney, TokyoLondon · NewYork +24 conditionstime_condtime_condconditionentry:My Long Entry IdOpen My Long Entry Idstrategy.entryexit:longtpexit longtpstrategy.exitentry:My Short Entry IdOpen My Short Entry Idstrategy.entryexit:shorttpexit shorttpstrategy.exitclose_all:close_all strategy.close_all

Order rules

OrderFires whenBy defaultLine
Open My Long Entry Id long(longCondition)On40
Exit longtp stop and limit(longCondition)On41
Open My Short Entry Id short(shortCondition)On45
Exit shorttp stop and limit(shortCondition)On46
Close not time_condOn49

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
Simple and efficient 1h strategy this page—v4 strategy0.0%00.0%
DMI Strategy by email_analystsrmav5 strategy+8.5%62.7%
Ichimoku + RSI Crypto trending strategy by exlux99rmav4 strategyNo trades on this market
DI Crossing Daily Straregy HulkTrading by TheHulkTradingrmav4 strategy+34.3%6518.4%
Kimchi Premium Strategy by chanu_lev10krmav5 strategyNo trades on this market
Infiten Slope Strategy by spiritualhealer117rmav4 strategy+47.2%2635.5%

Where it runs

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

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=4fromDay = 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) // To Date InputstoDay = input(defval = 1, title = "To Day", minval = 1, maxval = 31)toMonth = input(defval = 8, title = "To Month", minval = 1, maxval = 12)toYear = input(defval = 2021, title = "To Year", minval = 1970) // Calculate start/end date and time conditionDST = 1 //day light saving for usa//--- EuropeLondon = iff(DST==0,"0000-0900","0100-1000")//--- AmericaNewYork = iff(DST==0,"0400-1300","0500-1400")//--- PacificSydney = iff(DST==0,"1300-2200","1400-2300")//--- AsiaTokyo = iff(DST==0,"1500-2400","1600-0100")//-- Time In Rangetimeinrange(res, sess) => time(res, sess) != 0london = timeinrange(timeframe.period, London)newyork = timeinrange(timeframe.period, NewYork)startDate = timestamp(fromYear, fromMonth, fromDay, 00, 00)finishDate = timestamp(toYear, toMonth, toDay, 00, 00)time_cond = time >= startDate and time <= finishDate and (london or newyork)strategy("4 8 RSI", overlay=true)len = input(10, minval=1, title="Length")src = input(hl2, "Source", type = input.source)up = rma(max(change(src), 0), len)down = rma(-min(change(src), 0), len)rsi = down == 0 ? 100 : up == 0 ? 0 : 100 - (100 / (1 + up / down))tp=input(500,"tp pip")sl=input(500,"sl pip")longCondition = crossover(ema(close, 4), ema(close, 8)) and rsi > rsi[1] and crossover(rsi,50) and time_condif (longCondition)    strategy.entry("My Long Entry Id", strategy.long)    strategy.exit("longtp","long",profit=tp,loss=sl)  // strategy.close("long",when=crossunder(ema(close, 4), ema(close, 8)) or crossover(rsi,50), comment="cross_short")shortCondition = crossunder(ema(close, 4), ema(close, 8))  and rsi < rsi[1] and crossunder(rsi,50) and time_condif (shortCondition)    strategy.entry("My Short Entry Id", strategy.short)    strategy.exit("shorttp","short",profit=tp,loss=sl)  //  strategy.close("short", when=crossover(ema(close, 4), ema(close, 8)) or crossover(rsi,50), comment="cross_long")    strategy.close_all(when = not time_cond, comment="time", alert_message="time")