Zeal Terminal Open in Zeal Terminal

Pine Script v4 · Strategy

Ehlers Bandpass Filter

A Pine Script v4 strategy built on Crossover (trigger, signal) and Crossunder (trigger, signal). It has 4 order rules, 2 entries among them, and trades long and short with the default settings. Exits use a stop loss and a profit target. Each trade is one contract and pays no commission. 11 settings; defaults include Capital Settings Initial, Manual Position Size 100.3 and Leverage 1.

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 Ehlers Bandpass Filter repaint?
No
No repainting patterns were found in the source, and a live tick-by-tick replay matched history on 18 of 18 trades.
How did Ehlers Bandpass Filter do on BTCUSDT 1D with default settings?
−13.10%
From 26 Jan 2024 to 21 Oct 2026, over 58 closed trades, against +102.5% for buy and hold. A backtest, not investment advice.
Can Ehlers Bandpass Filter be converted to Pine Script v5?
No
The automatic step from v4 to v5 changes the results, so no v5 download is offered; the edits are shown below.
Does Ehlers Bandpass Filter use a stop loss?
Yes
strategy.exit sets a stop on line 63, 74.
Does Ehlers Bandpass Filter run in Zeal Terminal?
Yes
It compiles in 25 ms and runs 1,000 bars in 70 ms, in the browser.

BTCUSDT · 1D · default settings

  • Signal
  • Trigger
  • 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 (11)
40,00060,00080,000100,000120,000AprJulOct2025AprJulOct2026AprJulOctSignal$86,897$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
−13.10%
−$13,102.40
Buy and hold
+102.5%
same period
Closed trades
58
23 won · 34 lost
Profitable
39.7%
of closed trades
Profit factor
0.75
gross profit ÷ gross loss
Max drawdown
20.81%
−$22,534.20

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

    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.

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, security → request.security, asin → math.asin, cos → math.cos, sqrt → math.sqrt, sin → math.sin, abs → math.abs, crossover → ta.crossover, crossunder → ta.crossunder.

v4 → v5

Differs

Trades differ: 58 before, 78 after on BTCUSDT 1D, 1,000 bars, in Zeal Terminal's engine.

  • Line 3: //@version=4 → //@version=5
  • Line 8: input(type = input.string) → input.string()
  • Line 9: input(type = input.float) → input.float()
  • Line 10: input(type = input.float) → input.float()
  • Line 12: floor → math.floor
  • Line 13: floor → math.floor
22 more edits
  • Line 19: input(type = input.float) → input.float()
  • Line 20: input(type = input.float) → input.float()
  • Line 28: input(type = input.source) → input.source()
  • Line 29: input(type = input.resolution) → input.timeframe()
  • Line 30: input(type = input.bool) → input.bool()
  • Line 31: security → request.security
  • Line 32: input(type = input.integer) → input.int()
  • Line 33: input(type = input.float) → input.float()
  • Line 34: asin → math.asin
  • Line 37: cos → math.cos
  • Line 38: cos → math.cos
  • Line 39: sqrt → math.sqrt
  • Line 40: cos → math.cos
  • Line 40: sin → math.sin
  • Line 40: cos → math.cos
  • Line 41: cos → math.cos
  • Line 41: sin → math.sin
  • Line 41: cos → math.cos
  • Line 48: abs → math.abs
  • Line 48: abs → math.abs
  • Line 58: crossover → ta.crossover
  • Line 59: crossunder → ta.crossunder
