Zeal Terminal Open in Zeal Terminal

Pine Script v5 · Strategy

[Strategy Alert Webhook Demo] Buy One Sell One

A Pine Script v5 strategy with no technical-analysis calculation. 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 commits 10% of equity and pays no commission. It has no settings.

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 [Strategy Alert Webhook Demo] Buy One Sell One repaint?
No
No repainting patterns were found in the source, and a live tick-by-tick replay matched history on 299 of 299 trades.
How did [Strategy Alert Webhook Demo] Buy One Sell One do on BTCUSDT 1D with default settings?
−8.36%
From 26 Jan 2024 to 21 Oct 2026, over 998 closed trades, against +102.5% for buy and hold. A backtest, not investment advice.
What alerts does [Strategy Alert Webhook Demo] Buy One Sell One have?
1
{"action":"closeLong","percent":"' + percent + '","profit":"' + sl + '","loss":"' + tp + '","connectorName":"' + CONNECTOR_NAME + '","connectorToken":"' + CONNECTOR_TOKEN + '","log":"Close long at price:' + cls + '"}.
Does [Strategy Alert Webhook Demo] Buy One Sell One 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: 998 before, 998 after on BTCUSDT 1D, 1,000 bars, in Zeal Terminal's engine. It is shown for reference and is not offered as a download.
Does [Strategy Alert Webhook Demo] Buy One Sell One use a stop loss?
No
Every exit waits for a signal; nothing limits a losing trade before it fires.

BTCUSDT · 1D · default settings

  • 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 (0)
40,00060,00080,000100,000120,000AprJulOct2025AprJulOct2026AprJulOct$918,287$2,025,273Equity from $1,000,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
−8.36%
−$83,578.10
Buy and hold
+102.5%
same period
Closed trades
998
479 won · 519 lost
Profitable
48.0%
of closed trades
Profit factor
0.91
gross profit ÷ gross loss
Max drawdown
12.79%
−$132,792.00

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

Settings

Every input the script declares, with its default and what it feeds. Bounds are the ones the script enforces.

The script declares no settings.

What it calculates

No technical-analysis calculation: the script works on prices and settings directly.

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 dataclsclsvaluetp, sltp · sl2 valuesentry:Enter LongOpen Enter Longstrategy.entryentry:Enter ShortOpen Enter Shortstrategy.entryalert:24alertalert

Order rules

OrderFires whenBy defaultLine
Open Enter Long long(bar_index % 2 == 0)On18
Open Enter Short short(bar_index % 2 == 0)On21

Each order is guarded by the setting shown. “Off” orders never fire unless that setting is switched on.

Alerts

AlertCallMessageLine
(no title)alert{"action":"closeLong","percent":"' + percent + '","profit":"' + sl + '","loss":"' + tp + '","connectorName":"' + CONNECTOR_NAME + '","connectorToken":"' + CONNECTOR_TOKEN + '","log":"Close long at price:' + cls + '"}24

Does it repaint?

No

No repainting patterns in the source, and the live replay matched history.

299/299trades 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−8.4%+102.5%99848%0.9112.8%26 Jan 2024 – 21 Oct 2026
BTCUSDT 4h+0.8%+5.5%99851%1.031.6%8 May 2026 – 21 Oct 2026
ETHUSDT 1D−12.7%+9.8%99847%0.9017.8%26 Jan 2024 – 21 Oct 2026
ETHUSDT 4h+1.0%+8.4%99850%1.032.1%8 May 2026 – 21 Oct 2026
SOLUSDT 1D−16.4%+16.7%99848%0.8923.2%26 Jan 2024 – 21 Oct 2026
SOLUSDT 4h+1.9%+21.5%99850%1.052.8%8 May 2026 – 21 Oct 2026
BNBUSDT 1D−7.3%+148.3%99847%0.9215.3%26 Jan 2024 – 21 Oct 2026
BNBUSDT 4h−2.5%+17.1%99851%0.923.5%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 market34451%−$7,103.25
Sideways market43049%−$18,688.00
Falling market22443%−$57,786.80

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

