Pine Script v4 · Strategy
Nifty Volume profile + VWAP + EMA
A Pine Script v4 strategy built on EMA (close, 8), Crossover (fastEma, slowEma) and Crossunder (fastEma, slowEma). It has 0 order rules and no entry of its own. Exits wait for a signal; there is no stop loss. Each trade is one contract and pays no commission. 3 settings; defaults include Period 14, Period 8 and Period 5.
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 Nifty Volume profile + VWAP + EMA repaint?
- No
- No repainting patterns were found in the source. The live replay was not measured: it had no trades to compare.
- How did Nifty Volume profile + VWAP + EMA 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 Nifty Volume profile + VWAP + EMA be converted to Pine Script v5?
- Not tested
- The steps are shown below, but neither version placed a trade on any market tested, so there was nothing to compare and no download is offered.
- Does Nifty Volume profile + VWAP + EMA use a stop loss?
- No
- Every exit waits for a signal; nothing limits a losing trade before it fires.
- Does Nifty Volume profile + VWAP + EMA run in Zeal Terminal?
- Yes
- It compiles in 19 ms and runs 1,000 bars in 131 ms, in the browser.
BTCUSDT · 1D · default settings
- Fast EMA
- Slow EMA
- Long
- Short
- Winning trade
- Losing trade
- Equity
- Buy and hold
Needs NSE:HDFCBANK D data, not available: not a Binance spot market Needs NSE:RELIANCE D data, not available: not a Binance spot market Needs NSE:HDFC D data, not available: not a Binance spot market Needs NSE:ICICIBANK D data, not available: not a Binance spot market Needs NSE:INFY D data, not available: not a Binance spot market Needs NSE:TCS D data, not available: not a Binance spot market Needs NSE:KOTAKBANK D data, not available: not a Binance spot market Needs NSE:ITC D data, not available: not a Binance spot market Needs NSE:AXISBANK D data, not available: not a Binance spot market Needs NSE:LT D data, not available: not a Binance spot market Needs NSE:HINDUNILVR D data, not available: not a Binance spot market Needs NSE:SBIN D data, not available: not a Binance spot market Needs NSE:BAJFINANCE D data, not available: not a Binance spot market Needs NSE:MARUTI D data, not available: not a Binance spot market Needs NSE:INDUSINDBK D data, not available: not a Binance spot market Needs NSE:BHARTIARTL D data, not available: not a Binance spot market Needs NSE:ASIANPAINT D data, not available: not a Binance spot market Needs NSE:HCLTECH D data, not available: not a Binance spot market Needs NSE:BAJAJFINSV D data, not available: not a Binance spot market Needs NSE:NTPC D data, not available: not a Binance spot market Needs NSE:NESTLEIND D data, not available: not a Binance spot market Needs NSE:TITAN D data, not available: not a Binance spot market Needs NSE:M_M D data, not available: not a Binance spot market Needs NSE:TECHM D data, not available: not a Binance spot market Needs NSE:SUNPHARMA D data, not available: not a Binance spot market Needs NSE:ULTRACEMCO D data, not available: not a Binance spot market Needs NSE:POWERGRID D data, not available: not a Binance spot market Needs NSE:ONGC D data, not available: not a Binance spot market Needs NSE:BAJAJ_AUTO D data, not available: not a Binance spot market Needs NSE:COALINDIA D data, not available: not a Binance spot market Needs NSE:BPCL D data, not available: not a Binance spot market Needs NSE:WIPRO D data, not available: not a Binance spot market Needs NSE:BRITANNIA D data, not available: not a Binance spot market Needs NSE:TATASTEEL D data, not available: not a Binance spot market Needs NSE:DRREDDY D data, not available: not a Binance spot market Needs NSE:TATAMOTORS D data, not available: not a Binance spot market Needs NSE:IOC D data, not available: not a Binance spot market Needs NSE:UPL D data, not available: not a Binance spot market Needs NSE:EICHERMOT D data, not available: not a Binance spot market Needs NSE:HEROMOTOCO D data, not available: not a Binance spot market Values that depend on it are empty on this chart.
- 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.
-
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.
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 security → request.security, sum → math.sum, ema → ta.ema, crossover → ta.crossover, crossunder → ta.crossunder.
v4 → v5
Not verifiedNeither version placed a trade on any of the 8 markets, so there was nothing to compare.
- Line 3: //@version=4 → //@version=5
- Line 6: security → request.security
- Line 20: sum → math.sum
- Line 21: sum → math.sum
- Line 23: ema → ta.ema
- Line 24: ema → ta.ema
- Line 29: crossover → ta.crossover
- Line 30: crossunder → ta.crossunder
⋯// © aashish2137-//@version=4+//@version=5strategy("NF VWAP and EMA",overlay=true)// custom function -sym(s) => security(s,timeframe.period, volume)+sym(s) => request.security(s,timeframe.period, volume) ⋯priceVolume = priceValue * A-cumulativePriceVolume = sum(priceVolume, volumePeriod)+cumulativePriceVolume = math.sum(priceVolume, volumePeriod)-cumulativeVolume = sum(A, volumePeriod)+cumulativeVolume = math.sum(A, volumePeriod)vwapValue = cumulativePriceVolume / cumulativeVolume-fastEma = ema(close, fastEmaPeriod)+fastEma = ta.ema(close, fastEmaPeriod)-slowEma = ema(close, slowEmaPeriod)+slowEma = ta.ema(close, slowEmaPeriod)plot(series=vwapValue, title="VWAP BNF", style=plot.style_line, color= color.black)⋯ -longCond = crossover(fastEma, slowEma)+longCond = ta.crossover(fastEma, slowEma)-shortCond = crossunder(fastEma, slowEma)+shortCond = ta.crossunder(fastEma, slowEma) ⋯Clean v5
Not verifiedNeither version placed a trade on any of the 8 markets, so there was nothing to compare.
- Line 15: input() → input.int()
- Line 16: input() → input.int()
- Line 17: input() → input.int()
⋯ -volumePeriod = input(14, "Period")+volumePeriod = input.int(14, "Period")-fastEmaPeriod = input(8, "Period")+fastEmaPeriod = input.int(8, "Period")-slowEmaPeriod = input(5, "Period")+slowEmaPeriod = input.int(5, "Period")priceValue = (high + low + close) / 3⋯Does it run in Pine Script v6?
Not tested
Neither version placed a trade on any of the 8 markets, so there was nothing to compare. The v6 version is shown for reference and is not offered as a download. It differs from the v5 version by 1 edit.
⋯// © aashish2137-//@version=5+//@version=6strategy("NF VWAP and EMA",overlay=true)⋯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 |
|---|---|---|---|
| Period | 14 | int | cumulativePriceVolume cumulativeVolume |
| Period | 8 | int | fastEma |
| Period | 5 | int | slowEma |
What it calculates
- EMA (
ema,ta.emain v5)close, Period (8)fastEma · line 23 - EMA (
ema,ta.emain v5)close, Period (5)slowEma · line 24 - Crossover (
crossover,ta.crossoverin v5)fastEma, slowEmalongCond · line 29 - Crossunder (
crossunder,ta.crossunderin v5)fastEma, slowEmashortCond · line 30
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
The script places no orders.
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 data1 security call(s), none with lookahead on.
- 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
Not run on other markets: the script requests NSE:HDFCBANK D, NSE:RELIANCE D, NSE:HDFC D, NSE:ICICIBANK D, NSE:INFY D, NSE:TCS D, NSE:KOTAKBANK D, NSE:ITC D, NSE:AXISBANK D, NSE:LT D, NSE:HINDUNILVR D, NSE:SBIN D, NSE:BAJFINANCE D, NSE:MARUTI D, NSE:INDUSINDBK D, NSE:BHARTIARTL D, NSE:ASIANPAINT D, NSE:HCLTECH D, NSE:BAJAJFINSV D, NSE:NTPC D, NSE:NESTLEIND D, NSE:TITAN D, NSE:M_M D, NSE:TECHM D, NSE:SUNPHARMA D, NSE:ULTRACEMCO D, NSE:POWERGRID D, NSE:ONGC D, NSE:BAJAJ_AUTO D, NSE:COALINDIA D, NSE:BPCL D, NSE:WIPRO D, NSE:BRITANNIA D, NSE:TATASTEEL D, NSE:DRREDDY D, NSE:TATAMOTORS D, NSE:IOC D, NSE:UPL D, NSE:EICHERMOT D, NSE:HEROMOTOCO D, and that data is not available here (not a Binance spot market; not a Binance spot market; not a Binance spot market; not a Binance spot market; not a Binance spot market; not a Binance spot market; not a Binance spot market; not a Binance spot market; not a Binance spot market; not a Binance spot market; not a Binance spot market; not a Binance spot market; not a Binance spot market; not a Binance spot market; not a Binance spot market; not a Binance spot market; not a Binance spot market; not a Binance spot market; not a Binance spot market; not a Binance spot market; not a Binance spot market; not a Binance spot market; not a Binance spot market; not a Binance spot market; not a Binance spot market; not a Binance spot market; not a Binance spot market; not a Binance spot market; not a Binance spot market; not a Binance spot market; not a Binance spot market; not a Binance spot market; not a Binance spot market; not a Binance spot market; not a Binance spot market; not a Binance spot market; not a Binance spot market; not a Binance spot market; not a Binance spot market; not a Binance spot market). Its results would rest on empty values.
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 |
|---|---|---|---|---|---|
| Nifty Volume profile + VWAP + EMA this page | — | v4 strategy | 0.0% | 0 | 0.0% |
| EMA Slope AyE by fajardoarelys | ema | v4 strategy | No trades on this market | ||
| ROoT by realisticDove62527 | ema | v5 strategy | −4.7% | 225 | 9.4% |
| sachin5986 by mohitesachin78 | ema | v4 strategy | +32.1% | 35 | 17.6% |
| sonu1997 by Sonu1997 | ema | v4 strategy | +960.7% | 2 | 1,103.8% |
| Moving Average Crossover by Muh4mm4d | ema | v4 strategy | +19,990.1% | 30 | 1,274.2% |
Where it runs
| Engine | Compiles | Runs | Matches TradingView |
|---|---|---|---|
| Zeal Terminal · OpenPineScript v2 | Yes 19 ms | With a workaround 1,000 bars in 131 ms | Not measured |
| PineTS | No v5 and v6 only | — | Not measured |
The engine's host API cannot yet declare a chart's symbol and timeframe, so this page sets them on the engine directly for each market.
“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/// © aashish2137//@version=4strategy("NF VWAP and EMA",overlay=true)// custom function sym(s) => security(s,timeframe.period, volume) // make the weighted index A = (10.34*sym("NSE:HDFCBANK")/100+11.88*sym("NSE:RELIANCE")/100+7.2*sym("NSE:HDFC")/100+5.39*sym("NSE:ICICIBANK")/100+6.35*sym("NSE:INFY")/100+5.2*sym("NSE:TCS")/100+4.11*sym("NSE:KOTAKBANK")/100+4.32*sym("NSE:ITC")/100+2.18*sym("NSE:AXISBANK")/100+2.89*sym("NSE:LT")/100+3.69*sym("NSE:HINDUNILVR")/100+1.55*sym("NSE:SBIN")/100+1.3*sym("NSE:BAJFINANCE")/100+1.87*sym("NSE:MARUTI")/100+1.82*sym("NSE:INDUSINDBK")/100+3.1*sym("NSE:BHARTIARTL")/100+1.9*sym("NSE:ASIANPAINT")/100+1.5*sym("NSE:HCLTECH")/100+1.13*sym("NSE:BAJAJFINSV")/100+1.19*sym("NSE:NTPC")/100+1.57*sym("NSE:NESTLEIND")/100+0.93*sym("NSE:TITAN")/100+1.05*sym("NSE:M_M")/100+0.82*sym("NSE:TECHM")/100+1.28*sym("NSE:SUNPHARMA")/100+1.13*sym("NSE:ULTRACEMCO")/100+1.01*sym("NSE:POWERGRID")/100+0.76*sym("NSE:ONGC")/100+0.89*sym("NSE:BAJAJ_AUTO")/100+0.74*sym("NSE:COALINDIA")/100+0.69*sym("NSE:BPCL")/100+0.79*sym("NSE:WIPRO")/100+1*sym("NSE:BRITANNIA")/100+0.71*sym("NSE:TATASTEEL")/100+1.24*sym("NSE:DRREDDY")/100+0.66*sym("NSE:TATAMOTORS")/100+0.64*sym("NSE:IOC")/100+0.64*sym("NSE:UPL")/100+0.63*sym("NSE:EICHERMOT")/100+0.77*sym("NSE:HEROMOTOCO")/100) colorofbar = open < close ? color.green : color.red volumePeriod = input(14, "Period")fastEmaPeriod = input(8, "Period")slowEmaPeriod = input(5, "Period")priceValue = (high + low + close) / 3priceVolume = priceValue * AcumulativePriceVolume = sum(priceVolume, volumePeriod)cumulativeVolume = sum(A, volumePeriod)vwapValue = cumulativePriceVolume / cumulativeVolumefastEma = ema(close, fastEmaPeriod)slowEma = ema(close, slowEmaPeriod)plot(series=vwapValue, title="VWAP BNF", style=plot.style_line, color= color.black)plot(series=fastEma, title="Fast EMA", style=plot.style_line, color= color.green)plot(series=slowEma, title="Slow EMA", style=plot.style_line, color= color.red) longCond = crossover(fastEma, slowEma)shortCond = crossunder(fastEma, slowEma) plotshape(series=longCond, title="Long", style=shape.cross, location=location.bottom, color=color.green, text="LONG", size=size.small)plotshape(series=shortCond, title="Short", style=shape.cross, location=location.bottom, color=color.red, text="SHORT", size=size.small)