⋯// © greenmask9, @cheatcountry-//@version=4+//@version=5strategy(title= "Ehlers Bandpass Filter", shorttitle = "Bandpass Filter", overlay=false)⋯//Capital Management-capitaltype = input(defval="Initial", title="Capital Settings", options=["Initial", "Growing","Manual"], type=input.string)+capitaltype = input.string(defval="Initial", title="Capital Settings", options=["Initial", "Growing","Manual"])-manualcapital = input(title="Manual Position Size", defval=100.3, type=input.float)+manualcapital = input.float(title="Manual Position Size", defval=100.3)-leverage = input(title="Leverage", defval=1, type=input.float)+leverage = input.float(title="Leverage", defval=1)capitalsystem(capitaltype) =>-    v1 = floor(strategy.initial_capital/close) * leverage+    v1 = math.floor(strategy.initial_capital/close) * leverage-    v2 = floor((strategy.initial_capital + strategy.netprofit)/close) * leverage+    v2 = math.floor((strategy.initial_capital + strategy.netprofit)/close) * leverage    v3 = manualcapital⋯percentages = input(title="Percentage stop 🎯", defval=true)-targetpercentage = input(title="Profit (%)", type=input.float, minval=0.0, step=0.1, defval=1.3) * 0.01+targetpercentage = input.float(title="Profit (%)", minval=0.0, step=0.1, defval=1.3) * 0.01-stoppercentage = input(title="Stop Loss (%)", type=input.float, minval=0.0, step=0.1, defval=0.6) * 0.01+stoppercentage = input.float(title="Stop Loss (%)", minval=0.0, step=0.1, defval=0.6) * 0.01longtp  = strategy.position_avg_price * (1 + targetpercentage)⋯// Ehlers Bandpass Filter script may be freely distributed under the MIT license.-inp = input(title="Source", type=input.source, defval=close)+inp = input.source(title="Source", defval=close)-res = input(title="Resolution", type=input.resolution, defval="")+res = input.timeframe(title="Resolution", defval="")-rep = input(title="Allow Repainting?", type=input.bool, defval=false)+rep = input.bool(title="Allow Repainting?", defval=false)-src = security(syminfo.tickerid, res, inp[rep ? 0 : barstate.isrealtime ? 1 : 0])[rep ? 0 : barstate.isrealtime ? 0 : 1]+src = request.security(syminfo.tickerid, res, inp[rep ? 0 : barstate.isrealtime ? 1 : 0])[rep ? 0 : barstate.isrealtime ? 0 : 1]-length = input(title="Length", type=input.integer, defval=20, minval=1)+length = input.int(title="Length", defval=20, minval=1)-bw = input(title="Bandwidth", type=input.float, defval=0.3, minval=0.01, step = 0.01)+bw = input.float(title="Bandwidth", defval=0.3, minval=0.01, step = 0.01)-pi = 2 * asin(1)+pi = 2 * math.asin(1)twoPiPrd1 = 0.25 * bw * 2 * pi / lengthtwoPiPrd2 = 1.5 * bw * 2 * pi / length-beta = cos(2 * pi / length)+beta = math.cos(2 * pi / length)-gamma = 1.0 / cos(2 * pi * bw / length)+gamma = 1.0 / math.cos(2 * pi * bw / length)-alpha1 = gamma - sqrt((gamma * gamma) - 1)+alpha1 = gamma - math.sqrt((gamma * gamma) - 1)-alpha2 = (cos(twoPiPrd1) + sin(twoPiPrd1) - 1) / cos(twoPiPrd1)+alpha2 = (math.cos(twoPiPrd1) + math.sin(twoPiPrd1) - 1) / math.cos(twoPiPrd1)-alpha3 = (cos(twoPiPrd2) + sin(twoPiPrd2) - 1) / cos(twoPiPrd2)+alpha3 = (math.cos(twoPiPrd2) + math.sin(twoPiPrd2) - 1) / math.cos(twoPiPrd2)hp = 0.0⋯peak := 0.991 * nz(peak[1])-peak := abs(bp) > peak ? abs(bp) : peak+peak := math.abs(bp) > peak ? math.abs(bp) : peaksignal = peak != 0 ? bp / peak : 0⋯//Things-buy = crossover(trigger, signal)+buy = ta.crossover(trigger, signal)-sell = crossunder(trigger, signal)+sell = ta.crossunder(trigger, signal)if (buy)⋯

Clean v5

Verified

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

  • Line 18: input() → input.bool()
⋯//Targets, Stops-percentages = input(title="Percentage stop 🎯", defval=true)+percentages = input.bool(title="Percentage stop 🎯", defval=true)targetpercentage = input.float(title="Profit (%)", minval=0.0, step=0.1, defval=1.3) * 0.01⋯

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

⋯// © greenmask9, @cheatcountry-//@version=5+//@version=6strategy(title= "Ehlers Bandpass Filter", shorttitle = "Bandpass Filter", overlay=false)⋯

Settings

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

SettingDefaultType and rangeFeeds
Capital SettingsInitialstring · options ["Initial", "Growing","Manual"]ordersize line 15
Manual Position Size100.3floatv3
Leverage1floatv1 v2
Percentage stop 🎯trueboolexit Buy exit Short line 62 line 73
Profit (%)1.3float · min 0.0 · step 0.1longtp shorttp
Stop Loss (%)0.6float · min 0.0 · step 0.1longStopPrice shortStopPrice
Sourceclosesourcesrc
Resolutiontimeframe (written input.resolution)src
Allow Repainting?falseboolsrc
Length20int (written input.integer) · min 1twoPiPrd1 twoPiPrd2 beta gamma
Bandwidth0.3float · min 0.01 · step 0.01twoPiPrd1 twoPiPrd2 gamma