How bad could the drawdown be?

15.9%

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

0%18%
The first 150 of 998 trades
SideEntryExitBarsP&L
long27 Jan 2024 41,823.5028 Jan 2024 42,120.601$710.41
short28 Jan 2024 42,120.6029 Jan 2024 42,031.101$212.83
long29 Jan 2024 42,031.1030 Jan 2024 43,302.701$3,028.32
short30 Jan 2024 43,302.7031 Jan 2024 42,941.101$838.38
long31 Jan 2024 42,941.101 Feb 2024 42,580.001−$844.95
short1 Feb 2024 42,580.002 Feb 2024 43,082.901−$1,185.85
long2 Feb 2024 43,082.903 Feb 2024 43,200.001$272.41
short3 Feb 2024 43,200.004 Feb 2024 43,011.101$438.57
long4 Feb 2024 43,011.105 Feb 2024 42,582.901−$999.06
short5 Feb 2024 42,582.906 Feb 2024 42,708.701−$296.20
long6 Feb 2024 42,708.707 Feb 2024 43,099.001$915.76
short7 Feb 2024 43,099.008 Feb 2024 44,349.601−$2,910.76
long8 Feb 2024 44,349.609 Feb 2024 45,288.701$2,117.78
short9 Feb 2024 45,288.7010 Feb 2024 47,132.801−$4,081.28
long10 Feb 2024 47,132.8011 Feb 2024 47,751.101$1,309.49
short11 Feb 2024 47,751.1012 Feb 2024 48,300.001−$1,149.00
long12 Feb 2024 48,300.0013 Feb 2024 49,917.301$3,342.97
short13 Feb 2024 49,917.3014 Feb 2024 49,699.601$436.83
long14 Feb 2024 49,699.6015 Feb 2024 51,795.201$4,225.57
short15 Feb 2024 51,795.2016 Feb 2024 51,880.001−$164.84
long16 Feb 2024 51,880.0017 Feb 2024 52,124.101$473.42
short17 Feb 2024 52,124.1018 Feb 2024 51,642.601$929.86
long18 Feb 2024 51,642.6019 Feb 2024 52,137.701$965.89
short19 Feb 2024 52,137.7020 Feb 2024 51,774.701$702.10
long20 Feb 2024 51,774.7021 Feb 2024 52,258.801$943.66
short21 Feb 2024 52,258.8022 Feb 2024 51,849.401$791.50
long22 Feb 2024 51,849.4023 Feb 2024 51,288.401−$1,093.83
short23 Feb 2024 51,288.4024 Feb 2024 50,744.201$1,071.73
long24 Feb 2024 50,744.2025 Feb 2024 51,568.201$1,641.82
short25 Feb 2024 51,568.2026 Feb 2024 51,728.801−$315.45
long26 Feb 2024 51,728.8027 Feb 2024 54,476.501$5,377.08
short27 Feb 2024 54,476.5028 Feb 2024 57,037.301−$4,784.10
long28 Feb 2024 57,037.3029 Feb 2024 62,432.101$9,580.51
short29 Feb 2024 62,432.101 Mar 2024 61,131.001$2,130.95
long1 Mar 2024 61,131.002 Mar 2024 62,387.901$2,106.74
short2 Mar 2024 62,387.903 Mar 2024 61,987.301$659.31
long3 Mar 2024 61,987.304 Mar 2024 63,114.001$1,867.41
short4 Mar 2024 63,114.005 Mar 2024 68,245.701−$8,368.87
long5 Mar 2024 68,245.706 Mar 2024 63,724.001−$6,764.07
short6 Mar 2024 63,724.007 Mar 2024 66,074.001−$3,739.95
long7 Mar 2024 66,074.008 Mar 2024 66,823.201$1,145.57
short8 Mar 2024 66,823.209 Mar 2024 68,124.201−$1,969.42
long9 Mar 2024 68,124.2010 Mar 2024 68,313.301$280.21
short10 Mar 2024 68,313.3011 Mar 2024 68,955.901−$949.93
long11 Mar 2024 68,955.9012 Mar 2024 72,078.101$4,568.15
short12 Mar 2024 72,078.1013 Mar 2024 71,452.001$880.34
long13 Mar 2024 71,452.0014 Mar 2024 73,072.401$2,300.35
short14 Mar 2024 73,072.4015 Mar 2024 71,388.901$2,342.18
long15 Mar 2024 71,388.9016 Mar 2024 69,499.801−$2,696.46
short16 Mar 2024 69,499.8017 Mar 2024 65,300.601$6,140.48
long17 Mar 2024 65,300.6018 Mar 2024 68,393.501$4,842.55
short18 Mar 2024 68,393.5019 Mar 2024 67,610.001$1,176.78
long19 Mar 2024 67,610.0020 Mar 2024 61,937.401−$8,628.90
short20 Mar 2024 61,937.4021 Mar 2024 67,840.501−$9,719.70
long21 Mar 2024 67,840.5022 Mar 2024 65,501.301−$3,482.98
short22 Mar 2024 65,501.3023 Mar 2024 63,796.601$2,619.69
long23 Mar 2024 63,796.6024 Mar 2024 63,990.001$305.92
short24 Mar 2024 63,990.0025 Mar 2024 67,210.001−$5,080.05
long25 Mar 2024 67,210.0026 Mar 2024 69,880.001$3,990.37
short26 Mar 2024 69,880.0027 Mar 2024 69,988.001−$155.84
long27 Mar 2024 69,988.0028 Mar 2024 69,470.001−$746.27
short28 Mar 2024 69,470.0029 Mar 2024 70,780.601−$1,900.84
long29 Mar 2024 70,780.6030 Mar 2024 69,850.501−$1,321.45
short30 Mar 2024 69,850.5031 Mar 2024 69,582.201$385.86
long31 Mar 2024 69,582.201 Apr 2024 71,280.001$2,451.55
short1 Apr 2024 71,280.002 Apr 2024 69,649.801$2,303.42
long2 Apr 2024 69,649.803 Apr 2024 65,464.001−$6,066.75
short3 Apr 2024 65,464.004 Apr 2024 65,963.301−$765.28
long4 Apr 2024 65,963.305 Apr 2024 68,487.801$3,837.29
short5 Apr 2024 68,487.806 Apr 2024 67,820.601$980.46
long6 Apr 2024 67,820.607 Apr 2024 68,896.001$1,597.44
short7 Apr 2024 68,896.008 Apr 2024 69,360.401−$680.14
long8 Apr 2024 69,360.409 Apr 2024 71,620.001$3,285.09
short9 Apr 2024 71,620.0010 Apr 2024 69,146.001$3,494.63
long10 Apr 2024 69,146.0011 Apr 2024 70,631.101$2,180.30
short11 Apr 2024 70,631.1012 Apr 2024 70,006.201$900.02
long12 Apr 2024 70,006.2013 Apr 2024 67,116.501−$4,203.06
short13 Apr 2024 67,116.5014 Apr 2024 63,924.501$4,822.66
long14 Apr 2024 63,924.5015 Apr 2024 65,661.901$2,769.03
short15 Apr 2024 65,661.9016 Apr 2024 63,420.001$3,488.09
long16 Apr 2024 63,420.0017 Apr 2024 63,793.401$603.58
short17 Apr 2024 63,793.4018 Apr 2024 61,277.401$4,045.45
long18 Apr 2024 61,277.4019 Apr 2024 63,470.101$3,684.84
short19 Apr 2024 63,470.1020 Apr 2024 63,818.001−$566.50
long20 Apr 2024 63,818.0021 Apr 2024 64,940.601$1,816.86
short21 Apr 2024 64,940.6022 Apr 2024 64,941.201−$0.91
long22 Apr 2024 64,941.2023 Apr 2024 66,819.301$2,992.46
short23 Apr 2024 66,819.3024 Apr 2024 66,414.001$629.45
long24 Apr 2024 66,414.0025 Apr 2024 64,289.601−$3,321.33
short25 Apr 2024 64,289.6026 Apr 2024 64,498.301−$336.07
long26 Apr 2024 64,498.3027 Apr 2024 63,770.001−$1,168.36
short27 Apr 2024 63,770.0028 Apr 2024 63,462.001$499.19
long28 Apr 2024 63,462.0029 Apr 2024 63,118.601−$559.44
short29 Apr 2024 63,118.6030 Apr 2024 63,866.001−$1,223.68
long30 Apr 2024 63,866.001 May 2024 60,672.001−$5,162.17
short1 May 2024 60,672.002 May 2024 58,365.001$3,905.33
long2 May 2024 58,365.003 May 2024 59,060.601$1,228.75
short3 May 2024 59,060.604 May 2024 62,882.001−$6,678.55
long4 May 2024 62,882.005 May 2024 63,892.001$1,647.18
short5 May 2024 63,892.006 May 2024 64,012.001−$192.87
long6 May 2024 64,012.007 May 2024 63,165.201−$1,358.57
short7 May 2024 63,165.208 May 2024 62,312.101$1,385.18
long8 May 2024 62,312.109 May 2024 61,193.001−$1,844.32
short9 May 2024 61,193.0010 May 2024 63,074.001−$3,151.11
long10 May 2024 63,074.0011 May 2024 60,800.001−$3,684.58
short11 May 2024 60,800.0012 May 2024 60,826.001−$43.55
long12 May 2024 60,826.0013 May 2024 61,484.001$1,101.55
short13 May 2024 61,484.0014 May 2024 62,940.101−$2,414.10
long14 May 2024 62,940.1015 May 2024 61,577.501−$2,201.61
short15 May 2024 61,577.5016 May 2024 66,206.501−$7,628.25
long16 May 2024 66,206.5017 May 2024 65,235.201−$1,477.52
short17 May 2024 65,235.2018 May 2024 67,024.001−$2,757.53
long18 May 2024 67,024.0019 May 2024 66,915.201−$162.80
short19 May 2024 66,915.2020 May 2024 66,274.001$960.84
long20 May 2024 66,274.0021 May 2024 71,446.601$7,833.63
short21 May 2024 71,446.6022 May 2024 70,148.301$1,838.06
long22 May 2024 70,148.3023 May 2024 69,166.601−$1,418.18
short23 May 2024 69,166.6024 May 2024 67,969.701$1,751.20
long24 May 2024 67,969.7025 May 2024 68,550.001$865.49
short25 May 2024 68,550.0026 May 2024 69,290.601−$1,096.06
long26 May 2024 69,290.6027 May 2024 68,507.701−$1,145.07
short27 May 2024 68,507.7028 May 2024 69,436.401−$1,372.39
long28 May 2024 69,436.4029 May 2024 68,398.401−$1,511.29
short29 May 2024 68,398.4030 May 2024 67,652.401$1,100.94
long30 May 2024 67,652.4031 May 2024 68,352.201$1,045.24
short31 May 2024 68,352.201 Jun 2024 67,540.001$1,201.95
long1 Jun 2024 67,540.002 Jun 2024 67,766.801$340.14
short2 Jun 2024 67,766.803 Jun 2024 67,765.601$1.82
long3 Jun 2024 67,765.604 Jun 2024 68,809.901$1,561.22
short4 Jun 2024 68,809.905 Jun 2024 70,537.801−$2,548.04
long5 Jun 2024 70,537.806 Jun 2024 71,108.001$818.12
short6 Jun 2024 71,108.007 Jun 2024 70,799.101$440.09
long7 Jun 2024 70,799.108 Jun 2024 69,355.601−$2,066.11
short8 Jun 2024 69,355.609 Jun 2024 69,310.501$65.82
long9 Jun 2024 69,310.5010 Jun 2024 69,648.101$492.76
short10 Jun 2024 69,648.1011 Jun 2024 69,540.001$157.13
long11 Jun 2024 69,540.0012 Jun 2024 67,314.201−$3,239.23
short12 Jun 2024 67,314.2013 Jun 2024 68,264.001−$1,423.33
long13 Jun 2024 68,264.0014 Jun 2024 66,773.001−$2,200.23
short14 Jun 2024 66,773.0015 Jun 2024 66,044.001$1,097.44
long15 Jun 2024 66,044.0016 Jun 2024 66,228.301$280.75
short16 Jun 2024 66,228.3017 Jun 2024 66,676.901−$681.81
long17 Jun 2024 66,676.9018 Jun 2024 66,504.301−$260.27
short18 Jun 2024 66,504.3019 Jun 2024 65,175.301$2,009.59
long19 Jun 2024 65,175.3020 Jun 2024 64,974.401−$310.67
short20 Jun 2024 64,974.4021 Jun 2024 64,870.001$161.82
long21 Jun 2024 64,870.0022 Jun 2024 64,143.601−$1,128.19
short22 Jun 2024 64,143.6023 Jun 2024 64,262.001−$185.84
long23 Jun 2024 64,262.0024 Jun 2024 63,210.001−$1,647.13
short24 Jun 2024 63,210.0025 Jun 2024 60,293.301$4,635.13

