Pine Script v4 · Strategy
VWAP + Fibo Dev Extensions Strategy
A Pine Script v4 strategy with no technical-analysis calculation. 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 is one contract and pays 0.08 commission. 4 settings; defaults include Fibo extension 1 1.618, Fibo extension 2 2.618 and Resolution VWAP W.
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 VWAP + Fibo Dev Extensions Strategy repaint?
- No
- No repainting patterns were found in the source. The live replay was not measured: it had no trades to compare.
- How did VWAP + Fibo Dev Extensions Strategy do on BTCUSDT 1D with default settings?
- Not measured
- It closed no trades there from 26 Jan 2024 to 21 Oct 2026 with the default settings, so there is no result to report. Its entry conditions never all held on this data. It closed no trades on the other markets either. A backtest, not investment advice.
- Can VWAP + Fibo Dev Extensions Strategy be converted to Pine Script v5?
- No
- The automatic step from v4 to v5 changes the results, so no v5 download is offered; the edits are shown below.
- Does VWAP + Fibo Dev Extensions Strategy use a stop loss?
- No
- Every exit waits for a signal; nothing limits a losing trade before it fires.
- Does VWAP + Fibo Dev Extensions Strategy run in Zeal Terminal?
- Yes
- It compiles in 16 ms and runs 1,000 bars in 35 ms, in the browser.
BTCUSDT · 1D · default settings
- VWAP
- Plot
- Plot
- Plot
- Plot
- Winning trade
- Losing trade
- Equity
- Buy and hold
- Net profit
- 0.00%
- $0.00
- Buy and hold
- +102.5%
- same period
- Closed trades
- 0
- 0 won · 0 lost
- Profitable
- 0.0%
- of closed trades
- Profit factor
- —
- gross profit ÷ gross loss
- Max drawdown
- 0.00%
- $0.00
One run with the author's default settings, $100,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.
-
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 49, 50, 51, 52. 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 sqrt → math.sqrt, crossunder → ta.crossunder, crossover → ta.crossover.
- 4 strategy calls use the when = argument (line 49, 50, 51, 52). It is deprecated in v5 and removed in v6, where each call moves inside an if block.
v4 → v5
DiffersTrades differ: 0 before, 15 after on BTCUSDT 1D, 1,000 bars, in Zeal Terminal's engine.
- Line 3: //@version=4 → //@version=5
- Line 8: input(type = input.float) → input.float()
- Line 9: input(type = input.float) → input.float()
- Line 10: input(type = input.resolution) → input.timeframe()
- Line 11: input(type = input.integer) → input.int()
- Line 24: sqrt → math.sqrt
8 more edits
- Line 42: crossunder → ta.crossunder
- Line 43: crossover → ta.crossover
- Line 49: strategy.entry(…, true) → strategy.entry(…, strategy.long)
- Line 50: crossover → ta.crossover
- Line 50: crossunder → ta.crossunder
- Line 51: strategy.entry(…, false) → strategy.entry(…, strategy.short)
- Line 52: crossunder → ta.crossunder
- Line 52: crossover → ta.crossover
⋯// © Mysteriown-//@version=4+//@version=5strategy(title="VWAP + Fibo Dev Extensions Strategy", overlay=true, pyramiding=5, commission_value=0.08)⋯// --------------------------------------fib1 = input(title="Fibo extension 1", type=input.float, defval=1.618)+fib1 = input.float(title="Fibo extension 1", defval=1.618)-fib2 = input(title="Fibo extension 2", type=input.float, defval=2.618)+fib2 = input.float(title="Fibo extension 2", defval=2.618)-reso = input(title="Resolution VWAP", type=input.resolution, defval="W")+reso = input.timeframe(title="Resolution VWAP", defval="W")-dev = input(title="Deviation value min.", type=input.integer, defval=150)+dev = input.int(title="Deviation value min.", defval=150)// -------------------------------------⋯sn := debut ? sn : sn[1] + volume * (hlc3 - VWAP[1]) * (hlc3 - VWAP)-sd = sqrt(sn / addvol)+sd = math.sqrt(sn / addvol)Fibp2 = VWAP + fib2 * sd⋯// --------------------------------------bull = crossunder(low[1],Fibm1[1]) and low[1]>=Fibm2[1] and low>Fibm2 and low<Fibm1 and sd>dev+bull = ta.crossunder(low[1],Fibm1[1]) and low[1]>=Fibm2[1] and low>Fibm2 and low<Fibm1 and sd>dev-bear = crossover(high[1],Fibp1[1]) and high[1]<=Fibp2[1] and high<Fibp2 and high>Fibp1 and sd>dev+bear = ta.crossover(high[1],Fibp1[1]) and high[1]<=Fibp2[1] and high<Fibp2 and high>Fibp1 and sd>dev//plotshape(bear, title='Bear', style=shape.triangledown, location=location.abovebar, color=color.red, offset=0)⋯// --------------------------------------strategy.entry("Long", true, when = bull)+strategy.entry("Long", strategy.long, when = bull)-strategy.close("Long", when = crossover(high,VWAP) or crossunder(low,Fibm2))+strategy.close("Long", when = ta.crossover(high,VWAP) or ta.crossunder(low,Fibm2))-strategy.entry("Short", false, when = bear)+strategy.entry("Short", strategy.short, when = bear)-strategy.close("Short", when = crossunder(low,VWAP) or crossover(high,Fibp2))+strategy.close("Short", when = ta.crossunder(low,VWAP) or ta.crossover(high,Fibp2))Clean v5
VerifiedSame 15 trades and the same P&L on BTCUSDT 1D, 1,000 bars, in Zeal Terminal's engine.
- Line 49: when = bull → if block
- Line 50: when = ta.crossover(high,VWAP) or ta.crossunder(low,Fibm2) → if block
- Line 51: when = bear → if block
- Line 52: when = ta.crossunder(low,VWAP) or ta.crossover(high,Fibp2) → if block
⋯// --------------------------------------strategy.entry("Long", strategy.long, when = bull)+if bull+ strategy.entry("Long", strategy.long)-strategy.close("Long", when = ta.crossover(high,VWAP) or ta.crossunder(low,Fibm2))+if ta.crossover(high,VWAP) or ta.crossunder(low,Fibm2)+ strategy.close("Long")-strategy.entry("Short", strategy.short, when = bear)+if bear+ strategy.entry("Short", strategy.short)-strategy.close("Short", when = ta.crossunder(low,VWAP) or ta.crossover(high,Fibp2))+if ta.crossunder(low,VWAP) or ta.crossover(high,Fibp2)+ strategy.close("Short")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, 25 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.
⋯// © Mysteriown-//@version=5+//@version=6strategy(title="VWAP + Fibo Dev Extensions Strategy", overlay=true, pyramiding=5, commission_value=0.08)⋯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 |
|---|---|---|---|
| Fibo extension 1 | 1.618 | float | Fibp1 Fibm1 |
| Fibo extension 2 | 2.618 | float | Fibp2 Fibm2 |
| Resolution VWAP | W | timeframe (written input.resolution) | t |
| Deviation value min. | 150 | int (written input.integer) | bull bear |
What it calculates
No technical-analysis calculation: the script works on prices and settings directly.
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 | bullcrossunder(low[1],Fibm1[1]) and low[1]>=Fibm2[1] and low>Fibm2 and low<Fibm1 and sd>dev | On | 49 |
| Close Long | crossover(high,VWAP) or crossunder(low,Fibm2) | On | 50 |
| Open Short short | bearcrossover(high[1],Fibp1[1]) and high[1]<=Fibp2[1] and high<Fibp2 and high>Fibp1 and sd>dev | On | 51 |
| Close Short | crossunder(low,VWAP) or crossover(high,Fibp2) | On | 52 |
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 | 0.0% | +102.5% | 0 | 0% | — | 0.0% | 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.0% | +9.8% | 0 | 0% | — | 0.0% | 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% | 0 | 0% | — | 0.0% | 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% | 0 | 0% | — | 0.0% | 26 Jan 2024 – 21 Oct 2026 |
| BNBUSDT 4h | 0.0% | +17.1% | 0 | 0% | — | 0.0% | 8 May 2026 – 21 Oct 2026 |
Backtests are simulations on historical data and are not investment advice.
Similar scripts
No other indicator or strategy here shares enough of its calculations.
Where it runs
| Engine | Compiles | Runs | Matches TradingView |
|---|---|---|---|
| Zeal Terminal · OpenPineScript v2 | Yes 16 ms | With a workaround 1,000 bars in 35 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 49, 51) 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/// © Mysteriown//@version=4strategy(title="VWAP + Fibo Dev Extensions Strategy", overlay=true, pyramiding=5, commission_value=0.08)// -------------------------------------// ------- Inputs Fibos Values ---------// -------------------------------------fib1 = input(title="Fibo extension 1", type=input.float, defval=1.618)fib2 = input(title="Fibo extension 2", type=input.float, defval=2.618)reso = input(title="Resolution VWAP", type=input.resolution, defval="W")dev = input(title="Deviation value min.", type=input.integer, defval=150)// -------------------------------------// -------- VWAP Calculations ----------// -------------------------------------t = time(reso)debut = na(t[1]) or t > t[1]addsource = hlc3 * volumeaddvol = volumeaddsource := debut ? addsource : addsource + addsource[1]addvol := debut ? addvol : addvol + addvol[1]VWAP = addsource / addvolsn = 0.0sn := debut ? sn : sn[1] + volume * (hlc3 - VWAP[1]) * (hlc3 - VWAP)sd = sqrt(sn / addvol)Fibp2 = VWAP + fib2 * sdFibp1 = VWAP + fib1 * sdFibm1 = VWAP - fib1 * sdFibm2 = VWAP - fib2 * sd// -------------------------------------// -------------- Plots ----------------// -------------------------------------plot(VWAP, title="VWAP", color=color.orange)pFibp2 = plot(Fibp2, color=color.red)pFibp1 = plot(Fibp1, color=color.red)pFibm1 = plot(Fibm1, color=color.lime)pFibm2 = plot(Fibm2, color=color.lime)fill(pFibp2,pFibp1, color.red)fill(pFibm2,pFibm1, color.lime)// -------------------------------------// ------------ Positions --------------// -------------------------------------bull = crossunder(low[1],Fibm1[1]) and low[1]>=Fibm2[1] and low>Fibm2 and low<Fibm1 and sd>devbear = crossover(high[1],Fibp1[1]) and high[1]<=Fibp2[1] and high<Fibp2 and high>Fibp1 and sd>dev//plotshape(bear, title='Bear', style=shape.triangledown, location=location.abovebar, color=color.red, offset=0)//plotshape(bull, title='Bull', style=shape.triangleup, location=location.belowbar, color=color.green, offset=0)// -------------------------------------// --------- Strategy Orders -----------// -------------------------------------strategy.entry("Long", true, when = bull)strategy.close("Long", when = crossover(high,VWAP) or crossunder(low,Fibm2))strategy.entry("Short", false, when = bear)strategy.close("Short", when = crossunder(low,VWAP) or crossover(high,Fibp2))