Pine Script v5 · Strategy
Baseline Cross Qualifier Volatility Strategy with HMA Trend Bias
A Pine Script v5 strategy built on SMA (close, 20) and ATR (14). It has 11 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 is one contract and pays no commission. 9 settings; defaults include Baseline Length 20, Post Baseline Cross Qualifier Bars Ago 3 and ATR Length 14.
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 Baseline Cross Qualifier Volatility Strategy with HMA Trend Bias repaint?
- No
- No repainting patterns were found in the source, and a live tick-by-tick replay matched history on 69 of 69 trades.
- How did Baseline Cross Qualifier Volatility Strategy with HMA Trend Bias do on BTCUSDT 1D with default settings?
- −1.38%
- From 26 Jan 2024 to 21 Oct 2026, over 214 closed trades, against +102.5% for buy and hold. A backtest, not investment advice.
- Does Baseline Cross Qualifier Volatility Strategy with HMA Trend Bias run in Pine Script v6?
- No
- The v6 version does not run in Zeal Terminal's engine: Pine Script v6 Error at @L28:C20: 'bgcolor' has no 'transp' parameter in Pine Script v6. Use color.new(color, transparency) instead. The v6 version is shown for reference and is not offered as a download.
- Does Baseline Cross Qualifier Volatility Strategy with HMA Trend Bias use a stop loss?
- Yes
- strategy.exit sets a stop on line 48, 49.
- Does Baseline Cross Qualifier Volatility Strategy with HMA Trend Bias run in Zeal Terminal?
- Yes
- It compiles in 28 ms and runs 1,000 bars in 43 ms, in the browser.
BTCUSDT · 1D · default settings
- Plot
- Winning trade
- Losing trade
- Equity
- Buy and hold
- Net profit
- −1.38%
- −$13,752.10
- Buy and hold
- +102.5%
- same period
- Closed trades
- 214
- 36 won · 10 lost
- Profitable
- 16.8%
- of closed trades
- Profit factor
- 0.63
- gross profit ÷ gross loss
- Max drawdown
- 1.84%
- −$18,380.80
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
1 setting does nothing
“Volatility Multiplier” is declared but never read.
-
Check
No commission
The backtest assumes free trading. Results on any real exchange will be lower.
-
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.
| Setting | Default | Type and range | Feeds |
|---|---|---|---|
| Baseline Length | 20 | int | baseline |
| Post Baseline Cross Qualifier Enabled | true | bool | pbcqValid |
| Post Baseline Cross Qualifier Bars Ago | 3 | int | pbcqValid |
| ATR Length | 14 | int | atr |
| Volatility Multiplier | 2.0 | float | unused |
| Volatility Range Multiplier | 1.0 | float | rangeHigh rangeLow |
| Volatility Qualifier Multiplier | 0.5 | float | qualifier |
| Take Profit Type | 1 Take Profit | string · options ["1 Take Profit", "2 Take Profits", "3 Take Profits"] | exit TP/SL exit TP/SL exit TP1 exit TP2 exit TP1 exit TP2 exit TP1 exit TP2 exit TP3 line 47 line 50 line 55 |
| HMA Length | 50 | int | isLong isShort |
What it calculates
- SMAclose, Baseline Length (20)
baseline · line 8 - ATRATR Length (14)
atr · line 23
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 | (longCondition) | On | 43 |
| Open Short short | (shortCondition) | On | 45 |
| Exit TP/SL stop and limit | (takeProfitType == "1 Take Profit") | On | 48 |
| Exit TP/SL stop and limit | (takeProfitType == "1 Take Profit") | On | 49 |
| Exit TP1 limit | (takeProfitType == "2 Take Profits") | On | 51 |
| Exit TP2 limit | (takeProfitType == "2 Take Profits") | On | 52 |
| Exit TP1 limit | (takeProfitType == "2 Take Profits") | On | 53 |
| Exit TP2 limit | (takeProfitType == "2 Take Profits") | On | 54 |
| Exit TP1 limit | (takeProfitType == "3 Take Profits") | On | 56 |
| Exit TP2 limit | (takeProfitType == "3 Take Profits") | On | 57 |
| Exit TP3 limit | (takeProfitType == "3 Take Profits") | On | 58 |
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 | −1.4% | +102.5% | 214 | 17% | 0.63 | 1.8% | 26 Jan 2024 – 21 Oct 2026 |
| BTCUSDT 4h | −0.2% | +5.5% | 201 | 15% | 0.78 | 0.3% | 8 May 2026 – 21 Oct 2026 |
| ETHUSDT 1D | −0.0% | +9.8% | 204 | 14% | 0.96 | 0.1% | 26 Jan 2024 – 21 Oct 2026 |
| ETHUSDT 4h | +0.0% | +8.4% | 163 | 25% | 1.09 | 0.0% | 8 May 2026 – 21 Oct 2026 |
| SOLUSDT 1D | +0.0% | +16.7% | 199 | 17% | 1.55 | 0.0% | 26 Jan 2024 – 21 Oct 2026 |
| SOLUSDT 4h | +0.0% | +21.5% | 190 | 21% | 1.54 | 0.0% | 8 May 2026 – 21 Oct 2026 |
| BNBUSDT 1D | −0.0% | +148.3% | 219 | 21% | 0.69 | 0.0% | 26 Jan 2024 – 21 Oct 2026 |
| BNBUSDT 4h | +0.0% | +17.1% | 232 | 18% | 1.59 | 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 bars | Trades | Won | P&L |
|---|---|---|---|
| Rising market | 82 | 17% | −$4,873.52 |
| Sideways market | 110 | 16% | −$8,902.53 |
| Falling market | 22 | 18% | $23.94 |
Rising and falling mean the market moved more than 15% over the 90 bars before entry.
How bad could the drawdown be?
2.7%
The 95th percentile of the worst drawdown when the same 214 trades are reshuffled 5,000 times. The bar spans the 5th to 95th percentile, 1.5% to 2.7%; the tick is what actually happened, 1.7%. Order luck alone moves it this much.
The first 150 of 214 trades
| Side | Entry | Exit | Bars | P&L |
|---|---|---|---|---|
| long | 1 Apr 2024 71,280.00 | 2 Apr 2024 64,988.60 | 1 | −$6,291.44 |
| short | 3 Apr 2024 65,464.00 | 8 Apr 2024 71,013.30 | 5 | −$5,549.32 |
| long | 11 Apr 2024 70,631.10 | 12 Apr 2024 65,792.90 | 1 | −$4,838.21 |
| short | 15 Apr 2024 65,661.90 | 15 Apr 2024 65,079.10 | 0 | $582.72 |
| long | 20 May 2024 66,274.00 | 20 May 2024 66,274.00 | 0 | $0.00 |
| long | 21 May 2024 71,446.60 | 21 May 2024 71,446.60 | 0 | $0.00 |
| long | 22 May 2024 70,148.30 | 22 May 2024 70,148.30 | 0 | $0.00 |
| long | 23 May 2024 69,166.60 | 23 May 2024 69,166.60 | 0 | $0.00 |
| long | 24 May 2024 67,969.70 | 24 May 2024 67,969.70 | 0 | $0.00 |
| long | 25 May 2024 68,550.00 | 25 May 2024 68,550.00 | 0 | $0.00 |
| long | 26 May 2024 69,290.60 | 26 May 2024 69,290.60 | 0 | $0.00 |
| long | 27 May 2024 68,507.70 | 27 May 2024 68,507.70 | 0 | $0.00 |
| long | 28 May 2024 69,436.40 | 28 May 2024 69,436.40 | 0 | $0.00 |
| long | 29 May 2024 68,398.40 | 29 May 2024 68,798.60 | 0 | $400.17 |
| short | 12 Jun 2024 67,314.20 | 13 Jun 2024 66,741.00 | 1 | $573.24 |
| short | 14 Jun 2024 66,773.00 | 14 Jun 2024 66,649.20 | 0 | $123.80 |
| long | 19 Jul 2024 63,987.90 | 19 Jul 2024 63,987.90 | 0 | $0.00 |
| long | 20 Jul 2024 66,660.00 | 20 Jul 2024 66,660.00 | 0 | $0.00 |
| long | 21 Jul 2024 67,140.00 | 21 Jul 2024 67,140.00 | 0 | $0.00 |
| long | 22 Jul 2024 68,165.40 | 22 Jul 2024 68,165.40 | 0 | $0.00 |
| long | 23 Jul 2024 67,532.00 | 23 Jul 2024 67,532.00 | 0 | $0.00 |
| long | 24 Jul 2024 65,936.00 | 24 Jul 2024 65,936.00 | 0 | $0.00 |
| long | 25 Jul 2024 65,376.00 | 25 Jul 2024 65,376.00 | 0 | $0.00 |
| long | 26 Jul 2024 65,799.90 | 26 Jul 2024 65,799.90 | 0 | $0.00 |
| long | 27 Jul 2024 67,908.00 | 27 Jul 2024 67,908.00 | 0 | $0.00 |
| long | 28 Jul 2024 67,896.50 | 28 Jul 2024 67,896.50 | 0 | $0.00 |
| long | 30 Jul 2024 66,784.70 | 30 Jul 2024 66,872.00 | 0 | $87.36 |
| long | 27 Aug 2024 62,834.00 | 27 Aug 2024 62,906.60 | 0 | $72.57 |
| long | 18 Sep 2024 60,314.00 | 18 Sep 2024 60,314.00 | 0 | $0.00 |
| long | 19 Sep 2024 61,760.00 | 19 Sep 2024 61,760.00 | 0 | $0.00 |
| long | 22 Sep 2024 63,349.00 | 22 Sep 2024 63,349.00 | 0 | $0.00 |
| long | 23 Sep 2024 63,578.80 | 23 Sep 2024 63,578.80 | 0 | $0.00 |
| long | 24 Sep 2024 63,340.00 | 24 Sep 2024 63,340.00 | 0 | $0.00 |
| long | 25 Sep 2024 64,262.70 | 25 Sep 2024 64,262.70 | 0 | $0.00 |
| long | 26 Sep 2024 63,152.00 | 26 Sep 2024 63,152.00 | 0 | $0.00 |
| long | 27 Sep 2024 65,174.00 | 27 Sep 2024 65,174.00 | 0 | $0.00 |
| long | 28 Sep 2024 65,769.90 | 28 Sep 2024 65,769.90 | 0 | $0.00 |
| long | 29 Sep 2024 65,858.00 | 29 Sep 2024 65,858.00 | 0 | $0.00 |
| long | 30 Sep 2024 65,602.00 | 30 Sep 2024 65,602.00 | 0 | $0.00 |
| short | 2 Oct 2024 60,804.90 | 2 Oct 2024 60,237.90 | 0 | $567.06 |
| short | 3 Oct 2024 60,649.30 | 3 Oct 2024 60,348.90 | 0 | $300.39 |
| short | 4 Oct 2024 60,752.70 | 9 Oct 2024 61,195.40 | 5 | −$442.67 |
| long | 19 Oct 2024 68,428.00 | 19 Oct 2024 68,428.00 | 0 | $0.00 |
| long | 20 Oct 2024 68,378.00 | 20 Oct 2024 68,378.00 | 0 | $0.00 |
| long | 21 Oct 2024 69,032.00 | 21 Oct 2024 69,032.00 | 0 | $0.00 |
| long | 22 Oct 2024 67,377.50 | 22 Oct 2024 67,377.50 | 0 | $0.00 |
| long | 23 Oct 2024 67,426.00 | 23 Oct 2024 67,426.00 | 0 | $0.00 |
| long | 24 Oct 2024 66,668.60 | 24 Oct 2024 66,768.40 | 0 | $99.71 |
| long | 25 Oct 2024 68,198.30 | 25 Oct 2024 68,198.30 | 0 | $0.00 |
| long | 28 Oct 2024 68,021.70 | 28 Oct 2024 68,021.70 | 0 | $0.00 |
| long | 11 Nov 2024 80,370.00 | 11 Nov 2024 80,370.00 | 0 | $0.00 |
| long | 12 Nov 2024 88,648.00 | 12 Nov 2024 88,648.00 | 0 | $0.00 |
| long | 13 Nov 2024 87,952.00 | 13 Nov 2024 87,952.00 | 0 | $0.00 |
| long | 14 Nov 2024 90,375.20 | 14 Nov 2024 90,375.20 | 0 | $0.00 |
| long | 15 Nov 2024 87,325.60 | 15 Nov 2024 87,325.60 | 0 | $0.00 |
| long | 16 Nov 2024 91,032.10 | 16 Nov 2024 91,032.10 | 0 | $0.00 |
| long | 17 Nov 2024 90,588.00 | 17 Nov 2024 90,588.00 | 0 | $0.00 |
| long | 18 Nov 2024 89,856.00 | 18 Nov 2024 89,856.00 | 0 | $0.00 |
| long | 19 Nov 2024 90,464.10 | 19 Nov 2024 90,464.10 | 0 | $0.00 |
| long | 20 Nov 2024 92,310.80 | 20 Nov 2024 92,310.80 | 0 | $0.00 |
| long | 21 Nov 2024 94,286.60 | 21 Nov 2024 94,286.60 | 0 | $0.00 |
| long | 22 Nov 2024 98,317.10 | 22 Nov 2024 98,317.10 | 0 | $0.00 |
| long | 23 Nov 2024 98,892.00 | 23 Nov 2024 98,892.00 | 0 | $0.00 |
| long | 24 Nov 2024 97,672.40 | 24 Nov 2024 97,672.40 | 0 | $0.00 |
| long | 25 Nov 2024 97,900.10 | 25 Nov 2024 97,900.10 | 0 | $0.00 |
| long | 16 Dec 2024 104,464.00 | 16 Dec 2024 104,464.00 | 0 | $0.00 |
| long | 17 Dec 2024 106,059.00 | 17 Dec 2024 106,059.00 | 0 | $0.00 |
| long | 18 Dec 2024 106,134.00 | 18 Dec 2024 106,134.00 | 0 | $0.00 |
| short | 20 Dec 2024 97,461.90 | 20 Dec 2024 95,344.80 | 0 | $2,117.02 |
| short | 22 Dec 2024 97,292.00 | 22 Dec 2024 95,395.30 | 0 | $1,896.75 |
| short | 10 Jan 2025 92,552.50 | 10 Jan 2025 92,404.60 | 0 | $147.92 |
| long | 21 Jan 2025 102,260.00 | 21 Jan 2025 102,447.00 | 0 | $187.13 |
| long | 22 Jan 2025 106,144.00 | 22 Jan 2025 106,144.00 | 0 | $0.00 |
| long | 23 Jan 2025 103,707.00 | 23 Jan 2025 103,707.00 | 0 | $0.00 |
| long | 24 Jan 2025 103,910.00 | 24 Jan 2025 103,910.00 | 0 | $0.00 |
| long | 25 Jan 2025 104,871.00 | 25 Jan 2025 104,871.00 | 0 | $0.00 |
| long | 26 Jan 2025 104,747.00 | 26 Jan 2025 104,747.00 | 0 | $0.00 |
| long | 27 Jan 2025 102,620.00 | 29 Jan 2025 104,735.00 | 2 | $2,114.80 |
| long | 30 Jan 2025 103,733.00 | 30 Jan 2025 105,237.00 | 0 | $1,503.62 |
| short | 3 Feb 2025 97,700.60 | 3 Feb 2025 97,700.60 | 0 | $0.00 |
| long | 28 Mar 2025 87,232.00 | 31 Mar 2025 82,390.00 | 3 | −$4,842.01 |
| short | 31 Mar 2025 82,390.00 | 2 Apr 2025 87,761.60 | 2 | −$5,371.57 |
| long | 18 Apr 2025 84,947.90 | 21 Apr 2025 86,092.70 | 3 | $1,144.79 |
| long | 22 Apr 2025 87,516.20 | 22 Apr 2025 87,516.20 | 0 | $0.00 |
| long | 23 Apr 2025 93,443.00 | 23 Apr 2025 93,443.00 | 0 | $0.00 |
| long | 25 Apr 2025 93,980.50 | 25 Apr 2025 93,980.50 | 0 | $0.00 |
| long | 26 Apr 2025 94,638.70 | 26 Apr 2025 94,638.70 | 0 | $0.00 |
| long | 27 Apr 2025 94,628.00 | 27 Apr 2025 94,628.00 | 0 | $0.00 |
| long | 28 Apr 2025 93,749.30 | 28 Apr 2025 93,749.30 | 0 | $0.00 |
| long | 29 Apr 2025 95,011.20 | 29 Apr 2025 95,011.20 | 0 | $0.00 |
| long | 30 Apr 2025 94,256.80 | 30 Apr 2025 94,256.80 | 0 | $0.00 |
| long | 1 May 2025 94,172.00 | 1 May 2025 94,172.00 | 0 | $0.00 |
| long | 2 May 2025 96,489.90 | 2 May 2025 96,489.90 | 0 | $0.00 |
| long | 3 May 2025 96,887.10 | 3 May 2025 96,887.10 | 0 | $0.00 |
| long | 4 May 2025 95,856.40 | 4 May 2025 95,856.40 | 0 | $0.00 |
| long | 7 May 2025 96,834.00 | 7 May 2025 96,834.00 | 0 | $0.00 |
| long | 8 May 2025 97,030.50 | 8 May 2025 97,030.50 | 0 | $0.00 |
| long | 12 May 2025 104,118.00 | 12 May 2025 104,118.00 | 0 | $0.00 |
| long | 13 May 2025 102,791.00 | 13 May 2025 102,791.00 | 0 | $0.00 |
| long | 14 May 2025 104,104.00 | 14 May 2025 104,104.00 | 0 | $0.00 |
| long | 15 May 2025 103,508.00 | 15 May 2025 103,508.00 | 0 | $0.00 |
| long | 16 May 2025 103,764.00 | 16 May 2025 103,764.00 | 0 | $0.00 |
| long | 19 May 2025 106,454.00 | 19 May 2025 106,454.00 | 0 | $0.00 |
| long | 21 May 2025 106,850.00 | 21 May 2025 106,850.00 | 0 | $0.00 |
| long | 22 May 2025 109,644.00 | 22 May 2025 109,644.00 | 0 | $0.00 |
| short | 31 May 2025 103,985.00 | 31 May 2025 103,255.00 | 0 | $730.97 |
| short | 1 Jun 2025 104,592.00 | 5 Jun 2025 103,959.00 | 4 | $633.10 |
| long | 30 Jun 2025 108,357.00 | 30 Jun 2025 108,530.00 | 0 | $172.93 |
| long | 1 Jul 2025 107,147.00 | 2 Jul 2025 108,158.00 | 1 | $1,011.90 |
| long | 3 Jul 2025 108,850.00 | 3 Jul 2025 108,850.00 | 0 | $0.00 |
| long | 4 Jul 2025 109,585.00 | 4 Jul 2025 109,585.00 | 0 | $0.00 |
| long | 7 Jul 2025 109,204.00 | 7 Jul 2025 109,204.00 | 0 | $0.00 |
| long | 8 Jul 2025 108,263.00 | 8 Jul 2025 108,928.00 | 0 | $665.12 |
| long | 9 Jul 2025 108,923.00 | 9 Jul 2025 109,081.00 | 0 | $158.39 |
| long | 10 Jul 2025 111,234.00 | 10 Jul 2025 111,234.00 | 0 | $0.00 |
| long | 14 Jul 2025 119,087.00 | 14 Jul 2025 119,087.00 | 0 | $0.00 |
| long | 15 Jul 2025 119,841.00 | 15 Jul 2025 119,841.00 | 0 | $0.00 |
| long | 16 Jul 2025 117,758.00 | 16 Jul 2025 117,758.00 | 0 | $0.00 |
| long | 17 Jul 2025 118,630.00 | 17 Jul 2025 118,630.00 | 0 | $0.00 |
| long | 18 Jul 2025 119,178.00 | 18 Jul 2025 119,178.00 | 0 | $0.00 |
| long | 19 Jul 2025 117,925.00 | 19 Jul 2025 117,925.00 | 0 | $0.00 |
| long | 20 Jul 2025 117,840.00 | 20 Jul 2025 117,840.00 | 0 | $0.00 |
| long | 23 Jul 2025 119,954.00 | 23 Jul 2025 119,954.00 | 0 | $0.00 |
| short | 20 Aug 2025 112,873.00 | 20 Aug 2025 112,873.00 | 0 | $0.00 |
| short | 21 Aug 2025 114,271.00 | 21 Aug 2025 113,648.00 | 0 | $622.91 |
| long | 15 Sep 2025 115,268.00 | 15 Sep 2025 115,268.00 | 0 | $0.00 |
| long | 16 Sep 2025 115,350.00 | 16 Sep 2025 115,350.00 | 0 | $0.00 |
| long | 17 Sep 2025 116,789.00 | 17 Sep 2025 116,789.00 | 0 | $0.00 |
| long | 18 Sep 2025 116,448.00 | 18 Sep 2025 116,448.00 | 0 | $0.00 |
| long | 19 Sep 2025 117,074.00 | 19 Sep 2025 117,074.00 | 0 | $0.00 |
| long | 20 Sep 2025 115,632.00 | 20 Sep 2025 115,632.00 | 0 | $0.00 |
| long | 21 Sep 2025 115,686.00 | 23 Sep 2025 112,651.00 | 2 | −$3,034.64 |
| short | 23 Sep 2025 112,651.00 | 23 Sep 2025 111,725.00 | 0 | $926.04 |
| short | 24 Sep 2025 111,999.00 | 24 Sep 2025 111,770.00 | 0 | $229.13 |
| long | 6 Oct 2025 123,482.00 | 6 Oct 2025 123,482.00 | 0 | $0.00 |
| long | 7 Oct 2025 124,659.00 | 7 Oct 2025 124,659.00 | 0 | $0.00 |
| long | 8 Oct 2025 121,333.00 | 8 Oct 2025 121,333.00 | 0 | $0.00 |
| long | 9 Oct 2025 123,306.00 | 9 Oct 2025 123,306.00 | 0 | $0.00 |
| long | 10 Oct 2025 121,662.00 | 10 Oct 2025 121,662.00 | 0 | $0.00 |
| short | 11 Oct 2025 112,774.00 | 11 Oct 2025 112,451.00 | 0 | $323.50 |
| short | 12 Oct 2025 110,644.00 | 12 Oct 2025 110,644.00 | 0 | $0.00 |
| short | 31 Oct 2025 108,323.00 | 3 Nov 2025 106,673.00 | 3 | $1,650.34 |
| short | 5 Nov 2025 101,497.00 | 5 Nov 2025 101,497.00 | 0 | $0.00 |
| short | 6 Nov 2025 103,885.00 | 6 Nov 2025 103,885.00 | 0 | $0.00 |
| long | 4 Dec 2025 93,429.90 | 9 Dec 2025 93,029.00 | 5 | −$400.95 |
| long | 7 Jan 2026 93,748.00 | 7 Jan 2026 93,748.00 | 0 | $0.00 |
| long | 8 Jan 2026 91,364.20 | 9 Jan 2026 91,848.60 | 1 | $484.39 |
| long | 14 Jan 2026 95,414.00 | 14 Jan 2026 95,414.00 | 0 | $0.00 |
| long | 18 Jan 2026 95,147.80 | 18 Jan 2026 95,147.80 | 0 | $0.00 |
| long | 19 Jan 2026 93,673.10 | 20 Jan 2026 90,075.30 | 1 | −$3,597.85 |
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 |
|---|---|---|---|---|---|
| Baseline Cross Qualifier Volatility Strategy with HMA Trend Bias this page | — | v5 strategy | −1.4% | 214 | 1.8% |
| I11L - Better Buy Low Volatility or High Volatility- by I11L | atr sma | v5 strategy | +19.2% | 83 | 37.4% |
| Vortex Cross w-MA Confirmation by DraftVenture | atr sma | v5 strategy | +2.4% | 52 | 4.7% |
| Configurable Multi MA Crossover Voting System by levieux | sma atr | v5 strategy | +28.5% | 5 | 39.4% |
| Swing Trend Strategy by Inkedlau | sma atr | v5 strategy | +11.2% | 5 | 16.2% |
| SSL Backtester With ATR SL TP and Money Management by JBTrippin | sma atr | v4 strategy | +8.5% | 55 | 3.9% |
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.
- No v6-only features. v6 is not needed to run this script.
Clean v5
VerifiedNothing to change.
Does it run in Pine Script v6?
No
The v6 version does not run in Zeal Terminal's engine: Pine Script v6 Error at @L28:C20: 'bgcolor' has no 'transp' parameter in Pine Script v6. Use color.new(color, transparency) instead. The v6 version is shown for reference and is not offered as a download. It differs from the v5 version by 1 edit.
⋯// © sevencampbell-//@version=5+//@version=6strategy(title="Baseline Cross Qualifier Volatility Strategy with HMA Trend Bias", overlay=true)⋯Where it runs
| Engine | Compiles | Runs | Matches TradingView |
|---|---|---|---|
| Zeal Terminal · OpenPineScript v2 | Yes 28 ms | Yes 1,000 bars in 43 ms | Not measured |
| PineTS | Not tested | Not tested | Not measured |
“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.
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/// © sevencampbell//@version=5strategy(title="Baseline Cross Qualifier Volatility Strategy with HMA Trend Bias", overlay=true)// --- User Inputs ---// Baseline InputsbaselineLength = input.int(title="Baseline Length", defval=20)baseline = ta.sma(close, baselineLength)// PBCQ InputspbcqEnabled = input.bool(title="Post Baseline Cross Qualifier Enabled", defval=true)pbcqBarsAgo = input.int(title="Post Baseline Cross Qualifier Bars Ago", defval=3)// Volatility InputsatrLength = input.int(title="ATR Length", defval=14)multiplier = input.float(title="Volatility Multiplier", defval=2.0)rangeMultiplier = input.float(title="Volatility Range Multiplier", defval=1.0)qualifierMultiplier = input.float(title="Volatility Qualifier Multiplier", defval=0.5)// Take Profit InputstakeProfitType = input.string(title="Take Profit Type", options=["1 Take Profit", "2 Take Profits", "3 Take Profits"], defval="1 Take Profit")// HMA InputshmaLength = input.int(title="HMA Length", defval=50)// --- Calculations ---// ATRatr = ta.atr(atrLength)// Range CalculationrangeHigh = baseline + rangeMultiplier * atrrangeLow = baseline - rangeMultiplier * atrrangeColor = rangeLow <= close and close <= rangeHigh ? color.yellow : nabgcolor(rangeColor, transp=90)// Qualifier Calculationqualifier = qualifierMultiplier * atr// Dot CalculationisLong = close > baseline and (close - baseline) >= qualifier and close > ta.hma(close, hmaLength)isShort = close < baseline and (baseline - close) >= qualifier and close < ta.hma(close, hmaLength)colorDot = isLong ? color.green : isShort ? color.red : naplot(isLong or isShort ? baseline : na, color=colorDot, style=plot.style_circles, linewidth=3)// --- Strategy Logic ---// PBCQpbcqValid = not pbcqEnabled or low[pbcqBarsAgo] > baseline// Entry LogiclongCondition = isLong and pbcqValidshortCondition = isShort and pbcqValidif (longCondition) strategy.entry("Long", strategy.long)if (shortCondition) strategy.entry("Short", strategy.short)// Exit Logicif (takeProfitType == "1 Take Profit") strategy.exit("TP/SL", "Long", limit=rangeHigh, stop=rangeLow) strategy.exit("TP/SL", "Short", limit=rangeLow, stop=rangeHigh)else if (takeProfitType == "2 Take Profits") strategy.exit("TP1", "Long", qty=strategy.position_size * 0.5, limit=rangeHigh / 2) strategy.exit("TP2", "Long", qty=strategy.position_size * 0.5, limit=rangeHigh) strategy.exit("TP1", "Short", qty=strategy.position_size * 0.5, limit=rangeLow / 2) strategy.exit("TP2", "Short", qty=strategy.position_size * 0.5, limit=rangeLow)else if (takeProfitType == "3 Take Profits") strategy.exit("TP1", "Long", qty=strategy.position_size * 0.5, limit=rangeHigh / 2) strategy.exit("TP2", "Long", qty=strategy.position_size * 0.25, limit=rangeHigh * 0.75) strategy.exit("TP3", "Long", qty=strategy.position_size * 0.25, limit=rangeHigh * 1.5)