Zeal Terminal Open in Zeal Terminal

Pine Script v4 · Strategy

Maximized Scalping On Trend (by Coinrule)

A Pine Script v4 strategy built on Crossunder (close, 9) and RSI (close, lengthRSI). It has 2 order rules, 1 entry among them, and trades long only with the default settings. Exits wait for a signal; there is no stop loss. Each trade commits 30% of equity and pays 0.1% commission. 12 settings; defaults include From Month 1, From Day 10 and From Year 2019.

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 Maximized Scalping On Trend (by Coinrule) repaint?
No
No repainting patterns were found in the source, and a live tick-by-tick replay matched history on 4 of 4 trades.
How did Maximized Scalping On Trend (by Coinrule) do on BTCUSDT 1D with default settings?
+5.30%
From 26 Jan 2024 to 21 Oct 2026, over 12 closed trades, against +102.5% for buy and hold. A backtest, not investment advice.
Can Maximized Scalping On Trend (by Coinrule) 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 Maximized Scalping On Trend (by Coinrule) use a stop loss?
No
Every exit waits for a signal; nothing limits a losing trade before it fires.
Does Maximized Scalping On Trend (by Coinrule) run in Zeal Terminal?
Yes
It compiles in 12 ms and runs 1,000 bars in 35 ms, in the browser.

BTCUSDT · 1D · default settings

  • Plot
  • Plot
  • Plot
  • 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 (12)
40,00060,00080,000100,000120,000AprJulOct2025AprJulOct2026AprJulOct$1,058$2,025Equity from $1,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 long = true as a short, whatever it says; this page passes the same side as strategy.long or strategy.short (line 27) so the engine trades the way the script says.
Net profit
+5.30%
$53.00
Buy and hold
+102.5%
same period
Closed trades
12
9 won · 3 lost
Profitable
75.0%
of closed trades
Profit factor
1.41
gross profit ÷ gross loss
Max drawdown
5.55%
−$58.91

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

    1 setting does nothing

    “Show Date Range” is declared but never read.

  • Check

    No stop loss

    Every exit waits for a signal. Nothing limits a losing trade before the exit condition fires.

  • Note

    5 settings have no label

    In the settings dialog movingaverage_fast (line 17), movingaverage_mid (line 18), movingaverage_slow (line 19), TP (line 29), SL (line 30) 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 27, 33. The upgraded version below moves each call inside an if block.

  • Note

    Uses long =, which v5 renamed line 27

    long = on line 27. v5 writes it as direction = strategy.long or strategy.short.

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, crossunder → ta.crossunder, rsi → ta.rsi.
  • 2 strategy calls use the when = argument (line 27, 33). It is deprecated in v5 and removed in v6, where each call moves inside an if block.

v4 → v5

Verified

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

  • Line 3: //@version=4 → //@version=5
  • Line 6: input(type = input.integer) → input.int()
  • Line 7: input(type = input.integer) → input.int()
  • Line 8: input(type = input.integer) → input.int()
  • Line 9: input(type = input.integer) → input.int()
  • Line 10: input(type = input.integer) → input.int()
8 more edits
  • Line 11: input(type = input.integer) → input.int()
  • Line 12: input(type = input.bool) → input.bool()
  • Line 17: sma → ta.sma
  • Line 18: sma → ta.sma
  • Line 19: sma → ta.sma
  • Line 21: crossunder → ta.crossunder
  • Line 25: rsi → ta.rsi
  • Line 27: long = true → direction = strategy.long
⋯// © Coinrule-//@version=4+//@version=5strategy(shorttitle='Maximized Scalping On Trend',title='Maximized Scalping On Trend (by Coinrule)', overlay=true, initial_capital = 1000, process_orders_on_close=true, default_qty_type = strategy.percent_of_equity, default_qty_value = 30, commission_type=strategy.commission.percent, commission_value=0.1)//Backtest dates-fromMonth = input(defval = 1,    title = "From Month",      type = input.integer, minval = 1, maxval = 12)+fromMonth = input.int(defval = 1,    title = "From Month", minval = 1, maxval = 12)-fromDay   = input(defval = 10,    title = "From Day",        type = input.integer, minval = 1, maxval = 31)+fromDay   = input.int(defval = 10,    title = "From Day", minval = 1, maxval = 31)-fromYear  = input(defval = 2019, title = "From Year",       type = input.integer, minval = 1970)+fromYear  = input.int(defval = 2019, title = "From Year", minval = 1970)-thruMonth = input(defval = 1,    title = "Thru Month",      type = input.integer, minval = 1, maxval = 12)+thruMonth = input.int(defval = 1,    title = "Thru Month", minval = 1, maxval = 12)-thruDay   = input(defval = 1,    title = "Thru Day",        type = input.integer, minval = 1, maxval = 31)+thruDay   = input.int(defval = 1,    title = "Thru Day", minval = 1, maxval = 31)-thruYear  = input(defval = 2112, title = "Thru Year",       type = input.integer, minval = 1970)+thruYear  = input.int(defval = 2112, title = "Thru Year", minval = 1970)-showDate  = input(defval = true, title = "Show Date Range", type = input.bool)+showDate  = input.bool(defval = true, title = "Show Date Range")start     = timestamp(fromYear, fromMonth, fromDay, 00, 00)        // backtest start window⋯//MA inputs and calculations-movingaverage_fast = sma(close, input(9))+movingaverage_fast = ta.sma(close, input(9))-movingaverage_mid= sma(close, input(50))+movingaverage_mid= ta.sma(close, input(50))-movingaverage_slow = sma(close, input (100))+movingaverage_slow = ta.sma(close, input (100))//Trend situation-Bullish= crossunder(close, movingaverage_fast)+Bullish= ta.crossunder(close, movingaverage_fast)Momentum = movingaverage_mid > movingaverage_slow⋯lengthRSI = 14-RSI = rsi(close, lengthRSI)+RSI = ta.rsi(close, lengthRSI)//Entry-strategy.entry(id="long", long = true, when = Bullish and Momentum and RSI > 50 and window())+strategy.entry(id="long", direction = strategy.long, when = Bullish and Momentum and RSI > 50 and window())//Exit⋯

