Zeal Terminal Open in Zeal Terminal

Pine Script v4 · Strategy

Crypto Squeeze Strategy

A Pine Script v4 strategy built on Linreg or Highest or Lowest or SMA (20) and Change (hlc3). It has 6 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 commits 100% of equity and pays no commission. 12 settings; defaults include Stoploss % 50, Take Profit % 50 and Stoploss % 50.

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 Crypto Squeeze Strategy 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 Crypto Squeeze Strategy do on BTCUSDT 1D with default settings?
−43.85%
From 26 Jan 2024 to 21 Oct 2026, over 15 closed trades, against +102.5% for buy and hold. A backtest, not investment advice.
Can Crypto Squeeze 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 Crypto Squeeze Strategy use a stop loss?
Yes
strategy.exit sets a stop on line 56, 61.
Does Crypto Squeeze Strategy run in Zeal Terminal?
Yes
It compiles in 23 ms and runs 1,000 bars in 80 ms, in the browser.

BTCUSDT · 1D · default settings

  • Linreg
  • Change
  • Change
  • 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 (12)
0.0050,000100,000AprJulOct2025AprJulOct2026AprJulOct$55,160$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. The script plots nothing itself; the lines and the lower pane are its own calculations, drawn for reference. 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 55, 60) so the engine trades the way the script says.
Net profit
−43.85%
−$43,846.60
Buy and hold
+102.5%
same period
Closed trades
15
3 won · 12 lost
Profitable
20.0%
of closed trades
Profit factor
0.68
gross profit ÷ gross loss
Max drawdown
63.98%
−$92,332.40

One run with the author's default settings, $100,000 starting capital, commission as the script sets it. A long position was still open at the last bar. A single backtest says little about future results and is not a recommendation. Backtests are simulations on historical data and are not investment advice.

Review

What a careful reader of this script would point out, found by checking the source and the backtest.

  • Check

    No commission

    The backtest assumes free trading. Results on any real exchange will be lower.

  • Check

    Every trade uses all the equity

    default_qty_value is 100% of equity.

  • Note

    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 55, 57, 60, 62. 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 linreg → ta.linreg, avg → math.avg, highest → ta.highest, lowest → ta.lowest, sma → ta.sma, sum → math.sum, change → ta.change, crossover → ta.crossover, crossunder → ta.crossunder.
  • 4 strategy calls use the when = argument (line 55, 57, 60, 62). It is deprecated in v5 and removed in v6, where each call moves inside an if block.

v4 → v5

Verified

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

  • Line 1: //@version=4 → //@version=5
  • Line 8: input(type = input.float) → input.float()
  • Line 10: input(type = input.float) → input.float()
  • Line 14: input(type = input.float) → input.float()
  • Line 16: input(type = input.float) → input.float()
  • Line 28: input(type = input.integer) → input.int()
19 more edits
  • Line 29: input(type = input.integer) → input.int()
  • Line 30: input(type = input.integer) → input.int()
  • Line 31: input(type = input.integer) → input.int()
  • Line 32: input(type = input.integer) → input.int()
  • Line 33: input(type = input.integer) → input.int()
  • Line 37: linreg → ta.linreg
  • Line 37: avg → math.avg
  • Line 37: avg → math.avg
  • Line 37: highest → ta.highest
  • Line 37: lowest → ta.lowest
  • Line 37: sma → ta.sma
  • Line 39: sum → math.sum
  • Line 39: change → ta.change
  • Line 40: sum → math.sum
  • Line 40: change → ta.change
  • Line 51: crossover → ta.crossover
  • Line 52: crossunder → ta.crossunder
  • Line 55: strategy.entry(…, true) → strategy.entry(…, strategy.long)
  • Line 60: strategy.entry(…, false) → strategy.entry(…, strategy.short)
