Zeal Terminal Open in Zeal Terminal

Pine Script v5 · Strategy

Manual Buy & Sell Alerts

A Pine Script v5 strategy with no technical-analysis calculation. It has 3 order rules, 2 entries among them, and trades long only with the default settings. Exits use a stop loss and a profit target. Each trade commits 100% of equity and pays 0.1% commission. 8 settings; defaults include Buy Type stop, Buy Price 49000 and Target Price 51000.

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 Manual Buy & Sell Alerts repaint?
No
No repainting patterns were found in the source. The live replay was not measured: it had no trades to compare.
How did Manual Buy & Sell Alerts do on BTCUSDT 1D with default settings?
+3.93%
From 26 Jan 2024 to 21 Oct 2026, over 1 closed trade, against +102.5% for buy and hold. A backtest, not investment advice.
Does Manual Buy & Sell Alerts 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: 1 before, 0 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 Manual Buy & Sell Alerts use a stop loss?
Yes
strategy.exit sets a stop on line 27.
Does Manual Buy & Sell Alerts run in Zeal Terminal?
Yes
It compiles in 18 ms and runs 1,000 bars in 32 ms, in the browser.

BTCUSDT · 1D · default settings

  • Buy Price
  • Take Profit
  • Safety
  • 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 (8)
40,00060,00080,000100,000120,000AprJulOct2025AprJulOct2026AprJulOct$10,393$20,253Equity from $10,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
+3.93%
$393.38
Buy and hold
+102.5%
same period
Closed trades
1
1 won · 0 lost
Profitable
100.0%
of closed trades
Profit factor
—
gross profit ÷ gross loss
Max drawdown
1.55%
−$154.88

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

    Every trade uses all the equity

    default_qty_value is 100% of equity.

  • Note

    2 settings have no label

    In the settings dialog sTime (line 9), eTime (line 10) 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 30, 32. The upgraded version below moves each call inside an if block.

Settings

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

