Zeal Terminal Open in Zeal Terminal

Pine Script v4 · Strategy

Cross impro test by Canundo Crossover Crossunder Tick values

A Pine Script v4 strategy built on SMA (close, 2), Crossover and Crossunder. It has 2 order rules, 2 entries among them, and trades long and short with the default settings. Exits wait for a signal; there is no stop loss. Each trade is one contract and pays no commission. 4 settings; defaults include Backtest Trade Candle Count 3000, Change mintick for Cross Check (0 = Standard Tick/Pip, Chose pips like 0.5, 10, 100, 0.002) 0 and Add spread between values to be crossed. 0.

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

BTCUSDT · 1D · default settings

  • SMA1
  • SMA1 Improved
  • SMA1 Improved + Spread
  • SMA2
  • SMA2 Improved
  • SMA2 Improved + Spread
  • 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 (4)
40,00060,00080,000100,000120,000AprJulOct2025AprJulOct2026AprJulOct$131,507$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
+28.92%
$28,918.30
Buy and hold
+102.5%
same period
Closed trades
383
158 won · 225 lost
Profitable
41.3%
of closed trades
Profit factor
1.08
gross profit ÷ gross loss
Max drawdown
36.18%
−$56,358.60

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

    No stop loss

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

  • 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 transp =, which v5 removed line 36

    transp = on line 36. v5 folds the transparency into the colour with color.new(c, transp).

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 floor → math.floor, ceil → math.ceil, sma → ta.sma, crossover → ta.crossover, crossunder → ta.crossunder.

v4 → v5

VerifiedDownload the v5 script

Same 383 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.bool) → input.bool()
  • Line 7: input(type = input.integer) → input.int()
  • Line 8: input(type = input.float) → input.float()
  • Line 10: input(type = input.float) → input.float()
  • Line 19: floor → math.floor
8 more edits
  • Line 19: ceil → math.ceil
  • Line 19: floor → math.floor
  • Line 19: ceil → math.ceil
  • Line 21: sma → ta.sma
  • Line 22: sma → ta.sma
  • Line 23: crossover → ta.crossover
  • Line 26: crossunder → ta.crossunder
  • Line 36: transp = 100 removed: the call sets no colour to fold it into, so its default colour loses the transparency
⋯// © Canundo-//@version=4+//@version=5strategy("Cross impro test by Canundo", overlay=true)//Run on 1 min chart for better testing cases where x and y of crossover have the same value.-EnableStrictCross = input(title="Enable Strict Cross (rounds SMA to pips/ticks), otherwise standard", type=input.bool, defval=true) //Disable to see differences+EnableStrictCross = input.bool(title="Enable Strict Cross (rounds SMA to pips/ticks), otherwise standard", defval=true) //Disable to see differences-BacktestTradeCandleCount = input(title="Backtest Trade Candle Count", type=input.integer, defval=3000) //Avoid error for too many trades+BacktestTradeCandleCount = input.int(title="Backtest Trade Candle Count", defval=3000) //Avoid error for too many trades-MinTick = input(title="Change mintick for Cross Check (0 = Standard Tick/Pip, Chose pips like 0.5, 10, 100, 0.002)",-     type=input.float, defval=0) //Precision of round to pip function+MinTick = input.float(title="Change mintick for Cross Check (0 = Standard Tick/Pip, Chose pips like 0.5, 10, 100, 0.002)", defval=0) //Precision of round to pip function-SpreadBetween = input(title="Add spread between values to be crossed.",-     type=input.float, defval=0)+SpreadBetween = input.float(title="Add spread between values to be crossed.", defval=0)     ⋯mult = 1 / (MinTick == 0 ? syminfo.mintick : MinTick)-f_roundToPip(x)=> (x-floor(x*mult)/mult) < (ceil(x*mult)/mult-x) ? floor(x*mult)/mult : ceil(x*mult)/mult+f_roundToPip(x)=> (x-math.floor(x*mult)/mult) < (math.ceil(x*mult)/mult-x) ? math.floor(x*mult)/mult : math.ceil(x*mult)/mult//Very short SMA's to show the effect of crossovers und price values with more decimals than the tick has-sma1 = sma(close, 2), sma1impr = EnableStrictCross ? f_roundToPip(sma1) : sma1+sma1 = ta.sma(close, 2), sma1impr = EnableStrictCross ? f_roundToPip(sma1) : sma1-sma2 = sma(close, 3), sma2impr = EnableStrictCross ? f_roundToPip(sma2) : sma2+sma2 = ta.sma(close, 3), sma2impr = EnableStrictCross ? f_roundToPip(sma2) : sma2-longCondition = crossover(sma1impr - SpreadBetween/2, sma2impr + SpreadBetween/2)+longCondition = ta.crossover(sma1impr - SpreadBetween/2, sma2impr + SpreadBetween/2)if (longCondition and f_tWindow())    strategy.entry("Long", strategy.long)-shortCondition = crossunder(sma1impr + SpreadBetween/2, sma2impr - SpreadBetween/2)+shortCondition = ta.crossunder(sma1impr + SpreadBetween/2, sma2impr - SpreadBetween/2)if (shortCondition and f_tWindow())⋯plot(strategy.position_size < 0 ? sma2impr + SpreadBetween : sma2impr - SpreadBetween, title="SMA2 Improved + Spread", color=color.green, linewidth=1)-plot(sma1*1000, title="sma1*1000 (Show hidden decimal values)", transp=100)+plot(sma1*1000, title="sma1*1000 (Show hidden decimal values)")

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

