Pine Script v5 · Strategy
Crypto High Potential Strategy
A Pine Script v5 strategy built on EMA (closeHA, 200), RSI (closeHA, 14) and SAR (0.02, 0.02). It has 8 order rules, 4 entries among them, and trades long and short with the default settings; 2 entries are switched off until a setting enables them. Exits use a stop loss. Each trade is 0.5 contracts and pays no commission. 13 settings; defaults include Risk per Trade % 2, min of pips (00001.00) for each position 50 and Swing High 10.
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 Crypto High Potential Strategy repaint?
- No
- No repainting patterns were found in the source. The live replay was not measured: it had no trades to compare.
- How did Crypto High Potential Strategy do on BTCUSDT 1D with default settings?
- Not measured
- It closed no trades there from 26 Jan 2024 to 21 Oct 2026 with the default settings, so there is no result to report. Its code limits trading to a date window, which can leave this period out. It closed no trades on the other markets either. A backtest, not investment advice.
- Does Crypto High Potential Strategy run in Pine Script v6?
- Not tested
- Neither version placed a trade on any of the 8 markets, so there was nothing to compare. The v6 version is shown for reference and is not offered as a download.
- Does Crypto High Potential Strategy use a stop loss?
- Yes
- strategy.exit sets a stop on line 68, 73.
- Does Crypto High Potential Strategy run in Zeal Terminal?
- Yes
- It compiles in 41 ms and runs 1,000 bars in 80 ms, in the browser.
BTCUSDT · 1D · default settings
- ParabolicSAR
- EMA
- Winning trade
- Losing trade
- Equity
- Buy and hold
| Symbole | Net Profit | Trades | Period |
| BTCUSDT | 0.00 % | 0 | 30 day |
- Net profit
- 0.00%
- $0.00
- Buy and hold
- +102.5%
- same period
- Closed trades
- 0
- 0 won · 0 lost
- Profitable
- 0.0%
- of closed trades
- Profit factor
- —
- gross profit ÷ gross loss
- Max drawdown
- 0.00%
- $0.00
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.
-
Note
2 settings have no label
In the settings dialog start (line 28), increment (line 29) show an empty name. The labels on this page come from the variable names.
-
Note
The long side is off by default line 55
Its orders only fire after “do not take too small positions” is switched on. The figures on this page cover long and short trades only.
-
Note
The short side is off by default line 64
Its orders only fire after “do not take too small positions” is switched on. The figures on this page cover long and short trades only.
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 |
|---|---|---|---|
| Money Management | |||
| Risk per Trade % | 2 | float | riskt |
| do not take too small positionsThis parameter is used to avoid positions that have a stoploss that is too short and that the spreads of the broker take all the gains | false | bool | entry long entry short line 51 line 60 |
| min of pips (00001.00) for each position | 50 | float | entry long entry short line 52 line 61 |
| Backtest Time Period | |||
| Filter Date Range of Backtest | true | bool | inTradeWindow |
| Start DateThis start date is in the time zone of the exchange " + "where the chart's instrument trades. It doesn't use the time " + "zone of the chart or of your computer. | timestamp("1 June 2022") | time | inTradeWindow periodzone |
| End DateThis end date is in the time zone of the exchange " + "where the chart's instrument trades. It doesn't use the time " + "zone of the chart or of your computer. | timestamp("1 July 2022") | time | inTradeWindow periodzone |
| Stop Loss | |||
| Swing HighNumber of candles in which the parameter targets the highest | 10 | int | swingHigh |
| Swing LowNumber of candles in which the parameter targets the lowest point | 10 | int | swingLow |
| EMA | |||
| Ema Period | 200 | int | ema |
| RSI | |||
| RSI Period | 14 | int | rsi |
| Parabolic SAR | |||
| Start (no label in the script) | 0.02 | float | SAR |
| Increment (no label in the script) | 0.02 | float | SAR |
| Max Value | 0.2 | float | SAR |
What it calculates
- EMAcloseHA, Ema Period (200)
ema · line 31 - RSIcloseHA, RSI Period (14)
rsi · line 32 - SARStart (0.02), Increment (0.02), Max Value (0.2)
SAR · line 33 - HighestcloseHA, Swing High (10)
swingHigh · line 44 - LowestcloseHA, Swing Low (10)
swingLow · line 45
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 | minp > security | On | 53 |
| Open long long | _x | Off “do not take too small positions” | 55 |
| Open short short | minp > security | On | 62 |
| Open short short | _x | Off “do not take too small positions” | 64 |
| Exit long exit stop | strategy.position_size > 0 | On | 68 |
| Exit short exit stop | strategy.position_size < 0 | On | 73 |
| Close long | closeHA[1] < SAR and close > strategy.position_avg_price | On | 75 |
| Close short | closeHA[1] > SAR and close < strategy.position_avg_price | On | 78 |
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.
- ClearHigher-timeframe data1 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 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.0% | +102.5% | 0 | 0% | — | 0.0% | 26 Jan 2024 – 21 Oct 2026 |
| BTCUSDT 4h | 0.0% | +5.5% | 0 | 0% | — | 0.0% | 8 May 2026 – 21 Oct 2026 |
| ETHUSDT 1D | 0.0% | +9.8% | 0 | 0% | — | 0.0% | 26 Jan 2024 – 21 Oct 2026 |
| ETHUSDT 4h | 0.0% | +8.4% | 0 | 0% | — | 0.0% | 8 May 2026 – 21 Oct 2026 |
| SOLUSDT 1D | 0.0% | +16.7% | 0 | 0% | — | 0.0% | 26 Jan 2024 – 21 Oct 2026 |
| SOLUSDT 4h | 0.0% | +21.5% | 0 | 0% | — | 0.0% | 8 May 2026 – 21 Oct 2026 |
| BNBUSDT 1D | 0.0% | +148.3% | 0 | 0% | — | 0.0% | 26 Jan 2024 – 21 Oct 2026 |
| BNBUSDT 4h | 0.0% | +17.1% | 0 | 0% | — | 0.0% | 8 May 2026 – 21 Oct 2026 |
Higher-timeframe data for request.security(): heikinashi:SYMBOL D (Binance BTCUSDT 1d, as Heikin-Ashi by the engine), heikinashi:BINANCE:BTCUSDT D (Binance BTCUSDT 1d, as Heikin-Ashi by the engine), fetched from Binance's public market data for each market.
Backtests are simulations on historical data and are not investment advice.
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 |
|---|---|---|---|---|---|
| Crypto High Potential Strategy this page | — | v5 strategy | 0.0% | 0 | 0.0% |
| STRATEGY R18-F-BTC by SenatorVonShaft | ema highest lowest rsi | v4 strategy | −8.6% | 11 | 14.4% |
| M0PB (Momentum Pullback) by Marcns_ | rsi ema highest lowest | v5 strategy | +51.3% | 3 | 17.5% |
| sma RSI & sudden buy and sell Strategy v1 by samwillington | ema rsi highest lowest | v5 strategy | +7.6% | 15 | 3.7% |
| PlanB Quant Investing 101 v2 by fillippone | rsi highest lowest | v4 strategy | No trades on this market | ||
| CC Trend strategy 2- Downtrend Short by CheatCode1 | ema highest lowest | v5 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.
- 3 settings use the untyped input() (line 28, 29, 30). 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.
Clean v5
Not verifiedNeither version placed a trade on any of the 8 markets, so there was nothing to compare.
- Line 28: input() → input.float()
- Line 29: input() → input.float()
- Line 30: input() → input.float()
⋯rsiV = input.int(14, title="RSI Period", group="RSI")-start = input(0.02, group="Parabolic SAR")+start = input.float(0.02, group="Parabolic SAR")-increment = input(0.02, group="Parabolic SAR")+increment = input.float(0.02, group="Parabolic SAR")-maximum = input(0.2, "Max Value", group="Parabolic SAR")+maximum = input.float(0.2, "Max Value", group="Parabolic SAR")ema = ta.ema(closeHA, emaV)⋯Does it run in Pine Script v6?
Not tested
Neither version placed a trade on any of the 8 markets, so there was nothing to compare. The v6 version is shown for reference and is not offered as a download. It differs from the v5 version by 1 edit.
⋯// © maxencetajet-//@version=5+//@version=6strategy("HA_RSI", overlay=true, initial_capital=1000, default_qty_type=strategy.fixed, default_qty_value=0.5, slippage=25)⋯Where it runs
| Engine | Compiles | Runs | Matches TradingView |
|---|---|---|---|
| Zeal Terminal · OpenPineScript v2 | Yes 41 ms | With a workaround 1,000 bars in 80 ms | Not measured |
| PineTS | Not tested | Not tested | Not measured |
The engine's host API cannot yet declare a chart's symbol and timeframe, so this page sets them on the engine directly for each market. Data the page supplies at the chart's own timeframe (another symbol, or Heikin-Ashi) reaches the script one bar later in Zeal Terminal's engine than on TradingView.
“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/// © maxencetajet//@version=5strategy("HA_RSI", overlay=true, initial_capital=1000, default_qty_type=strategy.fixed, default_qty_value=0.5, slippage=25)closeHA = request.security(ticker.heikinashi(syminfo.tickerid), timeframe.period, close)risk = input.float(2, title="Risk per Trade %", group="Money Management")_x = input.bool(false, title="do not take too small positions", group="Money Management", tooltip="This parameter is used to avoid positions that have a stoploss that is too short and that the spreads of the broker take all the gains")security = input.float(50, title='min of pips (00001.00) for each position', group="Money Management")riskt = risk / 100 + 1useDateFilter = input.bool(true, title="Filter Date Range of Backtest", group="Backtest Time Period")backtestStartDate = input.time(timestamp("1 June 2022"), title="Start Date", group="Backtest Time Period", tooltip="This start date is in the time zone of the exchange " + "where the chart's instrument trades. It doesn't use the time " + "zone of the chart or of your computer.")backtestEndDate = input.time(timestamp("1 July 2022"), title="End Date", group="Backtest Time Period", tooltip="This end date is in the time zone of the exchange " + "where the chart's instrument trades. It doesn't use the time " + "zone of the chart or of your computer.")inTradeWindow = not useDateFilter or (time >= backtestStartDate and time < backtestEndDate)swingHighV = input.int(10, title="Swing High", group="Stop Loss", tooltip="Number of candles in which the parameter targets the highest")swingLowV = input.int(10, title="Swing Low", group="Stop Loss", tooltip="Number of candles in which the parameter targets the lowest point")emaV = input.int(200, title="Ema Period", group="EMA")rsiV = input.int(14, title="RSI Period", group="RSI")start = input(0.02, group="Parabolic SAR")increment = input(0.02, group="Parabolic SAR")maximum = input(0.2, "Max Value", group="Parabolic SAR")ema = ta.ema(closeHA, emaV)rsi = ta.rsi(closeHA, rsiV)SAR = ta.sar(start, increment, maximum)myColor = SAR < low?color.green:color.redlongcondition = closeHA > ema and rsi > 50 and closeHA[1] > SAR and closeHA[1] < SAR[1] shortcondition = closeHA < ema and rsi < 50 and closeHA[1] < SAR and closeHA[1] > SAR[1]float risk_long = nafloat risk_short = nafloat stopLoss = nafloat entry_price = nafloat takeProfit = narisk_long := risk_long[1]risk_short := risk_short[1]swingHigh = ta.highest(closeHA, swingHighV)swingLow = ta.lowest(closeHA, swingLowV)lotB = (strategy.equity*riskt-strategy.equity)/(closeHA - swingLow)lotS = (strategy.equity*riskt-strategy.equity)/(swingHigh - closeHA)if strategy.position_size == 0 and longcondition and inTradeWindow risk_long := (close - swingLow) / close minp = close - swingLow if _x if minp > security strategy.entry("long", strategy.long, qty=lotB, comment="Buy " + str.tostring(close) + "") else strategy.entry("long", strategy.long, qty=lotB, comment="Buy " + str.tostring(close) + "") if strategy.position_size == 0 and shortcondition and inTradeWindow risk_short := (swingHigh - close) / close minp = swingHigh - close if _x if minp > security strategy.entry("short", strategy.short, qty=lotS, comment="Sell " + str.tostring(close) + "") else strategy.entry("short", strategy.short, qty=lotS, comment="Sell " + str.tostring(close) + "")if strategy.position_size > 0 stopLoss := strategy.position_avg_price * (1 - risk_long) entry_price := strategy.position_avg_price strategy.exit("long exit", "long", stop = stopLoss) if strategy.position_size < 0 stopLoss := strategy.position_avg_price * (1 + risk_short) entry_price := strategy.position_avg_price strategy.exit("short exit", "short", stop = stopLoss)if closeHA[1] < SAR and close > strategy.position_avg_price strategy.close("long", comment="Exit Long") if closeHA[1] > SAR and close < strategy.position_avg_price strategy.close("short", comment="Exit Short")p_ep = plot(entry_price, color=color.new(color.white, 0), linewidth=2, style=plot.style_linebr, title='entry price')p_sl = plot(stopLoss, color=color.new(color.red, 0), linewidth=2, style=plot.style_linebr, title='stopLoss')fill(p_sl, p_ep, color.new(color.red, transp=85))plot(SAR, "ParabolicSAR", style=plot.style_circles, color=myColor, linewidth=1)plot(ema, color=color.white, linewidth=2, title="EMA")colorresult = strategy.netprofit > 0 ? color.green : color.red profitprc = strategy.netprofit / strategy.initial_capital * 100periodzone = (backtestEndDate - backtestStartDate) / 3600 / 24 / 1000var tbl = table.new(position.top_right, 4, 2, border_width=3)table.cell(tbl, 0, 0, "Symbole", bgcolor = #9B9B9B, width = 6, height = 6)table.cell(tbl, 1, 0, "Net Profit", bgcolor = #9B9B9B, width = 6, height = 6)table.cell(tbl, 2, 0, "Trades", bgcolor = #9B9B9B, width = 6, height = 6)table.cell(tbl, 3, 0, "Period", bgcolor = #9B9B9B, width = 6, height = 6) table.cell(tbl, 0, 1, str.tostring(syminfo.ticker), bgcolor = #E8E8E8, width = 6, height = 6)table.cell(tbl, 1, 1, str.tostring(profitprc, format.mintick) + " %", bgcolor = colorresult, width = 6, height = 6)table.cell(tbl, 2, 1, str.tostring(strategy.closedtrades), bgcolor = colorresult, width = 6, height = 6)table.cell(tbl, 3, 1, str.tostring(periodzone) + " day", bgcolor = colorresult, width = 6, height = 6)