Zeal Terminal Open in Zeal Terminal

Pine Script v4 · Strategy

Take America Back Version 1.0

A Pine Script v4 strategy with no technical-analysis calculation. It has 2 order rules, 1 entry among them, and trades long only with the default settings. Exits use a stop loss and a profit target. Each trade is one contract and pays no commission. 3 settings; defaults include Quantity Value 20, Saved 0 and Fees .0025.

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

BTCUSDT · 1D · default settings

  • Saved
  • 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 (3)
40,00060,00080,000100,000120,000AprJulOct2025AprJulOct2026AprJulOctSaved$100,013$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. Zeal Terminal's engine currently reads an order side written as true as a short, whatever it says; this page passes the same side as strategy.long or strategy.short (line 37) so the engine trades the way the script says.
Net profit
+0.02%
$17.56
Buy and hold
+102.5%
same period
Closed trades
24
24 won · 0 lost
Profitable
100.0%
of closed trades
Profit factor
—
gross profit ÷ gross loss
Max drawdown
0.01%
−$9.75

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 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 37. 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 tostring → str.tostring.
  • 1 strategy call uses the when = argument (line 37). It is deprecated in v5 and removed in v6, where each call moves inside an if block.

v4 → v5

Verified

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

  • Line 3: //@version=4 → //@version=5
  • Line 28: tostring → str.tostring
  • Line 29: tostring → str.tostring
  • Line 37: strategy.entry(…, true) → strategy.entry(…, strategy.long)
⋯// © Crystal_Catalyst-//@version=4+//@version=5// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/⋯    saved := saved+(strategy.netprofit-strategy.netprofit[1])*(base-saved)/base-buy = "Take America Back" + tostring(strategy.opentrades)+buy = "Take America Back" + str.tostring(strategy.opentrades)-sell = "Take America Back" + tostring(strategy.opentrades-1)+sell = "Take America Back" + str.tostring(strategy.opentrades-1)if open>price and asset*open<default_qty_value⋯if open<price*(1-2*fees/(base/default_qty_value)) and base>default_qty_value+saved-    strategy.entry(buy, true, limit=open, stop=open, qty=default_qty_value/close, when = close<price*(1-fees))+    strategy.entry(buy, strategy.long, limit=open, stop=open, qty=default_qty_value/close, when = close<price*(1-fees))plot(saved, title="Saved", color=color.black, style=plot.style_line)

Clean v5

VerifiedDownload the v5 script

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

  • Line 8: input() → input.int()
  • Line 9: input() → input.int()
  • Line 14: input() → input.float()
  • Line 37: when = close<price*(1-fees) → if block
⋯strategy("Take America Back Version 1.0", close_entries_rule="ANY")-default_qty_value=input(defval=20, title="Quantity Value")+default_qty_value=input.int(defval=20, title="Quantity Value")-var float saved=input(defval=0, title="Saved")+var float saved=input.int(defval=0, title="Saved")var price = close⋯var float ratio = na-fees = input(defval=.0025, title="Fees")+fees = input.float(defval=.0025, title="Fees")asset := (strategy.opentrades*default_qty_value+strategy.openprofit)/open⋯if open<price*(1-2*fees/(base/default_qty_value)) and base>default_qty_value+saved-    strategy.entry(buy, strategy.long, limit=open, stop=open, qty=default_qty_value/close, when = close<price*(1-fees))+    if close<price*(1-fees)+        strategy.entry(buy, strategy.long, limit=open, stop=open, qty=default_qty_value/close)plot(saved, title="Saved", color=color.black, style=plot.style_line)

Does it run in Pine Script v6?

Yes

Same 24 trades and the same P&L on BTCUSDT 1D, 1,000 bars, in Zeal Terminal's engine. Both versions were run on Zeal Terminal's engine, and the results are identical. It differs from the v5 version by 1 edit.

Download the v6 script

⋯// © Crystal_Catalyst-//@version=5+//@version=6// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/⋯

Settings

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

SettingDefaultType and rangeFeeds
Quantity Value20intasset base ratio exit sell entry buy line 30 line 32 line 34 line 36
Saved0intentry buy line 32 line 36 Saved
Fees.0025floatexit sell entry buy line 34 line 36

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.

openopenprice dataclosecloseprice datadefault_qty_valueQuantity Valuesetting · 20feesFeessetting · .0025savedSavedsetting · 0pricepricevalueassetassetvaluebasebasevalueratioratiovalueinitial_asset, previous_assetinitial_asset · previou…2 valuesinitial_base, previous_baseinitial_base · previous…2 valuesbuy, sellbuy · sell2 valuesexit:sellexit sellstrategy.exitentry:buyOpen buystrategy.entryplot:38Savedplot

Order rules

