Zeal Terminal Open in Zeal Terminal

Pine Script v3 · Strategy

Legacy

Scalping Dips On Trend (by Coinrule)

A Pine Script v3 strategy built on SMA (close, 50). 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 2020.

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 Scalping Dips On Trend (by Coinrule) repaint?
No
No repainting patterns were found in the source, and a live tick-by-tick replay matched history on 11 of 11 trades.
How did Scalping Dips On Trend (by Coinrule) do on BTCUSDT 1D with default settings?
+2.56%
From 26 Jan 2024 to 21 Oct 2026, over 35 closed trades, against +102.5% for buy and hold. A backtest, not investment advice.
Can Scalping Dips On Trend (by Coinrule) be converted to Pine Script v5?
No
The automatic step from v3 to v4 changes the results, so no v4 download is offered; the edits are shown below.
Does Scalping Dips On Trend (by Coinrule) use a stop loss?
No
Every exit waits for a signal; nothing limits a losing trade before it fires.
Does Scalping Dips On Trend (by Coinrule) run in Zeal Terminal?
Yes
It compiles in 8 ms and runs 1,000 bars in 57 ms, in the browser.

BTCUSDT · 1D · default settings

  • SMA
  • 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,026$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. The script plots nothing itself; the lines and the lower pane are its own calculations, drawn for reference. 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
+2.56%
$25.64
Buy and hold
+102.5%
same period
Closed trades
35
27 won · 8 lost
Profitable
77.1%
of closed trades
Profit factor
1.08
gross profit ÷ gross loss
Max drawdown
12.39%
−$134.53