-// @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/⋯enable_long_strategy = input(true, title="Enable Long Strategy", group="SL/TP For Long Strategy",inline="1")-long_stoploss_value = input(defval=50, title='Stoploss %', type=input.float, minval=0.1, group="SL/TP For Long Strategy",inline="2")+long_stoploss_value = input.float(defval=50, title='Stoploss %', minval=0.1, group="SL/TP For Long Strategy",inline="2")long_stoploss_percentage = (close * (long_stoploss_value / 100)) / syminfo.mintick-long_takeprofit_value = input(defval=50, title='Take Profit %', type=input.float, minval=0.1, group="SL/TP For Long Strategy",inline="2")+long_takeprofit_value = input.float(defval=50, title='Take Profit %', minval=0.1, group="SL/TP For Long Strategy",inline="2")long_takeprofit_percentage = (close * (long_takeprofit_value / 100)) / syminfo.mintick⋯enable_short_strategy = input(true, title="Enable Short Strategy", group="SL/TP For Short Strategy",inline="3")-short_stoploss_value = input(defval=50, title='Stoploss %', type=input.float, minval=0.1, group= "SL/TP For Short Strategy",inline="4")+short_stoploss_value = input.float(defval=50, title='Stoploss %', minval=0.1, group= "SL/TP For Short Strategy",inline="4")short_stoploss_percentage = (close * (short_stoploss_value / 100)) / syminfo.mintick-short_takeprofit_value = input(defval=50, title='Take Profit %', type=input.float, minval=0.1, group="SL/TP For Short Strategy",inline="4")+short_takeprofit_value = input.float(defval=50, title='Take Profit %', minval=0.1, group="SL/TP For Short Strategy",inline="4")short_takeprofit_percentage = (close * (short_takeprofit_value / 100)) / syminfo.mintick⋯// Date Range-start_date = input(title="Start Date", type=input.integer, defval=1, minval=1, maxval=31, group="Date Range")+start_date = input.int(title="Start Date", defval=1, minval=1, maxval=31, group="Date Range")-start_month = input(title="Start Month", type=input.integer, defval=1, minval=1, maxval=12, group="Date Range")+start_month = input.int(title="Start Month", defval=1, minval=1, maxval=12, group="Date Range")-start_year = input(title="Start Year", type=input.integer, defval=1804, minval=1800, maxval=3000, group="Date Range")+start_year = input.int(title="Start Year", defval=1804, minval=1800, maxval=3000, group="Date Range")-end_date = input(title="End Date", type=input.integer, defval=1, minval=1, maxval=3, group="Date Range")+end_date = input.int(title="End Date", defval=1, minval=1, maxval=3, group="Date Range")-end_month = input(title="End Month", type=input.integer, defval=1, minval=1, maxval=12, group="Date Range")+end_month = input.int(title="End Month", defval=1, minval=1, maxval=12, group="Date Range")-end_year = input(title="End Year", type=input.integer, defval=2077, minval=1800, maxval=3000, group="Date Range")+end_year = input.int(title="End Year", defval=2077, minval=1800, maxval=3000, group="Date Range")in_date_range = (time >= timestamp(syminfo.timezone, start_year, start_month, start_date, 0, 0)) and (time < timestamp(syminfo.timezone, end_year, end_month, end_date, 0, 0))⋯// Lazy Bear's Momentum Indicator-BlueWave = linreg(close - avg(avg(highest(high, 20), lowest(low, 20)), sma(close, 20)), 20, 0)+BlueWave = ta.linreg(close - math.avg(math.avg(ta.highest(high, 20), ta.lowest(low, 20)), ta.sma(close, 20)), 20, 0)// Replicated version of Crypto Face's MFI Indicator-mfiUpper = sum(volume * (change(hlc3) <= 0 ? 0 : hlc3), 58)+mfiUpper = math.sum(volume * (ta.change(hlc3) <= 0 ? 0 : hlc3), 58)-mfiLower = sum(volume * (change(hlc3) >= 0 ? 0 : hlc3), 58)+mfiLower = math.sum(volume * (ta.change(hlc3) >= 0 ? 0 : hlc3), 58)_mfiRsi(mfiUpper, mfiLower) =>⋯// Creating Long and Short Strategy-buy_signal = crossover(BlueWave, 0) and mfi > 0 +buy_signal = ta.crossover(BlueWave, 0) and mfi > 0 -sell_signal = crossunder(BlueWave, 0) and mfi < 0 +sell_signal = ta.crossunder(BlueWave, 0) and mfi < 0 // Long Strategyif buy_signal and in_date_range and enable_long_strategy == true-    strategy.entry("Long", true, when=buy_signal, alert_message="Open Long Position")+    strategy.entry("Long", strategy.long, when=buy_signal, alert_message="Open Long Position")    strategy.exit("Long  SL/TP", from_entry="Long", loss=long_stoploss_percentage, profit=long_takeprofit_percentage, alert_message="Your Long SL/TP Limit As Been Triggered.")⋯if sell_signal and in_date_range and enable_short_strategy == true-    strategy.entry("Short", false, when = sell_signal, alert_message="Open Short Position")+    strategy.entry("Short", strategy.short, when = sell_signal, alert_message="Open Short Position")    strategy.exit("Short SL/TP", from_entry="Short", loss=short_stoploss_percentage, profit=short_takeprofit_percentage, alert_message="Your Short SL/TP Limit As Been Triggered.")⋯

