Pine Script v4 · Strategy
Multi Supertrend with no-repaint HTF option strategy
A Pine Script v4 strategy built on Supertrend (3.0, 10). It has 4 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 is one contract and pays no commission. 8 settings; defaults include Multiplier for Default Supertrend 3.0, Period for Default Supertrend 10 and Multiplier for Additional Supertrend 2.0.
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 Multi Supertrend with no-repaint HTF option strategy repaint?
- Yes
- At least one pattern in the source can repaint: higher-timeframe data.
- How did Multi Supertrend with no-repaint HTF option strategy do on BTCUSDT 1D with default settings?
- −18.40%
- From 26 Jan 2024 to 21 Oct 2026, over 36 closed trades, against +102.5% for buy and hold. A backtest, not investment advice.
- Can Multi Supertrend with no-repaint HTF option strategy 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 Multi Supertrend with no-repaint HTF option strategy use a stop loss?
- No
- Every exit waits for a signal; nothing limits a losing trade before it fires.
- Does Multi Supertrend with no-repaint HTF option strategy run in Zeal Terminal?
- Yes
- It compiles in 14 ms and runs 1,000 bars in 69 ms, in the browser.
BTCUSDT · 1D · default settings
- SuperTrend
- Supertrend Higher Time Frame
- Winning trade
- Losing trade
- Equity
- Buy and hold
- Net profit
- −18.40%
- −$18,395.70
- Buy and hold
- +102.5%
- same period
- Closed trades
- 36
- 11 won · 25 lost
- Profitable
- 30.6%
- of closed trades
- Profit factor
- 0.87
- gross profit ÷ gross loss
- Max drawdown
- 67.63%
- −$76,984.50
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 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
1 setting has no label
In the settings dialog vwapfilter (line 49) shows 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 52, 53, 54, 55. 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 supertrend → ta.supertrend, security → request.security, abs → math.abs.
- 4 strategy calls use the when = argument (line 52, 53, 54, 55). It is deprecated in v5 and removed in v6, where each call moves inside an if block.
v4 → v5
VerifiedSame 36 trades and the same P&L on BTCUSDT 1D, 1,000 bars, in Zeal Terminal's engine.
- Line 4: //@version=4 → //@version=5
- Line 19: input(type = input.bool) → input.bool()
- Line 20: input(type = input.resolution) → input.timeframe()
- Line 27: supertrend → ta.supertrend
- Line 32: security → request.security
- Line 34: supertrend → ta.supertrend
6 more edits
- Line 36: supertrend → ta.supertrend
- Line 39: abs → math.abs
- Line 52: strategy.entry(…, true) → strategy.entry(…, strategy.long)
- Line 52: vwap → ta.vwap
- Line 53: strategy.entry(…, false) → strategy.entry(…, strategy.short)
- Line 53: vwap → ta.vwap
⋯// Thanks to LonesomeTheBlue for the original code-//@version=4+//@version=5strategy("Multi Supertrend with no-repaint HTF option strategy", overlay = true, shorttitle='Multi Supertrend')⋯ '5W'-HTFSelection = input(title='Select HTF Automatically for Additional Supertrend', type=input.bool, defval=false)+HTFSelection = input.bool(title='Select HTF Automatically for Additional Supertrend', defval=false)-HTFUserSel = input(title='Select Higher Timeframe for Additional Supertrend',type=input.resolution, defval ='')+HTFUserSel = input.timeframe(title='Select Higher Timeframe for Additional Supertrend', defval ='')HTF = HTFSelection ? HTFAuto : HTFUserSel⋯chbarcol = input(true, title = "Change Bar Color")-[Trailings, Trend] = supertrend(Mult1, Period1)+[Trailings, Trend] = ta.supertrend(Mult1, Period1)linecolor = Trend == -1 and Trend[1] == -1 ? color.teal :⋯plot(Trailings, color = linecolor, linewidth = 2,title = "SuperTrend")-f_Security(_symbol, _res, _src) => security(_symbol, _res, _src[1], lookahead = barmerge.lookahead_on)+f_Security(_symbol, _res, _src) => request.security(_symbol, _res, _src[1], lookahead = barmerge.lookahead_on)nonVectorSupertrend(Mult, Period) =>- [Trail_, Trend_] = supertrend(Mult, Period)+ [Trail_, Trend_] = ta.supertrend(Mult, Period) Trail_*Trend_-[TrailingslHtf, TrendHtf] = supertrend(Mult2, Period2)+[TrailingslHtf, TrendHtf] = ta.supertrend(Mult2, Period2)if HTF != timeframe.period and HTF != '' CompositeTrailHtf = f_Security(syminfo.tickerid, HTF,nonVectorSupertrend(Mult2, Period2) )- TrailingslHtf := abs(CompositeTrailHtf)+ TrailingslHtf := math.abs(CompositeTrailHtf) TrendHtf := CompositeTrailHtf > 0 ? 1 : -1⋯Short = Trend == 1 and TrendHtf == 1-strategy.entry("enter long", true, 1, when = Long and not Long[1] and (vwapfilter and close > vwap or not vwapfilter))+strategy.entry("enter long", strategy.long, 1, when = Long and not Long[1] and (vwapfilter and close > ta.vwap or not vwapfilter))-strategy.entry("enter short", false, 1, when = Short and not Short[1] and (vwapfilter and close < vwap or not vwapfilter))+strategy.entry("enter short", strategy.short, 1, when = Short and not Short[1] and (vwapfilter and close < ta.vwap or not vwapfilter))strategy.close("enter long", when = Long[1] and not Long)⋯Same 36 trades and the same P&L on BTCUSDT 1D, 1,000 bars, in Zeal Terminal's engine.
- Line 22: input() → input.float()
- Line 23: input() → input.int()
- Line 24: input() → input.float()
- Line 25: input() → input.int()
- Line 26: input() → input.bool()
- Line 49: input() → input.bool()
4 more edits
- Line 52: when = Long and not Long[1] and (vwapfilter and close > ta.vwap or not vwapfilter) → if block
- Line 53: when = Short and not Short[1] and (vwapfilter and close < ta.vwap or not vwapfilter) → if block
- Line 54: when = Long[1] and not Long → if block
- Line 55: when = Short[1] and not Short → if block
⋯HTF = HTFSelection ? HTFAuto : HTFUserSel-Mult1 = input(title='Multiplier for Default Supertrend', defval=3.0, minval = 0, maxval = 10)+Mult1 = input.float(title='Multiplier for Default Supertrend', defval=3.0, minval = 0, maxval = 10)-Period1 = input(title='Period for Default Supertrend', defval=10, minval = 1, maxval = 100)+Period1 = input.int(title='Period for Default Supertrend', defval=10, minval = 1, maxval = 100)-Mult2 = input(title='Multiplier for Additional Supertrend', defval=2.0, minval = 0, maxval = 10)+Mult2 = input.float(title='Multiplier for Additional Supertrend', defval=2.0, minval = 0, maxval = 10)-Period2 = input(title='Period for Additional Supertrend', defval=14, minval = 1, maxval = 100)+Period2 = input.int(title='Period for Additional Supertrend', defval=14, minval = 1, maxval = 100)-chbarcol = input(true, title = "Change Bar Color")+chbarcol = input.bool(true, title = "Change Bar Color")[Trailings, Trend] = ta.supertrend(Mult1, Period1)⋯barcolor(color = chbarcol ? barcolor_ : na)-vwapfilter = input(false)+vwapfilter = input.bool(false)Long = Trend == -1 and TrendHtf == -1Short = Trend == 1 and TrendHtf == 1-strategy.entry("enter long", strategy.long, 1, when = Long and not Long[1] and (vwapfilter and close > ta.vwap or not vwapfilter))+if Long and not Long[1] and (vwapfilter and close > ta.vwap or not vwapfilter)+ strategy.entry("enter long", strategy.long, 1)-strategy.entry("enter short", strategy.short, 1, when = Short and not Short[1] and (vwapfilter and close < ta.vwap or not vwapfilter))+if Short and not Short[1] and (vwapfilter and close < ta.vwap or not vwapfilter)+ strategy.entry("enter short", strategy.short, 1)-strategy.close("enter long", when = Long[1] and not Long)+if Long[1] and not Long+ strategy.close("enter long")-strategy.close("enter short", when = Short[1] and not Short)+if Short[1] and not Short+ strategy.close("enter short")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: 36 before, 20 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.
⋯// Thanks to LonesomeTheBlue for the original code-//@version=5+//@version=6strategy("Multi Supertrend with no-repaint HTF option strategy", overlay = true, shorttitle='Multi Supertrend')⋯Settings
Every input the script declares, with its default and what it feeds. Bounds are the ones the script enforces.
| Setting | Default | Type and range | Feeds |
|---|---|---|---|
| Select HTF Automatically for Additional Supertrend | false | bool | HTF |
| Select Higher Timeframe for Additional Supertrend | | timeframe (written input.resolution) | HTF |
| Multiplier for Default Supertrend | 3.0 | float · min 0 · max 10 | Trailings Trend |
| Period for Default Supertrend | 10 | int · min 1 · max 100 | Trailings Trend |
| Multiplier for Additional Supertrend | 2.0 | float · min 0 · max 10 | TrailingslHtf TrendHtf CompositeTrailHtf |
| Period for Additional Supertrend | 14 | int · min 1 · max 100 | TrailingslHtf TrendHtf CompositeTrailHtf |
| Change Bar Color | true | bool | barcolor |
| Vwapfilter (no label in the script) | false | bool | entry enter long entry enter short |
What it calculates
- Supertrend (
supertrend,ta.supertrendin v5)Multiplier for Default Supertrend (3.0), Period for Default Supertrend (10)Trailings · line 27 - Supertrend (
supertrend,ta.supertrendin v5)Multiplier for Default Supertrend (3.0), Period for Default Supertrend (10)Trend · line 27 - Supertrend (
supertrend,ta.supertrendin v5)Mult, PeriodTrail_ · line 34 - Supertrend (
supertrend,ta.supertrendin v5)Mult, PeriodTrend_ · line 34 - Supertrend (
supertrend,ta.supertrendin v5)Multiplier for Additional Supertrend (2.0), Period for Additional Supertrend (14)TrailingslHtf · line 36 - Supertrend (
supertrend,ta.supertrendin v5)Multiplier for Additional Supertrend (2.0), Period for Additional Supertrend (14)TrendHtf · line 36
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.
Order rules
| Order | Fires when | By default | Line |
|---|---|---|---|
| Open enter long long | Long and not Long[1] and (vwapfilter and close > vwap or not vwapfilter) | On | 52 |
| Open enter short short | Short and not Short[1] and (vwapfilter and close < vwap or not vwapfilter) | On | 53 |
| Close enter long | Long[1] and not Long | On | 54 |
| Close enter short | Short[1] and not Short | On | 55 |
Each order is guarded by the setting shown. “Off” orders never fire unless that setting is switched on.
Does it repaint?
Yes
At least one pattern in the source can repaint; it is marked Check below.
- CheckHigher-timeframe data1 security call(s) use lookahead_on (line 32). Without a [1] offset this reads future bars in history.
- 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.
| Market | Net | Buy and hold | Trades | Won | Profit factor | Max drawdown | Period |
|---|---|---|---|---|---|---|---|
| BTCUSDT 1D | −18.4% | +102.5% | 36 | 31% | 0.87 | 67.6% | 26 Jan 2024 – 21 Oct 2026 |
| BTCUSDT 4h | −3.2% | +5.5% | 35 | 31% | 0.92 | 12.5% | 8 May 2026 – 21 Oct 2026 |
| ETHUSDT 1D | +0.8% | +9.8% | 30 | 37% | 1.13 | 2.5% | 26 Jan 2024 – 21 Oct 2026 |
| ETHUSDT 4h | +0.3% | +8.4% | 28 | 32% | 1.25 | 0.6% | 8 May 2026 – 21 Oct 2026 |
| SOLUSDT 1D | −0.0% | +16.7% | 35 | 34% | 0.88 | 0.2% | 26 Jan 2024 – 21 Oct 2026 |
| SOLUSDT 4h | +0.0% | +21.5% | 33 | 33% | 1.07 | 0.0% | 8 May 2026 – 21 Oct 2026 |
| BNBUSDT 1D | −0.0% | +148.3% | 33 | 36% | 0.99 | 0.7% | 26 Jan 2024 – 21 Oct 2026 |
| BNBUSDT 4h | +0.0% | +17.1% | 35 | 31% | 1.04 | 0.1% | 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 bars | Trades | Won | P&L |
|---|---|---|---|
| Rising market | 10 | 30% | −$4,274.16 |
| Sideways market | 18 | 28% | −$15,679.20 |
| Falling market | 8 | 38% | $1,557.61 |
Rising and falling mean the market moved more than 15% over the 90 bars before entry.
How bad could the drawdown be?
68.6%
The 95th percentile of the worst drawdown when the same 36 trades are reshuffled 5,000 times. The bar spans the 5th to 95th percentile, 39.1% to 68.6%; the tick is what actually happened, 58.2%. Order luck alone moves it this much.
All 36 trades
| Side | Entry | Exit | Bars | P&L |
|---|---|---|---|---|
| short | 27 Jan 2024 41,823.50 | 10 Feb 2024 47,132.80 | 14 | −$5,309.27 |
| long | 11 Feb 2024 47,751.10 | 17 Mar 2024 65,300.60 | 35 | $17,549.60 |
| short | 20 Mar 2024 61,937.40 | 16 May 2024 66,206.50 | 57 | −$4,269.10 |
| long | 21 May 2024 71,446.60 | 15 Jun 2024 66,044.00 | 25 | −$5,402.63 |
| short | 22 Jun 2024 64,143.60 | 15 Jul 2024 60,797.90 | 23 | $3,345.65 |
| long | 16 Jul 2024 64,724.10 | 3 Aug 2024 61,498.30 | 18 | −$3,225.72 |
| short | 4 Aug 2024 60,698.00 | 9 Aug 2024 61,686.00 | 5 | −$988.01 |
| long | 24 Aug 2024 64,037.20 | 1 Sep 2024 58,974.00 | 8 | −$5,063.24 |
| short | 6 Sep 2024 56,180.00 | 14 Sep 2024 60,498.00 | 8 | −$4,317.99 |
| long | 20 Sep 2024 62,948.00 | 2 Oct 2024 60,804.90 | 12 | −$2,143.08 |
| long | 15 Oct 2024 66,084.00 | 5 Nov 2024 67,850.00 | 21 | $1,766.01 |
| long | 7 Nov 2024 75,572.00 | 20 Dec 2024 97,461.90 | 43 | $21,889.90 |
| short | 24 Dec 2024 94,881.50 | 7 Jan 2025 102,236.00 | 14 | −$7,354.13 |
| short | 10 Jan 2025 92,552.50 | 16 Jan 2025 100,497.00 | 6 | −$7,944.86 |
| long | 18 Jan 2025 104,077.00 | 6 Feb 2025 96,612.40 | 19 | −$7,465.03 |
| short | 25 Feb 2025 91,552.90 | 3 Mar 2025 94,270.00 | 6 | −$2,717.11 |
| long | 3 Mar 2025 94,270.00 | 10 Mar 2025 80,734.50 | 7 | −$13,535.50 |
| short | 11 Mar 2025 78,595.90 | 22 Apr 2025 87,516.20 | 42 | −$8,920.36 |
| long | 23 Apr 2025 93,443.00 | 31 May 2025 103,985.00 | 38 | $10,542.50 |
| long | 10 Jun 2025 110,263.00 | 21 Jun 2025 103,298.00 | 11 | −$6,965.04 |
| short | 23 Jun 2025 100,964.00 | 26 Jun 2025 107,341.00 | 3 | −$6,376.72 |
| long | 10 Jul 2025 111,234.00 | 2 Aug 2025 113,298.00 | 23 | $2,063.92 |
| long | 11 Aug 2025 119,294.00 | 20 Aug 2025 112,873.00 | 9 | −$6,421.32 |
| short | 22 Aug 2025 112,500.00 | 12 Sep 2025 115,483.00 | 21 | −$2,982.69 |
| short | 24 Sep 2025 111,999.00 | 30 Sep 2025 114,312.00 | 6 | −$2,313.17 |
| long | 2 Oct 2025 118,595.00 | 11 Oct 2025 112,774.00 | 9 | −$5,820.50 |
| short | 11 Oct 2025 112,774.00 | 4 Dec 2025 93,429.90 | 54 | $19,344.50 |
| short | 19 Dec 2025 85,516.40 | 6 Jan 2026 93,859.70 | 18 | −$8,343.30 |
| long | 14 Jan 2026 95,414.00 | 21 Jan 2026 88,427.70 | 7 | −$6,986.33 |
| short | 21 Jan 2026 88,427.70 | 5 Mar 2026 72,666.80 | 43 | $15,760.90 |
| long | 5 Mar 2026 72,666.80 | 23 Mar 2026 67,859.00 | 18 | −$4,807.77 |
| short | 30 Mar 2026 66,010.90 | 8 Apr 2026 71,924.20 | 9 | −$5,913.29 |
| long | 14 Apr 2026 74,418.00 | 18 May 2026 77,457.70 | 34 | $3,039.67 |
| short | 23 May 2026 75,539.50 | 15 Jun 2026 65,746.40 | 23 | $9,793.05 |
| short | 25 Jun 2026 61,078.00 | 7 Jul 2026 64,042.90 | 12 | −$2,964.93 |
| long | 22 Jul 2026 66,556.10 | 17 Oct 2026 81,615.90 | 87 | $15,059.80 |
Similar scripts
Indicators and strategies built from the same calculations, run on BTCUSDT 1D with their own defaults so they can be compared directly.
| Script | Shares | Type | Net | Trades | Max drawdown |
|---|---|---|---|---|---|
| Multi Supertrend with no-repaint HTF option strategy this page | — | v4 strategy | −18.4% | 36 | 67.6% |
| Supertrend Strategy by Zeal Terminal | supertrend | v5 strategy | −4.0% | 26 | 9.2% |
| Supertrend - Long & Short -Sachin Ughade by hello_sachin | supertrend | v4 strategy | +185.8% | 57 | 163.4% |
| Supertrend - Intraday by Pritesh-StocksDeveloper | supertrend | v5 strategy | No trades on this market | ||
| SuperTrend - Custom Screener and Dynamic Alerts by sharaaU7 | supertrend | v4 strategy | −9.7% | 27 | 51.9% |
| Supertrend by Zeal Terminal | supertrend | v5 indicator | indicator | ||
Where it runs
| Engine | Compiles | Runs | Matches TradingView |
|---|---|---|---|
| Zeal Terminal · OpenPineScript v2 | Yes 14 ms | With a workaround 1,000 bars in 69 ms | Not measured |
| PineTS | No v5 and v6 only | — | Not measured |
Zeal Terminal's engine currently reads an order side written as true, false as a short, whatever it says; this page passes the same side as strategy.long or strategy.short (lines 52, 53) so the engine trades the way the script says. The engine's host API cannot yet declare a chart's symbol and timeframe, so this page sets them on the engine directly for each market.
“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/// © ramki_simple// Thanks to LonesomeTheBlue for the original code//@version=4strategy("Multi Supertrend with no-repaint HTF option strategy", overlay = true, shorttitle='Multi Supertrend')//auto higher time frameHTFAuto = timeframe.period == '1' ? '5' : timeframe.period == '3' ? '15' : timeframe.period == '5' ? '15' : timeframe.period == '15' ? '60' : timeframe.period == '30' ? '60' : timeframe.period == '45' ? '60' : timeframe.period == '60' ? '240' : timeframe.period == '120' ? '240' : timeframe.period == '180' ? '240' : timeframe.period == '240' ? 'D' : timeframe.period == 'D' ? 'W' : '5W'HTFSelection = input(title='Select HTF Automatically for Additional Supertrend', type=input.bool, defval=false)HTFUserSel = input(title='Select Higher Timeframe for Additional Supertrend',type=input.resolution, defval ='')HTF = HTFSelection ? HTFAuto : HTFUserSelMult1 = input(title='Multiplier for Default Supertrend', defval=3.0, minval = 0, maxval = 10)Period1 = input(title='Period for Default Supertrend', defval=10, minval = 1, maxval = 100)Mult2 = input(title='Multiplier for Additional Supertrend', defval=2.0, minval = 0, maxval = 10)Period2 = input(title='Period for Additional Supertrend', defval=14, minval = 1, maxval = 100)chbarcol = input(true, title = "Change Bar Color")[Trailings, Trend] = supertrend(Mult1, Period1)linecolor = Trend == -1 and Trend[1] == -1 ? color.teal : Trend == 1 and Trend[1] == 1 ? color.red : color.new(color.white, 100)plot(Trailings, color = linecolor, linewidth = 2,title = "SuperTrend")f_Security(_symbol, _res, _src) => security(_symbol, _res, _src[1], lookahead = barmerge.lookahead_on)nonVectorSupertrend(Mult, Period) => [Trail_, Trend_] = supertrend(Mult, Period) Trail_*Trend_[TrailingslHtf, TrendHtf] = supertrend(Mult2, Period2)if HTF != timeframe.period and HTF != '' CompositeTrailHtf = f_Security(syminfo.tickerid, HTF,nonVectorSupertrend(Mult2, Period2) ) TrailingslHtf := abs(CompositeTrailHtf) TrendHtf := CompositeTrailHtf > 0 ? 1 : -1linecolorHtf = TrendHtf == -1 and TrendHtf[1] == -1 ? color.blue : TrendHtf == 1 and TrendHtf[1] == 1 ? color.maroon : color.new(color.white, 100)plot(TrailingslHtf, color = linecolorHtf, linewidth = 3, title = "Supertrend Higher Time Frame")barcolor_ = Trend == -1 and TrendHtf == -1 ? color.lime : Trend == 1 and TrendHtf == 1 ? color.red : color.whitebarcolor(color = chbarcol ? barcolor_ : na)vwapfilter = input(false)Long = Trend == -1 and TrendHtf == -1Short = Trend == 1 and TrendHtf == 1strategy.entry("enter long", true, 1, when = Long and not Long[1] and (vwapfilter and close > vwap or not vwapfilter))strategy.entry("enter short", false, 1, when = Short and not Short[1] and (vwapfilter and close < vwap or not vwapfilter))strategy.close("enter long", when = Long[1] and not Long)strategy.close("enter short", when = Short[1] and not Short)