Pine Script v4 · Strategy
ARR-Pivote-India-Stategy
A Pine Script v4 strategy with no technical-analysis calculation. It has 5 order rules, 2 entries among them, and trades long and short with the default settings. Exits use a stop loss. Each trade is one contract and pays no commission. 11 settings; defaults include Max Loss on one Trade 0.5, Trade base Level PP and Close all trade @ Hours 13.
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 ARR-Pivote-India-Stategy repaint?
- Yes
- At least one pattern in the source can repaint: higher-timeframe data.
- How did ARR-Pivote-India-Stategy do on BTCUSDT 1D with default settings?
- −0.42%
- From 26 Jan 2024 to 21 Oct 2026, over 2 closed trades, against +102.5% for buy and hold. A backtest, not investment advice.
- Can ARR-Pivote-India-Stategy 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 ARR-Pivote-India-Stategy use a stop loss?
- Yes
- strategy.exit sets a stop on line 98, 99.
- Does ARR-Pivote-India-Stategy run in Zeal Terminal?
- Yes
- It compiles in 26 ms and runs 1,000 bars in 117 ms, in the browser.
BTCUSDT · 1D · default settings
- TP
- PP
- Winning trade
- Losing trade
- Equity
- Buy and hold
- Net profit
- −0.42%
- −$423.06
- Buy and hold
- +102.5%
- same period
- Closed trades
- 2
- 0 won · 2 lost
- Profitable
- 0.0%
- of closed trades
- Profit factor
- 0.00
- gross profit ÷ gross loss
- Max drawdown
- 0.56%
- −$557.76
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 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 94, 96, 100. 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 security → request.security.
- 3 strategy calls use the when = argument (line 94, 96, 100). It is deprecated in v5 and removed in v6, where each call moves inside an if block.
v4 → v5
VerifiedSame 2 trades and the same P&L on BTCUSDT 1D, 1,000 bars, in Zeal Terminal's engine.
- Line 4: //@version=4 → //@version=5
- Line 9: input(type = input.bool) → input.bool()
- Line 10: input(type = input.bool) → input.bool()
- Line 11: input(type = input.bool) → input.bool()
- Line 12: input(type = input.bool) → input.bool()
- Line 13: input(type = input.bool) → input.bool()
7 more edits
- Line 14: input(type = input.bool) → input.bool()
- Line 15: input(type = input.bool) → input.bool()
- Line 16: input(type = input.float) → input.float()
- Line 17: input(type = input.string) → input.string()
- Line 19: input(type = input.integer) → input.int()
- Line 20: input(type = input.session) → input.session()
- Line 30: security → request.security
⋯//Reference credit goes to All-//@version=4+//@version=5strategy("ARR-Pivote-India-Stategy",shorttitle="ARR-PP-Ind", overlay=true)⋯//User Input-showPrevDayHighLow = input(false, title="Show previous day's High & Low(PDH/PDL)", type=input.bool)+showPrevDayHighLow = input.bool(false, title="Show previous day's High & Low(PDH/PDL)")-showPivoteLine = input(true, title="Show Pivot Point(PP)", type=input.bool)+showPivoteLine = input.bool(true, title="Show Pivot Point(PP)")-showPivoteR1Line = input(false, title="Show Pivot Point Resistance (R1)", type=input.bool)+showPivoteR1Line = input.bool(false, title="Show Pivot Point Resistance (R1)")-showPivoteS1Line = input(false, title="Show Pivot Point Support (S1)", type=input.bool)+showPivoteS1Line = input.bool(false, title="Show Pivot Point Support (S1)")-showTypicalPriceLine = input(true, title="Show True Price", type=input.bool)+showTypicalPriceLine = input.bool(true, title="Show True Price")-tradeLong = input(true, title="Trade on Long Entry", type=input.bool)+tradeLong = input.bool(true, title="Trade on Long Entry")-tradeShort = input(false, title="Trade on Short Entry", type=input.bool)+tradeShort = input.bool(false, title="Trade on Short Entry")-maxLoss = input(0.5, title="Max Loss on one Trade", type=input.float)+maxLoss = input.float(0.5, title="Max Loss on one Trade")-tradeOn=input(title="Trade base Level", type=input.string,+tradeOn=input.string(title="Trade base Level", options=["PP", "PDH", "PDL","R1","S1"], defval="PP")-closeHrs = input(13, title="Close all trade @ Hours", type=input.integer)+closeHrs = input.int(13, title="Close all trade @ Hours")-sessSpec = input("0915-1530", title="Session time", type=input.session)+sessSpec = input.session("0915-1530", title="Session time")// Defaults⋯// Get High & Low-getSeries(_e, _timeFrame) => security(syminfo.tickerid, _timeFrame, _e, lookahead=barmerge.lookahead_on) +getSeries(_e, _timeFrame) => request.security(syminfo.tickerid, _timeFrame, _e, lookahead=barmerge.lookahead_on) is_newbar(res, sess) =>⋯Same 2 trades and the same P&L on BTCUSDT 1D, 1,000 bars, in Zeal Terminal's engine.
- Line 94: when = strategy.position_size <= 0 → if block
- Line 96: when = strategy.position_size <= 0 → if block
- Line 100: when = hour == closeHrs → if block
⋯if (open < tradeEventPrice) and ( close >tradeEventPrice ) and ( hour < (closeHrs-2) ) and tradeLong- strategy.entry("buy", strategy.long, 1, when=strategy.position_size <= 0)+ if strategy.position_size <= 0+ strategy.entry("buy", strategy.long, 1)if (open > tradeEventPrice) and ( close <tradeEventPrice ) and ( hour < (closeHrs-2) ) and tradeShort- strategy.entry("Sell", strategy.short, 1, when=strategy.position_size <= 0)+ if strategy.position_size <= 0+ strategy.entry("Sell", strategy.short, 1)mxloss=orbPrevDayClose*maxLoss⋯strategy.exit("exit", "Sell", loss = mxloss) -strategy.close_all(when = hour == closeHrs , comment = "close all entries")+if hour == closeHrs+ strategy.close_all(comment = "close all entries")Does it run in Pine Script v6?
Yes
Same 2 trades and the same P&L on BTCUSDT 1D, 1,000 bars, in Zeal Terminal's engine. Both versions were run on Zeal Terminal's engine, and the results are identical. It differs from the v5 version by 1 edit.
⋯//Reference credit goes to All-//@version=5+//@version=6strategy("ARR-Pivote-India-Stategy",shorttitle="ARR-PP-Ind", 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 |
|---|---|---|---|
| Show previous day's High & Low(PDH/PDL) | false | bool | PDH PDL |
| Show Pivot Point(PP) | true | bool | PP |
| Show Pivot Point Resistance (R1) | false | bool | R1 |
| Show Pivot Point Support (S1) | false | bool | S1 |
| Show True Price | true | bool | TP |
| Trade on Long Entry | true | bool | entry buy line 93 |
| Trade on Short Entry | false | bool | entry Sell line 95 |
| Max Loss on one Trade | 0.5 | float | mxloss |
| Trade base Level | PP | string · options ["PP", "PDH", "PDL","R1","S1"] | tradeEventPrice |
| Close all trade @ Hours | 13 | int (written input.integer) | entry buy entry Sell line 93 line 95 close_all |
| Session time | 0915-1530 | session | newbar |
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 buy long | strategy.position_size <= 0 | On | 94 |
| Open Sell short | strategy.position_size <= 0 | On | 96 |
| Exit exit stop | every bar | On | 98 |
| Exit exit stop | every bar | On | 99 |
| Close | hour == closeHrs | On | 100 |
Each order is guarded by the setting shown. “Off” orders never fire unless that setting is switched on.
Does it repaint?
Yes
At least one pattern in the source can repaint; it is marked Check below.
- CheckHigher-timeframe data1 security call(s) use lookahead_on (line 30). Without a [1] offset this reads future bars in history.
- 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.4% | +102.5% | 2 | 0% | 0.00 | 0.6% | 26 Jan 2024 – 21 Oct 2026 |
| BTCUSDT 4h | −8.5% | +5.5% | 26 | 0% | 0.00 | 8.7% | 8 May 2026 – 21 Oct 2026 |
| ETHUSDT 1D | −1.8% | +9.8% | 137 | 0% | 0.00 | 1.8% | 26 Jan 2024 – 21 Oct 2026 |
| ETHUSDT 4h | −0.1% | +8.4% | 16 | 0% | 0.00 | 0.2% | 8 May 2026 – 21 Oct 2026 |
| SOLUSDT 1D | −0.1% | +16.7% | 138 | 0% | 0.00 | 0.1% | 26 Jan 2024 – 21 Oct 2026 |
| SOLUSDT 4h | −0.0% | +21.5% | 18 | 0% | 0.00 | 0.0% | 8 May 2026 – 21 Oct 2026 |
| BNBUSDT 1D | −0.2% | +148.3% | 87 | 0% | 0.00 | 0.3% | 26 Jan 2024 – 21 Oct 2026 |
| BNBUSDT 4h | −0.0% | +17.1% | 16 | 0% | 0.00 | 0.0% | 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 | 0 | — | $0.00 |
| Sideways market | 2 | 0% | −$423.06 |
| 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?
0.4%
The 95th percentile of the worst drawdown when the same 2 trades are reshuffled 5,000 times. The bar spans the 5th to 95th percentile, 0.4% to 0.4%; the tick is what actually happened, 0.4%. Order luck alone moves it this much.
All 2 trades
| Side | Entry | Exit | Bars | P&L |
|---|---|---|---|---|
| long | 30 Jan 2024 43,302.70 | 30 Jan 2024 43,092.60 | 0 | −$210.16 |
| long | 2 Feb 2024 43,082.90 | 2 Feb 2024 42,870.10 | 0 | −$212.90 |
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 26 ms | Yes 1,000 bars in 117 ms | Not measured |
| PineTS | No 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/// © arameshraju//Reference credit goes to All//@version=4strategy("ARR-Pivote-India-Stategy",shorttitle="ARR-PP-Ind", overlay=true)// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/// © arameshraju//User InputshowPrevDayHighLow = input(false, title="Show previous day's High & Low(PDH/PDL)", type=input.bool)showPivoteLine = input(true, title="Show Pivot Point(PP)", type=input.bool)showPivoteR1Line = input(false, title="Show Pivot Point Resistance (R1)", type=input.bool)showPivoteS1Line = input(false, title="Show Pivot Point Support (S1)", type=input.bool)showTypicalPriceLine = input(true, title="Show True Price", type=input.bool)tradeLong = input(true, title="Trade on Long Entry", type=input.bool)tradeShort = input(false, title="Trade on Short Entry", type=input.bool)maxLoss = input(0.5, title="Max Loss on one Trade", type=input.float)tradeOn=input(title="Trade base Level", type=input.string, options=["PP", "PDH", "PDL","R1","S1"], defval="PP")closeHrs = input(13, title="Close all trade @ Hours", type=input.integer)sessSpec = input("0915-1530", title="Session time", type=input.session)// Defaults// ColorscColor = color.blackrColor = color.redsColor = color.green// Line style & TransparencylStyle = plot.style_linelTransp = 35// Get High & LowgetSeries(_e, _timeFrame) => security(syminfo.tickerid, _timeFrame, _e, lookahead=barmerge.lookahead_on) is_newbar(res, sess) => t = time(res, sess) na(t[1]) and not na(t) or t[1] < tnewbar = is_newbar("375", sessSpec)// Today's Session Start timestampy = year(timenow)m = month(timenow)d = dayofmonth(timenow)// Start & End time for Todaystart = timestamp(y, m, d, 09, 15)end = start + 86400000PrevDayHigh = getSeries(high[1], 'D')PrevDayLow = getSeries(low[1], 'D')PrevDayClose = getSeries(close[1], 'D')PivoteLine=(PrevDayHigh+PrevDayLow+PrevDayClose) /3PivoteR1=(PivoteLine*2) -PrevDayLowPivoteS1=(PivoteLine*2) -PrevDayHighorbPrevDayOpen = getSeries(open[1], 'D')orbPrevDayClose = getSeries(close[1], 'D')//** True PriceTypicalPrice=(high[1]+low[1]+close[1])/3//Preview Day High line_pdh = line.new(start, PrevDayHigh, end, PrevDayHigh, xloc.bar_time, color=color.red, style=line.style_solid, width=2)line.delete(_pdh[1])_pdl = line.new(start, PrevDayLow, end, PrevDayLow, xloc.bar_time, color=color.green, style=line.style_solid, width=2)line.delete(_pdl[1])_Pp = line.new(start, PrevDayLow, end, PrevDayLow, xloc.bar_time, color=color.green, style=line.style_dashed, width=2)line.delete(_Pp[1])//Previous Day Low Linel_pdh = label.new(start, PrevDayHigh, text="PD", xloc=xloc.bar_time, textcolor=rColor, style=label.style_none)label.delete(l_pdh[1])l_pdl = label.new(start, PrevDayLow, text="PD", xloc=xloc.bar_time, textcolor=sColor, style=label.style_none)label.delete(l_pdl[1])//Pivote Linel_pp = label.new(start, PivoteLine, text="PP", xloc=xloc.bar_time, textcolor=color.black, style=label.style_none)label.delete(l_pp[1])l_R1 = label.new(start, PivoteR1, text="R1", xloc=xloc.bar_time, textcolor=color.fuchsia, style=label.style_none)label.delete(l_pp[1])l_SR = label.new(start, PivoteS1, text="S2", xloc=xloc.bar_time, textcolor=color.navy, style=label.style_none)label.delete(l_pp[1])plot(showTypicalPriceLine?TypicalPrice:na , title='TP', color=rColor)plot(showPrevDayHighLow?PrevDayHigh:na , title=' PDH', color=rColor)plot(showPrevDayHighLow?PrevDayLow:na, title=' PDL', color=sColor)plot(showPivoteLine?PivoteLine:na, title=' PP', color=color.black)plot(showPivoteR1Line?PivoteR1:na, title=' R1', color=color.fuchsia)plot(showPivoteS1Line?PivoteS1:na, title=' S1', color=color.navy)// Today's Session Start timestamp// Start & End time for Today//endTime = timestamp(t, m, d, 15, 00)tradeEventPrice= if string("PDH")==tradeOn PrevDayHighelse if string("PDL")==tradeOn PrevDayLowelse if string("R1")==tradeOn PivoteR1else if string("S1")==tradeOn PivoteS1else if string("TR")==tradeOn TypicalPrice else PivoteLine//tradeEventPrice=PrevDayHighif (open < tradeEventPrice) and ( close >tradeEventPrice ) and ( hour < (closeHrs-2) ) and tradeLong strategy.entry("buy", strategy.long, 1, when=strategy.position_size <= 0)if (open > tradeEventPrice) and ( close <tradeEventPrice ) and ( hour < (closeHrs-2) ) and tradeShort strategy.entry("Sell", strategy.short, 1, when=strategy.position_size <= 0)mxloss=orbPrevDayClose*maxLossstrategy.exit("exit", "buy", loss = mxloss) strategy.exit("exit", "Sell", loss = mxloss) strategy.close_all(when = hour == closeHrs , comment = "close all entries")