Zeal Terminal Open in Zeal Terminal

Pine Script v4 · Strategy

Trend Ravi Trial

A Pine Script v4 strategy with no technical-analysis calculation. It has 2 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 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 Trend Ravi Trial repaint?
No
No repainting patterns were found in the source. The live replay was not measured: it had no trades to compare.
How did Trend Ravi Trial do on BTCUSDT 1D with default settings?
+157.76%
From 26 Jan 2024 to 21 Oct 2026, over 99 closed trades, against +102.5% for buy and hold. A backtest, not investment advice.
Can Trend Ravi Trial be converted to Pine Script v5?
Yes
The upgrade takes 1 step, from v4; each was run before and after on the same candles with identical results, and the v5 script can be downloaded below.
Does Trend Ravi Trial use a stop loss?
No
Every exit waits for a signal; nothing limits a losing trade before it fires.
Does Trend Ravi Trial run in Zeal Terminal?
Yes
It compiles in 4 ms and runs 1,000 bars in 10 ms, in the browser.

BTCUSDT · 1D · default settings

  • Plot
  • 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 (0)
40,00060,00080,000100,000120,000AprJulOct2025AprJulOct2026AprJulOctPlot$49,584$202,527Equity from $100,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
+157.76%
$157,760.00
Buy and hold
+102.5%
same period
Closed trades
99
61 won · 38 lost
Profitable
61.6%
of closed trades
Profit factor
1.25
gross profit ÷ gross loss
Max drawdown
211.98%
−$691,545.00

One run with the author's default settings, $100,000 starting capital, commission as the script sets it. A short 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

    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.

  • Note

    Uses an argument v6 removed

    when = on line 6, 7. 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.

  • 2 strategy calls use the when = argument (line 6, 7). It is deprecated in v5 and removed in v6, where each call moves inside an if block.

v4 → v5

Verified

Same 99 trades and the same P&L on BTCUSDT 1D, 1,000 bars, in Zeal Terminal's engine.

  • Line 3: //@version=4 → //@version=5
⋯// © abhimanyoo-//@version=4+//@version=5strategy("test")⋯

Clean v5

VerifiedDownload the v5 script

Same 99 trades and the same P&L on BTCUSDT 1D, 1,000 bars, in Zeal Terminal's engine.

  • Line 6: when = strategy.position_size <= 0 → if block
  • Line 7: when = strategy.position_size > 0 → if block
⋯if bar_index < 100-    strategy.entry("buy", strategy.long, 10, when=strategy.position_size <= 0)+    if strategy.position_size <= 0+        strategy.entry("buy", strategy.long, 10)-    strategy.entry("sell", strategy.short, 10, when=strategy.position_size > 0)+    if strategy.position_size > 0+        strategy.entry("sell", strategy.short, 10)plot(strategy.equity)

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: 99 before, 0 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.

⋯// © abhimanyoo-//@version=5+//@version=6strategy("test")⋯

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

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.

entry:buyOpen buystrategy.entryentry:sellOpen sellstrategy.entryplot:8plotplot

Order rules

OrderFires whenBy defaultLine
Open buy longstrategy.position_size <= 0On6
Open sell shortstrategy.position_size > 0On7

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.

Not measuredNo trades to compareThe last 300 bars, from 26 Dec 2025, were fed to the engine as live ticks, but neither the live nor the historical run produced any trades in them, so the replay says nothing either way.
  • 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+157.8%+102.5%9962%1.25212.0%26 Jan 2024 – 21 Oct 2026
BTCUSDT 4h−65.3%+5.5%9940%0.70159.4%8 May 2026 – 21 Oct 2026
ETHUSDT 1D+7.8%+9.8%9961%1.2220.4%26 Jan 2024 – 21 Oct 2026
ETHUSDT 4h−2.0%+8.4%9938%0.729.2%8 May 2026 – 21 Oct 2026
SOLUSDT 1D+0.4%+16.7%9956%1.171.8%26 Jan 2024 – 21 Oct 2026
SOLUSDT 4h−0.1%+21.5%9944%0.730.5%8 May 2026 – 21 Oct 2026
BNBUSDT 1D+3.0%+148.3%9961%1.618.0%26 Jan 2024 – 21 Oct 2026
BNBUSDT 4h−0.8%+17.1%9942%0.652.5%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 market8462%$160,154.00
Sideways market1560%−$2,393.30
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?

76.1%

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