Clean v5

VerifiedDownload the v5 script

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

  • Line 7: input() → input.bool()
  • Line 13: input() → input.bool()
  • Line 55: when = buy_signal → if block
  • Line 57: when = sell_signal → if block
  • Line 60: when = sell_signal → if block
  • Line 62: when = buy_signal → if block
⋯// Enable Long Strategy-enable_long_strategy = input(true, title="Enable Long Strategy", group="SL/TP For Long Strategy",inline="1")+enable_long_strategy = input.bool(true, title="Enable Long Strategy", group="SL/TP For Long Strategy",inline="1")long_stoploss_value = input.float(defval=50, title='Stoploss %', minval=0.1, group="SL/TP For Long Strategy",inline="2")⋯// Enable Short Strategy-enable_short_strategy = input(true, title="Enable Short Strategy", group="SL/TP For Short Strategy",inline="3")+enable_short_strategy = input.bool(true, title="Enable Short Strategy", group="SL/TP For Short Strategy",inline="3")short_stoploss_value = input.float(defval=50, title='Stoploss %', minval=0.1, group= "SL/TP For Short Strategy",inline="4")⋯if buy_signal and in_date_range and enable_long_strategy == true-    strategy.entry("Long", strategy.long, when=buy_signal, alert_message="Open Long Position")+    if buy_signal+        strategy.entry("Long", strategy.long, alert_message="Open Long Position")    strategy.exit("Long  SL/TP", from_entry="Long", loss=long_stoploss_percentage, profit=long_takeprofit_percentage, alert_message="Your Long SL/TP Limit As Been Triggered.")-    strategy.close("Long", when=sell_signal, alert_message="Close Long Position")+    if sell_signal+        strategy.close("Long", alert_message="Close Long Position")// Short Strategyif sell_signal and in_date_range and enable_short_strategy == true-    strategy.entry("Short", strategy.short, when = sell_signal, alert_message="Open Short Position")+    if sell_signal+        strategy.entry("Short", strategy.short, alert_message="Open Short Position")    strategy.exit("Short SL/TP", from_entry="Short", loss=short_stoploss_percentage, profit=short_takeprofit_percentage, alert_message="Your Short SL/TP Limit As Been Triggered.")-    strategy.close("Short", when=buy_signal, alert_message="Close Short Position")+    if buy_signal+        strategy.close("Short", alert_message="Close Short Position")

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: 15 before, 10 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.

-// @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.

SettingDefaultType and rangeFeeds
SL/TP For Long Strategy
Enable Long Strategytrueboolentry Long exit Long SL/TP close Long Long SL Level Long TP Level Short SL Level Short TP Level line 54
Stoploss %50float · min 0.1long_stoploss_percentage long_stoploss_price
Take Profit %50float · min 0.1long_takeprofit_percentage long_takeprofit_price
SL/TP For Short Strategy
Enable Short Strategytrueboolentry Short exit Short SL/TP close Short Long SL Level Long TP Level Short SL Level Short TP Level line 59
Stoploss %50float · min 0.1short_stoploss_percentage short_stoploss_price
Take Profit %50float · min 0.1short_takeprofit_percentage short_takeprofit_price
Date Range
Start Date1int (written input.integer) · min 1 · max 31in_date_range
Start Month1int (written input.integer) · min 1 · max 12in_date_range
Start Year1804int (written input.integer) · min 1800 · max 3000in_date_range
End Date1int (written input.integer) · min 1 · max 3in_date_range
End Month1int (written input.integer) · min 1 · max 12in_date_range
End Year2077int (written input.integer) · min 1800 · max 3000in_date_range

