Zeal Terminal Open in Zeal Terminal

Pine Script v5 · Strategy

VIP

A Pine Script v5 strategy with no technical-analysis calculation. It has 4 order rules, 1 entry among them, and trades long only with the default settings. Exits use a stop loss and a profit target. Each trade commits 100% of equity and pays no commission. 5 settings; defaults include MA Line Length 100, Take Profit Percentage 1 and StopLose Percentage 1.

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 VIP 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 VIP do on BTCUSDT 1D with default settings?
+11.07%
From 26 Jan 2024 to 21 Oct 2026, over 4 closed trades, against +102.5% for buy and hold. A backtest, not investment advice.
Does VIP 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: 4 before, 2 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 VIP use a stop loss?
Yes
strategy.exit sets a stop on line 73, 75.
Does VIP run in Zeal Terminal?
Yes
It compiles in 24 ms and runs 1,000 bars in 56 ms, in the browser.

BTCUSDT · 1D · default settings

  • UP
  • DOWN
  • MA Line
  • Buy Label
  • Winning trade
  • Losing trade
  • Equity
  • Buy and hold
Prerendered with the defaults. Change anything and run it here. The script runs in your browser.
Settings (4)
40,00060,00080,000100,000120,000AprJulOct2025AprJulOct2026AprJulOct$1,111$2,025Equity from $1,000
Binance BTCUSDT 1D candles, 26 Jan 2024 to 21 Oct 2026, 1,000 bars, default settings. Triangles mark entries; circles mark exits. Lines are what the script plots.
Net profit
+11.07%
$110.69
Buy and hold
+102.5%
same period
Closed trades
4
4 won · 0 lost
Profitable
100.0%
of closed trades
Profit factor
—
gross profit ÷ gross loss
Max drawdown
1.94%
−$19.62

One run with the author's default settings, $1,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 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.

SettingDefaultType and rangeFeeds
Wick ColorSuggest Full Transparency.color.rgb(80, 80, 80, 100)colorHAMA Candles
MA Line Length100int · min 1MA_1
Take Profit Percentage1float · min 0 · step 1baseProfit
Use Stop Percentagefalseboolexit SELL with VIP exit SELL with VIP line 72 line 74
StopLose Percentage1float · min 0 · step 1baseLose

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.

closecloseprice datahighhighprice datalowlowprice dataopenopenprice dataLengthMAMA Line Lengthsetting · 100TakeProfitTake Profit Percentagesetting · 1StopLoseStopLose Percentagesetting · 1MASourceMASourcevaluema1ma1valuema2ma2valueHlv1Hlv1valuesslUp1, sslDown1sslUp1 · sslDown12 valuesColor1Color1valueSourceOpenSourceOpenvalueSourceHighSourceHighvalueSourceLowSourceLowvalueSourceCloseSourceClosevalueMA_1MA_1valueCandleOpenCandleOpenvalueCandleHighCandleHighvalueCandleLowCandleLowvalueCandleCloseCandleClosevalueavgavgvaluebaseProfitbaseProfitvaluebaseLosebaseLosevaluema1_color, ma2_color, fillColor1, BodyColor, LongConditionColourma1_color · ma2_color +3entry:BUY with VIPOpen BUY with VIPstrategy.entryexit:SELL with VIPexit SELL with VIPstrategy.exitplot:34UPplotplot:35DOWNplotbarcolor:58barcolorbarcolorplotcandle:59HAMA Candlesplotcandleplot:60MA Lineplotplotshape:77Buy Labelplotshapefill:78Fillfill

Order rules

OrderFires whenBy defaultLine
Open BUY with VIP longLongConditionOn66
Exit SELL with VIP limitevery barOn71
Exit SELL with VIP stopUseStopLose and (close < MA_1)On73
Exit SELL with VIP stopnot UseStopLose and (close < MA_1)On75

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.

1/1trades identical when replayed liveThe last 300 bars, from 26 Dec 2025, were fed to the engine as live ticks, four per bar, and compared with the historical run. Orders are decided once per closed bar, so nothing can change mid-bar.
  • 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.

MarketNetBuy and holdTradesWonProfit factorMax drawdownPeriod
BTCUSDT 1D+11.1%+102.5%4100%—1.9%26 Jan 2024 – 21 Oct 2026
BTCUSDT 4h+3.0%+5.5%3100%—3.7%8 May 2026 – 21 Oct 2026
ETHUSDT 1D−9.2%+9.8%475%0.5121.3%26 Jan 2024 – 21 Oct 2026
ETHUSDT 4h+2.5%+8.4%2100%—1.0%8 May 2026 – 21 Oct 2026
SOLUSDT 1D+5.0%+16.7%3100%—6.3%26 Jan 2024 – 21 Oct 2026
SOLUSDT 4h+2.0%+21.5%2100%—0.9%8 May 2026 – 21 Oct 2026
BNBUSDT 1D+6.4%+148.3%3100%—2.8%26 Jan 2024 – 21 Oct 2026
BNBUSDT 4h−4.8%+17.1%30%0.005.3%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 barsTradesWonP&L
Rising market0—$0.00
Sideways market4100%$110.69
Falling market0—$0.00

Rising and falling mean the market moved more than 15% over the 90 bars before entry.

How bad could the drawdown be?

0.0%

The 95th percentile of the worst drawdown when the same 4 trades are reshuffled 5,000 times. The bar spans the 5th to 95th percentile, 0.0% to 0.0%; the tick is what actually happened, 0.0%. Order luck alone moves it this much.