What it calculates

  • Crossover (crossover, ta.crossover in v5)trigger, signalbuy · line 58
  • Crossunder (crossunder, ta.crossunder in v5)trigger, signalsell · line 59

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 dataleverageLeveragesetting · 1manualcapitalManual Position Sizesetting · 100.3capitaltypeCapital Settingssetting · InitialtargetpercentageProfit (%)setting · 1.3stoppercentageStop Loss (%)setting · 0.6resResolutionsetting · bwBandwidthsetting · 0.3lengthLengthsetting · 20buyCrossover→ buysellCrossunder→ sellv1, v2v1 · v22 valuesv3v3valueordersizeordersizevaluelongtp, shorttplongtp · shorttp2 valueslongStopPrice, shortStopPricelongStopPrice · shortSt…2 valuessrcsrcvaluetwoPiPrd1, twoPiPrd2, gammatwoPiPrd1 · twoPiPrd2 +13 valuesbetabetavaluealpha1alpha1valuealpha2alpha2valuealpha3alpha3valuehphpvaluebpbpvaluepeak, signalpeak · signal2 valuestriggertriggervaluesigsigvaluesigColorColoursigColorentry:BuyOpen Buystrategy.entryexit:Buyexit Buystrategy.exitentry:ShortOpen Shortstrategy.entryexit:Shortexit Shortstrategy.exitplot:54Signalplotplot:55Triggerplot

Order rules

OrderFires whenBy defaultLine
Open Buy long(buy)On61
Exit Buy stop and limit(percentages)On63
Open Short short(sell)On72
Exit Short stop and limit(percentages)On74

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.

18/18trades 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 data1 security call(s), none with lookahead on.
  • 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−13.1%+102.5%5840%0.7520.8%26 Jan 2024 – 21 Oct 2026
BTCUSDT 4h−3.4%+5.5%7532%0.866.4%8 May 2026 – 21 Oct 2026
ETHUSDT 1D+5.0%+9.8%7438%1.0539.5%26 Jan 2024 – 21 Oct 2026
ETHUSDT 4h−15.9%+8.4%7325%0.5715.9%8 May 2026 – 21 Oct 2026
SOLUSDT 1D−7.6%+16.7%8249%0.9434.7%26 Jan 2024 – 21 Oct 2026
SOLUSDT 4h−7.7%+21.5%8133%0.8516.5%8 May 2026 – 21 Oct 2026
BNBUSDT 1D+5.1%+148.3%8046%1.0812.6%26 Jan 2024 – 21 Oct 2026
BNBUSDT 4h−10.8%+17.1%7528%0.7113.8%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 market1844%−$3,889.89
Sideways market1932%−$7,518.38
Falling market2143%−$1,694.12

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

How bad could the drawdown be?

26.8%

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

