Zeal Terminal Open in Zeal Terminal

Pine Script v4 · Strategy

DI Crossing Daily Straregy HulkTrading

A Pine Script v4 strategy built on Change (high), RMA (tr, 14) and Crossover (di_plus, di_minus). It has 4 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. 2 settings; defaults include ATR Multiplier 1 and Length di 14.

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 DI Crossing Daily Straregy HulkTrading repaint?
No
No repainting patterns were found in the source, and a live tick-by-tick replay matched history on 16 of 16 trades.
How did DI Crossing Daily Straregy HulkTrading do on BTCUSDT 1D with default settings?
+34.26%
From 26 Jan 2024 to 21 Oct 2026, over 65 closed trades, against +102.5% for buy and hold. A backtest, not investment advice.
Can DI Crossing Daily Straregy HulkTrading 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 DI Crossing Daily Straregy HulkTrading use a stop loss?
Yes
strategy.exit sets a stop on line 25, 27.
Does DI Crossing Daily Straregy HulkTrading run in Zeal Terminal?
Yes
It compiles in 12 ms and runs 1,000 bars in 31 ms, in the browser.

BTCUSDT · 1D · default settings

  • Change
  • Change
  • RMA
  • RMA
  • RMA
  • Crossover
  • Crossunder
  • ATR
  • ATR
  • ATR
  • ATR
  • 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 (2)
0.0050,000100,000AprJulOct2025AprJulOct2026AprJulOct$134,263$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.
Net profit
+34.26%
$34,261.10
Buy and hold
+102.5%
same period
Closed trades
65
26 won · 38 lost
Profitable
40.0%
of closed trades
Profit factor
1.38
gross profit ÷ gross loss
Max drawdown
18.44%
−$22,978.20

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.

  • Likely bug

    rma(tr, 14) ignores the settings line 11

    Line 11 hard-codes 14 where line 13 uses “Length di”. Changing those settings moves one band but not this one.

    rma(tr, 14)rma(tr, length)
  • 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 24, 26. 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 change → ta.change, rma → ta.rma, crossover → ta.crossover, crossunder → ta.crossunder, atr → ta.atr.
  • 2 strategy calls use the when = argument (line 24, 26). It is deprecated in v5 and removed in v6, where each call moves inside an if block.

v4 → v5

Verified

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

  • Line 3: //@version=4 → //@version=5
  • Line 9: change → ta.change
  • Line 10: change → ta.change
  • Line 11: range is reserved in v5: renamed range_
  • Line 11: rma → ta.rma
  • Line 11: tr → ta.tr
8 more edits
  • Line 13: rma → ta.rma
  • Line 14: rma → ta.rma
  • Line 16: crossover → ta.crossover
  • Line 17: crossunder → ta.crossunder
  • Line 19: atr → ta.atr
  • Line 20: atr → ta.atr
  • Line 21: atr → ta.atr
  • Line 22: atr → ta.atr
⋯// © TheHulkTrading-//@version=4+//@version=5strategy("DI Crossing Daily Straregy HulkTrading", overlay=true)⋯length = input(14, minval=1, title="Length di")-up = change(high)+up = ta.change(high)-down = -change(low)+down = -ta.change(low)-range = rma(tr, 14)+range_ = ta.rma(ta.tr, 14)//DI+ and DI- Calculations-di_plus = fixnan(100 * rma(up > down and up > 0 ? up : 0, length) / range)+di_plus = fixnan(100 * ta.rma(up > down and up > 0 ? up : 0, length) / range_)-di_minus = fixnan(100 * rma(down > up and down > 0 ? down : 0, length) / range)+di_minus = fixnan(100 * ta.rma(down > up and down > 0 ? down : 0, length) / range_)//Long and short conditions-longCond = crossover(di_plus,di_minus)+longCond = ta.crossover(di_plus,di_minus)-shortCond = crossunder(di_plus,di_minus) +shortCond = ta.crossunder(di_plus,di_minus) //Stop levels and take profits-stop_level_long = strategy.position_avg_price - atr_multiplier*atr(14)+stop_level_long = strategy.position_avg_price - atr_multiplier*ta.atr(14)-take_level_long = strategy.position_avg_price + 2*atr_multiplier*atr(14)+take_level_long = strategy.position_avg_price + 2*atr_multiplier*ta.atr(14)-stop_level_short = strategy.position_avg_price + atr_multiplier*atr(14)+stop_level_short = strategy.position_avg_price + atr_multiplier*ta.atr(14)-take_level_short = strategy.position_avg_price - 2*atr_multiplier*atr(14)+take_level_short = strategy.position_avg_price - 2*atr_multiplier*ta.atr(14)//Entries and exits ⋯