Clean v5

VerifiedDownload the v5 script

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

  • Line 17: input() → input.int()
  • Line 18: input() → input.int()
  • Line 19: input() → input.int()
  • Line 27: when = Bullish and Momentum and RSI > 50 and window() → if block
  • Line 29: input() → input.int()
  • Line 30: input() → input.int()
  • Line 33: when = longStopPrice or longTakeProfit and window() → if block
⋯//MA inputs and calculations-movingaverage_fast = ta.sma(close, input(9))+movingaverage_fast = ta.sma(close, input.int(9))-movingaverage_mid= ta.sma(close, input(50))+movingaverage_mid= ta.sma(close, input.int(50))-movingaverage_slow = ta.sma(close, input (100))+movingaverage_slow = ta.sma(close, input.int (100))//Trend situation⋯//Entry-strategy.entry(id="long", direction = strategy.long, when = Bullish and Momentum and RSI > 50 and window())+if Bullish and Momentum and RSI > 50 and window()+    strategy.entry(id="long", direction = strategy.long)//Exit-TP = input(70)+TP = input.int(70)-SL =input(30)+SL =input.int(30)longTakeProfit  = RSI > TPlongStopPrice = RSI < SL-strategy.close("long", when = longStopPrice or longTakeProfit and window())+if longStopPrice or longTakeProfit and window()+    strategy.close("long")plot(movingaverage_fast, color=color.black, linewidth=2 )⋯

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

⋯// © Coinrule-//@version=5+//@version=6strategy(shorttitle='Maximized Scalping On Trend',title='Maximized Scalping On Trend (by Coinrule)', overlay=true, initial_capital = 1000, process_orders_on_close=true, default_qty_type = strategy.percent_of_equity, default_qty_value = 30, commission_type=strategy.commission.percent, commission_value=0.1)⋯

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 (written input.integer) · min 1 · max 12start
From Day10int (written input.integer) · min 1 · max 31start
From Year2019int (written input.integer) · min 1970start
Thru Month1int (written input.integer) · min 1 · max 12finish
Thru Day1int (written input.integer) · min 1 · max 31finish
Thru Year2112int (written input.integer) · min 1970finish
Show Date Rangetrueboolunused
Movingaverage fast (no label in the script)9intBullish plot
Movingaverage mid (no label in the script)50intMomentum plot
Movingaverage slow (no label in the script)100intMomentum plot
TP (no label in the script)70intlongTakeProfit
SL (no label in the script)30intlongStopPrice

What it calculates

  • Crossunder (crossunder, ta.crossunder in v5)close, Movingaverage fast (9)Bullish · line 21
  • RSI (rsi, ta.rsi in v5)close, lengthRSIRSI · line 25

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 datamovingaverage_fastMovingaverage fastsetting · 9fromYearFrom Yearsetting · 2019fromMonthFrom Monthsetting · 1fromDayFrom Daysetting · 10thruYearThru Yearsetting · 2112thruMonthThru Monthsetting · 1thruDayThru Daysetting · 1movingaverage_midMovingaverage midsetting · 50movingaverage_slowMovingaverage slowsetting · 100TPTPsetting · 70SLSLsetting · 30BullishCrossunder→ BullishRSIRSI→ RSIstartstartvaluefinishfinishvalueMomentumMomentumconditionlongTakeProfitlongTakeProfitconditionlongStopPricelongStopPriceconditionentry:longOpen longstrategy.entryclose:longClose longstrategy.closeplot:34plotplotplot:35plotplotplot:36plotplot

Order rules

OrderFires whenBy defaultLine
Open long longBullish and Momentum and RSI > 50 and window()On27
Close longlongStopPrice or longTakeProfit and window()On33

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, and the live replay matched history.

