Pine Script v4 · Strategy
SOJA PIVOT
A Pine Script v4 strategy built on ATR (14). It has 4 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 is one contract and pays no commission. It has no settings.
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 SOJA PIVOT repaint?
- No
- No repainting patterns were found in the source. The live replay was not measured: it had no trades to compare.
- How did SOJA PIVOT do on BTCUSDT 1D with default settings?
- +3.28%
- From 26 Jan 2024 to 21 Oct 2026, over 9 closed trades, against +102.5% for buy and hold. A backtest, not investment advice.
- Can SOJA PIVOT be converted to Pine Script v5?
- No
- The automatic step from v4 to v5 gives a script that does not run in v5 (Pine Script v5 Error at @L5:C149: 'obv' was renamed to 'ta.obv' in Pine Script v5), so no v5 download is offered; the edits are shown below.
- Does SOJA PIVOT use a stop loss?
- No
- Every exit waits for a signal; nothing limits a losing trade before it fires.
- Does SOJA PIVOT run in Zeal Terminal?
- Yes
- It compiles in 8 ms and runs 1,000 bars in 41 ms, in the browser.
BTCUSDT · 1D · default settings
- ATR
- Winning trade
- Losing trade
- Equity
- Buy and hold
- Net profit
- +3.28%
- $3,281.21
- Buy and hold
- +102.5%
- same period
- Closed trades
- 9
- 7 won · 2 lost
- Profitable
- 77.8%
- of closed trades
- Profit factor
- 1.86
- gross profit ÷ gross loss
- Max drawdown
- 18.21%
- −$18,210.00
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 stop loss
strategy.exit is used without a stop, loss or trailing stop.
-
Check
No commission
The backtest assumes free trading. Results on any real exchange will be lower.
-
Check
strategy.exit with no exit price stops the upgrade to v5 line 12
strategy.exit on line 12 sets none of profit, limit, loss, stop or a trailing stop. v4 allows that; v5 rejects the call, so the script does not convert to v5 until each call gets one.
-
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 9, 10, 11, 12. 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 cmo → ta.cmo, bbw → ta.bbw, sum → math.sum, avg → math.avg, atr → ta.atr.
- 4 strategy calls use the when = argument (line 9, 10, 11, 12). It is deprecated in v5 and removed in v6, where each call moves inside an if block.
v4 → v5
DiffersThe v5 version does not run in Zeal Terminal's engine: Pine Script v5 Error at @L5:C149: 'obv' was renamed to 'ta.obv' in Pine Script v5.
- Line 3: //@version=4 → //@version=5
- Line 5: cmo → ta.cmo
- Line 5: cmo → ta.cmo
- Line 5: bbw → ta.bbw
- Line 5: sum → math.sum
- Line 8: avg → math.avg
- Line 8: atr → ta.atr
- Line 9: strategy.entry(…, true) → strategy.entry(…, strategy.long)
⋯// © ParaBellum68-//@version=4+//@version=5strategy(title="SOJA PIVOT", shorttitle="SOJA PIVOT")-soja = ((cmo(close,5) > 25) and (cmo(close,5) < 70) and (close> close[1]) and (bbw(close,50,1) < 0.6) and (sum(volume,5)> 250000) and (obv[5]>15))+soja = ((ta.cmo(close,5) > 25) and (ta.cmo(close,5) < 70) and (close> close[1]) and (ta.bbw(close,50,1) < 0.6) and (math.sum(volume,5)> 250000) and (obv[5]>15))TP = 2.1 * hlc3[1]- high[1]TP2 = TP + high[1] - low[1]-SL = avg(close,14) - 3*atr(14)+SL = math.avg(close,14) - 3*ta.atr(14)-strategy.entry("buy", true, 1, when = soja == 1)+strategy.entry("buy", strategy.long, 1, when = soja == 1)strategy.close("buy", when = close > TP, qty_percent = 25)⋯Clean v5
Not verifiedThe v5 script does not run in Zeal Terminal's engine (Pine Script v5 Error at @L5:C149: 'obv' was renamed to 'ta.obv' in Pine Script v5.), so this step could not be checked.
- Line 9: when = soja == 1 → if block
- Line 10: when = close > TP → if block
- Line 11: when = close > TP2 → if block
- Line 12: when = close < SL → if block
⋯SL = math.avg(close,14) - 3*ta.atr(14)-strategy.entry("buy", strategy.long, 1, when = soja == 1)+if soja == 1+ strategy.entry("buy", strategy.long, 1)-strategy.close("buy", when = close > TP, qty_percent = 25)+if close > TP+ strategy.close("buy", qty_percent = 25)-strategy.close("buy", when = close > TP2, qty_percent = 25)+if close > TP2+ strategy.close("buy", qty_percent = 25)-strategy.exit("stop", "exit", when = close < SL)+if close < SL+ strategy.exit("stop", "exit")Does it run in Pine Script v6?
Not tested
The v5 script does not run in Zeal Terminal's engine (Pine Script v5 Error at @L5:C149: 'obv' was renamed to 'ta.obv' in Pine Script v5.), so this step could not be checked. The v6 version is shown for reference and is not offered as a download. It differs from the v5 version by 1 edit.
⋯// © ParaBellum68-//@version=5+//@version=6strategy(title="SOJA PIVOT", shorttitle="SOJA PIVOT")⋯Settings
Every input the script declares, with its default and what it feeds. Bounds are the ones the script enforces.
The script declares no settings.
What it calculates
- ATR (
atr,ta.atrin v5)14SL · line 8
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 buy long | soja == 1 | On | 9 |
| Close buy | close > TP | On | 10 |
| Close buy | close > TP2 | On | 11 |
| Exit stop | close < SL | On | 12 |
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.
- 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 | +3.3% | +102.5% | 9 | 78% | 1.86 | 18.2% | 26 Jan 2024 – 21 Oct 2026 |
| BTCUSDT 4h | 0.0% | +5.5% | 0 | 0% | — | 0.0% | 8 May 2026 – 21 Oct 2026 |
| ETHUSDT 1D | −0.2% | +9.8% | 44 | 20% | 0.33 | 0.6% | 26 Jan 2024 – 21 Oct 2026 |
| ETHUSDT 4h | 0.0% | +8.4% | 0 | 0% | — | 0.0% | 8 May 2026 – 21 Oct 2026 |
| SOLUSDT 1D | −0.0% | +16.7% | 67 | 34% | 0.01 | 0.1% | 26 Jan 2024 – 21 Oct 2026 |
| SOLUSDT 4h | 0.0% | +21.5% | 0 | 0% | — | 0.0% | 8 May 2026 – 21 Oct 2026 |
| BNBUSDT 1D | −0.0% | +148.3% | 19 | 74% | 0.78 | 0.1% | 26 Jan 2024 – 21 Oct 2026 |
| BNBUSDT 4h | 0.0% | +17.1% | 0 | 0% | — | 0.2% | 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 | 9 | 78% | $3,281.21 |
| Sideways market | 0 | — | $0.00 |
| Falling market | 0 | — | $0.00 |
Rising and falling mean the market moved more than 15% over the 90 bars before entry.
How bad could the drawdown be?
3.8%
The 95th percentile of the worst drawdown when the same 9 trades are reshuffled 5,000 times. The bar spans the 5th to 95th percentile, 2.8% to 3.8%; the tick is what actually happened, 3.8%. Order luck alone moves it this much.
All 9 trades
| Side | Entry | Exit | Bars | P&L |
|---|---|---|---|---|
| long | 25 Mar 2024 67,210.00 | 7 Aug 2024 56,022.00 | 135 | −$2,797.00 |
| long | 25 Mar 2024 67,210.00 | 9 Aug 2024 61,686.00 | 137 | −$1,035.75 |
| long | 25 Mar 2024 67,210.00 | 7 Nov 2024 75,572.00 | 227 | $1,175.90 |
| long | 25 Mar 2024 67,210.00 | 12 Nov 2024 88,648.00 | 232 | $2,261.04 |
| long | 25 Mar 2024 67,210.00 | 3 Mar 2025 94,270.00 | 343 | $2,140.49 |
| long | 25 Mar 2024 67,210.00 | 10 Apr 2025 82,615.20 | 381 | $913.93 |
| long | 25 Mar 2024 67,210.00 | 7 Feb 2026 70,580.30 | 684 | $149.96 |
| long | 25 Mar 2024 67,210.00 | 21 Aug 2026 73,027.00 | 879 | $194.12 |
| long | 25 Mar 2024 67,210.00 | 22 Aug 2026 78,338.00 | 880 | $278.51 |
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 |
|---|---|---|---|---|---|
| SOJA PIVOT this page | — | v4 strategy | +3.3% | 9 | 18.2% |
| Volatility System by EduardoMattje | atr | v5 strategy | +150.2% | 2 | 21.5% |
| ATR Stop Buy Strategy by phobo3s | atr | v4 strategy | No trades on this market | ||
| VBand Strategy by Saravanan_Ragavan | atr | v4 strategy | No trades on this market | ||
| Volatility Breakout Strategy [Angel Algo] by AngelAlgo | atr | v5 strategy | +3.1% | 18 | 3.6% |
| ATR Mean Reversion Strategy V1 by Bcullen175 | atr | v5 strategy | −20.0% | 79 | 59.6% |
Where it runs
| Engine | Compiles | Runs | Matches TradingView |
|---|---|---|---|
| Zeal Terminal · OpenPineScript v2 | Yes 8 ms | With a workaround 1,000 bars in 41 ms | Not measured |
| PineTS | No v5 and v6 only | — | Not measured |
Zeal Terminal's engine currently reads an order side written as true as a short, whatever it says; this page passes the same side as strategy.long or strategy.short (line 9) 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.
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/// © ParaBellum68//@version=4strategy(title="SOJA PIVOT", shorttitle="SOJA PIVOT")soja = ((cmo(close,5) > 25) and (cmo(close,5) < 70) and (close> close[1]) and (bbw(close,50,1) < 0.6) and (sum(volume,5)> 250000) and (obv[5]>15))TP = 2.1 * hlc3[1]- high[1]TP2 = TP + high[1] - low[1]SL = avg(close,14) - 3*atr(14)strategy.entry("buy", true, 1, when = soja == 1)strategy.close("buy", when = close > TP, qty_percent = 25)strategy.close("buy", when = close > TP2, qty_percent = 25)strategy.exit("stop", "exit", when = close < SL)