0%31%
All 58 trades
SideEntryExitBarsP&L
short30 Jan 2024 43,302.7031 Jan 2024 42,941.101$723.22
long31 Jan 2024 42,941.1031 Jan 2024 42,941.100$0.00
short19 Feb 2024 52,137.7020 Feb 2024 51,459.901$677.79
long25 Feb 2024 51,568.2026 Feb 2024 51,258.801−$309.41
short6 Mar 2024 63,724.007 Mar 2024 66,074.001−$2,350.03
long17 Mar 2024 65,300.6018 Mar 2024 68,393.501$3,092.83
short2 Apr 2024 69,649.803 Apr 2024 65,464.001$4,185.82
long8 Apr 2024 69,360.409 Apr 2024 71,620.001$2,259.62
short17 May 2024 65,235.2018 May 2024 67,024.001−$1,788.79
long2 Jun 2024 67,766.803 Jun 2024 68,647.801$880.97
short12 Jun 2024 67,314.2013 Jun 2024 68,264.001−$949.75
long18 Jun 2024 66,504.3019 Jun 2024 65,175.301−$1,329.01
short6 Jul 2024 56,628.807 Jul 2024 58,230.101−$1,601.34
long9 Jul 2024 56,714.6010 Jul 2024 58,050.001$1,335.39
short20 Jul 2024 66,660.0021 Jul 2024 67,140.001−$479.96
long1 Aug 2024 64,628.002 Aug 2024 65,468.201$840.17
short17 Aug 2024 58,874.6018 Aug 2024 59,492.001−$617.40
long3 Sep 2024 59,132.104 Sep 2024 57,487.701−$1,644.38
short17 Sep 2024 58,214.0018 Sep 2024 60,314.001−$2,100.00
long5 Oct 2024 62,086.006 Oct 2024 62,893.101$807.12
short17 Oct 2024 67,620.0018 Oct 2024 68,025.701−$405.72
long30 Oct 2024 72,736.4031 Oct 2024 72,300.001−$436.42
short6 Nov 2024 69,372.007 Nov 2024 75,572.001−$6,199.98
long30 Nov 2024 97,460.001 Dec 2024 96,408.001−$1,052.01
short11 Dec 2024 96,593.0012 Dec 2024 101,125.001−$4,532.00
short21 Dec 2024 97,805.4022 Dec 2024 96,534.001$1,271.48
long23 Dec 2024 95,186.3024 Dec 2024 94,615.201−$571.12
short9 Jan 2025 95,060.6010 Jan 2025 92,552.501$2,508.12
long3 Feb 2025 97,700.604 Feb 2025 101,329.001$3,627.92
short18 Feb 2025 95,780.0019 Feb 2025 96,354.701−$574.69
long26 Feb 2025 88,680.4027 Feb 2025 84,250.101−$4,430.30
short12 Mar 2025 82,933.0013 Mar 2025 83,680.101−$747.13
long17 Mar 2025 82,574.5018 Mar 2025 84,010.001$1,435.50
short26 Mar 2025 87,392.9027 Mar 2025 86,256.801$1,136.11
long6 Apr 2025 83,538.007 Apr 2025 78,430.001−$5,107.99
short17 Apr 2025 84,030.4018 Apr 2025 84,947.901−$917.54
short19 Nov 2025 92,960.8020 Nov 2025 91,555.001$1,405.87
long23 Nov 2025 84,739.8024 Nov 2025 86,830.001$2,090.25
short4 Dec 2025 93,429.905 Dec 2025 92,078.101$1,351.89
long17 Dec 2025 87,863.4018 Dec 2025 86,243.201−$1,620.20
short27 Dec 2025 87,369.6028 Dec 2025 87,893.801−$524.22
long26 Jan 2026 86,670.4027 Jan 2026 88,347.101$1,676.72
short19 Feb 2026 66,461.0020 Feb 2026 67,003.701−$542.73
long2 Mar 2026 65,776.503 Mar 2026 68,830.101$3,053.58
short8 Mar 2026 67,262.909 Mar 2026 65,971.201$1,291.71
long27 Mar 2026 68,820.3028 Mar 2026 66,407.301−$2,413.03
short8 Apr 2026 71,924.209 Apr 2026 70,989.201$935.02
long20 May 2026 76,834.4021 May 2026 77,833.201$998.85
short19 Jun 2026 62,958.0020 Jun 2026 63,543.901−$585.89
long29 Jun 2026 59,577.0030 Jun 2026 59,219.501−$357.47
short9 Jul 2026 62,290.0010 Jul 2026 63,230.001−$940.00
long21 Jul 2026 65,255.5022 Jul 2026 66,556.101$1,300.64
short28 Jul 2026 63,755.9029 Jul 2026 64,138.401−$382.54
long6 Aug 2026 64,665.207 Aug 2026 64,277.201−$388.00
short14 Aug 2026 63,490.9017 Aug 2026 63,871.803−$380.95
long6 Sep 2026 79,831.807 Sep 2026 79,352.801−$479.00
short18 Sep 2026 76,417.0019 Sep 2026 80,883.901−$4,466.85
long5 Oct 2026 86,530.006 Oct 2026 85,766.901−$763.13

Similar scripts

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

Where it runs

