Zeal Terminal Open in Zeal Terminal

Pine Script v5 · Strategy

Exponential Stochastic Strategy

A Pine Script v5 strategy built on Lowest or Highest (low, 14). 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 100% of equity and pays no commission. 4 settings; defaults include length 14, exp 2 and Bot 20.

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 Exponential Stochastic Strategy repaint?
No
No repainting patterns were found in the source, and a live tick-by-tick replay matched history on 24 of 24 trades.
How did Exponential Stochastic Strategy do on BTCUSDT 1D with default settings?
+64.09%
From 26 Jan 2024 to 21 Oct 2026, over 85 closed trades, against +102.5% for buy and hold. A backtest, not investment advice.
What alerts does Exponential Stochastic Strategy have?
2
buy; sell.
Does Exponential Stochastic Strategy 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: 85 before, 78 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 Exponential Stochastic Strategy use a stop loss?
No
Every exit waits for a signal; nothing limits a losing trade before it fires.

BTCUSDT · 1D · default settings

  • Plot
  • HLine
  • HLine
  • HLine
  • HLine
  • 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,000AprJulOct2025AprJulOct2026AprJulOctPlot$1,658,970$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. Lines are what the script plots.
Net profit
+64.09%
$640,863.00
Buy and hold
+102.5%
same period
Closed trades
85
36 won · 49 lost
Profitable
42.4%
of closed trades
Profit factor
1.38
gross profit ÷ gross loss
Max drawdown
42.20%
−$421,995.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.

  • Check

    Every trade uses all the equity

    default_qty_value is 100% of equity.

  • Note

    2 settings have no label

    In the settings dialog bot (line 12), top (line 13) 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.

Settings

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

SettingDefaultType and rangeFeeds
length14ints
exp2int · min 1 · max 10exp
Bot (no label in the script)20intlongCondition h2 hline fill
Top (no label in the script)80intshortCondition h1 hline fill

What it calculates

  • Lowest / Highestlow, length (14)s · line 8

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 dataclosecloseprice datalenlengthsetting · 14exexpsetting · 2botBotsetting · 20topTopsetting · 80sLowest / Highest→ sexpexpvalueksksvaluelongConditionlongConditionconditionshortConditionshortConditionconditionentry:My Long Entry IdOpen My Long Entry Idstrategy.entryentry:My Short Entry IdOpen My Short Entry Idstrategy.entryplot:11plotplotalertcondition:21buyalertconditionalertcondition:22sellalertconditionhline:23hlinehlinehline:24hlinehlinehline:25hlinehlinehline:26hlinehlinefill:27Fillfill × 2fill:28Fillfill × 2

Order rules

OrderFires whenBy defaultLine
Open My Long Entry Id long(longCondition)On16
Open My Short Entry Id short(shortCondition)On19

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

Alerts

AlertCallMessageLine
buyalertconditionno message21
sellalertconditionno message22

Does it repaint?

No

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

24/24trades 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+64.1%+102.5%8542%1.3842.2%26 Jan 2024 – 21 Oct 2026
BTCUSDT 4h+17.8%+5.5%9941%1.2921.8%8 May 2026 – 21 Oct 2026
ETHUSDT 1D−18.1%+9.8%9840%0.9170.8%26 Jan 2024 – 21 Oct 2026
ETHUSDT 4h−13.5%+8.4%11036%0.8843.1%8 May 2026 – 21 Oct 2026
SOLUSDT 1D−59.7%+16.7%9236%0.7894.3%26 Jan 2024 – 21 Oct 2026
SOLUSDT 4h−39.5%+21.5%9137%0.6042.8%8 May 2026 – 21 Oct 2026
BNBUSDT 1D−53.1%+148.3%9741%0.7370.3%26 Jan 2024 – 21 Oct 2026
BNBUSDT 4h−33.9%+17.1%9140%0.5441.7%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 market3441%$160,148.00
Sideways market3047%$327,316.00
Falling market2138%$153,399.00

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

How bad could the drawdown be?

51.2%

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