Similar scripts

No other indicator or strategy here shares enough of its calculations.

Upgrade and export

Written in Pine Script v5. The clean-v5 step types the settings and moves when = into if blocks, which v6 requires; it is run before and after like any upgrade.

  • No v6-only features. v6 is not needed to run this script.

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

⋯// © Crypto-Arsenal-//@version=5+//@version=6strategy("Buy One Sell One", overlay = false, default_qty_type=strategy.percent_of_equity, default_qty_value=10)⋯

Where it runs

EngineCompilesRunsMatches TradingView
Zeal Terminal · OpenPineScript v2Yes 39 msYes 1,000 bars in 21 msNot measured
PineTSNot testedNot testedNot 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.

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/// © Crypto-Arsenal//@version=5strategy("Buy One Sell One", overlay = false, default_qty_type=strategy.percent_of_equity, default_qty_value=10)CONNECTOR_NAME = 'YOUR_CONNECTOR_NAME'CONNECTOR_TOKEN = 'YOUR_CONNECTOR_TOKEN'percent = str.tostring(10)cls = str.tostring(close)tp = str.tostring(strategy.position_avg_price * (1 + 0.1))sl = str.tostring(strategy.position_avg_price * (1 - 0.1))    if(bar_index % 2 == 0)    // DEMO FOR SENDING MESSAGE WITH alert_message()    // NEED TO ADD {{{strategy.order.alert_message}} to Message field at Create Alert box         // Add "limit" to open a LIMIT order instead of default MARKET    alert_message = '{"action":"openLong","percent":"' + percent + '","profit":"' + tp + '","loss":"' + sl + '","connectorName":"' + CONNECTOR_NAME + '","connectorToken":"' + CONNECTOR_TOKEN + '","log":"Open Long at price:' + cls + '"}'    strategy.entry('Enter Long',  strategy.long, alert_message = alert_message)else    // DEMO FOR SENDING MESSAGE WITH alert()     strategy.entry('Enter Short', strategy.short)    // Add "limit" to open a LIMIT order instead of default MARKET    alert_message = '{"action":"closeLong","percent":"' + percent + '","profit":"' + sl + '","loss":"' + tp + '","connectorName":"' + CONNECTOR_NAME + '","connectorToken":"' + CONNECTOR_TOKEN + '","log":"Close long at price:' + cls + '"}'    alert(alert_message, alert.freq_once_per_bar)