OrderFires whenBy defaultLine
Exit sell stop and limitopen>(asset*price+default_qty_value*2*fees)/(asset*ratio) and asset*open>default_qty_valueOn35
Open buy longclose<price*(1-fees)On37

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+0.0%+102.5%24100%—0.0%26 Jan 2024 – 21 Oct 2026
BTCUSDT 4h+0.0%+5.5%4100%—0.0%8 May 2026 – 21 Oct 2026
ETHUSDT 1D+0.0%+9.8%7100%—0.0%26 Jan 2024 – 21 Oct 2026
ETHUSDT 4h+0.0%+8.4%7100%—0.0%8 May 2026 – 21 Oct 2026
SOLUSDT 1D+0.0%+16.7%8100%—0.0%26 Jan 2024 – 21 Oct 2026
SOLUSDT 4h+0.0%+21.5%11100%—0.0%8 May 2026 – 21 Oct 2026
BNBUSDT 1D+0.0%+148.3%24100%—0.0%26 Jan 2024 – 21 Oct 2026
BNBUSDT 4h+0.0%+17.1%8100%—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 market19100%$13.62
Sideways market5100%$3.94
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 24 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 24 trades
SideEntryExitBarsP&L
long1 Feb 2024 42,580.004 Feb 2024 43,011.103$0.20
long5 Feb 2024 42,582.909 Feb 2024 45,288.704$1.27
long23 Feb 2024 51,288.4028 Feb 2024 57,037.305$2.24
long3 Mar 2024 61,987.305 Mar 2024 68,245.702$2.02
long7 Mar 2024 66,074.008 Mar 2024 66,823.201$0.23
long16 Mar 2024 69,499.8031 Oct 2024 72,344.80229$0.82
long1 Nov 2024 70,292.008 Nov 2024 75,857.907$1.58
long18 Nov 2024 89,856.0021 Nov 2024 94,286.603$0.99
long25 Nov 2024 97,672.408 Dec 2024 99,832.0013$0.44
long11 Dec 2024 96,593.0013 Dec 2024 100,004.002$0.71
long20 Dec 2024 97,461.9019 Jan 2025 104,556.0030$1.46
long21 Jan 2025 101,332.0022 Jan 2025 106,144.001$0.94
long24 Jan 2025 103,707.0026 Jan 2025 104,747.002$0.20
long27 Jan 2025 102,620.0020 May 2025 105,574.00113$0.58
long25 May 2025 107,318.0027 May 2025 109,435.002$0.39
long29 May 2025 107,782.0011 Jun 2025 110,274.0013$0.46
long13 Jun 2025 105,672.005 Jul 2025 107,984.0022$0.44
long6 Jul 2025 107,984.008 Jul 2025 108,263.002$0.05
long9 Jul 2025 108,923.0010 Jul 2025 111,234.001$0.42
long17 Jul 2025 117,758.0018 Jul 2025 119,178.001$0.24
long20 Jul 2025 117,840.0024 Jul 2025 118,756.004$0.16
long25 Jul 2025 118,341.0014 Aug 2025 123,306.0020$0.84
long16 Aug 2025 117,342.004 Oct 2025 122,232.0049$0.83
long9 Oct 2025 121,333.0010 Oct 2025 121,662.001$0.05

Similar scripts

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

Where it runs

EngineCompilesRunsMatches TradingView
Zeal Terminal · OpenPineScript v2Yes 15 msWith a workaround 1,000 bars in 27 msNot measured
PineTSNo v5 and v6 only—Not measured

Zeal Terminal's engine currently reads an order side written as true as a short, whatever it says; this page passes the same side as strategy.long or strategy.short (line 37) 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/// © Crystal_Catalyst//@version=4// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/// © Crystal_Catalyst//@version=4strategy("Take America Back Version 1.0", close_entries_rule="ANY")default_qty_value=input(defval=20, title="Quantity Value")var float saved=input(defval=0, title="Saved")var price = closevar float asset = navar float base = navar float ratio = nafees = input(defval=.0025, title="Fees")asset := (strategy.opentrades*default_qty_value+strategy.openprofit)/openbase := strategy.initial_capital-strategy.opentrades*default_qty_value+strategy.netprofitratio := asset*open/(default_qty_value*strategy.opentrades)if ratio>1    ratio := 1var initial_asset = assetvar initial_base = basevar previous_asset = assetvar previous_base = baseif strategy.opentrades != strategy.opentrades[1]    price := open[1]if strategy.netprofit>strategy.netprofit[1]    saved := saved+(strategy.netprofit-strategy.netprofit[1])*(base-saved)/basebuy = "Take America Back" + tostring(strategy.opentrades)sell = "Take America Back" + tostring(strategy.opentrades-1)if open>price and asset*open<default_qty_value    price := openif open<price and base<default_qty_value+saved    price := openif open>(asset*price+default_qty_value*2*fees)/(asset*ratio) and asset*open>default_qty_value    strategy.exit(sell, limit=open, stop=open)if open<price*(1-2*fees/(base/default_qty_value)) and base>default_qty_value+saved    strategy.entry(buy, true, limit=open, stop=open, qty=default_qty_value/close, when = close<price*(1-fees))plot(saved, title="Saved", color=color.black, style=plot.style_line)