What it calculates

  • Linreg / Highest / Lowest / SMA (linreg, ta.linreg in v5)close - avg(avg(highest(high, 20), lowest(low, 20)), sma(close, 20)), 20, 0BlueWave · line 37
  • Change (change, ta.change in v5)hlc3mfiUpper · line 39
  • Change (change, ta.change in v5)hlc3mfiLower · line 40

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.

lowlowprice datahighhighprice dataclosecloseprice datahlc3hlc3price datavolumevolumeprice datalong_stoploss_valueStoploss %setting · 50long_takeprofit_valueTake Profit %setting · 50short_stoploss_valueStoploss %setting · 50short_takeprofit_valueTake Profit %setting · 50timetimeprice datastart_yearStart Yearsetting · 1804start_monthStart Monthsetting · 1start_dateStart Datesetting · 1end_yearEnd Yearsetting · 2077end_monthEnd Monthsetting · 1end_dateEnd Datesetting · 1BlueWaveLinreg / Highest / Lowe…→ BlueWavemfiUpperChange→ mfiUppermfiLowerChange→ mfiLowerlong_stoploss_percentagelong_stoploss_percentagevaluelong_takeprofit_percentagelong_takeprofit_percent…valueshort_stoploss_percentageshort_stoploss_percenta…valueshort_takeprofit_percentageshort_takeprofit_percen…valuelong_stoploss_pricelong_stoploss_pricevaluelong_takeprofit_pricelong_takeprofit_pricevalueshort_stoploss_priceshort_stoploss_pricevalueshort_takeprofit_priceshort_takeprofit_pricevaluemfmfvaluemfimfivaluein_date_rangein_date_rangeconditionbuy_signalbuy_signalconditionsell_signalsell_signalconditionentry:LongOpen Longstrategy.entryexit:Long SL/TPexit Long SL/TPstrategy.exitclose:LongClose Longstrategy.closeentry:ShortOpen Shortstrategy.entryexit:Short SL/TPexit Short SL/TPstrategy.exitclose:ShortClose Shortstrategy.closeplot:23Long SL Levelplotplot:24Long TP Levelplotplot:25Short SL Levelplotplot:26Short TP Levelplot

Order rules

OrderFires whenBy defaultLine
Open Long longbuy_signalcrossover(BlueWave, 0) and mfi > 0On55
Exit Long SL/TP stop and limitbuy_signal and in_date_range and enable_long_strategy == trueOn56
Close Longsell_signalcrossunder(BlueWave, 0) and mfi < 0On57
Open Short shortsell_signalcrossunder(BlueWave, 0) and mfi < 0On60
Exit Short SL/TP stop and limitsell_signal and in_date_range and enable_short_strategy == trueOn61
Close Shortbuy_signalcrossover(BlueWave, 0) and mfi > 0On62

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.

2/2trades identical when replayed liveThe last 300 bars, from 26 Dec 2025, were fed to the engine as live ticks, four per bar, and compared with the historical run. Orders are decided once per closed bar, so nothing can change mid-bar.
  • ClearHigher-timeframe dataThe script requests no other symbol or timeframe.
  • ClearFuture-bar referencesNo negative history offsets such as close[-1].
  • ClearIntrabar recalculationNo varip, calc_on_every_tick or realtime-only state. Orders are decided once per closed bar.
  • ClearOrder timingOrders fill at the next bar's open, after the signal bar has closed.

The checks read the source; the replay runs it. Together they catch the common causes, not every possible one.

Other markets

The same script with default settings on 8 Binance markets. Each row is a separate backtest over the most recent 1,000 bars.

