Pine Script v5 · Strategy
AryaN
A Pine Script v5 strategy built on Crossover or EMA (close, 5, close, 10) and Crossunder or EMA (close, 6, close, 11). 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 AryaN repaint?
- No
- No repainting patterns were found in the source, and a live tick-by-tick replay matched history on 17 of 17 trades.
- How did AryaN do on BTCUSDT 1D with default settings?
- +2.85%
- From 26 Jan 2024 to 21 Oct 2026, over 56 closed trades, against +102.5% for buy and hold. A backtest, not investment advice.
- Does AryaN 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: 56 before, 42 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 AryaN use a stop loss?
- No
- Every exit waits for a signal; nothing limits a losing trade before it fires.
- Does AryaN run in Zeal Terminal?
- Yes
- It compiles in 6 ms and runs 1,000 bars in 11 ms, in the browser.
BTCUSDT · 1D · default settings
- Crossover
- Crossunder
- Winning trade
- Losing trade
- Equity
- Buy and hold
- Net profit
- +2.85%
- $28,453.60
- Buy and hold
- +102.5%
- same period
- Closed trades
- 56
- 19 won · 37 lost
- Profitable
- 33.9%
- of closed trades
- Profit factor
- 1.24
- gross profit ÷ gross loss
- Max drawdown
- 3.30%
- −$33,165.30
One run with the author's default settings, $1,000,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.
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
- Crossover / EMAta.ema(close, 5), ta.ema(close, 10)
longCondition · line 5 - Crossunder / EMAta.ema(close, 6), ta.ema(close, 11)
shortCondition · line 8
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 | (longCondition) | On | 7 |
| Open Sell short | (shortCondition) | On | 10 |
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.
- 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 | +2.8% | +102.5% | 56 | 34% | 1.24 | 3.3% | 26 Jan 2024 – 21 Oct 2026 |
| BTCUSDT 4h | +1.2% | +5.5% | 69 | 30% | 1.30 | 1.5% | 8 May 2026 – 21 Oct 2026 |
| ETHUSDT 1D | +0.2% | +9.8% | 68 | 32% | 1.25 | 0.2% | 26 Jan 2024 – 21 Oct 2026 |
| ETHUSDT 4h | −0.1% | +8.4% | 93 | 20% | 0.78 | 0.1% | 8 May 2026 – 21 Oct 2026 |
| SOLUSDT 1D | +0.0% | +16.7% | 71 | 35% | 1.05 | 0.0% | 26 Jan 2024 – 21 Oct 2026 |
| SOLUSDT 4h | +0.0% | +21.5% | 69 | 35% | 1.53 | 0.0% | 8 May 2026 – 21 Oct 2026 |
| BNBUSDT 1D | −0.0% | +148.3% | 71 | 34% | 0.97 | 0.0% | 26 Jan 2024 – 21 Oct 2026 |
| BNBUSDT 4h | +0.0% | +17.1% | 69 | 32% | 1.32 | 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 | 17 | 29% | −$36,453.90 |
| Sideways market | 23 | 52% | $60,374.40 |
| Falling market | 16 | 13% | $4,533.10 |
Rising and falling mean the market moved more than 15% over the 90 bars before entry.
How bad could the drawdown be?
6.4%
The 95th percentile of the worst drawdown when the same 56 trades are reshuffled 5,000 times. The bar spans the 5th to 95th percentile, 2.7% to 6.4%; the tick is what actually happened, 2.9%. Order luck alone moves it this much.
All 56 trades
| Side | Entry | Exit | Bars | P&L |
|---|---|---|---|---|
| short | 20 Mar 2024 61,937.40 | 26 Mar 2024 69,880.00 | 6 | −$7,942.59 |
| long | 26 Mar 2024 69,880.00 | 4 Apr 2024 65,963.30 | 9 | −$3,916.73 |
| short | 4 Apr 2024 65,963.30 | 8 Apr 2024 69,360.40 | 4 | −$3,397.11 |
| long | 8 Apr 2024 69,360.40 | 14 Apr 2024 63,924.50 | 6 | −$5,435.86 |
| short | 14 Apr 2024 63,924.50 | 24 Apr 2024 66,414.00 | 10 | −$2,489.48 |
| long | 24 Apr 2024 66,414.00 | 12 Jun 2024 67,314.20 | 49 | $900.23 |
| short | 12 Jun 2024 67,314.20 | 15 Jul 2024 60,797.90 | 33 | $6,516.32 |
| long | 15 Jul 2024 60,797.90 | 3 Aug 2024 61,498.30 | 19 | $700.43 |
| short | 3 Aug 2024 61,498.30 | 22 Aug 2024 61,156.00 | 19 | $342.31 |
| long | 22 Aug 2024 61,156.00 | 29 Aug 2024 59,034.90 | 7 | −$2,121.13 |
| short | 29 Aug 2024 59,034.90 | 13 Sep 2024 58,132.30 | 15 | $902.59 |
| long | 13 Sep 2024 58,132.30 | 3 Oct 2024 60,649.30 | 20 | $2,516.96 |
| short | 3 Oct 2024 60,649.30 | 13 Oct 2024 63,206.20 | 10 | −$2,556.96 |
| long | 13 Oct 2024 63,206.20 | 21 Dec 2024 97,805.40 | 69 | $34,599.20 |
| short | 21 Dec 2024 97,805.40 | 4 Jan 2025 98,174.20 | 14 | −$368.73 |
| long | 4 Jan 2025 98,174.20 | 10 Jan 2025 92,552.50 | 6 | −$5,621.68 |
| short | 10 Jan 2025 92,552.50 | 16 Jan 2025 100,497.00 | 6 | −$7,944.86 |
| long | 16 Jan 2025 100,497.00 | 2 Feb 2025 100,636.00 | 17 | $138.31 |
| short | 2 Feb 2025 100,636.00 | 21 Feb 2025 98,305.00 | 19 | $2,330.65 |
| long | 21 Feb 2025 98,305.00 | 30 Mar 2025 82,648.50 | 37 | −$15,656.50 |
| short | 30 Mar 2025 82,648.50 | 13 Apr 2025 85,276.90 | 14 | −$2,628.38 |
| long | 13 Apr 2025 85,276.90 | 31 May 2025 103,985.00 | 48 | $18,708.60 |
| short | 31 May 2025 103,985.00 | 10 Jun 2025 110,263.00 | 10 | −$6,277.55 |
| long | 10 Jun 2025 110,263.00 | 15 Jun 2025 105,415.00 | 5 | −$4,848.39 |
| short | 15 Jun 2025 105,415.00 | 26 Jun 2025 107,341.00 | 11 | −$1,925.96 |
| long | 26 Jun 2025 107,341.00 | 1 Aug 2025 115,764.00 | 36 | $8,423.48 |
| short | 1 Aug 2025 115,764.00 | 9 Aug 2025 116,675.00 | 8 | −$910.67 |
| long | 9 Aug 2025 116,675.00 | 19 Aug 2025 116,227.00 | 10 | −$447.69 |
| short | 19 Aug 2025 116,227.00 | 9 Sep 2025 112,065.00 | 21 | $4,161.82 |
| long | 9 Sep 2025 112,065.00 | 23 Sep 2025 112,651.00 | 14 | $585.76 |
| short | 23 Sep 2025 112,651.00 | 1 Oct 2025 114,049.00 | 8 | −$1,397.95 |
| long | 1 Oct 2025 114,049.00 | 12 Oct 2025 110,644.00 | 11 | −$3,404.54 |
| short | 12 Oct 2025 110,644.00 | 27 Oct 2025 114,559.00 | 15 | −$3,915.01 |
| long | 27 Oct 2025 114,559.00 | 31 Oct 2025 108,323.00 | 4 | −$6,236.54 |
| short | 31 Oct 2025 108,323.00 | 4 Dec 2025 93,429.90 | 34 | $14,892.90 |
| long | 4 Dec 2025 93,429.90 | 7 Dec 2025 89,236.80 | 3 | −$4,193.15 |
| short | 7 Dec 2025 89,236.80 | 9 Dec 2025 90,634.40 | 2 | −$1,397.55 |
| long | 9 Dec 2025 90,634.40 | 15 Dec 2025 88,172.20 | 6 | −$2,462.19 |
| short | 15 Dec 2025 88,172.20 | 31 Dec 2025 88,485.50 | 16 | −$313.34 |
| long | 31 Dec 2025 88,485.50 | 21 Jan 2026 88,427.70 | 21 | −$57.84 |
| short | 21 Jan 2026 88,427.70 | 3 Mar 2026 68,830.10 | 41 | $19,597.60 |
| long | 3 Mar 2026 68,830.10 | 9 Mar 2026 65,971.20 | 6 | −$2,858.86 |
| short | 9 Mar 2026 65,971.20 | 11 Mar 2026 69,948.60 | 2 | −$3,977.44 |
| long | 11 Mar 2026 69,948.60 | 22 Mar 2026 68,918.10 | 11 | −$1,030.52 |
| short | 22 Mar 2026 68,918.10 | 26 Mar 2026 71,336.50 | 4 | −$2,418.41 |
| long | 26 Mar 2026 71,336.50 | 27 Mar 2026 68,820.30 | 1 | −$2,516.22 |
| short | 27 Mar 2026 68,820.30 | 7 Apr 2026 68,853.70 | 11 | −$33.35 |
| long | 7 Apr 2026 68,853.70 | 17 May 2026 78,148.10 | 40 | $9,294.39 |
| short | 17 May 2026 78,148.10 | 16 Jun 2026 66,328.70 | 30 | $11,819.30 |
| long | 16 Jun 2026 66,328.70 | 28 Jul 2026 63,755.90 | 42 | −$2,572.88 |
| short | 28 Jul 2026 63,755.90 | 6 Aug 2026 64,665.20 | 9 | −$909.38 |
| long | 6 Aug 2026 64,665.20 | 12 Aug 2026 63,600.00 | 6 | −$1,065.23 |
| short | 12 Aug 2026 63,600.00 | 19 Aug 2026 64,725.40 | 7 | −$1,125.41 |
| long | 19 Aug 2026 64,725.40 | 11 Sep 2026 76,568.70 | 23 | $11,843.30 |
| short | 11 Sep 2026 76,568.70 | 19 Sep 2026 80,883.90 | 8 | −$4,315.13 |
| long | 19 Sep 2026 80,883.90 | 9 Oct 2026 81,754.50 | 20 | $870.60 |
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 |
|---|---|---|---|---|---|
| AryaN this page | — | v5 strategy | +2.8% | 56 | 3.3% |
| 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% |
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
VerifiedNothing 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: 56 before, 42 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.
⋯// © sandipkindo-//@version=5+//@version=6strategy("My strategyP", overlay=true, margin_long=100, margin_short=100)⋯Where it runs
| Engine | Compiles | Runs | Matches TradingView |
|---|---|---|---|
| Zeal Terminal · OpenPineScript v2 | Yes 6 ms | Yes 1,000 bars in 11 ms | Not measured |
| PineTS | Not tested | Not tested | 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.
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/// © sandipkindo//@version=5strategy("My strategyP", overlay=true, margin_long=100, margin_short=100)longCondition = ta.crossover(ta.ema(close, 5), ta.ema(close, 10))if (longCondition) strategy.entry("Buy", strategy.long)shortCondition = ta.crossunder(ta.ema(close, 6), ta.ema(close, 11))if (shortCondition) strategy.entry("Sell" , strategy.short)