0%59%
All 85 trades
SideEntryExitBarsP&L
short17 Mar 2024 65,300.6018 Mar 2024 68,393.501−$47,362.90
long18 Mar 2024 68,393.5020 Mar 2024 61,937.402−$89,925.00
short20 Mar 2024 61,937.4021 Mar 2024 67,840.501−$82,222.90
long21 Mar 2024 67,840.503 Apr 2024 65,464.0013−$27,341.30
short3 Apr 2024 65,464.005 Apr 2024 68,487.802−$34,788.20
long5 Apr 2024 68,487.806 Apr 2024 67,820.601−$6,997.86
short6 Apr 2024 67,820.6023 Apr 2024 66,819.3017$10,502.60
long23 Apr 2024 66,819.3025 Apr 2024 64,289.602−$27,329.40
short25 Apr 2024 64,289.6027 Apr 2024 63,770.002$5,613.14
long27 Apr 2024 63,770.008 May 2024 62,312.1011−$16,007.00
short8 May 2024 62,312.1031 May 2024 68,352.2023−$66,315.90
long31 May 2024 68,352.208 Jun 2024 69,355.608$9,069.86
short8 Jun 2024 69,355.601 Jul 2024 62,772.0023$59,508.10
long1 Jul 2024 62,772.0031 Jul 2024 66,188.0030$37,353.40
short31 Jul 2024 66,188.009 Aug 2024 61,686.009$49,228.70
long9 Aug 2024 61,686.0010 Aug 2024 60,838.001−$10,626.40
short10 Aug 2024 60,838.0011 Sep 2024 57,636.0032$40,124.20
long11 Sep 2024 57,636.0012 Sep 2024 57,338.001−$4,149.00
short12 Sep 2024 57,338.007 Oct 2024 62,819.9025−$76,326.30
long7 Oct 2024 62,819.902 Nov 2024 69,496.0026$76,730.30
short2 Nov 2024 69,496.006 Nov 2024 69,372.004$1,425.05
long6 Nov 2024 69,372.0026 Nov 2024 93,010.0020$272,650.00
short26 Nov 2024 93,010.0028 Nov 2024 95,863.102−$32,908.70
long28 Nov 2024 95,863.106 Dec 2024 96,945.608$11,743.00
short6 Dec 2024 96,945.6026 Dec 2024 99,429.6020−$26,945.70
long26 Dec 2024 99,429.608 Jan 2025 96,954.6013−$25,507.00
short8 Jan 2025 96,954.6015 Jan 2025 96,560.907$4,057.91
long15 Jan 2025 96,560.9028 Jan 2025 102,083.0013$57,372.50
short28 Jan 2025 102,083.0030 Jan 2025 103,733.002−$17,147.60
long30 Jan 2025 103,733.001 Feb 2025 102,430.002−$13,114.10
short1 Feb 2025 102,430.004 Feb 2025 101,329.003$11,075.70
long4 Feb 2025 101,329.005 Feb 2025 97,763.101−$36,644.30
short5 Feb 2025 97,763.1013 Feb 2025 97,870.008−$1,098.29
long13 Feb 2025 97,870.0022 Feb 2025 96,182.009−$17,311.20
short22 Feb 2025 96,182.003 Mar 2025 94,270.009$19,608.30
long3 Mar 2025 94,270.004 Mar 2025 86,221.201−$85,892.30
short4 Mar 2025 86,221.206 Mar 2025 90,606.002−$46,792.40
long6 Mar 2025 90,606.007 Mar 2025 89,931.901−$6,497.52
short7 Mar 2025 89,931.9018 Mar 2025 84,010.0011$57,078.00
long18 Mar 2025 84,010.0021 Mar 2025 84,223.403$2,346.40
short21 Mar 2025 84,223.402 Apr 2025 85,158.4012−$10,282.20
long2 Apr 2025 85,158.4011 Apr 2025 79,607.309−$59,706.50
short11 Apr 2025 79,607.3012 Apr 2025 83,423.801−$41,050.20
long12 Apr 2025 83,423.8030 May 2025 105,590.0048$216,600.00
short30 May 2025 105,590.008 Jun 2025 105,552.009$367.42
long8 Jun 2025 105,552.0013 Jun 2025 105,672.005$1,169.44
short13 Jun 2025 105,672.0019 Jun 2025 104,887.006$7,675.80
long19 Jun 2025 104,887.0025 Jul 2025 118,341.0036$133,534.00
short25 Jul 2025 118,341.0028 Jul 2025 119,416.003−$10,665.30
long28 Jul 2025 119,416.0015 Aug 2025 118,295.0018−$10,920.60
short15 Aug 2025 118,295.004 Sep 2025 111,706.0020$64,223.00
long4 Sep 2025 111,706.0023 Sep 2025 112,651.0019$10,300.00
short23 Sep 2025 112,651.0030 Sep 2025 114,312.007−$18,098.50
long30 Sep 2025 114,312.0011 Oct 2025 112,774.0011−$16,266.00
short11 Oct 2025 112,774.0013 Oct 2025 114,959.002−$23,109.40
long13 Oct 2025 114,959.0030 Oct 2025 110,021.0017−$50,252.10
short30 Oct 2025 110,021.0028 Nov 2025 91,333.9029$190,193.00
long28 Nov 2025 91,333.902 Dec 2025 86,286.004−$72,399.30
short2 Dec 2025 86,286.003 Dec 2025 91,277.901−$71,595.30
long3 Dec 2025 91,277.906 Dec 2025 89,330.003−$24,881.00
short6 Dec 2025 89,330.0027 Dec 2025 87,369.6021$25,042.50
long27 Dec 2025 87,369.6030 Dec 2025 87,237.103−$1,767.53
short30 Dec 2025 87,237.1015 Feb 2026 69,822.9047$232,426.00
long15 Feb 2026 69,822.9021 Feb 2026 68,020.006−$36,066.90
short21 Feb 2026 68,020.0026 Feb 2026 67,988.005$639.34
long26 Feb 2026 67,988.0028 Feb 2026 65,872.102−$42,368.30
short28 Feb 2026 65,872.101 Mar 2026 66,973.301−$22,049.00
long1 Mar 2026 66,973.307 Mar 2026 68,114.006$22,090.60
short7 Mar 2026 68,114.0010 Mar 2026 68,432.203−$6,160.73
long10 Mar 2026 68,432.2019 Mar 2026 71,246.609$53,993.50
short19 Mar 2026 71,246.6021 Mar 2026 70,510.702$14,116.60
long21 Mar 2026 70,510.707 Apr 2026 68,853.7017−$32,454.00
short7 Apr 2026 68,853.701 May 2026 76,346.6024−$146,750.00
long1 May 2026 76,346.6014 May 2026 79,313.6013$46,703.70
short14 May 2026 79,313.6015 Jun 2026 65,746.4032$213,559.00
long15 Jun 2026 65,746.4019 Jun 2026 62,958.004−$62,007.40
short19 Jun 2026 62,958.0023 Jun 2026 64,020.004−$23,616.00
long23 Jun 2026 64,020.0025 Jul 2026 64,140.0032$2,579.73
short25 Jul 2026 64,140.0031 Jul 2026 64,780.006−$13,760.40
long31 Jul 2026 64,780.0011 Aug 2026 63,970.0011−$17,070.90
short11 Aug 2026 63,970.0018 Aug 2026 64,532.107−$11,846.10
long18 Aug 2026 64,532.108 Sep 2026 79,112.0021$301,914.00
short8 Sep 2026 79,112.0019 Sep 2026 80,883.9011−$36,690.90
long19 Sep 2026 80,883.908 Oct 2026 83,321.8019$48,272.20
short8 Oct 2026 83,321.8012 Oct 2026 83,773.104−$8,936.09

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
Exponential Stochastic Strategy this page—v5 strategy+64.1%8542.2%
Alex Days HiLo Rajib by 14rajibhighest lowestv4 strategyNo trades on this market
Donchian Strat EXMO by pskoroplashighest lowestv4 strategy+12.1%2268.0%
Average Highest High and Lowest Low Swinger Strategy by exlux99lowest highestv4 strategy+6.4%2049.6%
Highest High and Lowest Low Channel Strategy by ceyhunhighest lowestv5 strategy−3.7%267.9%
Donchian Channels System [racer8] by racer8highest lowestv4 strategy−3.2%3643.6%

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