SettingDefaultType and rangeFeeds
Period
S Time (no label in the script)timestamp("2020-01-01")timeinDateRange
E Time (no label in the script)timestamp("2030-01-01")timeinDateRange
Buy&Sell
Buy Typestopstring · options ['stop', 'limit']entry buy entry buy line 29 line 31
Buy Price49000floatBuy Price entry buy
Target Price51000floatTake Profit exit sell
Stop Price47000floatSafety exit sell
Alert set-up
Buy Alert MessageBuy messagestringentry buy
Sell Alert MessageSell messagestringexit sell

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 datatimetimeprice datasTimeS Timesetting · timestamp("2020-01-…eTimeE Timesetting · timestamp("2030-01-…buy_priceBuy Pricesetting · 49000target_priceTarget Pricesetting · 51000stop_priceStop Pricesetting · 47000avg_priceavg_pricevalueposSizeposSizevaluelongConditionlongConditionconditioninDateRangeinDateRangeconditionexit:sellexit sellstrategy.exitentry:buyOpen buystrategy.entryplot:22Buy Priceplotplot:23Take Profitplotplot:24Safetyplot

Order rules

OrderFires whenBy defaultLine
Exit sell stop and limitevery barOn27
Open buy longclose < buy_priceOn30
Open buy longclose > buy_priceOn32

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.

Not measuredNo trades to compareThe last 300 bars, from 26 Dec 2025, were fed to the engine as live ticks, but neither the live nor the historical run produced any trades in them, so the replay says nothing either way.
  • 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+3.9%+102.5%1100%—1.5%26 Jan 2024 – 21 Oct 2026
BTCUSDT 4h0.0%+5.5%00%—0.0%8 May 2026 – 21 Oct 2026
ETHUSDT 1D0.0%+9.8%00%—0.0%26 Jan 2024 – 21 Oct 2026
ETHUSDT 4h0.0%+8.4%00%—0.0%8 May 2026 – 21 Oct 2026
SOLUSDT 1D0.0%+16.7%00%—0.0%26 Jan 2024 – 21 Oct 2026
SOLUSDT 4h0.0%+21.5%00%—0.0%8 May 2026 – 21 Oct 2026
BNBUSDT 1D0.0%+148.3%00%—0.0%26 Jan 2024 – 21 Oct 2026
BNBUSDT 4h0.0%+17.1%00%—0.0%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 market1100%$393.38
Sideways market0—$0.00
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?

0.0%

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

0%1%
All 1 trades
SideEntryExitBarsP&L
long12 Feb 2024 49,000.0014 Feb 2024 51,000.002$393.38

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.

  • 2 strategy calls use the when = argument (line 30, 32). It is deprecated in v5 and removed in v6, where each call moves inside an if block.
  • No v6-only features. v6 is not needed to run this script.

Clean v5

VerifiedDownload the v5 script

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

  • Line 30: when = close < buy_price → if block
  • Line 32: when = close > buy_price → if block
⋯if longCondition and buy_type == 'stop'-    strategy.entry("buy", strategy.long, qty=posSize, stop=buy_price, when=close < buy_price, comment="buy_STOP", alert_message=AlertLong)+    if close < buy_price+        strategy.entry("buy", strategy.long, qty=posSize, stop=buy_price, comment="buy_STOP", alert_message=AlertLong)if longCondition and buy_type == 'limit'-    strategy.entry("buy", strategy.long, qty=posSize, limit=buy_price, when=close > buy_price, comment="buy_LIMIT", alert_message=AlertLong)+    if close > buy_price+        strategy.entry("buy", strategy.long, qty=posSize, limit=buy_price, comment="buy_LIMIT", alert_message=AlertLong)

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

⋯title_name = 'Manual Buy & Sell Alerts'-//@version=5+//@version=6strategy(⋯

Where it runs

EngineCompilesRunsMatches TradingView
Zeal Terminal · OpenPineScript v2Yes 18 msYes 1,000 bars in 32 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/// © MGTGtitle_name = 'Manual Buy & Sell Alerts'//@version=5strategy( title=title_name, overlay=true, initial_capital=10000, default_qty_type=strategy.percent_of_equity, default_qty_value=100,  pyramiding=1, commission_type=strategy.commission.percent, commission_value=0.1)// PeriodsTime         = input.time(timestamp("2020-01-01"), "Start", group="Period", inline='1')eTime         = input.time(timestamp("2030-01-01"), "End", group="Period", inline='2')inDateRange   = time >= sTime and time <= eTime// Bot Set-upbuy_type = input.string('stop', 'Buy Type', group='Buy&Sell', inline='1', options=['stop', 'limit'])buy_price = input.float(49000, 'Buy Price', group='Buy&Sell', inline='1')target_price = input.float(51000, 'Target Price', group='Buy&Sell', inline='2')stop_price = input.float(47000, 'Stop Price', group='Buy&Sell', inline='2')avg_price = strategy.position_avg_pricedivision = 1// Alert messageAlertLong=input.string("Buy message", "Buy Alert Message",  group='Alert set-up', inline='1')AlertExit=input.string("Sell message", "Sell Alert Message",  group='Alert set-up', inline='1')plot(buy_price, 'Buy Price', color=color.new(#009688, 0), style=plot.style_linebr, offset=1)plot(target_price, 'Take Profit', color=color.new(color.orange, 0), style=plot.style_linebr, offset=1)plot(stop_price, 'Safety', color=color.new(color.aqua, 0), style=plot.style_linebr, offset=1)posSize =  strategy.equity / closestrategy.exit("sell", "buy", limit=target_price, stop=stop_price, alert_message=AlertExit)longCondition = inDateRange and strategy.position_size == 0if longCondition and buy_type == 'stop'    strategy.entry("buy", strategy.long, qty=posSize, stop=buy_price, when=close < buy_price, comment="buy_STOP", alert_message=AlertLong)if longCondition and buy_type == 'limit'    strategy.entry("buy", strategy.long, qty=posSize, limit=buy_price, when=close > buy_price, comment="buy_LIMIT", alert_message=AlertLong)