0%88%
All 99 trades
SideEntryExitBarsP&L
long27 Jan 2024 41,823.5028 Jan 2024 42,120.601$2,971.20
short28 Jan 2024 42,120.6029 Jan 2024 42,031.101$895.80
long29 Jan 2024 42,031.1030 Jan 2024 43,302.701$12,716.60
short30 Jan 2024 43,302.7031 Jan 2024 42,941.101$3,616.10
long31 Jan 2024 42,941.101 Feb 2024 42,580.001−$3,611.00
short1 Feb 2024 42,580.002 Feb 2024 43,082.901−$5,029.50
long2 Feb 2024 43,082.903 Feb 2024 43,200.001$1,170.40
short3 Feb 2024 43,200.004 Feb 2024 43,011.101$1,888.90
long4 Feb 2024 43,011.105 Feb 2024 42,582.901−$4,282.20
short5 Feb 2024 42,582.906 Feb 2024 42,708.701−$1,258.20
long6 Feb 2024 42,708.707 Feb 2024 43,099.001$3,902.60
short7 Feb 2024 43,099.008 Feb 2024 44,349.601−$12,506.40
long8 Feb 2024 44,349.609 Feb 2024 45,288.701$9,390.60
short9 Feb 2024 45,288.7010 Feb 2024 47,132.801−$18,441.20
long10 Feb 2024 47,132.8011 Feb 2024 47,751.101$6,183.00
short11 Feb 2024 47,751.1012 Feb 2024 48,300.001−$5,489.20
long12 Feb 2024 48,300.0013 Feb 2024 49,917.301$16,172.80
short13 Feb 2024 49,917.3014 Feb 2024 49,699.601$2,176.80
long14 Feb 2024 49,699.6015 Feb 2024 51,795.201$20,955.70
short15 Feb 2024 51,795.2016 Feb 2024 51,880.001−$848.40
long16 Feb 2024 51,880.0017 Feb 2024 52,124.101$2,440.90
short17 Feb 2024 52,124.1018 Feb 2024 51,642.601$4,814.60
long18 Feb 2024 51,642.6019 Feb 2024 52,137.701$4,950.40
short19 Feb 2024 52,137.7020 Feb 2024 51,774.701$3,629.40
long20 Feb 2024 51,774.7021 Feb 2024 52,258.801$4,840.80
short21 Feb 2024 52,258.8022 Feb 2024 51,849.401$4,094.40
long22 Feb 2024 51,849.4023 Feb 2024 51,288.401−$5,609.60
short23 Feb 2024 51,288.4024 Feb 2024 50,744.201$5,442.70
long24 Feb 2024 50,744.2025 Feb 2024 51,568.201$8,240.60
short25 Feb 2024 51,568.2026 Feb 2024 51,728.801−$1,606.40
long26 Feb 2024 51,728.8027 Feb 2024 54,476.501$27,476.30
short27 Feb 2024 54,476.5028 Feb 2024 57,037.301−$25,608.70
long28 Feb 2024 57,037.3029 Feb 2024 62,432.101$53,947.60
short29 Feb 2024 62,432.101 Mar 2024 61,131.001$13,011.20
long1 Mar 2024 61,131.002 Mar 2024 62,387.901$12,569.10
short2 Mar 2024 62,387.903 Mar 2024 61,987.301$4,006.20
long3 Mar 2024 61,987.304 Mar 2024 63,114.001$11,266.90
short4 Mar 2024 63,114.005 Mar 2024 68,245.701−$51,317.40
long5 Mar 2024 68,245.706 Mar 2024 63,724.001−$45,217.00
short6 Mar 2024 63,724.007 Mar 2024 66,074.001−$23,500.30
long7 Mar 2024 66,074.008 Mar 2024 66,823.201$7,491.40
short8 Mar 2024 66,823.209 Mar 2024 68,124.201−$13,010.20
long9 Mar 2024 68,124.2010 Mar 2024 68,313.301$1,890.80
short10 Mar 2024 68,313.3011 Mar 2024 68,955.901−$6,426.00
long11 Mar 2024 68,955.9012 Mar 2024 72,078.101$31,222.20
short12 Mar 2024 72,078.1013 Mar 2024 71,452.001$6,261.00
long13 Mar 2024 71,452.0014 Mar 2024 73,072.401$16,204.00
short14 Mar 2024 73,072.4015 Mar 2024 71,388.901$16,834.60
long15 Mar 2024 71,388.9016 Mar 2024 69,499.801−$18,891.00
short16 Mar 2024 69,499.8017 Mar 2024 65,300.601$41,992.00
long17 Mar 2024 65,300.6018 Mar 2024 68,393.501$30,928.30
short18 Mar 2024 68,393.5019 Mar 2024 67,610.001$7,834.70
long19 Mar 2024 67,610.0020 Mar 2024 61,937.401−$56,725.90
short20 Mar 2024 61,937.4021 Mar 2024 67,840.501−$59,031.00
long21 Mar 2024 67,840.5022 Mar 2024 65,501.301−$23,392.30
short22 Mar 2024 65,501.3023 Mar 2024 63,796.601$17,046.40
long23 Mar 2024 63,796.6024 Mar 2024 63,990.001$1,933.80
short24 Mar 2024 63,990.0025 Mar 2024 67,210.001−$32,199.80
long25 Mar 2024 67,210.0026 Mar 2024 69,880.001$26,700.00
short26 Mar 2024 69,880.0027 Mar 2024 69,988.001−$1,079.90
long27 Mar 2024 69,988.0028 Mar 2024 69,470.001−$5,180.00
short28 Mar 2024 69,470.0029 Mar 2024 70,780.601−$13,106.10
long29 Mar 2024 70,780.6030 Mar 2024 69,850.501−$9,300.70
short30 Mar 2024 69,850.5031 Mar 2024 69,582.201$2,683.60
long31 Mar 2024 69,582.201 Apr 2024 71,280.001$16,978.30
short1 Apr 2024 71,280.002 Apr 2024 69,649.801$16,301.90
long2 Apr 2024 69,649.803 Apr 2024 65,464.001−$41,858.20
short3 Apr 2024 65,464.004 Apr 2024 65,963.301−$4,992.80
long4 Apr 2024 65,963.305 Apr 2024 68,487.801$25,245.30
short5 Apr 2024 68,487.806 Apr 2024 67,820.601$6,671.70
long6 Apr 2024 67,820.607 Apr 2024 68,896.001$10,753.70
short7 Apr 2024 68,896.008 Apr 2024 69,360.401−$4,643.80
long8 Apr 2024 69,360.409 Apr 2024 71,620.001$22,596.20
short9 Apr 2024 71,620.0010 Apr 2024 69,146.001$24,740.00
long10 Apr 2024 69,146.0011 Apr 2024 70,631.101$14,850.80
short11 Apr 2024 70,631.1012 Apr 2024 70,006.201$6,248.60
long12 Apr 2024 70,006.2013 Apr 2024 67,116.501−$28,897.00
short13 Apr 2024 67,116.5014 Apr 2024 63,924.501$31,920.00
long14 Apr 2024 63,924.5015 Apr 2024 65,661.901$17,373.30
short15 Apr 2024 65,661.9016 Apr 2024 63,420.001$22,418.60
long16 Apr 2024 63,420.0017 Apr 2024 63,793.401$3,734.10
short17 Apr 2024 63,793.4018 Apr 2024 61,277.401$25,160.20
long18 Apr 2024 61,277.4019 Apr 2024 63,470.101$21,927.10
short19 Apr 2024 63,470.1020 Apr 2024 63,818.001−$3,479.20
long20 Apr 2024 63,818.0021 Apr 2024 64,940.601$11,225.70
short21 Apr 2024 64,940.6022 Apr 2024 64,941.201−$5.70
long22 Apr 2024 64,941.2023 Apr 2024 66,819.301$18,781.70
short23 Apr 2024 66,819.3024 Apr 2024 66,414.001$4,053.20
long24 Apr 2024 66,414.0025 Apr 2024 64,289.601−$21,244.20
short25 Apr 2024 64,289.6026 Apr 2024 64,498.301−$2,087.50
long26 Apr 2024 64,498.3027 Apr 2024 63,770.001−$7,283.30
short27 Apr 2024 63,770.0028 Apr 2024 63,462.001$3,080.20
long28 Apr 2024 63,462.0029 Apr 2024 63,118.601−$3,433.60
short29 Apr 2024 63,118.6030 Apr 2024 63,866.001−$7,473.80
long30 Apr 2024 63,866.001 May 2024 60,672.001−$31,939.90
short1 May 2024 60,672.002 May 2024 58,365.001$23,070.40
long2 May 2024 58,365.003 May 2024 59,060.601$6,956.30
short3 May 2024 59,060.604 May 2024 62,882.001−$38,214.10
long4 May 2024 62,882.005 May 2024 63,892.001$10,100.20

Similar scripts

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

Where it runs

EngineCompilesRunsMatches TradingView
Zeal Terminal · OpenPineScript v2Yes 4 msYes 1,000 bars in 10 msNot measured
PineTSNo v5 and v6 only—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. 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/// © abhimanyoo//@version=4strategy("test")if bar_index < 100    strategy.entry("buy", strategy.long, 10, when=strategy.position_size <= 0)    strategy.entry("sell", strategy.short, 10, when=strategy.position_size > 0)plot(strategy.equity)