EngineCompilesRunsMatches TradingView
Zeal Terminal · OpenPineScript v2Yes 25 msYes 1,000 bars in 70 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/// © greenmask9, @cheatcountry//@version=4strategy(title= "Ehlers Bandpass Filter", shorttitle = "Bandpass Filter", overlay=false)//commission_type=strategy.commission.percent, commission_value=.5////Capital Managementcapitaltype = input(defval="Initial", title="Capital Settings", options=["Initial", "Growing","Manual"], type=input.string)manualcapital = input(title="Manual Position Size", defval=100.3, type=input.float)leverage = input(title="Leverage", defval=1, type=input.float)capitalsystem(capitaltype) =>    v1 = floor(strategy.initial_capital/close) * leverage    v2 = floor((strategy.initial_capital + strategy.netprofit)/close) * leverage    v3 = manualcapital    capitaltype== "Initial"? v1 : capitaltype == "Growing" ? v2 : v3ordersize=capitalsystem(capitaltype)//Targets, Stopspercentages = input(title="Percentage stop 🎯", defval=true)targetpercentage = input(title="Profit (%)", type=input.float, minval=0.0, step=0.1, defval=1.3) * 0.01stoppercentage = input(title="Stop Loss (%)", type=input.float, minval=0.0, step=0.1, defval=0.6) * 0.01longtp  = strategy.position_avg_price * (1 + targetpercentage)shorttp = strategy.position_avg_price * (1 - targetpercentage)longStopPrice  = strategy.position_avg_price * (1 - stoppercentage)shortStopPrice = strategy.position_avg_price * (1 + stoppercentage)//Cheatcountry's part// Copyright (c) 2019-present, Franklin Moormann (cheatcountry)// Ehlers Bandpass Filter script may be freely distributed under the MIT license.inp = input(title="Source", type=input.source, defval=close)res = input(title="Resolution", type=input.resolution, defval="")rep = input(title="Allow Repainting?", type=input.bool, defval=false)src = security(syminfo.tickerid, res, inp[rep ? 0 : barstate.isrealtime ? 1 : 0])[rep ? 0 : barstate.isrealtime ? 0 : 1]length = input(title="Length", type=input.integer, defval=20, minval=1)bw = input(title="Bandwidth", type=input.float, defval=0.3, minval=0.01, step = 0.01)pi = 2 * asin(1)twoPiPrd1 = 0.25 * bw * 2 * pi / lengthtwoPiPrd2 = 1.5 * bw * 2 * pi / lengthbeta = cos(2 * pi / length)gamma = 1.0 / cos(2 * pi * bw / length)alpha1 = gamma - sqrt((gamma * gamma) - 1)alpha2 = (cos(twoPiPrd1) + sin(twoPiPrd1) - 1) / cos(twoPiPrd1)alpha3 = (cos(twoPiPrd2) + sin(twoPiPrd2) - 1) / cos(twoPiPrd2)hp = 0.0hp := ((1 + (alpha2 / 2)) * (src - nz(src[1]))) + ((1 - alpha2) * nz(hp[1]))bp = 0.0bp := bar_index > 2 ? (0.5 * (1 - alpha1) * (hp - nz(hp[2]))) + (beta * (1 + alpha1) * nz(bp[1])) - (alpha1 * nz(bp[2])) : 0peak = 0.0peak := 0.991 * nz(peak[1])peak := abs(bp) > peak ? abs(bp) : peaksignal = peak != 0 ? bp / peak : 0trigger = 0.0trigger := ((1 + (alpha3 / 2)) * (signal - nz(signal[1]))) + ((1 - alpha3) * nz(trigger[1]))sig = trigger > nz(trigger[1]) ? 1 : trigger < nz(trigger[1]) ? -1 : 0sigColor = sig > 0 ? color.green : sig < 0 ? color.red : color.blackplot(signal, title="Signal", color=sigColor, linewidth=2)plot(trigger, title="Trigger", color=color.black, linewidth=1)//End Cheatcountry's part//Thingsbuy = crossover(trigger, signal)sell = crossunder(trigger, signal)if (buy)    strategy.entry("Buy", strategy.long, ordersize)if (percentages)    strategy.exit( "Buy", from_entry="Buy", stop=longStopPrice, limit= longtp)//    if (target and stop)//        strategy.exit( "Set Value tp/sl", from_entry="Buy", profit=targetticks, loss=stopnumberticks)//    if (target and not stop)//        strategy.exit( "Set Value tp/sl", from_entry="Buy", profit=targetticks)//    if (stop and not target)//        strategy.exit( "Set Value tp/sl", from_entry="Buy", loss=stopnumberticks)//strategy.close("Buy", buyend)if (sell)    strategy.entry("Short", strategy.short, ordersize)if (percentages)    strategy.exit( "Short", from_entry="Short", stop=shortStopPrice, limit = shorttp)//plot(series=(strategy.position_size > 0) ? longStopPrice : na,//     color=color.red, style=plot.style_linebr,//     linewidth=2, title="Long Stop Loss")//plot(series=(strategy.position_size < 0) ? shortStopPrice : na,//     color=color.red, style=plot.style_linebr,//     linewidth=2, title="Short Stop Loss")//plot(series=(strategy.position_size > 0) ? longtp : na,//     color=color.lime, style=plot.style_linebr,//     linewidth=2, title="Long Stop Loss")//plot(series=(strategy.position_size < 0) ? shorttp : na,//     color=color.lime, style=plot.style_linebr,//     linewidth=2, title="Short Stop Loss")