Pine Script v4 · Strategy
RSI KANNEMAN
A Pine Script v4 strategy built on RSI (close, 14), SMA (mi_rsi, 14) and Crossover (mm_rsi, 30). It has 8 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. 8 settings; defaults include Sobre Compra 70, Sobre Venta 30 and Periodos 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 RSI KANNEMAN repaint?
- No
- No repainting patterns were found in the source. The live replay was not measured: it had no trades to compare.
- How did RSI KANNEMAN 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.
- Can RSI KANNEMAN be converted to Pine Script v5?
- Not tested
- The steps are shown below, but neither version placed a trade on any market tested, so there was nothing to compare and no download is offered.
- Does RSI KANNEMAN use a stop loss?
- No
- Every exit waits for a signal; nothing limits a losing trade before it fires.
- Does RSI KANNEMAN run in Zeal Terminal?
- Yes
- It compiles in 18 ms and runs 1,000 bars in 43 ms, in the browser.
BTCUSDT · 1D · default settings
- HLine
- HLine
- Plot
- Plot
- Winning trade
- Losing trade
- Equity
- Buy and hold
- 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, $100,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 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 transp =, which v5 removed line 64
transp = on line 64, 65. v5 folds the transparency into the colour with color.new(c, transp).
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 rsi → ta.rsi, sma → ta.sma, crossover → ta.crossover, crossunder → ta.crossunder.
v4 → v5
Not verifiedNeither version placed a trade on any of the 8 markets, so there was nothing to compare.
- Line 3: //@version=4 → //@version=5
- Line 6: input(type = input.time) → input.time()
- Line 7: input(type = input.time) → input.time()
- Line 8: input(type = input.integer) → input.int()
- Line 9: input(type = input.integer) → input.int()
- Line 12: input(type = input.integer) → input.int()
7 more edits
- Line 13: input(type = input.integer) → input.int()
- Line 19: rsi → ta.rsi
- Line 20: sma → ta.sma
- Line 21: crossover → ta.crossover
- Line 22: crossunder → ta.crossunder
- Line 64: transp = 0 → color.new(Es_compra ? color.blue : na, 0)
- Line 65: transp = 0 → color.new(Es_venta ? color.red : na, 0)
⋯// © samuelkanneman-//@version=4+//@version=5strategy("RSI KANNEMAN")//////Entrada///////-i_startTime = input(title="Start Date Filter", defval=timestamp("01 Nov 2020 13:30 +0000"), type=input.time, tooltip="Date & time to begin trading from")+i_startTime = input.time(title="Start Date Filter", defval=timestamp("01 Nov 2020 13:30 +0000"), tooltip="Date & time to begin trading from")-i_endTime = input(title="End Date Filter", defval=timestamp("1 Nov 2022 19:30 +0000"), type=input.time, tooltip="Date & time to stop trading")+i_endTime = input.time(title="End Date Filter", defval=timestamp("1 Nov 2022 19:30 +0000"), tooltip="Date & time to stop trading")-sobrecompra= input(70, title="Sobre Compra", type=input.integer ,minval=50, maxval=100 )+sobrecompra= input.int(70, title="Sobre Compra" ,minval=50, maxval=100 )-sobreventa= input(30, title="Sobre Venta", type=input.integer ,minval=0, maxval=50 )+sobreventa= input.int(30, title="Sobre Venta" ,minval=0, maxval=50 )l1=hline(sobrecompra)l2=hline(sobreventa, color=color.purple)-periodos= input(14, title="Periodos", type=input.integer ,minval=1, maxval=50 )+periodos= input.int(14, title="Periodos" ,minval=1, maxval=50 )-periodos_media= input(14, title="Logintud media movil", type=input.integer ,minval=1, maxval=200 )+periodos_media= input.int(14, title="Logintud media movil" ,minval=1, maxval=200 )var SL =0.0⋯//////Proceso///////-mi_rsi=rsi(close,periodos)+mi_rsi=ta.rsi(close,periodos)-mm_rsi=sma(mi_rsi,periodos_media)+mm_rsi=ta.sma(mi_rsi,periodos_media)-Es_compra= crossover(mm_rsi,sobreventa)+Es_compra= ta.crossover(mm_rsi,sobreventa)-Es_venta= crossunder(mm_rsi,sobrecompra)+Es_venta= ta.crossunder(mm_rsi,sobrecompra)comprado= strategy.position_size > 0⋯plot(mm_rsi, color=color.yellow)-bgcolor(Es_compra ? color.blue : na , transp=0)+bgcolor(color.new(Es_compra ? color.blue : na, 0) )-bgcolor(Es_venta ? color.red : na , transp=0)+bgcolor(color.new(Es_venta ? color.red : na, 0) )// 1d 70 22 5 4 3 15 6 meses⋯Clean v5
Not verifiedNeither version placed a trade on any of the 8 markets, so there was nothing to compare.
- Line 16: input() → input.float()
- Line 17: input() → input.float()
⋯var TP=0.0-StopLoss = input(2.0, title="SL %", step=0.2)+StopLoss = input.float(2.0, title="SL %", step=0.2)-TakeProfit = input(5.0, title="TP %", step=0.2)+TakeProfit = input.float(5.0, title="TP %", step=0.2)//////Proceso///////⋯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.
⋯// © samuelkanneman-//@version=5+//@version=6strategy("RSI KANNEMAN")⋯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 |
|---|---|---|---|
| Start Date FilterDate & time to begin trading from | timestamp("01 Nov 2020 13:30 +0000") | time | dateFilter |
| End Date FilterDate & time to stop trading | timestamp("1 Nov 2022 19:30 +0000") | time | dateFilter |
| Sobre Compra | 70 | int (written input.integer) · min 50 · max 100 | l1 Es_venta hline |
| Sobre Venta | 30 | int (written input.integer) · min 0 · max 50 | l2 Es_compra hline |
| Periodos | 14 | int (written input.integer) · min 1 · max 50 | mi_rsi |
| Logintud media movil | 14 | int (written input.integer) · min 1 · max 200 | mm_rsi |
| SL % | 2.0 | float · step 0.2 | SL |
| TP % | 5.0 | float · step 0.2 | TP |
What it calculates
- RSI (
rsi,ta.rsiin v5)close, Periodos (14)mi_rsi · line 19 - SMA (
sma,ta.smain v5)mi_rsi, Logintud media movil (14)mm_rsi · line 20 - Crossover (
crossover,ta.crossoverin v5)mm_rsi, Sobre Venta (30)Es_compra · line 21 - Crossunder (
crossunder,ta.crossunderin v5)mm_rsi, Sobre Compra (70)Es_venta · line 22
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 compra long | (not comprado and Es_compra and dateFilter ) | On | 32 |
| Close compra | close >= TP | On | 37 |
| Close compra | (comprado and Es_venta ) | On | 39 |
| Close compra | close <= SL | On | 41 |
| Open venta short | (not vendido and Es_venta and dateFilter ) | On | 47 |
| Close venta | close <= TP | On | 52 |
| Close venta | (vendido and Es_compra ) | On | 54 |
| Close venta | close >= SL | On | 56 |
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 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 | 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 |
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 |
|---|---|---|---|---|---|
| RSI KANNEMAN this page | — | v4 strategy | 0.0% | 0 | 0.0% |
| SRJ RSI Outperformer Strategy by Sapt_Jash | rsi sma | v5 strategy | +0.6% | 8 | 2.4% |
| RSI SMA Crossover Strategy by reees | rsi sma | v5 strategy | +39.8% | 42 | 30.8% |
| Short In Downtrend Below MA100 (Coinrule) by Coinrule | sma rsi | v4 strategy | −34.5% | 99 | 45.4% |
| Simple RSI and SMA Long and Short (by Coinrule) by Coinrule | rsi sma | v5 strategy | −3.0% | 2 | 17.7% |
| Maximized Moving Average Crossing (by Coinrule) by Coinrule | sma rsi | v4 strategy | −6.6% | 9 | 13.3% |
Where it runs
| Engine | Compiles | Runs | Matches TradingView |
|---|---|---|---|
| Zeal Terminal · OpenPineScript v2 | Yes 18 ms | Yes 1,000 bars in 43 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/// © samuelkanneman//@version=4strategy("RSI KANNEMAN")//////Entrada///////i_startTime = input(title="Start Date Filter", defval=timestamp("01 Nov 2020 13:30 +0000"), type=input.time, tooltip="Date & time to begin trading from")i_endTime = input(title="End Date Filter", defval=timestamp("1 Nov 2022 19:30 +0000"), type=input.time, tooltip="Date & time to stop trading")sobrecompra= input(70, title="Sobre Compra", type=input.integer ,minval=50, maxval=100 )sobreventa= input(30, title="Sobre Venta", type=input.integer ,minval=0, maxval=50 )l1=hline(sobrecompra)l2=hline(sobreventa, color=color.purple)periodos= input(14, title="Periodos", type=input.integer ,minval=1, maxval=50 )periodos_media= input(14, title="Logintud media movil", type=input.integer ,minval=1, maxval=200 )var SL =0.0var TP=0.0StopLoss = input(2.0, title="SL %", step=0.2)TakeProfit = input(5.0, title="TP %", step=0.2)//////Proceso///////mi_rsi=rsi(close,periodos)mm_rsi=sma(mi_rsi,periodos_media)Es_compra= crossover(mm_rsi,sobreventa)Es_venta= crossunder(mm_rsi,sobrecompra)comprado= strategy.position_size > 0vendido = strategy.position_size < 0//time to test dateFilter = time >= i_startTime and time <= i_endTime//timePeriod = time >= timestamp(syminfo.timezone, 2020, 11, 1, 0, 0)// longif (not comprado and Es_compra and dateFilter ) // realizar long cantidad = strategy.equity/hlc3 strategy.entry ("compra", strategy.long , cantidad) SL := close*(1-(StopLoss/100)) TP := close*(1+(TakeProfit/100)) if close >= TP strategy.close ("compra" , comment="Salto TP") if (comprado and Es_venta ) strategy.close ("compra" , comment="Sobre Venta")if close <= SL strategy.close ("compra" , comment="Salto SL") // shortif (not vendido and Es_venta and dateFilter ) // realizar short cantidad = strategy.equity/hlc3 strategy.entry ("venta", strategy.short , cantidad) SL := close*(1+(StopLoss/100)) TP := close*(1-(TakeProfit/100)) if close <= TP strategy.close ("venta" , comment="Salto TP") if (vendido and Es_compra ) strategy.close ("venta" , comment="Sobre Compra")if close >= SL strategy.close ("venta" , comment="Salto SL") ///////Salida//////fill(l1,l2)plot(mi_rsi)plot(mm_rsi, color=color.yellow)bgcolor(Es_compra ? color.blue : na , transp=0)bgcolor(Es_venta ? color.red : na , transp=0)// 1d 70 22 5 4 3 15 6 meses//1h 70 20 6 4 5 7 1 mese//15m 70 20 5 4 4 7 1 semana