MarketNetBuy and holdTradesWonProfit factorMax drawdownPeriod
BTCUSDT 1D−43.8%+102.5%1520%0.6864.0%26 Jan 2024 – 21 Oct 2026
BTCUSDT 4h−20.7%+5.5%1030%0.5139.9%8 May 2026 – 21 Oct 2026
ETHUSDT 1D−12.1%+9.8%1233%0.9152.0%26 Jan 2024 – 21 Oct 2026
ETHUSDT 4h−25.6%+8.4%838%0.4841.1%8 May 2026 – 21 Oct 2026
SOLUSDT 1D+50.7%+16.7%1450%1.2760.2%26 Jan 2024 – 21 Oct 2026
SOLUSDT 4h+58.5%+21.5%1060%3.9912.5%8 May 2026 – 21 Oct 2026
BNBUSDT 1D+47.6%+148.3%933%2.1348.6%26 Jan 2024 – 21 Oct 2026
BNBUSDT 4h−15.0%+17.1%1118%0.5523.9%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 market520%−$14,658.30
Sideways market922%−$9,872.29
Falling market10%−$19,316.00

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

How bad could the drawdown be?

72.2%

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

0%83%
All 15 trades
SideEntryExitBarsP&L
long2 Apr 2024 69,649.8012 Jun 2024 67,314.2071−$3,353.32
short12 Jun 2024 67,314.2017 Oct 2024 67,620.00127−$439.01
long17 Oct 2024 67,620.005 Dec 2024 101,430.0049$48,103.80
long13 Dec 2024 100,004.005 Feb 2025 97,763.1054−$3,234.10
short5 Feb 2025 97,763.1016 Jun 2025 105,594.00131−$11,300.40
long16 Jun 2025 105,594.001 Aug 2025 115,764.0046$12,499.20
short1 Aug 2025 115,764.0014 Aug 2025 123,306.0013−$9,269.71
long14 Aug 2025 123,306.0022 Aug 2025 112,500.008−$11,656.50
short22 Aug 2025 112,500.004 Oct 2025 122,232.0043−$10,497.80
long4 Oct 2025 122,232.0017 Oct 2025 108,194.0013−$12,731.00
short17 Oct 2025 108,194.003 Nov 2025 110,541.0017−$2,127.96
long3 Nov 2025 110,541.005 Nov 2025 101,497.002−$7,853.31
short5 Nov 2025 101,497.0028 Mar 2026 66,407.30143$30,472.00
long10 Apr 2026 71,788.0027 Jun 2026 60,097.3078−$19,316.00
short27 Jun 2026 60,097.3023 Sep 2026 86,208.6088−$43,142.40

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
Crypto Squeeze Strategy this page—v4 strategy−43.8%1564.0%
VixFixLinReg-Strategy by Trendoscopehighest sma lowest linregv4 strategy−49.3%1251.1%
Multi MA MTF SandBox Strategy by dman103sma linreg highest lowestv5 strategy+17.4%489.5%
ChBrkOutStrategySMA by anshuanshu333sma highest lowestv4 strategy−4.5%4220.9%
KDJ Strategy @ionvolution by ionvolutionsma highest lowestv5 strategyNo trades on this market
Trading range display with Box by potatoshopsma highest lowestv5 strategy+0.7%273.9%

Where it runs

