Zeal Terminal Open in Zeal Terminal

Pine Script v5 · Strategy

TradingGroundhog - Strategy & Wavetrend V2

A Pine Script v5 strategy built on WMA (_data, w1), Highest (high, 2) and Lowest (low, 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. 15 settings; defaults include Start Date 13, Start Month 1 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 & Wavetrend V2 repaint?
No
No repainting patterns were found in the source. The live replay was not measured: it had no trades to compare.
How did TradingGroundhog - Strategy & Wavetrend V2 do on BTCUSDT 1D with default settings?
−0.00%
From 26 Jan 2024 to 21 Oct 2026, over 2 closed trades, against +102.5% for buy and hold. A backtest, not investment advice.
Does TradingGroundhog - Strategy & Wavetrend V2 run in Pine Script v6?
No
The v6 version does not run in Zeal Terminal's engine: Pine Script v6 Error at @L14:C97: the argument 'overlay' is specified more than once. The v6 version is shown for reference and is not offered as a download.
Does TradingGroundhog - Strategy & Wavetrend V2 use a stop loss?
No
Every exit waits for a signal; nothing limits a losing trade before it fires.
Does TradingGroundhog - Strategy & Wavetrend V2 run in Zeal Terminal?
Yes
It compiles in 95 ms and runs 1,000 bars in 8,669 ms, in the browser.

BTCUSDT · 1D · default settings

  • Plot
  • Plot
  • Plot
  • Plot
  • Plot
  • Plot
  • Plot
  • Plot
  • Plot
  • Plot
  • 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 (15)
40,00060,00080,000100,000120,000AprJulOct2025AprJulOct2026AprJulOctPlot$999,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. 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.
Net profit
−0.00%
−$30.24
Buy and hold
+102.5%
same period
Closed trades
2
0 won · 2 lost
Profitable
0.0%
of closed trades
Profit factor
0.00
gross profit ÷ gross loss
Max drawdown
0.02%
−$228.74

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

    3 settings do nothing

    “length top bottom drawn”, “Show Zig Zag”, “Show Swings HL” 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 showZigZag (line 151), showchannel (line 152), ShowSwingsHL (line 171) 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
Start Date13intafterStartDate
Start Month1intafterStartDate
Start Year2021intafterStartDate
Long Stop Loss (%)0.01floatline 232
Sourceopensourcelimit_to_pass limit_to_pass_down LL line 133
Combined Smoothness9intLL uptrend bottom_1 bottom_2 bottom_3 bottom_4 bottom_5 top_1 top_2 top_3 top_4 top_5 c_top_1 c_top_2 c_top_3 c_top_4 c_top_5 c_bottom_1 c_bottom_2 c_bottom_3 c_bottom_4 c_bottom_5 go_above go_down
VolumeMA2intvam
Show Zig Zag (no label in the script)falseboolunused
Showchannel (no label in the script)falseboolplot
filter Bill Williams Fractals:falseboolbillwtopfractal billwbotfractal ftop fbot
Filter fractals using extreme method:falseboolfilteredtopf filteredbotf
Extreme Window:2inttopf botf
Show Swings HL (no label in the script)trueboolunused
Sell Directive Inputs USER
limit_candle to look on4000intLL uptrend bottom_1 bottom_2 bottom_3 bottom_4 bottom_5 top_1 top_2 top_3 top_4 top_5 c_top_1 c_top_2 c_top_3 c_top_4 c_top_5 c_bottom_1 c_bottom_2 c_bottom_3 c_bottom_4 c_bottom_5 go_above go_down line 84 line 98 line 192 line 203
length top bottom drawn1intunused

What it calculates

  • WMA_data, w1L1 · line 29
  • WMAL1, w2L2 · line 30
  • WMAL2, w3L3 · line 31
  • Highesthigh, Extreme Window: (2)topf · line 165
  • Lowestlow, Extreme Window: (2)botf · line 166
  • Valuewhenfilteredtopf == true, high[2], 2highswings · line 172
  • Valuewhenfilteredbotf == true, low[2], 2lowswings · line 173
  • Barssinceistoptopcount · line 178
  • Barssinceisbotbotcount · line 179
  • SMAvolume, VolumeMA (2)vam · line 182

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.

The script has 69 named inputs, calculations, conditions and outputs, too many to draw legibly here; the tables above list them.

Order rules

OrderFires whenBy defaultLine
Open SL longSignal_Test and afterStartDateOn284
Close Signal_Test_OUT_TEMP and afterStartDateOn286

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 data3 request.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−0.0%+102.5%20%0.000.0%26 Jan 2024 – 21 Oct 2026
BTCUSDT 4h+0.1%+5.5%667%3.520.0%8 May 2026 – 21 Oct 2026
ETHUSDT 1D+0.0%+9.8%520%1.300.1%26 Jan 2024 – 21 Oct 2026
ETHUSDT 4h+0.0%+8.4%367%43.490.0%8 May 2026 – 21 Oct 2026
SOLUSDT 1D−0.2%+16.7%450%0.280.2%26 Jan 2024 – 21 Oct 2026
SOLUSDT 4h+0.1%+21.5%580%51.360.1%8 May 2026 – 21 Oct 2026
BNBUSDT 1D+0.0%+148.3%1100%—0.0%26 Jan 2024 – 21 Oct 2026
BNBUSDT 4h+0.1%+17.1%5100%—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 market0—$0.00
Sideways market20%−$30.24
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 2 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 2 trades
SideEntryExitBarsP&L
long21 Mar 2025 84,223.4022 Mar 2025 84,088.801−$15.98
long4 Sep 2025 111,706.0010 Sep 2025 111,546.006−$14.26

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
TradingGroundhog - Strategy & Wavetrend V2 this page—v5 strategy−0.0%20.0%
TradingGroundhog - Strategy & Fractal V1 by UnknownUnicorn27666852highest lowest valuewhen barssince smav4 strategy−2.9%85.9%
Coral Trend Pullback Strategy (TradeIQ) by kevinmck100sma wma lowest highest barssincev5 strategy−1.0%11.0%
Stochastic RSI + WMA + SMA strat by tweakerIDsma wma lowest highest valuewhenv4 strategy−11.9%437.9%
Trend Bounce [racer8] by racer8highest lowest sma valuewhenv4 strategy+2.4%2232.2%
Swing Multi Moving Averages Crypto and Stocks Strategy by exlux99wma highest lowest smav5 strategy+60.2%2213.1%

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.

  • 15 settings use the untyped input() (line 8, 9, 10, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 171). It still compiles in v6; input.int, input.float or input.source state the type.
  • No v6-only features. v6 is not needed to run this script.

Clean v5

VerifiedDownload the v5 script

Same 2 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 145: input() → input.int()
  • Line 146: input() → input.int()
  • Line 147: input() → input.float()
9 more edits
  • Line 148: input() → input.source()
  • Line 149: input() → input.int()
  • Line 150: input() → input.int()
  • Line 151: input() → input.bool()
  • Line 152: input() → input.bool()
  • Line 153: input() → input.bool()
  • Line 154: input() → input.bool()
  • Line 155: input() → input.int()
  • Line 171: input() → input.bool()
⋯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=1)+startMonth = input.int(title="Start Month",defval=1)-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))⋯//per_cent_space_down       = input(title = "per_cent_space_down",   defval = 0.0, group="Sell Directive Inputs USER")-limit_candle       = input(title = "limit_candle to look on",      defval = 4000, group="Sell Directive Inputs USER")+limit_candle       = input.int(title = "limit_candle to look on",      defval = 4000, group="Sell Directive Inputs USER")-draw_step       = input(title = "length top bottom drawn",      defval = 1, group="Sell Directive Inputs USER")+draw_step       = input.int(title = "length top bottom drawn",      defval = 1, group="Sell Directive Inputs USER")-longLossPerc = input(title="Long Stop Loss (%)", defval=0.01) * 0.01+longLossPerc = input.float(title="Long Stop Loss (%)", defval=0.01) * 0.01-price       = input(title = "Source",                  defval = open)+price       = input.source(title = "Source",                  defval = open)-alpha       = input(title = "Combined Smoothness", defval = 9)+alpha       = input.int(title = "Combined Smoothness", defval = 9)-vamp = input(title="VolumeMA",  defval=2)+vamp = input.int(title="VolumeMA",  defval=2)-showZigZag = input(false)+showZigZag = input.bool(false)-showchannel = input(false)+showchannel = input.bool(false)-filterBW = input(false, title="filter Bill Williams Fractals:")+filterBW = input.bool(false, title="filter Bill Williams Fractals:")-filterFractals = input(false, title="Filter fractals using extreme method:")+filterFractals = input.bool(false, title="Filter fractals using extreme method:")-length = input(2, title="Extreme Window:")+length = input.int(2, title="Extreme Window:")//---------------------------------------------------------------------------------------------------------⋯//  ||---   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)⋯

