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
- 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
VerifiedSame 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.")⋯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.
| Setting | Default | Type and range | Feeds |
|---|---|---|---|
| SL/TP For Long Strategy | |||
| Enable Long Strategy | true | bool | entry Long exit Long SL/TP close Long Long SL Level Long TP Level Short SL Level Short TP Level line 54 |
| Stoploss % | 50 | float · min 0.1 | long_stoploss_percentage long_stoploss_price |
| Take Profit % | 50 | float · min 0.1 | long_takeprofit_percentage long_takeprofit_price |
| SL/TP For Short Strategy | |||
| Enable Short Strategy | true | bool | entry Short exit Short SL/TP close Short Long SL Level Long TP Level Short SL Level Short TP Level line 59 |
| Stoploss % | 50 | float · min 0.1 | short_stoploss_percentage short_stoploss_price |
| Take Profit % | 50 | float · min 0.1 | short_takeprofit_percentage short_takeprofit_price |
| Date Range | |||
| Start Date | 1 | int (written input.integer) · min 1 · max 31 | in_date_range |
| Start Month | 1 | int (written input.integer) · min 1 · max 12 | in_date_range |
| Start Year | 1804 | int (written input.integer) · min 1800 · max 3000 | in_date_range |
| End Date | 1 | int (written input.integer) · min 1 · max 3 | in_date_range |
| End Month | 1 | int (written input.integer) · min 1 · max 12 | in_date_range |
| End Year | 2077 | int (written input.integer) · min 1800 · max 3000 | in_date_range |
What it calculates
- Linreg / Highest / Lowest / SMA (
linreg,ta.linregin v5)close - avg(avg(highest(high, 20), lowest(low, 20)), sma(close, 20)), 20, 0BlueWave · line 37 - Change (
change,ta.changein v5)hlc3mfiUpper · line 39 - Change (
change,ta.changein 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.
Order rules
| Order | Fires when | By default | Line |
|---|---|---|---|
| Open Long long | buy_signalcrossover(BlueWave, 0) and mfi > 0 | On | 55 |
| Exit Long SL/TP stop and limit | buy_signal and in_date_range and enable_long_strategy == true | On | 56 |
| Close Long | sell_signalcrossunder(BlueWave, 0) and mfi < 0 | On | 57 |
| Open Short short | sell_signalcrossunder(BlueWave, 0) and mfi < 0 | On | 60 |
| Exit Short SL/TP stop and limit | sell_signal and in_date_range and enable_short_strategy == true | On | 61 |
| Close Short | buy_signalcrossover(BlueWave, 0) and mfi > 0 | On | 62 |
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 | −43.8% | +102.5% | 15 | 20% | 0.68 | 64.0% | 26 Jan 2024 – 21 Oct 2026 |
| BTCUSDT 4h | −20.7% | +5.5% | 10 | 30% | 0.51 | 39.9% | 8 May 2026 – 21 Oct 2026 |
| ETHUSDT 1D | −12.1% | +9.8% | 12 | 33% | 0.91 | 52.0% | 26 Jan 2024 – 21 Oct 2026 |
| ETHUSDT 4h | −25.6% | +8.4% | 8 | 38% | 0.48 | 41.1% | 8 May 2026 – 21 Oct 2026 |
| SOLUSDT 1D | +50.7% | +16.7% | 14 | 50% | 1.27 | 60.2% | 26 Jan 2024 – 21 Oct 2026 |
| SOLUSDT 4h | +58.5% | +21.5% | 10 | 60% | 3.99 | 12.5% | 8 May 2026 – 21 Oct 2026 |
| BNBUSDT 1D | +47.6% | +148.3% | 9 | 33% | 2.13 | 48.6% | 26 Jan 2024 – 21 Oct 2026 |
| BNBUSDT 4h | −15.0% | +17.1% | 11 | 18% | 0.55 | 23.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 bars | Trades | Won | P&L |
|---|---|---|---|
| Rising market | 5 | 20% | −$14,658.30 |
| Sideways market | 9 | 22% | −$9,872.29 |
| Falling market | 1 | 0% | −$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.
All 15 trades
| Side | Entry | Exit | Bars | P&L |
|---|---|---|---|---|
| long | 2 Apr 2024 69,649.80 | 12 Jun 2024 67,314.20 | 71 | −$3,353.32 |
| short | 12 Jun 2024 67,314.20 | 17 Oct 2024 67,620.00 | 127 | −$439.01 |
| long | 17 Oct 2024 67,620.00 | 5 Dec 2024 101,430.00 | 49 | $48,103.80 |
| long | 13 Dec 2024 100,004.00 | 5 Feb 2025 97,763.10 | 54 | −$3,234.10 |
| short | 5 Feb 2025 97,763.10 | 16 Jun 2025 105,594.00 | 131 | −$11,300.40 |
| long | 16 Jun 2025 105,594.00 | 1 Aug 2025 115,764.00 | 46 | $12,499.20 |
| short | 1 Aug 2025 115,764.00 | 14 Aug 2025 123,306.00 | 13 | −$9,269.71 |
| long | 14 Aug 2025 123,306.00 | 22 Aug 2025 112,500.00 | 8 | −$11,656.50 |
| short | 22 Aug 2025 112,500.00 | 4 Oct 2025 122,232.00 | 43 | −$10,497.80 |
| long | 4 Oct 2025 122,232.00 | 17 Oct 2025 108,194.00 | 13 | −$12,731.00 |
| short | 17 Oct 2025 108,194.00 | 3 Nov 2025 110,541.00 | 17 | −$2,127.96 |
| long | 3 Nov 2025 110,541.00 | 5 Nov 2025 101,497.00 | 2 | −$7,853.31 |
| short | 5 Nov 2025 101,497.00 | 28 Mar 2026 66,407.30 | 143 | $30,472.00 |
| long | 10 Apr 2026 71,788.00 | 27 Jun 2026 60,097.30 | 78 | −$19,316.00 |
| short | 27 Jun 2026 60,097.30 | 23 Sep 2026 86,208.60 | 88 | −$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.
| Script | Shares | Type | Net | Trades | Max drawdown |
|---|---|---|---|---|---|
| Crypto Squeeze Strategy this page | — | v4 strategy | −43.8% | 15 | 64.0% |
| VixFixLinReg-Strategy by Trendoscope | highest sma lowest linreg | v4 strategy | −49.3% | 12 | 51.1% |
| Multi MA MTF SandBox Strategy by dman103 | sma linreg highest lowest | v5 strategy | +17.4% | 48 | 9.5% |
| ChBrkOutStrategySMA by anshuanshu333 | sma highest lowest | v4 strategy | −4.5% | 42 | 20.9% |
| KDJ Strategy @ionvolution by ionvolution | sma highest lowest | v5 strategy | No trades on this market | ||
| Trading range display with Box by potatoshop | sma highest lowest | v5 strategy | +0.7% | 27 | 3.9% |
Where it runs
| Engine | Compiles | Runs | Matches TradingView |
|---|---|---|---|
| Zeal Terminal · OpenPineScript v2 | Yes 23 ms | With a workaround 1,000 bars in 80 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 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")