Pine Script v5 · Strategy
Profitable Contrarian scalping
A Pine Script v5 strategy built on VWMA or SMA (close,5, 5). It has 4 order rules, 2 entries among them, and trades long and short with the default settings. Exits wait for a signal; there is no stop loss. Each trade commits 100% of equity and pays no commission. 3 settings; defaults include Length1 5, Length2 200 and Stop length 20.
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 Profitable Contrarian scalping repaint?
- No
- No repainting patterns were found in the source, and a live tick-by-tick replay matched history on 1 of 1 trades.
- How did Profitable Contrarian scalping do on BTCUSDT 1D with default settings?
- −48.24%
- From 26 Jan 2024 to 21 Oct 2026, over 7 closed trades, against +102.5% for buy and hold. A backtest, not investment advice.
- Does Profitable Contrarian scalping 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: 7 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.
- Does Profitable Contrarian scalping use a stop loss?
- No
- Every exit waits for a signal; nothing limits a losing trade before it fires.
- Does Profitable Contrarian scalping run in Zeal Terminal?
- Yes
- It compiles in 22 ms and runs 1,000 bars in 25 ms, in the browser.
BTCUSDT · 1D · default settings
- Plot
- Plot
- Winning trade
- Losing trade
- Equity
- Buy and hold
- Net profit
- −48.24%
- −$482,374.00
- Buy and hold
- +102.5%
- same period
- Closed trades
- 7
- 4 won · 3 lost
- Profitable
- 57.1%
- of closed trades
- Profit factor
- 0.27
- gross profit ÷ gross loss
- Max drawdown
- 60.24%
- −$691,237.00
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
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.
-
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.
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 |
|---|---|---|---|
| Length1 | 5 | int | vwma1 |
| Length2 | 200 | int | vwma2 |
| Stop length | 20 | int | vwma3 |
What it calculates
- VWMA / SMAta.sma(close,5), Length1 (5)
vwma1 · line 8 - VWMA / SMAta.sma(close,5), Length2 (200)
vwma2 · line 9 - VWMA / SMAta.sma(close, 5), Stop length (20)
vwma3 · line 10
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 Short short | ta.crossover(vwma1, vwma2) | On | 14 |
| Close Short | ta.crossunder(vwma1, vwma3) | On | 16 |
| Open Long long | ta.crossunder(vwma1, vwma2) | On | 18 |
| Close Long | ta.crossover(vwma1, vwma3) | On | 20 |
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 | −48.2% | +102.5% | 7 | 57% | 0.27 | 60.2% | 26 Jan 2024 – 21 Oct 2026 |
| BTCUSDT 4h | −17.3% | +5.5% | 8 | 63% | 0.17 | 26.2% | 8 May 2026 – 21 Oct 2026 |
| ETHUSDT 1D | −60.3% | +9.8% | 7 | 43% | 0.06 | 67.6% | 26 Jan 2024 – 21 Oct 2026 |
| ETHUSDT 4h | −31.7% | +8.4% | 4 | 25% | 0.01 | 35.4% | 8 May 2026 – 21 Oct 2026 |
| SOLUSDT 1D | −47.4% | +16.7% | 9 | 33% | 0.28 | 57.2% | 26 Jan 2024 – 21 Oct 2026 |
| SOLUSDT 4h | −1.0% | +21.5% | 6 | 83% | 0.92 | 15.3% | 8 May 2026 – 21 Oct 2026 |
| BNBUSDT 1D | +30.7% | +148.3% | 14 | 71% | 1.64 | 31.1% | 26 Jan 2024 – 21 Oct 2026 |
| BNBUSDT 4h | +2.6% | +17.1% | 8 | 63% | 1.71 | 5.7% | 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 | 0 | — | $0.00 |
| Sideways market | 6 | 50% | −$509,913.00 |
| Falling market | 1 | 100% | $27,539.50 |
Rising and falling mean the market moved more than 15% over the 90 bars before entry.
How bad could the drawdown be?
57.3%
The 95th percentile of the worst drawdown when the same 7 trades are reshuffled 5,000 times. The bar spans the 5th to 95th percentile, 48.2% to 57.3%; the tick is what actually happened, 55.4%. Order luck alone moves it this much.
All 7 trades
| Side | Entry | Exit | Bars | P&L |
|---|---|---|---|---|
| short | 30 Sep 2024 65,602.00 | 5 Oct 2024 62,086.00 | 5 | $53,596.10 |
| long | 5 Oct 2024 62,086.00 | 17 Oct 2024 67,620.00 | 12 | $93,911.70 |
| short | 17 Oct 2024 67,620.00 | 25 Dec 2024 98,663.60 | 69 | −$526,808.00 |
| long | 13 Mar 2025 83,680.10 | 26 Mar 2025 87,392.90 | 13 | $27,539.50 |
| short | 27 Apr 2025 94,628.00 | 4 Jun 2025 105,377.00 | 38 | −$73,634.20 |
| long | 5 Nov 2025 101,497.00 | 8 Dec 2025 90,395.30 | 33 | −$62,851.10 |
| short | 24 Aug 2026 77,734.00 | 14 Sep 2026 76,842.00 | 21 | $5,872.33 |
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 |
|---|---|---|---|---|---|
| Profitable Contrarian scalping this page | — | v5 strategy | −48.2% | 7 | 60.2% |
| Volume fight strategy by Shuttle_Club | vwma sma | v5 strategy | +92.0% | 45 | 24.6% |
| Volume Weighted Moving Average by Zeal Terminal | vwma sma | v5 indicator | indicator | ||
| Wave Trend w- VWMA overlay by jadamcraig | vwma sma | v4 strategy | No trades on this market | ||
| VWMA-SMA 3Commas Bot by CrackingCryptocurrency | sma vwma | v5 strategy | −1,774,150,000.0% | 157 | 50,545.9% |
| Smoothed Heikin Ashi Trend on Chart - TraderHalai BACKTEST by TraderHalai | sma vwma | v5 strategy | +1.3% | 113 | 5.6% |
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.
- 3 settings use the untyped input() (line 5, 6, 7). 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.
Same 7 trades and the same P&L on BTCUSDT 1D, 1,000 bars, in Zeal Terminal's engine.
- Line 5: input() → input.int()
- Line 6: input() → input.int()
- Line 7: input() → input.int()
⋯strategy("Smooth VWMA scalping contrarian", overlay = true, default_qty_type = strategy.percent_of_equity, default_qty_value = 100)-length1 = input(5, title = "Length1")+length1 = input.int(5, title = "Length1")-length2 = input(200, title = "Length2")+length2 = input.int(200, title = "Length2")-length3 = input(20, title = "Stop length")+length3 = input.int(20, title = "Stop length")vwma1 = ta.vwma(ta.sma(close,5), length1)⋯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: 7 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.
⋯// © Jaerevan47-//@version=5+//@version=6strategy("Smooth VWMA scalping contrarian", overlay = true, default_qty_type = strategy.percent_of_equity, default_qty_value = 100)⋯Where it runs
| Engine | Compiles | Runs | Matches TradingView |
|---|---|---|---|
| Zeal Terminal · OpenPineScript v2 | Yes 22 ms | Yes 1,000 bars in 25 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/// © Jaerevan47//@version=5strategy("Smooth VWMA scalping contrarian", overlay = true, default_qty_type = strategy.percent_of_equity, default_qty_value = 100)length1 = input(5, title = "Length1")length2 = input(200, title = "Length2")length3 = input(20, title = "Stop length")vwma1 = ta.vwma(ta.sma(close,5), length1)vwma2 = ta.vwma(ta.sma(close,5), length2)vwma3 = ta.vwma(ta.sma(close, 5), length3)plot(vwma1)plot(vwma2, color = color.white)if ta.crossover(vwma1, vwma2) strategy.entry("Short", strategy.short)if ta.crossunder(vwma1, vwma3) strategy.close("Short")if ta.crossunder(vwma1, vwma2) strategy.entry("Long", strategy.long)if ta.crossover(vwma1, vwma3) strategy.close("Long")