4/4trades identical when replayed liveThe last 300 bars, from 26 Dec 2025, were fed to the engine as live ticks, four per bar, and compared with the historical run. Orders are decided once per closed bar, so nothing can change mid-bar.
  • 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 timingprocess_orders_on_close = true: orders fill at the signal bar's close.

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+5.3%+102.5%1275%1.415.5%26 Jan 2024 – 21 Oct 2026
BTCUSDT 4h+0.2%+5.5%956%1.062.4%8 May 2026 – 21 Oct 2026
ETHUSDT 1D−7.6%+9.8%863%0.7017.4%26 Jan 2024 – 21 Oct 2026
ETHUSDT 4h+6.1%+8.4%1182%2.673.1%8 May 2026 – 21 Oct 2026
SOLUSDT 1D−2.7%+16.7%771%0.8919.4%26 Jan 2024 – 21 Oct 2026
SOLUSDT 4h+0.9%+21.5%956%1.104.7%8 May 2026 – 21 Oct 2026
BNBUSDT 1D+24.2%+148.3%1283%2.608.5%26 Jan 2024 – 21 Oct 2026
BNBUSDT 4h−1.6%+17.1%875%0.765.9%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 market967%$22.10
Sideways market3100%$31.21
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?

11.8%

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

0%14%
All 12 trades
SideEntryExitBarsP&L
long26 May 2024 68,507.7024 Jun 2024 60,293.3029−$36.50
long22 Oct 2024 67,426.0029 Oct 2024 72,736.407$22.14
long2 Nov 2024 69,374.706 Nov 2024 75,572.004$25.77
long25 Nov 2024 93,010.0017 Dec 2024 106,134.0022$42.12
long18 Dec 2024 100,204.0025 Feb 2025 88,680.4069−$36.91
long16 May 2025 103,464.0018 May 2025 106,454.002$8.19
long28 May 2025 107,782.0010 Jul 2025 116,010.0043$22.81
long18 Jul 2025 117,925.005 Oct 2025 123,482.0079$14.15
long12 May 2026 80,504.502 Jun 2026 66,760.8021−$54.91
long28 Aug 2026 77,845.9029 Aug 2026 78,230.001$0.88
long1 Sep 2026 77,439.003 Sep 2026 81,270.402$14.32
long8 Sep 2026 78,455.8021 Sep 2026 86,620.0013$31.23

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
Maximized Scalping On Trend (by Coinrule) this page—v4 strategy+5.3%125.5%
Triple RSI strategy by Trade_by_DBrsiv5 strategy+3.2%23.3%
Hobbiecode - RSI + Close previous day by hobbiecodersiv5 strategy+1.2%634.2%
dirt cheap yet elegant RSI Strategy by SparkyFlaryrsiv4 strategy−11.4%820.5%
RSI Classic Strategy (by Coinrule) by Coinrulersiv4 strategy+7.5%67.2%
RSITrendStrategy by email_analystsrsiv4 strategy+69.2%2238.6%

Where it runs

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

Zeal Terminal's engine currently reads an order side written as long = true as a short, whatever it says; this page passes the same side as strategy.long or strategy.short (line 27) so the engine trades the way the script says.

“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/// © Coinrule//@version=4strategy(shorttitle='Maximized Scalping On Trend',title='Maximized Scalping On Trend (by Coinrule)', overlay=true, initial_capital = 1000, process_orders_on_close=true, default_qty_type = strategy.percent_of_equity, default_qty_value = 30, commission_type=strategy.commission.percent, commission_value=0.1)//Backtest datesfromMonth = input(defval = 1,    title = "From Month",      type = input.integer, minval = 1, maxval = 12)fromDay   = input(defval = 10,    title = "From Day",        type = input.integer, minval = 1, maxval = 31)fromYear  = input(defval = 2019, title = "From Year",       type = input.integer, minval = 1970)thruMonth = input(defval = 1,    title = "Thru Month",      type = input.integer, minval = 1, maxval = 12)thruDay   = input(defval = 1,    title = "Thru Day",        type = input.integer, minval = 1, maxval = 31)thruYear  = input(defval = 2112, title = "Thru Year",       type = input.integer, minval = 1970)showDate  = input(defval = true, title = "Show Date Range", type = input.bool)start     = timestamp(fromYear, fromMonth, fromDay, 00, 00)        // backtest start windowfinish    = timestamp(thruYear, thruMonth, thruDay, 23, 59)        // backtest finish windowwindow()  => time >= start and time <= finish ? true : false       // create function "within window of time"//MA inputs and calculationsmovingaverage_fast = sma(close, input(9))movingaverage_mid= sma(close, input(50))movingaverage_slow = sma(close, input (100))//Trend situationBullish= crossunder(close, movingaverage_fast)Momentum = movingaverage_mid > movingaverage_slow// RSI inputs and calculationslengthRSI = 14RSI = rsi(close, lengthRSI)//Entrystrategy.entry(id="long", long = true, when = Bullish and Momentum and RSI > 50 and window())//ExitTP = input(70)SL =input(30)longTakeProfit  = RSI > TPlongStopPrice = RSI < SLstrategy.close("long", when = longStopPrice or longTakeProfit and window())plot(movingaverage_fast, color=color.black, linewidth=2 )plot(movingaverage_mid, color=color.orange, linewidth=2)plot(movingaverage_slow, color=color.purple, linewidth=2)