Clean v5

VerifiedDownload the v5 script

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

  • Line 6: input() → input.int()
  • Line 8: input() → input.int()
  • Line 24: when = longCond → if block
  • Line 26: when = shortCond → if block
⋯// ATR Multiplier. Recommended values between 1..4-atr_multiplier = input(1, minval=1, title="ATR Multiplier") +atr_multiplier = input.int(1, minval=1, title="ATR Multiplier") //Length of DI. Recommended default value = 14-length = input(14, minval=1, title="Length di")+length = input.int(14, minval=1, title="Length di")up = ta.change(high)⋯//Entries and exits -strategy.entry("Long", strategy.long, when=longCond)+if longCond+    strategy.entry("Long", strategy.long)strategy.exit("Close Long","Long", stop=stop_level_long, limit = take_level_long)-strategy.entry("Short", strategy.short, when=shortCond)+if shortCond+    strategy.entry("Short", strategy.short)strategy.exit("Close Short","Short", stop=stop_level_short, limit = take_level_short)

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

⋯// © TheHulkTrading-//@version=5+//@version=6strategy("DI Crossing Daily Straregy HulkTrading", 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
ATR Multiplier1int · min 1stop_level_long take_level_long stop_level_short take_level_short
Length di14int · min 1di_plus di_minus

What it calculates

  • Change (change, ta.change in v5)highup · line 9
  • Change (change, ta.change in v5)lowdown · line 10
  • RMA (rma, ta.rma in v5)tr, 14range · line 11
  • RMA (rma, ta.rma in v5)up > down and up > 0 ? up : 0, Length di (14)di_plus · line 13
  • RMA (rma, ta.rma in v5)down > up and down > 0 ? down : 0, Length di (14)di_minus · line 14
  • Crossover (crossover, ta.crossover in v5)di_plus, di_minuslongCond · line 16
  • Crossunder (crossunder, ta.crossunder in v5)di_plus, di_minusshortCond · line 17
  • ATR (atr, ta.atr in v5)14stop_level_long · line 19
  • ATR (atr, ta.atr in v5)14take_level_long · line 20
  • ATR (atr, ta.atr in v5)14stop_level_short · line 21
  • ATR (atr, ta.atr in v5)14take_level_short · line 22

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.

highhighprice datalowlowprice datalengthLength disetting · 14high · low · closehigh · low · closeprice dataatr_multiplierATR Multipliersetting · 1upChange→ updownChange→ downrangeRMA→ rangedi_plusRMA→ di_plusdi_minusRMA→ di_minuslongCondCrossover→ longCondshortCondCrossunder→ shortCondstop_level_longATR→ stop_level_longtake_level_longATR→ take_level_longstop_level_shortATR→ stop_level_shorttake_level_shortATR→ take_level_shortentry:LongOpen Longstrategy.entryexit:Close Longexit Close Longstrategy.exitentry:ShortOpen Shortstrategy.entryexit:Close Shortexit Close Shortstrategy.exit

Order rules

OrderFires whenBy defaultLine
Open Long longlongCondOn24
Exit Close Long stop and limitevery barOn25
Open Short shortshortCondOn26
Exit Close Short stop and limitevery barOn27

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.

16/16trades 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 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+34.3%+102.5%6540%1.3818.4%26 Jan 2024 – 21 Oct 2026
BTCUSDT 4h+7.4%+5.5%8438%1.236.0%8 May 2026 – 21 Oct 2026
ETHUSDT 1D+2.5%+9.8%4943%1.760.7%26 Jan 2024 – 21 Oct 2026
ETHUSDT 4h−0.1%+8.4%8228%0.900.5%8 May 2026 – 21 Oct 2026
SOLUSDT 1D+0.3%+16.7%7043%2.510.0%26 Jan 2024 – 21 Oct 2026
SOLUSDT 4h+0.0%+21.5%7536%1.170.0%8 May 2026 – 21 Oct 2026
BNBUSDT 1D−0.1%+148.3%8628%0.910.4%26 Jan 2024 – 21 Oct 2026
BNBUSDT 4h+0.0%+17.1%8433%1.140.1%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 market2528%−$14,986.70
Sideways market2955%$51,953.80
Falling market1127%−$2,706.04

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