EngineCompilesRunsMatches TradingView
Zeal Terminal · OpenPineScript v2Yes 23 msWith a workaround 1,000 bars in 80 msNot measured
PineTSNo 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 55, 60) 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/// © Bunghole 2021strategy(title="Crypto Squeeze Strategy", initial_capital = 100000, default_qty_type = strategy.percent_of_equity, default_qty_value = 100, pyramiding = 0, currency = 'USD', overlay=true)//// Stoploss and Take Profit Parameters// Enable Long Strategyenable_long_strategy = input(true, title="Enable Long Strategy", group="SL/TP For Long Strategy",inline="1")long_stoploss_value = input(defval=50, title='Stoploss %', type=input.float, minval=0.1, group="SL/TP For Long Strategy",inline="2")long_stoploss_percentage = (close * (long_stoploss_value / 100)) / syminfo.minticklong_takeprofit_value = input(defval=50, title='Take Profit %', type=input.float, minval=0.1, group="SL/TP For Long Strategy",inline="2")long_takeprofit_percentage = (close * (long_takeprofit_value / 100)) / syminfo.mintick// Enable Short Strategyenable_short_strategy = input(true, title="Enable Short Strategy", group="SL/TP For Short Strategy",inline="3")short_stoploss_value = input(defval=50, title='Stoploss %', type=input.float, minval=0.1, group= "SL/TP For Short Strategy",inline="4")short_stoploss_percentage = (close * (short_stoploss_value / 100)) / syminfo.mintickshort_takeprofit_value = input(defval=50, title='Take Profit %', type=input.float, minval=0.1, group="SL/TP For Short Strategy",inline="4")short_takeprofit_percentage = (close * (short_takeprofit_value / 100)) / syminfo.mintick// Plot Stoploss & Take Profit Levelslong_stoploss_price = strategy.position_avg_price * (1 - long_stoploss_value/100)long_takeprofit_price = strategy.position_avg_price * (1 + long_takeprofit_value/100)short_stoploss_price = strategy.position_avg_price * (1 + short_stoploss_value/100)short_takeprofit_price = strategy.position_avg_price * (1 - short_takeprofit_value/100)plot(enable_long_strategy and not enable_short_strategy ? long_stoploss_price: na, color=#ff0000, style=plot.style_linebr, linewidth=2, title="Long SL Level")plot(enable_long_strategy and not enable_short_strategy ? long_takeprofit_price: na, color=#008000, style=plot.style_linebr, linewidth=2, title="Long TP Level")plot(enable_short_strategy and not enable_long_strategy ? short_stoploss_price: na, color=#ff0000, style=plot.style_linebr, linewidth=2, title="Short SL Level")plot(enable_short_strategy and not enable_long_strategy ? short_takeprofit_price: na, color=#008000, style=plot.style_linebr, linewidth=2, title="Short TP Level")// Date Rangestart_date = input(title="Start Date", type=input.integer, defval=1, minval=1, maxval=31, group="Date Range")start_month = input(title="Start Month", type=input.integer, defval=1, minval=1, maxval=12, group="Date Range")start_year = input(title="Start Year", type=input.integer, defval=1804, minval=1800, maxval=3000, group="Date Range")end_date = input(title="End Date", type=input.integer, defval=1, minval=1, maxval=3, group="Date Range")end_month = input(title="End Month", type=input.integer, defval=1, minval=1, maxval=12, group="Date Range")end_year = input(title="End Year", type=input.integer, defval=2077, minval=1800, maxval=3000, group="Date Range")in_date_range = (time >= timestamp(syminfo.timezone, start_year, start_month, start_date, 0, 0)) and (time < timestamp(syminfo.timezone, end_year, end_month, end_date, 0, 0))//// Indicator Inputs// Lazy Bear's Momentum IndicatorBlueWave = linreg(close - avg(avg(highest(high, 20), lowest(low, 20)), sma(close, 20)), 20, 0)// Replicated version of Crypto Face's MFI IndicatormfiUpper = sum(volume * (change(hlc3) <= 0 ? 0 : hlc3), 58)mfiLower = sum(volume * (change(hlc3) >= 0 ? 0 : hlc3), 58)_mfiRsi(mfiUpper, mfiLower) =>    if mfiLower == 0        100    if mfiUpper == 0        0    100.0 - (100.0 / (1.0 + mfiUpper / mfiLower))mf = _mfiRsi(mfiUpper, mfiLower)mfi = (mf - 50) * 3//// Strategy// Creating Long and Short Strategybuy_signal = crossover(BlueWave, 0) and mfi > 0 sell_signal = crossunder(BlueWave, 0) and mfi < 0 // Long Strategyif buy_signal and in_date_range and enable_long_strategy == true    strategy.entry("Long", true, when=buy_signal, alert_message="Open Long Position")    strategy.exit("Long  SL/TP", from_entry="Long", loss=long_stoploss_percentage, profit=long_takeprofit_percentage, alert_message="Your Long SL/TP Limit As Been Triggered.")    strategy.close("Long", when=sell_signal, alert_message="Close Long Position")// Short Strategyif sell_signal and in_date_range and enable_short_strategy == true    strategy.entry("Short", false, when = sell_signal, alert_message="Open Short Position")    strategy.exit("Short SL/TP", from_entry="Short", loss=short_stoploss_percentage, profit=short_takeprofit_percentage, alert_message="Your Short SL/TP Limit As Been Triggered.")    strategy.close("Short", when=buy_signal, alert_message="Close Short Position")