⋯// © faytterro-//@version=5+//@version=6strategy("Exponential Stochastic Strategy", overlay=false, default_qty_type=strategy.percent_of_equity, default_qty_value=100)⋯

Where it runs

EngineCompilesRunsMatches TradingView
Zeal Terminal · OpenPineScript v2Yes 21 msYes 1,000 bars in 38 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/// © faytterro//@version=5strategy("Exponential Stochastic Strategy", overlay=false, default_qty_type=strategy.percent_of_equity, default_qty_value=100)len=input.int(14, "length") ex=input.int(2, title="exp", minval=1, maxval=10)exp= ex<10? (ex)/(10-ex) : 99s=100 * (close - ta.lowest(low, len)) / (ta.highest(high, len) - ta.lowest(low, len))ks=s>50? math.pow(math.abs(s-50),exp)/math.pow(50,exp-1)+50 : -math.pow(math.abs(s-50),exp)/math.pow(50,exp-1)+50plot(ks, color= color.white)bot=input.int(20)top=input.int(80)longCondition = ta.crossover(ks, bot) and bar_index>0if (longCondition)    strategy.entry("My Long Entry Id", strategy.long)shortCondition = ta.crossunder(ks, top) and bar_index>0if (shortCondition)    strategy.entry("My Short Entry Id", strategy.short)//    strategy.close("My Long Entry Id")alertcondition(longCondition, title = "buy")alertcondition(shortCondition, title = "sell")h1=hline(top)h2=hline(bot)h3=hline(100)h4=hline(0)fill(h1,h3, color= color.rgb(255,0,0,200-top*2))fill(h2,h4, color= color.rgb(0,255,0,bot*2))