Pine Script v5 · Strategy
Bitpanda Coinrule Template
A Pine Script v5 strategy built on RSI (close, 14), EMA (close, 9) and Crossover (buyFastEMA, buySlowEMA). It has 2 order rules, 1 entry among them, and trades long only with the default settings. Exits wait for a signal; there is no stop loss. Each trade commits 30% of equity and pays 0.1% commission. 2 settings; defaults include Length 14.
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 Bitpanda Coinrule Template 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 Bitpanda Coinrule Template do on BTCUSDT 1D with default settings?
- −2.78%
- 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 Bitpanda Coinrule Template run in Pine Script v6?
- Yes
- Same 4 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. The v6 script can be downloaded below.
- Does Bitpanda Coinrule Template use a stop loss?
- No
- Every exit waits for a signal; nothing limits a losing trade before it fires.
- Does Bitpanda Coinrule Template run in Zeal Terminal?
- Yes
- It compiles in 12 ms and runs 1,000 bars in 32 ms, in the browser.
BTCUSDT · 1D · default settings
- EMA
- EMA
- Crossover
- EMA
- EMA
- Crossover
- Winning trade
- Losing trade
- Equity
- Buy and hold
Needs BINANCE:BTCUSDT 60 data, not available: a lower timeframe than the chart; the engine does not evaluate intrabar data Values that depend on it are empty on this chart.
- Net profit
- −2.78%
- −$27.76
- Buy and hold
- +102.5%
- same period
- Closed trades
- 4
- 1 won · 3 lost
- Profitable
- 25.0%
- of closed trades
- Profit factor
- 0.65
- gross profit ÷ gross loss
- Max drawdown
- 4.57%
- −$46.29
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
1 setting does nothing
“Show Date Range” is declared but never read.
-
Check
No stop loss
Every exit waits for a signal. Nothing limits a losing trade before the exit condition fires.
-
Note
1 setting has no label
In the settings dialog length (line 16) shows an empty name. The labels on this page come from the variable names.
-
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 32. The upgraded version below moves each call inside an if block.
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 Date Range | true | bool | unused |
| Length (no label in the script) | 14 | int | vrsi |
What it calculates
- RSIclose, Length (14)
vrsi · line 17 - EMAclose, 9
buyFastEMA · line 19 - EMAclose, 50
buySlowEMA · line 20 - CrossoverbuyFastEMA, buySlowEMA
buyCondition1 · line 21 - EMAclose, 9
sellFastEMA · line 26 - EMAclose, 50
sellSlowEMA · line 27 - CrossoversellSlowEMA, sellFastEMA
condition · 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
| Order | Fires when | By default | Line |
|---|---|---|---|
| Open Long long | ((vrsi > vrsi[1]+increase) and buyCondition1 and vrsi < 70 and timePeriod) | On | 24 |
| Close Long | condition and timePeriod | On | 32 |
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 data2 request.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 timingprocess_orders_on_close = true: orders fill at the signal bar's close.
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 BINANCE:BTCUSDT 60, and that data is not available here (a lower timeframe than the chart; the engine does not evaluate intrabar data). Its results would rest on empty values.
The trades
By market direction
| At entry, last 90 bars | Trades | Won | P&L |
|---|---|---|---|
| Rising market | 0 | — | $0.00 |
| Sideways market | 4 | 25% | −$27.76 |
| 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?
7.7%
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, 3.9% to 7.7%; the tick is what actually happened, 3.9%. Order luck alone moves it this much.
All 4 trades
| Side | Entry | Exit | Bars | P&L |
|---|---|---|---|---|
| long | 19 Jul 2024 66,660.00 | 4 Aug 2024 58,161.00 | 16 | −$38.77 |
| long | 22 Apr 2025 93,443.00 | 25 Aug 2025 110,112.00 | 125 | $50.76 |
| long | 1 Oct 2025 118,595.00 | 15 Oct 2025 110,763.00 | 14 | −$20.62 |
| long | 13 Jan 2026 95,414.00 | 21 Jan 2026 89,454.70 | 8 | −$19.13 |
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 |
|---|---|---|---|---|---|
| Bitpanda Coinrule Template this page | — | v5 strategy | −2.8% | 4 | 4.6% |
| RSI Cross [xaurr] by livetrend | rsi ema | v4 strategy | +24.4% | 53 | 35.3% |
| RSI with Slow and Fast MA Crossing Strategy (by Coinrule) by Coinrule | rsi ema | v5 strategy | −2.8% | 4 | 4.6% |
| RSI of VWAP by mohanee | rsi ema | v4 strategy | No trades on this market | ||
| EMA SCALPEUR + RSi - SHORT by YukalMoon | rsi ema | v5 strategy | No trades on this market | ||
| BTC Sentiment analysis RSI 2xEMA by exlux99 | rsi ema | v4 strategy | No trades on this market | ||
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.
- 1 strategy call uses the when = argument (line 32). It is deprecated in v5 and removed in v6, where each call moves inside an if block.
- 2 settings use the untyped input() (line 12, 16). It still compiles in v6; input.int, input.float or input.source state the type.
- No v6-only features. v6 is not needed to run this script.
Same 4 trades and the same P&L on BTCUSDT 1D, 1,000 bars, in Zeal Terminal's engine.
- Line 12: input() → input.bool()
- Line 16: input() → input.int()
- Line 32: when = condition and timePeriod → if block
⋯ commission_value=0.1)-showDate = input(defval=true, title='Show Date Range')+showDate = input.bool(defval=true, title='Show Date Range')timePeriod = time >= timestamp(syminfo.timezone, 2020, 1, 1, 0, 0)⋯// RSI-length = input(14)+length = input.int(14)vrsi = ta.rsi(close, length)⋯//sellCondition1 = request.security(syminfo.tickerid, "60", condition)-strategy.close('Long', when = condition and timePeriod)+if condition and timePeriod+ strategy.close('Long')Does it run in Pine Script v6?
Yes
Same 4 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.
⋯// © joshuajcoop01-//@version=5+//@version=6strategy("Bitpanda Coinrule Template",⋯Where it runs
| Engine | Compiles | Runs | Matches TradingView |
|---|---|---|---|
| Zeal Terminal · OpenPineScript v2 | Yes 12 ms | Yes 1,000 bars in 32 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/// © joshuajcoop01//@version=5strategy("Bitpanda Coinrule Template", overlay=true, initial_capital=1000, process_orders_on_close=true, default_qty_type=strategy.percent_of_equity, default_qty_value=30, commission_type=strategy.commission.percent, commission_value=0.1)showDate = input(defval=true, title='Show Date Range')timePeriod = time >= timestamp(syminfo.timezone, 2020, 1, 1, 0, 0)notInTrade = strategy.position_size <= 0// RSIlength = input(14)vrsi = ta.rsi(close, length)// Moving Averages for Buy ConditionbuyFastEMA = ta.ema(close, 9)buySlowEMA = ta.ema(close, 50)buyCondition1 = ta.crossover(buyFastEMA, buySlowEMA)increase = 5if ((vrsi > vrsi[1]+increase) and buyCondition1 and vrsi < 70 and timePeriod) strategy.entry("Long", strategy.long)// Moving Averages for Sell ConditionsellFastEMA = ta.ema(close, 9)sellSlowEMA = ta.ema(close, 50)plot(request.security(syminfo.tickerid, "60", sellFastEMA), color = color.blue)plot(request.security(syminfo.tickerid, "60", sellSlowEMA), color = color.green)condition = ta.crossover(sellSlowEMA, sellFastEMA)//sellCondition1 = request.security(syminfo.tickerid, "60", condition)strategy.close('Long', when = condition and timePeriod)