Does it run in Pine Script v6?

No

The v6 version does not run in Zeal Terminal's engine: Pine Script v6 Error at @L14:C97: the argument 'overlay' is specified more than once. The v6 version is shown for reference and is not offered as a download. 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/⋯

Where it runs

EngineCompilesRunsMatches TradingView
Zeal Terminal · OpenPineScript v2Yes 95 msWith a workaround 1,000 bars in 8,669 msNot measured
PineTSNot testedNot testedNot measured

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.

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 = 5// 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=1)startYear = input(title="Start Year",defval=2021)afterStartDate = (time >= timestamp(syminfo.timezone,startYear, startMonth, startDate, 0, 0))//====================================// ======================== STRATEGY ============================ strategy(title="TradingGroundhog - Strategy & Wavetrend V1", overlay=true, max_bars_back = 4000, overlay = false, 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)//====================================////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////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)// ======================== FUNCTIONS ============================ f_LazyLine(_data, _length) =>    w1 = 0, w2 = 0, w3 = 0    L1 = 0.0, L2 = 0.0, L3 = 0.0    w = _length / 3        if _length > 2         w2 := math.round(w)        w1 := math.round((_length-w2)/2)        w3 :=   int((_length-w2)/2)                L1 := ta.wma(_data, w1)        L2 := ta.wma(L1, w2)        L3 := ta.wma(L2, w3)    else        L3 := _data    L3//====================================choice_transp(top_val) =>    bool c_val = false    if top_val == 0.0        c_val := false    else        c_val := true    c_val//====================================f_Top_Bottom_Lazy(alpha, limit_candle) =>    price = request.security(syminfo.tickerid, "D",open)    low_day = request.security(syminfo.tickerid, "D",low)    LL = f_LazyLine(price, alpha)    uptrend     = LL > LL[1]    bool reverse = false    float reversed_price = 0.0    float reversed_price_low = 0.0    float limit_to_pass = 0.0    float limit_to_pass_down = 0.0    prices_top = array.new_float(0)    prices_start = array.new_float(0)    prices_bottom = array.new_float(0)    prices_top_v = array.new_float(0)    if uptrend[1] and not uptrend        reversed_price := LL[1] // Max de close sur period donne en wavetrend    else        reversed_price :=0.0            if uptrend and not uptrend[1]        reversed_price_low := LL[1]    else        reversed_price_low :=1000000    /// SHOW Actual OPEN    limit_to_pass := price    limit_to_pass_down := price    ///    float bottom_1 = 0.0    float bottom_2 = 0.0    float bottom_3 = 0.0    float bottom_4 = 0.0    float bottom_5 = 0.0    int bottom_count = 0    float top_1 = 10000000.0    float top_2 = 10000000.0    float top_3 = 10000000.0    float top_4 = 10000000.0    float top_5 = 10000000.0    int top_count = 0    /// SHOW PAST TOP BOTTOM    for i = 0 to limit_candle        if reversed_price[i] > limit_to_pass //and ((reversed_price[i]-limit_to_pass)/reversed_price[i])*100 > per_cent_space_up            limit_to_pass := reversed_price[i]            if top_count == 0                top_1 := limit_to_pass            if top_count == 1                top_2 := limit_to_pass            if top_count == 2                top_3 := limit_to_pass            if top_count == 3                top_4 := limit_to_pass            if top_count == 4                top_5 := limit_to_pass            top_count := top_count +1    for i = 0 to limit_candle        if reversed_price_low[i] < limit_to_pass_down //and ((limit_to_pass_down-reversed_price_low[i])/limit_to_pass_down)*100 > per_cent_space_down and array.size(prices_bottom) < 2            limit_to_pass_down := reversed_price_low[i]            if bottom_count == 0                bottom_1 := limit_to_pass_down            if bottom_count == 1                bottom_2 := limit_to_pass_down            if bottom_count == 2                bottom_3 := limit_to_pass_down            if bottom_count == 3                bottom_4 := limit_to_pass_down            if bottom_count == 4                bottom_5 := limit_to_pass_down            bottom_count := bottom_count +1    bool c_top_1    = false    bool c_top_2    = false    bool c_top_3    = false    bool c_top_4    = false    bool c_top_5    = false    bool c_bottom_1 = false    bool c_bottom_2 = false    bool c_bottom_3 = false    bool c_bottom_4 = false    bool c_bottom_5 = false    c_top_1    := choice_transp(top_1)    c_top_2    := choice_transp(top_2)    c_top_3    := choice_transp(top_3)    c_top_4    := choice_transp(top_3)    c_top_5    := choice_transp(top_3)    c_bottom_1 := choice_transp(bottom_1)    c_bottom_2 := choice_transp(bottom_2)    c_bottom_3 := choice_transp(bottom_3)    c_bottom_4 := choice_transp(bottom_3)    c_bottom_5 := choice_transp(bottom_3)    bool go_above = false    if price > top_1[2] and price[2] < top_1[2] and not go_above[1] and not go_above[2]        go_above := true    var go_down = false    if low_day[1] < bottom_1[1]        go_down := true    if go_down and uptrend and not uptrend[1]        go_down :=  false    [top_1, top_2, top_3, top_4, top_5, bottom_1, bottom_2, bottom_3, bottom_4, bottom_5, go_above, go_down, LL, uptrend, c_top_1, c_top_2, c_top_3, c_top_4, c_top_5, c_bottom_1, c_bottom_2, c_bottom_3, c_bottom_4, c_bottom_5] //---------------------------------------------------------------------------------------------------------// ======================== USER INPUT ============================//per_cent_space_up       = input(title = "per_cent_space_up",     defval = 0.0, group="Sell Directive Inputs USER")//per_cent_space_down       = input(title = "per_cent_space_down",   defval = 0.0, group="Sell Directive Inputs USER")limit_candle       = input(title = "limit_candle to look on",      defval = 4000, group="Sell Directive Inputs USER")draw_step       = input(title = "length top bottom drawn",      defval = 1, group="Sell Directive Inputs USER")longLossPerc = input(title="Long Stop Loss (%)", defval=0.01) * 0.01price       = input(title = "Source",                  defval = open)alpha       = input(title = "Combined Smoothness", defval = 9)vamp = input(title="VolumeMA",  defval=2)showZigZag = input(false)showchannel = input(false)filterBW = input(false, title="filter Bill Williams Fractals:")filterFractals = input(false, title="Filter fractals using extreme method:")length = input(2, title="Extreme Window:")//---------------------------------------------------------------------------------------------------------// ======================== EXECUTION AND SORTING ============================//  ||---   Fractal Recognition: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] >= ta.highest(high, length) ? true : false : falsebotf = fbot ? low[2] <= ta.lowest(low, length) ? true : false : falsefilteredtopf = filterFractals ? topf : ftopfilteredbotf = filterFractals ? botf : fbot//---------------------------------------------------------------------------------------------------------//  ||---   Added Swing High/Low OptionShowSwingsHL = input(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)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)//---------------------------------------------------------------------------------------------------------//  ||---   ZigZag:istop = filteredtopf ? true : falseisbot = filteredbotf ? true : falsetopcount = ta.barssince(istop)botcount = ta.barssince(isbot)//---------------------------------------------------------------------------------------------------------//  ||---   Fractals Up Down:vam = ta.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]//---------------------------------------------------------------------------------------------------------//  ||---   Fractals Pattern and Signal recognition:fractaldown_save = array.new_float(0)for i = 0 to limit_candle    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 limit_candle    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)//---------------------------------------------------------------------------------------------------------//  ||---   Top/Bottom Fractals: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)bool Signal_Test = falsebool Signal_Test_OUT_TEMP = falsevar Signal_Test_TEMP = false//---------------------------------------------------------------------------------------------------------//  ||---   Wavetrend Top/Bottom:[top_1, top_2, top_3, top_4, top_5, bottom_1, bottom_2, bottom_3, bottom_4, bottom_5, go_above, go_down, LL, uptrend, c_top_1, c_top_2, c_top_3, c_top_4, c_top_5, c_bottom_1, c_bottom_2, c_bottom_3, c_bottom_4, c_bottom_5]  = request.security(syminfo.tickerid, "D",f_Top_Bottom_Lazy(alpha, limit_candle))//---------------------------------------------------------------------------------------------------------//  ||---   NoBuy Signal:Kill_signal =   go_above or go_down//---------------------------------------------------------------------------------------------------------//  ||---   IF Statement for Buy and Sell:if filteredbotf and open < Bottom_1 and (Bottom_1 - open) / Bottom_1 >= longLossPerc and not Kill_signal    Signal_Test := trueif filteredtopf and open > Top_1 and not Kill_signal    Signal_Test_TEMP := trueif filteredtopf and Signal_Test_TEMP or Kill_signal and not Kill_signal[1]    Signal_Test_TEMP := false    Signal_Test_OUT_TEMP := true//---------------------------------------------------------------------------------------------------------// ======================== PLOTTING ============================// Plot Wavetrendc_up        = color.new(#33ff00, 0)c_dn        = color.new(#ff1111, 0)//plot(LL, "SS_WMA Line",  color = uptrend ? c_up : c_dn,  linewidth=3)//---------------------------------------------------------------------------------------------------------// Plot Topsplot(top_1, style=plot.style_circles, linewidth= 1 ,color=  color.rgb(102, 204, 255, c_top_1 ? 0 : 100))plot(top_2, style=plot.style_circles, linewidth= 1 ,color=  color.rgb(51, 153, 255, c_top_2 ? 0 : 100))plot(top_3, style=plot.style_circles, linewidth= 1 ,color=  color.rgb(0, 102, 255, c_top_3 ? 0 : 100))plot(top_4, style=plot.style_circles, linewidth= 1 ,color=  color.rgb(0, 0, 255, c_top_4 ? 0 : 100))plot(top_5, style=plot.style_circles, linewidth= 1 ,color=  color.rgb(0, 0, 204, c_top_5 ? 0 : 100))//---------------------------------------------------------------------------------------------------------// Plot Bottomsplot(bottom_1, style=plot.style_circles, linewidth= 1 ,color=  color.rgb(255, 204, 153, c_bottom_1 ? 0 : 100))plot(bottom_2, style=plot.style_circles, linewidth= 1 ,color=  color.rgb(255, 153, 102, c_bottom_2 ? 0 :100))plot(bottom_3, style=plot.style_circles, linewidth= 1 ,color=  color.rgb(255, 102, 0, c_bottom_3 ? 0 : 100))plot(bottom_4, style=plot.style_circles, linewidth= 1 ,color=  color.rgb(255, 0, 0, c_bottom_4 ? 0 : 100))plot(bottom_5, style=plot.style_circles, linewidth= 1 ,color=  color.rgb(128, 0, 0, c_bottom_5 ? 0 : 100))//---------------------------------------------------------------------------------------------------------// Plot NoBuy Patternsplotshape(go_above, style=shape.diamond, location=location.abovebar, color=color.red, offset=0)plotshape(go_down, style=shape.square, location=location.belowbar, color=color.red , offset=0)//---------------------------------------------------------------------------------------------------------// Plot BUY Signalplotshape(Signal_Test, style=shape.flag, location=location.belowbar, color=color.yellow, offset=0)//---------------------------------------------------------------------------------------------------------// Plot SELL Signalplotshape(Signal_Test_OUT_TEMP, style=shape.flag, location=location.abovebar, color=color.white, offset=0)//---------------------------------------------------------------------------------------------------------// Show NO-BUY Period presenting NoBuy Patternscl_Kill_signal = Kill_signal ? color.rgb(128, 0, 0,85) : nabgcolor(cl_Kill_signal)//---------------------------------------------------------------------------------------------------------//  ||---   Plot Lines based on the fractals.plot(showchannel ? (filteredtopf ? high[2] : na) : na, color=color.black, offset=0)plot(showchannel ? (filteredbotf ? low[2] : na) : na, color=color.black, offset=0)//---------------------------------------------------------------------------------------------------------//  ||---   HLswings channel: unable to offset valuesplot(showchannel ? (highswings ? high[2] : na) : na, color=color.black, offset=-2)plot(showchannel ? (lowswings ? low[2] : na) : na, color=color.black, offset=-2)//----------------------------------------------------------------------------------------------------------// Strategy Buy and Sellif Signal_Test and afterStartDate    strategy.entry("SL", strategy.long)if Signal_Test_OUT_TEMP and afterStartDate    strategy.close_all()//---------------------------------------------------------------------------------------------------------