Pine Script v4 · Strategy
TradingGroundhog - Strategy & Fractal V1
A Pine Script v4 strategy built on Highest (high, 2), Lowest (low, 2) and Valuewhen (high[2], 2). It has 2 order rules, 1 entry among them, and trades long only with the default settings. Exits wait for a signal; there is no stop loss. Each trade commits cash_given_per_lot in cash and pays no commission. 11 settings; defaults include Start Date 13, Start Month 9 and Start Year 2021.
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 TradingGroundhog - Strategy & Fractal V1 repaint?
- No
- No repainting patterns were found in the source, and a live tick-by-tick replay matched history on 2 of 2 trades.
- How did TradingGroundhog - Strategy & Fractal V1 do on BTCUSDT 1D with default settings?
- −2.94%
- From 26 Jan 2024 to 21 Oct 2026, over 8 closed trades, against +102.5% for buy and hold. A backtest, not investment advice.
- Can TradingGroundhog - Strategy & Fractal V1 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 TradingGroundhog - Strategy & Fractal V1 use a stop loss?
- No
- Every exit waits for a signal; nothing limits a losing trade before it fires.
- Does TradingGroundhog - Strategy & Fractal V1 run in Zeal Terminal?
- Yes
- It compiles in 56 ms and runs 1,000 bars in 5,141 ms, in the browser.
BTCUSDT · 1D · default settings
- Plot
- Plot
- Plot
- Plot
- Shape
- Shape
- Winning trade
- Losing trade
- Equity
- Buy and hold
- Net profit
- −2.94%
- −$2,939.04
- Buy and hold
- +102.5%
- same period
- Closed trades
- 8
- 3 won · 5 lost
- Profitable
- 37.5%
- of closed trades
- Profit factor
- 0.46
- gross profit ÷ gross loss
- Max drawdown
- 5.85%
- −$5,970.30
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
2 settings do nothing
“Show Swings HL”, “Show Zig Zag” are declared but never read.
-
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
3 settings have no label
In the settings dialog ShowSwingsHL (line 32), showchannel (line 37), showZigZag (line 40) 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 112, 113. The upgraded version below moves each call inside an if block.
-
Note
Uses long =, which v5 renamed line 112
long = on line 112. v5 writes it as direction = strategy.long or strategy.short.
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 highest → ta.highest, lowest → ta.lowest, valuewhen → ta.valuewhen, barssince → ta.barssince, sma → ta.sma.
- 2 strategy calls use the when = argument (line 112, 113). It is deprecated in v5 and removed in v6, where each call moves inside an if block.
v4 → v5
VerifiedSame 8 trades and the same P&L on BTCUSDT 1D, 1,000 bars, in Zeal Terminal's engine.
- Line 1: //@version=4 → //@version=5
- Line 26: highest → ta.highest
- Line 27: lowest → ta.lowest
- Line 33: valuewhen → ta.valuewhen
- Line 33: valuewhen → ta.valuewhen
- Line 33: valuewhen → ta.valuewhen
9 more edits
- Line 33: valuewhen → ta.valuewhen
- Line 34: valuewhen → ta.valuewhen
- Line 34: valuewhen → ta.valuewhen
- Line 34: valuewhen → ta.valuewhen
- Line 34: valuewhen → ta.valuewhen
- Line 45: barssince → ta.barssince
- Line 46: barssince → ta.barssince
- Line 48: sma → ta.sma
- Line 112: long = true → direction = strategy.long
-// @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/⋯fbot = filterBW ? regularbotfractal : regularbotfractal or billwbotfractal-topf = ftop ? high[2] >= highest(high, length) ? true : false : false+topf = ftop ? high[2] >= ta.highest(high, length) ? true : false : false-botf = fbot ? low[2] <= lowest(low, length) ? true : false : false+botf = fbot ? low[2] <= ta.lowest(low, length) ? true : false : falsefilteredtopf = filterFractals ? topf : ftop⋯ShowSwingsHL = input(true)-highswings = filteredtopf == false ? na : valuewhen(filteredtopf == true, high[2], 2) < valuewhen(filteredtopf == true, high[2], 1) and valuewhen(filteredtopf == true, high[2], 1) > valuewhen(filteredtopf == true, high[2], 0)+highswings = filteredtopf == false ? na : ta.valuewhen(filteredtopf == true, high[2], 2) < ta.valuewhen(filteredtopf == true, high[2], 1) and ta.valuewhen(filteredtopf == true, high[2], 1) > ta.valuewhen(filteredtopf == true, high[2], 0)-lowswings = filteredbotf == false ? na : valuewhen(filteredbotf == true, low[2], 2) > valuewhen(filteredbotf == true, low[2], 1) and valuewhen(filteredbotf == true, low[2], 1) < valuewhen(filteredbotf == true, low[2], 0)+lowswings = filteredbotf == false ? na : ta.valuewhen(filteredbotf == true, low[2], 2) > ta.valuewhen(filteredbotf == true, low[2], 1) and ta.valuewhen(filteredbotf == true, low[2], 1) < ta.valuewhen(filteredbotf == true, low[2], 0)//---------------------------------------------------------------------------------------------------------⋯isbot = filteredbotf ? true : false-topcount = barssince(istop)+topcount = ta.barssince(istop)-botcount = barssince(isbot)+botcount = ta.barssince(isbot)vamp = input(title="VolumeMA", defval=2)-vam = sma(volume, vamp)+vam = ta.sma(volume, vamp)fractalup = 0.0⋯// ||--- Buy And Sell:-strategy.entry(id="Long", long=true, when = Signal_Test and afterStartDate)+strategy.entry(id="Long", direction = strategy.long, when = Signal_Test and afterStartDate)strategy.close_all(when = Signal_Test_OUT_TEMP and afterStartDate)⋯Same 8 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 10: input() → input.int()
- Line 17: input() → input.bool()
- Line 18: input() → input.bool()
- Line 19: input() → input.int()
7 more edits
- Line 32: input() → input.bool()
- Line 37: input() → input.bool()
- Line 40: input() → input.bool()
- Line 47: input() → input.int()
- Line 90: input() → input.float()
- Line 112: when = Signal_Test and afterStartDate → if block
- Line 113: when = Signal_Test_OUT_TEMP and afterStartDate → if block
⋯cash_given_per_lot = cash_amout/pyramid_val-startDate = input(title="Start Date",defval=13)+startDate = input.int(title="Start Date",defval=13)-startMonth = input(title="Start Month",defval=9)+startMonth = input.int(title="Start Month",defval=9)-startYear = input(title="Start Year",defval=2021)+startYear = input.int(title="Start Year",defval=2021)afterStartDate = (time >= timestamp(syminfo.timezone,startYear, startMonth, startDate, 0, 0))⋯// ||--- Fractal Recognition:-filterBW = input(true, title="filter Bill Williams Fractals:")+filterBW = input.bool(true, title="filter Bill Williams Fractals:")-filterFractals = input(true, title="Filter fractals using extreme method:")+filterFractals = input.bool(true, title="Filter fractals using extreme method:")-length = input(2, title="Extreme Window:")+length = input.int(2, title="Extreme Window:")regulartopfractal = high[4] < high[3] and high[3] < high[2] and high[2] > high[1] and high[1] > high[0]⋯// ||--- V1 : Added Swing High/Low Option-ShowSwingsHL = input(true)+ShowSwingsHL = input.bool(true)highswings = filteredtopf == false ? na : ta.valuewhen(filteredtopf == true, high[2], 2) < ta.valuewhen(filteredtopf == true, high[2], 1) and ta.valuewhen(filteredtopf == true, high[2], 1) > ta.valuewhen(filteredtopf == true, high[2], 0)⋯// ||--- V2 : Plot Lines based on the fractals.-showchannel = input(true)+showchannel = input.bool(true)//---------------------------------------------------------------------------------------------------------// ||--- ZigZag:-showZigZag = input(true)+showZigZag = input.bool(true)//----------------------------------------------------------------------------------------------------------⋯botcount = ta.barssince(isbot)-vamp = input(title="VolumeMA", defval=2)+vamp = input.int(title="VolumeMA", defval=2)vam = ta.sma(volume, vamp)⋯var Signal_Test_TEMP = false-longLossPerc = input(title="Long Stop Loss (%)", minval=0.0, step=0.1, defval=0.01) * 0.01+longLossPerc = input.float(title="Long Stop Loss (%)", minval=0.0, step=0.1, defval=0.01) * 0.01if filteredbotf and open < Bottom_1 and (Bottom_1 - open) / Bottom_1 >= longLossPerc⋯// ||--- Buy And Sell:-strategy.entry(id="Long", direction = strategy.long, when = Signal_Test and afterStartDate)+if Signal_Test and afterStartDate+ strategy.entry(id="Long", direction = strategy.long)-strategy.close_all(when = Signal_Test_OUT_TEMP and afterStartDate)+if Signal_Test_OUT_TEMP and afterStartDate+ strategy.close_all()//----------------------------------------------------------------------------------------------------------Does it run in Pine Script v6?
Yes
Same 8 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.
-// @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.
| Setting | Default | Type and range | Feeds |
|---|---|---|---|
| Start Date | 13 | int | afterStartDate |
| Start Month | 9 | int | afterStartDate |
| Start Year | 2021 | int | afterStartDate |
| filter Bill Williams Fractals: | true | bool | billwtopfractal billwbotfractal ftop fbot |
| Filter fractals using extreme method: | true | bool | filteredtopf filteredbotf |
| Extreme Window: | 2 | int | topf botf |
| Show Swings HL (no label in the script) | true | bool | unused |
| Showchannel (no label in the script) | true | bool | plot |
| Show Zig Zag (no label in the script) | true | bool | unused |
| VolumeMA | 2 | int | vam |
| Long Stop Loss (%) | 0.01 | float · min 0.0 · step 0.1 | line 91 |
What it calculates
- Highest (
highest,ta.highestin v5)high, Extreme Window: (2)topf · line 26 - Lowest (
lowest,ta.lowestin v5)low, Extreme Window: (2)botf · line 27 - Valuewhen (
valuewhen,ta.valuewhenin v5)filteredtopf == true, high[2], 2highswings · line 33 - Valuewhen (
valuewhen,ta.valuewhenin v5)filteredbotf == true, low[2], 2lowswings · line 34 - Barssince (
barssince,ta.barssincein v5)istoptopcount · line 45 - Barssince (
barssince,ta.barssincein v5)isbotbotcount · line 46 - SMA (
sma,ta.smain v5)volume, VolumeMA (2)vam · line 48
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 Long long | Signal_Test and afterStartDate | On | 112 |
| Close | Signal_Test_OUT_TEMP and afterStartDate | On | 113 |
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.
- 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.
| Market | Net | Buy and hold | Trades | Won | Profit factor | Max drawdown | Period |
|---|---|---|---|---|---|---|---|
| BTCUSDT 1D | −2.9% | +102.5% | 8 | 38% | 0.46 | 5.9% | 26 Jan 2024 – 21 Oct 2026 |
| BTCUSDT 4h | −0.8% | +5.5% | 6 | 50% | 0.55 | 2.4% | 8 May 2026 – 21 Oct 2026 |
| ETHUSDT 1D | −1.4% | +9.8% | 7 | 43% | 0.85 | 8.9% | 26 Jan 2024 – 21 Oct 2026 |
| ETHUSDT 4h | +2.3% | +8.4% | 5 | 40% | 1.98 | 2.9% | 8 May 2026 – 21 Oct 2026 |
| SOLUSDT 1D | +3.0% | +16.7% | 8 | 63% | 1.51 | 5.3% | 26 Jan 2024 – 21 Oct 2026 |
| SOLUSDT 4h | −0.4% | +21.5% | 4 | 50% | 0.83 | 3.4% | 8 May 2026 – 21 Oct 2026 |
| BNBUSDT 1D | +0.6% | +148.3% | 6 | 67% | 1.43 | 3.0% | 26 Jan 2024 – 21 Oct 2026 |
| BNBUSDT 4h | +4.7% | +17.1% | 10 | 100% | — | 0.5% | 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 | 2 | 50% | $556.48 |
| Sideways market | 5 | 40% | −$1,732.30 |
| Falling market | 1 | 0% | −$1,763.22 |
Rising and falling mean the market moved more than 15% over the 90 bars before entry.
How bad could the drawdown be?
5.3%
The 95th percentile of the worst drawdown when the same 8 trades are reshuffled 5,000 times. The bar spans the 5th to 95th percentile, 2.9% to 5.3%; the tick is what actually happened, 4.9%. Order luck alone moves it this much.
All 8 trades
| Side | Entry | Exit | Bars | P&L |
|---|---|---|---|---|
| long | 4 May 2024 62,882.00 | 24 May 2024 67,969.70 | 20 | $809.08 |
| long | 17 Jun 2024 66,676.90 | 25 Jul 2024 65,376.00 | 38 | −$195.10 |
| long | 8 Aug 2024 55,133.80 | 16 Sep 2024 59,132.00 | 39 | $725.18 |
| long | 6 Feb 2025 96,612.40 | 1 May 2025 94,172.00 | 84 | −$252.60 |
| long | 29 Aug 2025 112,567.00 | 9 Oct 2025 123,306.00 | 41 | $954.02 |
| long | 13 Oct 2025 114,959.00 | 8 Jan 2026 91,364.20 | 87 | −$2,052.44 |
| long | 24 Jan 2026 89,600.30 | 20 Apr 2026 73,801.80 | 86 | −$1,763.22 |
| long | 1 Jun 2026 73,674.40 | 24 Jul 2026 65,099.00 | 53 | −$1,163.96 |
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 |
|---|---|---|---|---|---|
| TradingGroundhog - Strategy & Fractal V1 this page | — | v4 strategy | −2.9% | 8 | 5.9% |
| TradingGroundhog - Strategy & Wavetrend V2 by UnknownUnicorn27666852 | highest lowest valuewhen barssince sma | v5 strategy | −0.0% | 2 | 0.0% |
| Trend Bounce [racer8] by racer8 | highest lowest sma valuewhen | v4 strategy | +2.4% | 22 | 32.2% |
| Coral Trend Pullback Strategy (TradeIQ) by kevinmck100 | sma lowest highest barssince | v5 strategy | −1.0% | 1 | 1.0% |
| Buying Dip Strategy With Take Profit And Stop Loss [racer8] by racer8 | sma valuewhen lowest | v4 strategy | −22.3% | 34 | 34.7% |
| ChBrkOutStrategySMA by anshuanshu333 | sma highest lowest | v4 strategy | −4.5% | 42 | 20.9% |
Where it runs
| Engine | Compiles | Runs | Matches TradingView |
|---|---|---|---|
| Zeal Terminal · OpenPineScript v2 | Yes 56 ms | With a workaround 1,000 bars in 5,141 ms | Not measured |
| PineTS | No v5 and v6 only | — | Not measured |
Zeal Terminal's engine currently reads an order side written as long = true as a short, whatever it says; this page passes the same side as strategy.long or strategy.short (line 112) 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.
// @version = 4// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/// © TradingGroundhog// ||--- Cash & Date:cash_amout = 10000pyramid_val = 1cash_given_per_lot = cash_amout/pyramid_valstartDate = input(title="Start Date",defval=13)startMonth = input(title="Start Month",defval=9)startYear = input(title="Start Year",defval=2021)afterStartDate = (time >= timestamp(syminfo.timezone,startYear, startMonth, startDate, 0, 0))// ||------------------------------------------------------------------------------------------------------// ||--- Strategy:strategy(title="TradingGroundhog - Strategy & Fractal V1 - Short term", overlay=true, max_bars_back = 4000, max_labels_count=500, commission_type=strategy.commission.percent, commission_value=0.00,default_qty_type=strategy.cash, default_qty_value= cash_given_per_lot, pyramiding=pyramid_val)// ||------------------------------------------------------------------------------------------------------// ||--- Fractal Recognition:filterBW = input(true, title="filter Bill Williams Fractals:")filterFractals = input(true, title="Filter fractals using extreme method:")length = input(2, title="Extreme Window:")regulartopfractal = high[4] < high[3] and high[3] < high[2] and high[2] > high[1] and high[1] > high[0]regularbotfractal = low[4] > low[3] and low[3] > low[2] and low[2] < low[1] and low[1] < low[0]billwtopfractal = filterBW ? false : (high[4] < high[2] and high[3] < high[2] and high[2] > high[1] and high[2] > high[0] ? true : false)billwbotfractal = filterBW ? false : (low[4] > low[2] and low[3] > low[2] and low[2] < low[1] and low[2] < low[0] ? true : false)ftop = filterBW ? regulartopfractal : regulartopfractal or billwtopfractalfbot = filterBW ? regularbotfractal : regularbotfractal or billwbotfractaltopf = ftop ? high[2] >= highest(high, length) ? true : false : falsebotf = fbot ? low[2] <= lowest(low, length) ? true : false : falsefilteredtopf = filterFractals ? topf : ftopfilteredbotf = filterFractals ? botf : fbot// ||------------------------------------------------------------------------------------------------------// ||--- V1 : Added Swing High/Low OptionShowSwingsHL = input(true)highswings = filteredtopf == false ? na : valuewhen(filteredtopf == true, high[2], 2) < valuewhen(filteredtopf == true, high[2], 1) and valuewhen(filteredtopf == true, high[2], 1) > valuewhen(filteredtopf == true, high[2], 0)lowswings = filteredbotf == false ? na : valuewhen(filteredbotf == true, low[2], 2) > valuewhen(filteredbotf == true, low[2], 1) and valuewhen(filteredbotf == true, low[2], 1) < valuewhen(filteredbotf == true, low[2], 0)//---------------------------------------------------------------------------------------------------------// ||--- V2 : Plot Lines based on the fractals.showchannel = input(true)//---------------------------------------------------------------------------------------------------------// ||--- ZigZag:showZigZag = input(true)//----------------------------------------------------------------------------------------------------------// ||--- Fractal computation:istop = filteredtopf ? true : falseisbot = filteredbotf ? true : falsetopcount = barssince(istop)botcount = barssince(isbot)vamp = input(title="VolumeMA", defval=2)vam = sma(volume, vamp)fractalup = 0.0fractaldown = 0.0up = high[3]>high[4] and high[4]>high[5] and high[2]<high[3] and high[1]<high[2] and volume[3]>vam[3]down = low[3]<low[4] and low[4]<low[5] and low[2]>low[3] and low[1]>low[2] and volume[3]>vam[3]fractalup := up ? high[3] : fractalup[1] fractaldown := down ? low[3] : fractaldown[1]//----------------------------------------------------------------------------------------------------------// ||--- Fractal save:fractaldown_save = array.new_float(0)for i = 0 to 4000 if array.size(fractaldown_save) < 3 if array.size(fractaldown_save) == 0 array.push(fractaldown_save, fractaldown[i]) else if fractaldown[i] != array.get(fractaldown_save, array.size(fractaldown_save)-1) array.push(fractaldown_save, fractaldown[i])if array.size(fractaldown_save) < 3 array.push(fractaldown_save, fractaldown) array.push(fractaldown_save, fractaldown)fractalup_save = array.new_float(0)for i = 0 to 4000 if array.size(fractalup_save) < 3 if array.size(fractalup_save) == 0 array.push(fractalup_save, fractalup[i]) else if fractalup[i] != array.get(fractalup_save, array.size(fractalup_save)-1) array.push(fractalup_save, fractalup[i])if array.size(fractalup_save) < 3 array.push(fractalup_save, fractalup) array.push(fractalup_save, fractalup)Bottom_1 = array.get(fractaldown_save, 0)Bottom_2 = array.get(fractaldown_save, 1)Bottom_3 = array.get(fractaldown_save, 2)Top_1 = array.get(fractalup_save, 0)Top_2 = array.get(fractalup_save, 1)Top_3 = array.get(fractalup_save, 2)//----------------------------------------------------------------------------------------------------------// ||--- Fractal Buy Sell Signal:bool Signal_Test = falsebool Signal_Test_OUT_TEMP = falsevar Signal_Test_TEMP = falselongLossPerc = input(title="Long Stop Loss (%)", minval=0.0, step=0.1, defval=0.01) * 0.01if filteredbotf and open < Bottom_1 and (Bottom_1 - open) / Bottom_1 >= longLossPerc Signal_Test := trueif filteredtopf and open > Top_1 Signal_Test_TEMP := trueif filteredtopf and Signal_Test_TEMP Signal_Test_TEMP := false Signal_Test_OUT_TEMP := true//----------------------------------------------------------------------------------------------------------// ||--- Plotting://plotshape(filteredtopf, style=shape.triangledown, location=location.abovebar, color=color.red, text="•", offset=0)//plotshape(filteredbotf, style=shape.triangleup, location=location.belowbar, color=color.lime, text="•", offset=0)//plotshape(ShowSwingsHL ? highswings : na, style=shape.triangledown, location=location.abovebar, color=color.maroon, text="H", offset=0)//plotshape(ShowSwingsHL ? lowswings : na, style=shape.triangleup, location=location.belowbar, color=color.green, text="L", offset=0)plot(showchannel ? (filteredtopf ? high[2] : na) : na, color=color.black, offset=0)plot(showchannel ? (filteredbotf ? low[2] : na) : na, color=color.black, offset=0)plot(showchannel ? (highswings ? high[2] : na) : na, color=color.black, offset=-2)plot(showchannel ? (lowswings ? low[2] : na) : na, color=color.black, offset=-2)plotshape(Signal_Test, style=shape.flag, location=location.belowbar, color=color.yellow, offset=0)plotshape(Signal_Test_OUT_TEMP, style=shape.flag, location=location.abovebar, color=color.white, offset=0)//----------------------------------------------------------------------------------------------------------// ||--- Buy And Sell:strategy.entry(id="Long", long=true, when = Signal_Test and afterStartDate)strategy.close_all(when = Signal_Test_OUT_TEMP and afterStartDate)//----------------------------------------------------------------------------------------------------------