⋯// © Canundo-//@version=5+//@version=6strategy("Cross impro test by Canundo", 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
Enable Strict Cross (rounds SMA to pips/ticks), otherwise standardtrueboolsma1impr sma2impr
Backtest Trade Candle Count3000int (written input.integer)timeFrame
Change mintick for Cross Check (0 = Standard Tick/Pip, Chose pips like 0.5, 10, 100, 0.002)0floatmult
Add spread between values to be crossed.0floatlongCondition shortCondition SMA1 Improved + Spread SMA2 Improved + Spread

What it calculates

  • SMA (sma, ta.sma in v5)close, 2sma1 · line 21
  • SMA (sma, ta.sma in v5)close, 3sma2 · line 22
  • Crossover (crossover, ta.crossover in v5)sma1impr - SpreadBetween/2, sma2impr + SpreadBetween/2longCondition · line 23
  • Crossunder (crossunder, ta.crossunder in v5)sma1impr + SpreadBetween/2, sma2impr - SpreadBetween/2shortCondition · line 26

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 dataSpreadBetweenAdd spread between valu…setting · 0BacktestTradeCandleCountBacktest Trade Candle C…setting · 3000MinTickChange mintick for Cros…setting · 0sma1SMA→ sma1sma2SMA→ sma2longConditionCrossover→ longConditionshortConditionCrossunder→ shortConditionstarttimestarttimevaluetimeFrametimeFramevaluemultmultvaluesma1imprsma1imprvaluesma2imprsma2imprvalueentry:LongOpen Longstrategy.entryentry:ShortOpen Shortstrategy.entryplot:30SMA1plotplot:31SMA1 Improvedplotplot:32SMA1 Improved + Spreadplotplot:33SMA2plotplot:34SMA2 Improved plotplot:35SMA2 Improved + Spreadplotplot:36sma1*1000 (Show hidden …plot

Order rules

OrderFires whenBy defaultLine
Open Long long(longCondition and f_tWindow())On25
Open Short short(shortCondition and f_tWindow())On28

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.

112/112trades 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+28.9%+102.5%38341%1.0836.2%26 Jan 2024 – 21 Oct 2026
BTCUSDT 4h−0.4%+5.5%38435%1.0017.5%8 May 2026 – 21 Oct 2026
ETHUSDT 1D+3.6%+9.8%36441%1.212.2%26 Jan 2024 – 21 Oct 2026
ETHUSDT 4h−0.3%+8.4%40736%0.930.9%8 May 2026 – 21 Oct 2026
SOLUSDT 1D−0.0%+16.7%35540%0.980.3%26 Jan 2024 – 21 Oct 2026
SOLUSDT 4h+0.0%+21.5%37138%1.020.0%8 May 2026 – 21 Oct 2026
BNBUSDT 1D−0.4%+148.3%37341%0.901.3%26 Jan 2024 – 21 Oct 2026
BNBUSDT 4h+0.1%+17.1%37739%1.140.2%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 market14340%−$17,792.40
Sideways market15644%$39,974.50
Falling market8438%$6,736.16

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

How bad could the drawdown be?

45.5%

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

0%52%
The first 150 of 383 trades
SideEntryExitBarsP&L
short1 Feb 2024 42,580.003 Feb 2024 43,200.002−$619.99
long3 Feb 2024 43,200.005 Feb 2024 42,582.902−$617.11
short5 Feb 2024 42,582.907 Feb 2024 43,099.002−$516.08
long7 Feb 2024 43,099.0019 Feb 2024 52,137.7012$9,038.72
short19 Feb 2024 52,137.7020 Feb 2024 51,774.701$362.94
long20 Feb 2024 51,774.7021 Feb 2024 52,258.801$484.08
short21 Feb 2024 52,258.8022 Feb 2024 51,849.401$409.44
long22 Feb 2024 51,849.4023 Feb 2024 51,288.401−$560.96
short23 Feb 2024 51,288.4026 Feb 2024 51,728.803−$440.43
long26 Feb 2024 51,728.802 Mar 2024 62,387.905$10,659.10
short2 Mar 2024 62,387.903 Mar 2024 61,987.301$400.62
long3 Mar 2024 61,987.307 Mar 2024 66,074.004$4,086.76
short7 Mar 2024 66,074.008 Mar 2024 66,823.201−$749.14
long8 Mar 2024 66,823.2016 Mar 2024 69,499.808$2,676.66
short16 Mar 2024 69,499.8019 Mar 2024 67,610.003$1,889.84
long19 Mar 2024 67,610.0020 Mar 2024 61,937.401−$5,672.59
short20 Mar 2024 61,937.4022 Mar 2024 65,501.302−$3,563.87
long22 Mar 2024 65,501.3023 Mar 2024 63,796.601−$1,704.64
short23 Mar 2024 63,796.6025 Mar 2024 67,210.002−$3,413.36
long25 Mar 2024 67,210.0028 Mar 2024 69,470.003$2,259.99
short28 Mar 2024 69,470.0029 Mar 2024 70,780.601−$1,310.61
long29 Mar 2024 70,780.6031 Mar 2024 69,582.202−$1,198.43
short31 Mar 2024 69,582.201 Apr 2024 71,280.001−$1,697.83
long1 Apr 2024 71,280.003 Apr 2024 65,464.002−$5,816.01
short3 Apr 2024 65,464.005 Apr 2024 68,487.802−$3,023.81
long5 Apr 2024 68,487.807 Apr 2024 68,896.002$408.20
short7 Apr 2024 68,896.008 Apr 2024 69,360.401−$464.38
long8 Apr 2024 69,360.4011 Apr 2024 70,631.103$1,270.70
short11 Apr 2024 70,631.1012 Apr 2024 70,006.201$624.86
long12 Apr 2024 70,006.2013 Apr 2024 67,116.501−$2,889.70
short13 Apr 2024 67,116.5016 Apr 2024 63,420.003$3,696.53
long16 Apr 2024 63,420.0017 Apr 2024 63,793.401$373.41
short17 Apr 2024 63,793.4020 Apr 2024 63,818.003−$24.61
long20 Apr 2024 63,818.0025 Apr 2024 64,289.605$471.57
short25 Apr 2024 64,289.6030 Apr 2024 63,866.005$423.58
long30 Apr 2024 63,866.001 May 2024 60,672.001−$3,193.99
short1 May 2024 60,672.004 May 2024 62,882.003−$2,210.00
long4 May 2024 62,882.007 May 2024 63,165.203$283.17
short7 May 2024 63,165.2011 May 2024 60,800.004$2,365.19
long11 May 2024 60,800.0012 May 2024 60,826.001$26.00
short12 May 2024 60,826.0013 May 2024 61,484.001−$658.01
long13 May 2024 61,484.0018 May 2024 67,024.005$5,540.00
short18 May 2024 67,024.0019 May 2024 66,915.201$108.80
long19 May 2024 66,915.2020 May 2024 66,274.001−$641.20
short20 May 2024 66,274.0021 May 2024 71,446.601−$5,172.62
long21 May 2024 71,446.6023 May 2024 69,166.602−$2,280.00
short23 May 2024 69,166.6026 May 2024 69,290.603−$123.94
long26 May 2024 69,290.6028 May 2024 69,436.402$145.87
short28 May 2024 69,436.4029 May 2024 68,398.401$1,038.03
long29 May 2024 68,398.4030 May 2024 67,652.401−$745.99
short30 May 2024 67,652.401 Jun 2024 67,540.002$112.40
long1 Jun 2024 67,540.002 Jun 2024 67,766.801$226.83
short2 Jun 2024 67,766.803 Jun 2024 67,765.601$1.22
long3 Jun 2024 67,765.608 Jun 2024 69,355.605$1,589.98
short8 Jun 2024 69,355.6010 Jun 2024 69,648.102−$292.55
long10 Jun 2024 69,648.1012 Jun 2024 67,314.202−$2,333.92
short12 Jun 2024 67,314.2014 Jun 2024 66,773.002$541.22
long14 Jun 2024 66,773.0015 Jun 2024 66,044.001−$729.02
short15 Jun 2024 66,044.0017 Jun 2024 66,676.902−$632.87
long17 Jun 2024 66,676.9019 Jun 2024 65,175.302−$1,501.54
short19 Jun 2024 65,175.3027 Jun 2024 60,865.008$4,310.34
long27 Jun 2024 60,865.0028 Jun 2024 61,706.501$841.48
short28 Jun 2024 61,706.5029 Jun 2024 60,427.801$1,278.62
long29 Jun 2024 60,427.8030 Jun 2024 60,986.701$558.84
short30 Jun 2024 60,986.701 Jul 2024 62,772.001−$1,785.33
long1 Jul 2024 62,772.003 Jul 2024 62,135.502−$636.55
short3 Jul 2024 62,135.507 Jul 2024 58,230.104$3,905.33
long7 Jul 2024 58,230.109 Jul 2024 56,714.602−$1,515.52
short9 Jul 2024 56,714.6010 Jul 2024 58,050.001−$1,335.39
long10 Jul 2024 58,050.0012 Jul 2024 57,339.902−$710.11
short12 Jul 2024 57,339.9014 Jul 2024 59,204.002−$1,864.12
long14 Jul 2024 59,204.0018 Jul 2024 64,088.004$4,883.98
short18 Jul 2024 64,088.0020 Jul 2024 66,660.002−$2,572.02
long20 Jul 2024 66,660.0024 Jul 2024 65,936.004−$724.01
short24 Jul 2024 65,936.0027 Jul 2024 67,908.003−$1,972.00
long27 Jul 2024 67,908.0030 Jul 2024 66,784.703−$1,123.32
short30 Jul 2024 66,784.708 Aug 2024 55,133.809$11,650.90
long8 Aug 2024 55,133.8011 Aug 2024 60,923.503$5,789.75
short11 Aug 2024 60,923.5014 Aug 2024 60,587.203$336.35
long14 Aug 2024 60,587.2016 Aug 2024 57,541.102−$3,046.11
short16 Aug 2024 57,541.1018 Aug 2024 59,492.002−$1,950.94
long18 Aug 2024 59,492.0020 Aug 2024 59,438.502−$53.49
short20 Aug 2024 59,438.5021 Aug 2024 59,013.801$424.70
long21 Aug 2024 59,013.8027 Aug 2024 62,834.006$3,820.20
short27 Aug 2024 62,834.0031 Aug 2024 59,124.004$3,710.01
long31 Aug 2024 59,124.001 Sep 2024 58,974.001−$149.99
short1 Sep 2024 58,974.004 Sep 2024 57,487.703$1,486.26
long4 Sep 2024 57,487.705 Sep 2024 57,970.901$483.16
short5 Sep 2024 57,970.909 Sep 2024 54,869.904$3,100.95
long9 Sep 2024 54,869.9016 Sep 2024 59,132.007$4,262.05
short16 Sep 2024 59,132.0018 Sep 2024 60,314.002−$1,181.99
long18 Sep 2024 60,314.0027 Sep 2024 65,174.009$4,860.00
short27 Sep 2024 65,174.0028 Sep 2024 65,769.901−$595.96
long28 Sep 2024 65,769.9030 Sep 2024 65,602.002−$167.94
short30 Sep 2024 65,602.005 Oct 2024 62,086.005$3,516.01
long5 Oct 2024 62,086.009 Oct 2024 62,160.504$74.50
short9 Oct 2024 62,160.5012 Oct 2024 62,540.003−$379.49
long12 Oct 2024 62,540.0022 Oct 2024 67,377.5010$4,837.51
short22 Oct 2024 67,377.5025 Oct 2024 68,198.303−$820.77
long25 Oct 2024 68,198.3027 Oct 2024 67,092.802−$1,105.51
short27 Oct 2024 67,092.8028 Oct 2024 68,021.701−$928.93
long28 Oct 2024 68,021.701 Nov 2024 70,292.004$2,270.32
short1 Nov 2024 70,292.007 Nov 2024 75,572.006−$5,279.98
long7 Nov 2024 75,572.0016 Nov 2024 91,032.109$15,460.10
short16 Nov 2024 91,032.1017 Nov 2024 90,588.001$444.10
long17 Nov 2024 90,588.0018 Nov 2024 89,856.001−$732.00
short18 Nov 2024 89,856.0020 Nov 2024 92,310.802−$2,454.82
long20 Nov 2024 92,310.8024 Nov 2024 97,672.404$5,361.60
short24 Nov 2024 97,672.4028 Nov 2024 95,863.104$1,809.29
long28 Nov 2024 95,863.102 Dec 2024 97,185.204$1,322.06
short2 Dec 2024 97,185.203 Dec 2024 95,840.601$1,344.56
long3 Dec 2024 95,840.604 Dec 2024 95,849.701$9.08
short4 Dec 2024 95,849.705 Dec 2024 98,587.301−$2,737.63
long5 Dec 2024 98,587.307 Dec 2024 99,740.802$1,153.52
short7 Dec 2024 99,740.808 Dec 2024 99,832.001−$91.15
long8 Dec 2024 99,832.0010 Dec 2024 97,276.502−$2,555.51
short10 Dec 2024 97,276.5012 Dec 2024 101,125.002−$3,848.52
long12 Dec 2024 101,125.0014 Dec 2024 101,424.002$299.24
short14 Dec 2024 101,424.0015 Dec 2024 101,420.001$4.24
long15 Dec 2024 101,420.0019 Dec 2024 100,204.004−$1,215.99
short19 Dec 2024 100,204.0022 Dec 2024 97,292.003$2,912.01
long22 Dec 2024 97,292.0023 Dec 2024 95,186.301−$2,105.72
short23 Dec 2024 95,186.3025 Dec 2024 98,663.602−$3,477.30
long25 Dec 2024 98,663.6027 Dec 2024 95,791.602−$2,871.98
short27 Dec 2024 95,791.6030 Dec 2024 93,738.203$2,053.41
long30 Dec 2024 93,738.2031 Dec 2024 92,792.101−$946.14
short31 Dec 2024 92,792.102 Jan 2025 94,591.802−$1,799.73
long2 Jan 2025 94,591.809 Jan 2025 95,060.607$468.83
short9 Jan 2025 95,060.6012 Jan 2025 94,600.003$460.62
long12 Jan 2025 94,600.0013 Jan 2025 94,545.101−$54.92
short13 Jan 2025 94,545.1015 Jan 2025 96,560.902−$2,015.78
long15 Jan 2025 96,560.9020 Jan 2025 101,332.005$4,770.72
short20 Jan 2025 101,332.0022 Jan 2025 106,144.002−$4,812.25
long22 Jan 2025 106,144.0024 Jan 2025 103,910.002−$2,233.47
short24 Jan 2025 103,910.0025 Jan 2025 104,871.001−$960.16
long25 Jan 2025 104,871.0027 Jan 2025 102,620.002−$2,250.50
short27 Jan 2025 102,620.0030 Jan 2025 103,733.003−$1,113.24
long30 Jan 2025 103,733.001 Feb 2025 102,430.002−$1,303.69
short1 Feb 2025 102,430.005 Feb 2025 97,763.104$4,666.42
long5 Feb 2025 97,763.106 Feb 2025 96,612.401−$1,150.70
short6 Feb 2025 96,612.4011 Feb 2025 97,430.805−$818.38
long11 Feb 2025 97,430.8013 Feb 2025 97,870.002$439.18
short13 Feb 2025 97,870.0014 Feb 2025 96,608.101$1,261.87
long14 Feb 2025 96,608.1015 Feb 2025 97,500.501$892.34
short15 Feb 2025 97,500.5016 Feb 2025 97,569.701−$69.20
long16 Feb 2025 97,569.7017 Feb 2025 96,118.101−$1,451.55
short17 Feb 2025 96,118.1020 Feb 2025 96,644.403−$526.25
long20 Feb 2025 96,644.4023 Feb 2025 96,551.003−$93.36
short23 Feb 2025 96,551.0024 Feb 2025 96,258.001$293.01
long24 Feb 2025 96,258.0025 Feb 2025 91,552.901−$4,705.12

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
Cross impro test by Canundo Crossover Crossunder Tick values this page—v4 strategy+28.9%38336.2%
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 12 msYes 1,000 bars in 39 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/// © Canundo//@version=4strategy("Cross impro test by Canundo", overlay=true)//Run on 1 min chart for better testing cases where x and y of crossover have the same value.EnableStrictCross = input(title="Enable Strict Cross (rounds SMA to pips/ticks), otherwise standard", type=input.bool, defval=true) //Disable to see differencesBacktestTradeCandleCount = input(title="Backtest Trade Candle Count", type=input.integer, defval=3000) //Avoid error for too many tradesMinTick = input(title="Change mintick for Cross Check (0 = Standard Tick/Pip, Chose pips like 0.5, 10, 100, 0.002)",     type=input.float, defval=0) //Precision of round to pip functionSpreadBetween = input(title="Add spread between values to be crossed.",     type=input.float, defval=0)     //Calculate Timeframe for Backtest demonstrationstarttime = 0, starttime := starttime[1] != 0 ? starttime[1] : timenowtimeFrame = (time_close - time_close[1]) * BacktestTradeCandleCountf_tWindow() => time >= starttime - timeFrame ? true : false//Rounding functionmult = 1 / (MinTick == 0 ? syminfo.mintick : MinTick)f_roundToPip(x)=> (x-floor(x*mult)/mult) < (ceil(x*mult)/mult-x) ? floor(x*mult)/mult : ceil(x*mult)/mult//Very short SMA's to show the effect of crossovers und price values with more decimals than the tick hassma1 = sma(close, 2), sma1impr = EnableStrictCross ? f_roundToPip(sma1) : sma1sma2 = sma(close, 3), sma2impr = EnableStrictCross ? f_roundToPip(sma2) : sma2longCondition = crossover(sma1impr - SpreadBetween/2, sma2impr + SpreadBetween/2)if (longCondition and f_tWindow())    strategy.entry("Long", strategy.long)shortCondition = crossunder(sma1impr + SpreadBetween/2, sma2impr - SpreadBetween/2)if (shortCondition and f_tWindow())    strategy.entry("Short", strategy.short)//Show changed SMA as line, show normal SMA with crosses.plot(sma1, title="SMA1", color=color.red, linewidth=2, style=plot.style_cross)plot(sma1impr, title="SMA1 Improved", color=color.red, linewidth=2, style=plot.style_cross)plot(strategy.position_size < 0 ? sma1impr - SpreadBetween/2 : sma1impr + SpreadBetween/2, title="SMA1 Improved + Spread", color=color.red, linewidth=1)plot(sma2, title="SMA2", color=color.green, linewidth=2, style=plot.style_cross)plot(sma2impr, title="SMA2 Improved ", color=color.green, linewidth=2, style=plot.style_cross)plot(strategy.position_size < 0 ? sma2impr + SpreadBetween : sma2impr - SpreadBetween, title="SMA2 Improved + Spread", color=color.green, linewidth=1)plot(sma1*1000, title="sma1*1000 (Show hidden decimal values)", transp=100)