0%1%
All 4 trades
SideEntryExitBarsP&L
long27 Sep 2024 65,174.0028 Sep 2024 65,825.701$10.00
long15 Oct 2024 66,084.0016 Oct 2024 67,074.101$15.13
long23 Apr 2025 93,443.0025 Apr 2025 94,377.402$10.25
long21 Aug 2026 73,027.0022 Aug 2026 78,338.001$75.30

Similar scripts

No other indicator or strategy here shares enough of its calculations.

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

Verified

Nothing to change.

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: 4 before, 2 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.

⋯// © Darshana_Alwis-//@version=5+//@version=6strategy("VIP", overlay=true, initial_capital=1000,currency=currency.USD,default_qty_type=strategy.percent_of_equity,default_qty_value=100,pyramiding=0)⋯

Where it runs

EngineCompilesRunsMatches TradingView
Zeal Terminal · OpenPineScript v2Yes 24 msYes 1,000 bars in 56 msNot measured
PineTSNot testedNot testedNot 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/// © Darshana_Alwis//@version=5strategy("VIP", overlay=true, initial_capital=1000,currency=currency.USD,default_qty_type=strategy.percent_of_equity,default_qty_value=100,pyramiding=0)//SSS = Sultan+Saud Strategy//The original idea of the code belonges to saudALThaidy//The strategy code is basically made out of two other indicators, edited and combined by me.// 1- NSDT HAMA Candles => https://www.tradingview.com/script/k7nrF2oI-NSDT-HAMA-Candles/// 2- SSL Channel => https://www.tradingview.com/script/6y9SkpnV-SSL-Channel///MA INFOWickColor = input.color(color.rgb(80, 80, 80, 100), title='Wick Color', tooltip='Suggest Full Transparency.')LengthMA = input.int(100, minval=1, title='MA Line Length', inline='MA Info')TakeProfit = input.float(1, minval=0, title='Take Profit Percentage', step=1)UseStopLose = input.bool(false, title='Use Stop Percentage')StopLose = input.float(1, minval=0, title='StopLose Percentage', step=1)MASource = closema(source, length, type) =>    type == "SMA" ? ta.sma(source, length) :     type == "EMA" ? ta.ema(source, length) :     type == "SMMA (RMA)" ? ta.rma(source, length) :     type == "WMA" ? ta.wma(source, length) :     type == "VWMA" ? ta.vwma(source, length) :     nama1_color  = color.rgb(230, 172, 0)ma1 = ma(high, 200, "SMA")ma2_color  = color.redma2 = ma(low, 200, "SMA")Hlv1 = float(na)Hlv1 := close > ma1 ? 1 : close < ma2 ? -1 : Hlv1[1]sslUp1   = Hlv1 < 0 ? ma2 : ma1sslDown1 = Hlv1 < 0 ? ma1 : ma2Color1 = Hlv1 == 1 ? ma1_color : ma2_colorfillColor1 = color.new(Color1, 90)highLine1 = plot(sslUp1, title="UP", linewidth=2, color = Color1)lowLine1 = plot(sslDown1, title="DOWN", linewidth=2, color = Color1)OpenLength = 25HighLength = 20LowLength = 20CloseLength = 20     SourceOpen = (open[1] + close[1]) / 2SourceHigh = math.max(high, close)SourceLow = math.min(low, close)SourceClose = (open + high + low + close) / 4funcCalcMA1(src1, len1) => ta.ema(src1, len1)funcCalcOpen(SourceOpen, OpenLength) => ta.ema(SourceOpen, OpenLength)funcCalcHigh(SourceHigh, HighLength) => ta.ema(SourceHigh, HighLength)funcCalcLow(SourceLow, LowLength) => ta.ema(SourceLow, LowLength)funcCalcClose(SourceClose, CloseLength) => ta.ema(SourceClose, CloseLength)MA_1 = funcCalcMA1(MASource, LengthMA)CandleOpen = funcCalcOpen(SourceOpen, OpenLength)CandleHigh = funcCalcHigh(SourceHigh, HighLength)CandleLow = funcCalcLow(SourceLow, LowLength)CandleClose = funcCalcClose(SourceClose, CloseLength)//PLOT CANDLES//-------------------------------NSDT HAMA CandelsBodyColor = CandleOpen > CandleOpen[1] ? color.rgb(230, 172, 0) : color.redbarcolor(BodyColor)plotcandle(CandleOpen, CandleHigh, CandleLow, CandleClose, color=BodyColor, title='HAMA Candles', wickcolor=WickColor, bordercolor=na)plot(MA_1, title='MA Line', color=BodyColor, style=plot.style_line, linewidth=2)//------------------------------SSL Channelplot_buy = falseavg = ((high-low)/2)+lowLongCondition = (Hlv1 == 1 and Hlv1[1] == -1) and (BodyColor == color.rgb(230, 172, 0)) and (MA_1 < avg) and (CandleHigh < avg) and (strategy.opentrades == 0)if LongCondition    strategy.entry("BUY with VIP", strategy.long)    plot_buy := truebase = strategy.opentrades.entry_price(0)baseProfit = (base+((base/100)*TakeProfit))baseLose = (base-((base/100)*StopLose))strategy.exit("SELL with VIP","BUY with VIP",limit = baseProfit)if UseStopLose and (close < MA_1)    strategy.exit("SELL with VIP","BUY with VIP",stop = baseLose)if not UseStopLose and (close < MA_1)    strategy.exit("SELL with VIP","BUY with VIP", stop = close)    plotshape(plot_buy, title="Buy Label", text="Buy", location=location.belowbar, style=shape.labelup, size=size.tiny, color=Color1, textcolor=color.white)fill(highLine1, lowLine1, color = fillColor1)