How bad could the drawdown be?

25.1%

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

0%29%
All 65 trades
SideEntryExitBarsP&L
short20 Mar 2024 61,937.4021 Mar 2024 67,840.501−$5,903.10
long26 Mar 2024 69,880.002 Apr 2024 69,649.807−$230.19
short2 Apr 2024 69,649.807 Apr 2024 68,896.005$753.81
long7 Apr 2024 68,896.0012 Apr 2024 65,735.005−$3,160.96
short13 Apr 2024 67,116.5017 Apr 2024 59,807.804$7,308.69
long16 May 2024 66,206.5020 May 2024 71,312.404$5,105.86
short12 Jun 2024 67,314.2021 Jun 2024 63,394.809$3,919.45
long16 Jul 2024 64,724.1029 Jul 2024 69,459.8013$4,735.71
short2 Aug 2024 65,354.003 Aug 2024 60,147.801$5,206.20
long24 Aug 2024 64,037.2027 Aug 2024 61,404.603−$2,632.62
short28 Aug 2024 59,415.006 Sep 2024 54,326.709$5,088.29
long18 Sep 2024 60,314.0023 Sep 2024 64,701.205$4,387.16
short2 Oct 2024 60,804.906 Oct 2024 62,848.904−$2,044.03
long8 Oct 2024 62,224.0010 Oct 2024 60,636.002−$1,588.00
short10 Oct 2024 60,636.0011 Oct 2024 62,644.901−$2,008.94
long12 Oct 2024 62,540.0014 Oct 2024 62,870.002$330.03
short14 Oct 2024 62,870.0014 Oct 2024 64,507.700−$1,637.64
long15 Oct 2024 66,084.0028 Oct 2024 69,974.3013$3,890.30
short21 Dec 2024 97,805.406 Jan 2025 101,197.0016−$3,391.40
long7 Jan 2025 102,236.008 Jan 2025 96,954.601−$5,281.00
short9 Jan 2025 95,060.6015 Jan 2025 98,712.806−$3,652.19
long18 Jan 2025 104,077.0019 Jan 2025 100,320.001−$3,757.90
short27 Jan 2025 102,620.003 Feb 2025 94,379.407$8,240.65
long25 Mar 2025 87,498.2027 Mar 2025 86,909.202−$588.99
short27 Mar 2025 86,909.203 Apr 2025 82,516.307$4,392.89
long3 Apr 2025 82,516.303 Apr 2025 82,516.300$0.00
short7 Apr 2025 78,430.009 Apr 2025 82,249.402−$3,819.40
long13 Apr 2025 85,276.9022 Apr 2025 91,600.909$6,323.99
short31 May 2025 103,985.004 Jun 2025 105,377.004−$1,391.43
long4 Jun 2025 105,377.005 Jun 2025 104,697.001−$680.04
short5 Jun 2025 104,697.009 Jun 2025 107,511.004−$2,814.09
long10 Jun 2025 110,263.0012 Jun 2025 107,385.002−$2,877.62
short13 Jun 2025 105,672.0016 Jun 2025 108,454.003−$2,781.78
long30 Jun 2025 108,357.001 Jul 2025 107,147.001−$1,210.42
short1 Jul 2025 107,147.003 Jul 2025 108,850.002−$1,703.08
long3 Jul 2025 108,850.005 Jul 2025 107,984.002−$865.34
short5 Jul 2025 107,984.007 Jul 2025 109,204.002−$1,219.60
long7 Jul 2025 109,204.0010 Jul 2025 114,218.003$5,014.40
short2 Aug 2025 113,298.007 Aug 2025 115,960.005−$2,661.71
long8 Aug 2025 117,472.0013 Aug 2025 122,812.005$5,340.26
short20 Aug 2025 112,873.0022 Aug 2025 115,724.002−$2,850.92
long23 Aug 2025 116,936.0024 Aug 2025 113,920.001−$3,015.61
short25 Aug 2025 113,494.001 Sep 2025 107,379.007$6,114.53
long9 Sep 2025 112,065.0016 Sep 2025 116,943.007$4,877.86
short23 Sep 2025 112,651.0030 Sep 2025 114,312.007−$1,660.98
long30 Sep 2025 114,312.002 Oct 2025 119,363.002$5,051.52
short11 Oct 2025 112,774.0017 Oct 2025 104,305.006$8,469.97
long27 Oct 2025 114,559.0029 Oct 2025 110,820.002−$3,739.13
short30 Oct 2025 110,021.004 Nov 2025 102,736.005$7,284.83
long30 Dec 2025 87,237.105 Jan 2026 92,103.606$4,866.45
short21 Jan 2026 88,427.7023 Jan 2026 90,912.302−$2,484.59
long5 Mar 2026 72,666.806 Mar 2026 69,061.001−$3,605.80
short7 Mar 2026 68,114.0010 Mar 2026 71,540.903−$3,426.85
long11 Mar 2026 69,948.6017 Mar 2026 75,951.806$6,003.12
short23 Mar 2026 67,859.0024 Mar 2026 70,906.401−$3,047.45
long24 Mar 2026 70,906.4027 Mar 2026 68,820.303−$2,086.14
short27 Mar 2026 68,820.307 Apr 2026 68,853.7011−$33.35
long7 Apr 2026 68,853.7013 Apr 2026 73,781.606$4,927.97
short19 May 2026 77,001.9021 May 2026 77,552.202−$550.36
long21 May 2026 77,552.2022 May 2026 75,593.201−$1,959.02
short23 May 2026 75,539.5025 May 2026 77,573.602−$2,034.08
long20 Aug 2026 69,334.8021 Aug 2026 73,027.001$3,692.24
short14 Oct 2026 83,169.0020 Oct 2026 81,938.406$1,230.62
long20 Oct 2026 81,938.4021 Oct 2026 83,028.101$1,089.75
short21 Oct 2026 83,028.1021 Oct 2026 84,017.800−$989.69

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
DI Crossing Daily Straregy HulkTrading this page—v4 strategy+34.3%6518.4%
Strategy Myth-Busting #12 - OSGFC+SuperTrend - [MYN] by myncryptoatr rmav5 strategydoes not run in Zeal Terminal
Jigga - Survival Level by jigneshjcrma atrv5 strategyNo trades on this market
Nifty & BN 2 Candle Theory Back Testing and Alert Notification by abdullabashaarma atrv5 strategy−1.9%31.9%
Strategy Myth-Busting #8 - TrendSurfers+TrendOsc - [MYN] by myncryptoatr rmav5 strategyNo trades on this market