One run with the author's default settings, $1,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

    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

    3 settings have no label

    In the settings dialog dip (line 26), Stop_loss (line 29), Take_profit (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.

Upgrade and export

Written in Pine Script v3. The upgrade to v5 takes 2 steps, 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.
  • 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.

v3 → v4

Differs

Trades differ: 35 before, 35 after on BTCUSDT 1D, 1,000 bars, in Zeal Terminal's engine.

  • Line 3: //@version=3 → //@version=4
⋯// © Coinrule-//@version=3+//@version=4strategy(shorttitle='Scalping Dips On Trend',title='Scalping Dips On Trend (by Coinrule)', overlay=true, initial_capital = 1000, default_qty_type = strategy.percent_of_equity, default_qty_value = 30, commission_type=strategy.commission.percent, commission_value=0.1)⋯

v4 → v5

Verified

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

  • Line 3: //@version=4 → //@version=5
  • Line 24: sma → ta.sma
  • Line 27: long = true → direction = strategy.long
⋯// © Coinrule-//@version=4+//@version=5strategy(shorttitle='Scalping Dips On Trend',title='Scalping Dips On Trend (by Coinrule)', overlay=true, initial_capital = 1000, default_qty_type = strategy.percent_of_equity, default_qty_value = 30, commission_type=strategy.commission.percent, commission_value=0.1)⋯MA=input(50, title='Moving Average')-MAsignal = sma(close, MA)+MAsignal = ta.sma(close, MA)//Entrydip= -(input(2))-strategy.entry(id="long", long = true, when = overall< dip and MAsignal > close and window()) +strategy.entry(id="long", direction = strategy.long, when = overall< dip and MAsignal > close and window()) //Exit⋯

Clean v5

Verified

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

  • Line 6: input() → input.int()
  • Line 7: input() → input.int()
  • Line 8: input() → input.int()
  • Line 9: input() → input.int()
  • Line 10: input() → input.int()
  • Line 11: input() → input.int()
8 more edits
  • Line 12: input() → input.bool()
  • Line 16: input() → input.int()
  • Line 23: input() → input.int()
  • Line 26: input() → input.int()
  • Line 27: when = overall< dip and MAsignal > close and window() → if block
  • Line 29: input() → input.int()
  • Line 30: input() → input.int()
  • Line 33: when = close < longStopPrice or close > longTakeProfit and window() → if block
⋯//Backtest dates-fromMonth = input(defval = 1,  title = "From Month")     +fromMonth = input.int(defval = 1,  title = "From Month")     -fromDay   = input(defval = 10,    title = "From Day")       +fromDay   = input.int(defval = 10,    title = "From Day")       -fromYear  = input(defval = 2020, title = "From Year")       +fromYear  = input.int(defval = 2020, title = "From Year")       -thruMonth = input(defval = 1,    title = "Thru Month")     +thruMonth = input.int(defval = 1,    title = "Thru Month")     -thruDay   = input(defval = 1,    title = "Thru Day")     +thruDay   = input.int(defval = 1,    title = "Thru Day")     -thruYear  = input(defval = 2112, title = "Thru Year")       +thruYear  = input.int(defval = 2112, title = "Thru Year")       -showDate  = input(defval = true, title = "Show Date Range")+showDate  = input.bool(defval = true, title = "Show Date Range")start     = timestamp(fromYear, fromMonth, fromDay, 00, 00)        // backtest start window⋯window()  => time >= start and time <= finish ? true : false       // create function "within window of time"-inp_lkb = input(1, title='Lookback Period')+inp_lkb = input.int(1, title='Lookback Period') ⋯//MA inputs and calculations-MA=input(50, title='Moving Average')+MA=input.int(50, title='Moving Average')MAsignal = ta.sma(close, MA)//Entry-dip= -(input(2))+dip= -(input.int(2))-strategy.entry(id="long", direction = strategy.long, when = overall< dip and MAsignal > close and window()) +if overall< dip and MAsignal > close and window()+    strategy.entry(id="long", direction = strategy.long) //Exit-Stop_loss= ((input (10))/100)+Stop_loss= ((input.int (10))/100)-Take_profit= ((input (3))/100)+Take_profit= ((input.int (3))/100)longStopPrice  = strategy.position_avg_price * (1 - Stop_loss)longTakeProfit = strategy.position_avg_price * (1 + Take_profit)-strategy.close("long", when = close < longStopPrice or close > longTakeProfit and window())+if close < longStopPrice or close > longTakeProfit and window()+    strategy.close("long")

Does it run in Pine Script v6?

No

Same 35 trades and the same P&L on BTCUSDT 1D, 1,000 bars, in Zeal Terminal's engine. The v6 version matches the upgraded v5 version, but the upgrade from the original already changed the results, so 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='Scalping Dips On Trend',title='Scalping Dips On Trend (by Coinrule)', overlay=true, initial_capital = 1000, 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 Month1intstart
From Day10intstart
From Year2020intstart
Thru Month1intfinish
Thru Day1intfinish
Thru Year2112intfinish
Show Date Rangetrueboolunused
Lookback Period1intoverall
Moving Average50intMAsignal
Dip (no label in the script)2intentry long
Stop loss (no label in the script)10intlongStopPrice
Take profit (no label in the script)3intlongTakeProfit

What it calculates

  • SMA (sma, ta.sma in v5)close, Moving Average (50)MAsignal · 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.

closecloseprice dataMAMoving Averagesetting · 50fromYearFrom Yearsetting · 2020fromMonthFrom Monthsetting · 1fromDayFrom Daysetting · 10thruYearThru Yearsetting · 2112thruMonthThru Monthsetting · 1thruDayThru Daysetting · 1inp_lkbLookback Periodsetting · 1Stop_lossStop losssetting · 10Take_profitTake profitsetting · 3dipDipsetting · 2MAsignalSMA→ MAsignalstartstartvaluefinishfinishvalueoverall_changeoverall_changevalueoveralloverallvaluelongStopPricelongStopPricevaluelongTakeProfitlongTakeProfitvalueentry:longOpen longstrategy.entryclose:longClose longstrategy.close

Order rules

OrderFires whenBy defaultLine
Open long longoverall< dip and MAsignal > close and window()On27
Close longclose < longStopPrice or close > 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.

11/11trades 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 calc_on_every_tick. 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+2.6%+102.5%3577%1.0812.4%26 Jan 2024 – 21 Oct 2026
BTCUSDT 4h+0.5%+5.5%580%1.163.3%8 May 2026 – 21 Oct 2026
ETHUSDT 1D−6.8%+9.8%6068%0.9117.9%26 Jan 2024 – 21 Oct 2026
ETHUSDT 4h+1.8%+8.4%1173%1.187.6%8 May 2026 – 21 Oct 2026
SOLUSDT 1D+25.0%+16.7%7876%1.2913.7%26 Jan 2024 – 21 Oct 2026
SOLUSDT 4h−3.4%+21.5%967%0.676.9%8 May 2026 – 21 Oct 2026
BNBUSDT 1D−12.8%+148.3%3569%0.7118.2%26 Jan 2024 – 21 Oct 2026
BNBUSDT 4h+2.9%+17.1%786%1.913.6%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 market580%$1.97
Sideways market1771%−$41.48
Falling market1385%$65.15

Rising and falling mean the market moved more than 15% over the 90 bars before entry.

How bad could the drawdown be?

16.9%

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

0%19%
All 35 trades
SideEntryExitBarsP&L
long14 Apr 2024 63,924.5023 Apr 2024 66,819.309$12.97
long25 Apr 2024 64,289.6018 May 2024 67,024.0023$12.30
long25 Jun 2024 60,293.301 Jul 2024 62,772.006$12.02
long4 Jul 2024 60,208.6016 Jul 2024 64,724.1012$22.69
long3 Aug 2024 61,498.306 Aug 2024 54,018.803−$39.27
long12 Aug 2024 58,712.6014 Aug 2024 60,587.202$9.15
long15 Aug 2024 58,683.4022 Aug 2024 61,156.007$12.39
long28 Aug 2024 59,415.0019 Sep 2024 61,760.0022$11.70
long10 Oct 2024 60,636.0012 Oct 2024 62,540.002$9.29
long8 Jan 2025 96,954.6016 Jan 2025 100,497.008$11.01
long3 Feb 2025 97,700.604 Feb 2025 101,329.001$11.31
long5 Feb 2025 97,763.1027 Feb 2025 84,250.1022−$45.62
long4 Mar 2025 86,221.206 Mar 2025 90,606.002$15.23
long8 Mar 2025 86,801.709 Apr 2025 76,322.4032−$38.81
long11 Apr 2025 79,607.3012 Apr 2025 83,423.801$13.99
long20 Aug 2025 112,873.0023 Aug 2025 116,936.003$10.50
long26 Aug 2025 110,112.0011 Sep 2025 113,960.0016$10.28
long23 Sep 2025 112,651.002 Oct 2025 118,595.009$15.99
long11 Oct 2025 112,774.007 Nov 2025 101,346.0027−$33.05
long12 Nov 2025 103,059.0018 Nov 2025 92,215.106−$33.23
long21 Nov 2025 86,637.2027 Nov 2025 90,484.006$12.72
long2 Dec 2025 86,286.003 Dec 2025 91,277.901$16.97
long6 Dec 2025 89,330.0010 Dec 2025 92,678.804$10.96
long13 Dec 2025 90,268.406 Jan 2026 93,859.7024$11.79
long21 Jan 2026 88,427.701 Feb 2026 78,741.1011−$35.21
long2 Feb 2026 76,968.206 Feb 2026 62,909.904−$56.34
long12 Feb 2026 67,082.5015 Feb 2026 69,822.903$11.20
long18 Feb 2026 67,503.505 Mar 2026 72,666.8015$21.72
long6 Mar 2026 70,891.0017 Mar 2026 74,884.7011$16.20
long22 Mar 2026 68,918.1026 Mar 2026 71,336.504$10.02
long27 Mar 2026 68,820.308 Apr 2026 71,924.2012$13.19
long23 May 2026 75,539.503 Jun 2026 66,760.8011−$36.64
long4 Jun 2026 64,142.8016 Jun 2026 66,328.7012$9.59
long19 Jun 2026 62,958.0015 Jul 2026 65,044.0026$9.40
long1 Aug 2026 62,887.908 Aug 2026 64,923.207$9.25

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
Scalping Dips On Trend (by Coinrule) this page—v3 strategy+2.6%3512.4%
Follow the Crypto Shorts by xtradernetsmav4 strategyNo trades on this market
buy down and sell high trend 200 sma and ma cross by willi130503smav4 strategyNo trades on this market
Mayer Multiple Strategy by xtradernetsmav4 strategyNo trades on this market
Moving Average Cross Strategy early Closing by Geduldtradersmav4 strategy+73.8%20151.5%
MFI Simple Strategy by OztheWozsmav5 strategy−0.2%283.2%

Where it runs

EngineCompilesRunsMatches TradingView
Zeal Terminal · OpenPineScript v2Yes 8 msWith a workaround 1,000 bars in 57 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=3strategy(shorttitle='Scalping Dips On Trend',title='Scalping Dips On Trend (by Coinrule)', overlay=true, initial_capital = 1000, 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")     fromDay   = input(defval = 10,    title = "From Day")       fromYear  = input(defval = 2020, title = "From Year")       thruMonth = input(defval = 1,    title = "Thru Month")     thruDay   = input(defval = 1,    title = "Thru Day")     thruYear  = input(defval = 2112, title = "Thru Year")       showDate  = input(defval = true, title = "Show Date Range")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"inp_lkb = input(1, title='Lookback Period') perc_change(lkb) =>    overall_change = ((close[0] - close[lkb]) / close[lkb]) * 100// Call the function    overall = perc_change(inp_lkb)//MA inputs and calculationsMA=input(50, title='Moving Average')MAsignal = sma(close, MA)//Entrydip= -(input(2))strategy.entry(id="long", long = true, when = overall< dip and MAsignal > close and window()) //ExitStop_loss= ((input (10))/100)Take_profit= ((input (3))/100)longStopPrice  = strategy.position_avg_price * (1 - Stop_loss)longTakeProfit = strategy.position_avg_price * (1 + Take_profit)strategy.close("long", when = close < longStopPrice or close > longTakeProfit and window())