Where it runs

EngineCompilesRunsMatches TradingView
Zeal Terminal · OpenPineScript v2Yes 12 msYes 1,000 bars in 31 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/// © TheHulkTrading//@version=4strategy("DI Crossing Daily Straregy HulkTrading", overlay=true)// ATR Multiplier. Recommended values between 1..4atr_multiplier = input(1, minval=1, title="ATR Multiplier") //Length of DI. Recommended default value = 14length = input(14, minval=1, title="Length di")up = change(high)down = -change(low)range = rma(tr, 14)//DI+ and DI- Calculationsdi_plus = fixnan(100 * rma(up > down and up > 0 ? up : 0, length) / range)di_minus = fixnan(100 * rma(down > up and down > 0 ? down : 0, length) / range)//Long and short conditionslongCond = crossover(di_plus,di_minus)shortCond = crossunder(di_plus,di_minus) //Stop levels and take profitsstop_level_long = strategy.position_avg_price - atr_multiplier*atr(14)take_level_long = strategy.position_avg_price + 2*atr_multiplier*atr(14)stop_level_short = strategy.position_avg_price + atr_multiplier*atr(14)take_level_short = strategy.position_avg_price - 2*atr_multiplier*atr(14)//Entries and exits strategy.entry("Long", strategy.long, when=longCond)strategy.exit("Close Long","Long", stop=stop_level_long, limit = take_level_long)strategy.entry("Short", strategy.short, when=shortCond)strategy.exit("Close Short","Short", stop=stop_level_short, limit = take_level_short)