Pine Script v5 · Strategy
MTF Diagonally Layered RSI - 1 minute Bitcoin Bot [wbburgin]
A Pine Script v5 strategy built on RSI (close, 7), RMA (u, len * time_mult) and Crossunder (rsi, 80). It has 4 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. 11 settings; defaults include RSI Length 7, HT 1 3 and HT 2 5.
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 MTF Diagonally Layered RSI - 1 minute Bitcoin Bot [wbburgin] repaint?
- Yes
- At least one pattern in the source can repaint: intrabar recalculation.
- How did MTF Diagonally Layered RSI - 1 minute Bitcoin Bot [wbburgin] 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 entry conditions never all held on this data. It closed no trades on the other markets either. A backtest, not investment advice.
- Does MTF Diagonally Layered RSI - 1 minute Bitcoin Bot [wbburgin] 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 MTF Diagonally Layered RSI - 1 minute Bitcoin Bot [wbburgin] use a stop loss?
- No
- Every exit waits for a signal; nothing limits a losing trade before it fires.
- Does MTF Diagonally Layered RSI - 1 minute Bitcoin Bot [wbburgin] run in Zeal Terminal?
- Yes
- It compiles in 30 ms and runs 1,000 bars in 74 ms, in the browser.
BTCUSDT · 1D · default settings
- RSI Current TF
- Oversold
- Overbought
- Winning trade
- Losing trade
- Equity
- Buy and hold
Needs BINANCE:BTCUSDT 3 data, not available: a lower timeframe than the chart; the engine does not evaluate intrabar data Needs BINANCE:BTCUSDT 5 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
- 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, $10,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.
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 |
|---|---|---|---|
| Config | |||
| RSI Length | 7 | int | rsi rsi2_man rsi3_man |
| HT 1 | 3 | timeframe | rsi2_sec ht1_int |
| HT 2 | 5 | timeframe | rsi3_sec ht2_int |
| Overbought Level | 80 | int | Overbought sellSig htCross_short shortEntry |
| Oversold Level | 20 | int | Oversold htCross buySig shortExit |
| Calc TypeManual calculation is a way to stop repaint without using request.security(). | Manual Calculation | string · options ["Security Function","Manual Calculation"] | rsi2 rsi3 |
| Allow Shorts? | Long-only | string · options ["Long-only","Long and Short"] | entry Short line 91 |
| Risk Management | |||
| Use EMA Filter | false | bool | filter shortfilter |
| EMA Length | 200 | int | ema200 |
| Use % Stop Loss | false | bool | initiate_stoploss_long initiate_stoploss_short |
| Stop Loss (%) | 0.5 | float | stoplosslevel_long stoplosslevel_short |
What it calculates
- RSIclose, RSI Length (7)
rsi · line 17 - RMAu, len * time_mult
rs · line 57 - Crossunderrsi, Overbought Level (80)
sellSig · line 74 - Crossoverrsi, Oversold Level (20)
shortExit · line 78 - EMAclose, EMA Length (200)
ema200 · line 80 - Crossunderclose, stoplosslevel_long
initiate_stoploss_long · line 85 - Crossoverclose, stoplosslevel_short
initiate_stoploss_short · line 86
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 | buySig and filter | On | 88 |
| Close Long | sellSig or initiate_stoploss_long | On | 90 |
| Open Short short | shortEntry and shortfilter and tradeType == "Long and Short" | On | 92 |
| Close Short | shortExit or initiate_stoploss_short | On | 94 |
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.
- ClearHigher-timeframe data2 request.security call(s), none with lookahead on.
- ClearFuture-bar referencesNo negative history offsets such as close[-1].
- CheckIntrabar recalculationreads realtime-only state. Live values can differ from history.
- 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
Not run on other markets: the script requests BINANCE:BTCUSDT 3, BINANCE:BTCUSDT 5, and that data is not available here (a lower timeframe than the chart; the engine does not evaluate intrabar data; a lower timeframe than the chart; the engine does not evaluate intrabar data). Its results would rest on empty values.
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 |
|---|---|---|---|---|---|
| MTF Diagonally Layered RSI - 1 minute Bitcoin Bot [wbburgin] this page | — | v5 strategy | 0.0% | 0 | 0.0% |
| Take Profit On Trend v2 (by BHD_Trade_Bot) by BHD_Trade_Bot | ema rsi rma | v5 strategy | +9.4% | 6 | 24.0% |
| Hulk Strategy x35 Leverage 5m chart w-Alerts by npietronuto1 | rsi rma ema | v5 strategy | No trades on this market | ||
| Kahlman HullMA - WT Cross Strategy by pigsq | ema rsi rma | v5 strategy | +1.0% | 54 | 33.3% |
| RSI Cross [xaurr] by livetrend | rsi ema | v4 strategy | +24.4% | 53 | 35.3% |
| Bitpanda Coinrule Template by joshuajcoop01 | rsi ema | v5 strategy | −2.8% | 4 | 4.6% |
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?
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.
⋯// © wbburgin-//@version=5+//@version=6strategy("MTF Layered RSI - Bitcoin Bot [wbburgin]",overlay=false, initial_capital=10000, pyramiding=2)⋯Where it runs
| Engine | Compiles | Runs | Matches TradingView |
|---|---|---|---|
| Zeal Terminal · OpenPineScript v2 | Yes 30 ms | With a workaround 1,000 bars in 74 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.
“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/// © wbburgin//@version=5strategy("MTF Layered RSI - Bitcoin Bot [wbburgin]",overlay=false, initial_capital=10000, pyramiding=2)length = input.int(7,"RSI Length",group="Config")tf2 = input.timeframe("3",title="HT 1",group="Config")tf3 = input.timeframe("5",title="HT 2",group="Config")ob = input.int(80,"Overbought Level",group="Config")os = input.int(20,"Oversold Level",group="Config")calcType = input.string("Manual Calculation",options=["Security Function","Manual Calculation"],title="Calc Type", tooltip="Manual calculation is a way to stop repaint without using request.security().")use200ma = input.bool(false,"Use EMA Filter",group="Risk Management")emaLen = input.int(200,"EMA Length",group="Risk Management")stoploss = input.bool(false,"Use % Stop Loss",group="Risk Management")stoplosspercent = input.float(0.5,title="Stop Loss (%)",group="Risk Management")tradeType = input.string("Long-only",options=["Long-only","Long and Short"],title="Allow Shorts?")rsi = ta.rsi(close,length)// Security RSI Calculation ____________________________________________________________________________________________indexHighTF = barstate.isrealtime ? 1 : 0indexCurrTF = barstate.isrealtime ? 0 : 1rsi2_sec = request.security(syminfo.tickerid, tf2, rsi[indexHighTF])[indexCurrTF]rsi3_sec = request.security(syminfo.tickerid, tf3, rsi[indexHighTF])[indexCurrTF]//Aligns with Tradingview's method of non-repainting: https://www.tradingview.com/pine-script-docs/en/v5/concepts/Repainting.html// Manual RSI Calculation ______________________________________________________________________________________________currentTF = timeframe.periodtf_to_int(timeframe)=> switch timeframe == "1S" => 1 timeframe == "5S" => 5 timeframe == "10S"=> 10 timeframe == "15S"=> 15 timeframe == "30S"=> 30 timeframe == "1" => 60 timeframe == "3" => 180 timeframe == "5" => 300 timeframe == "15" => 900 timeframe == "30" => 1800 timeframe == "45" => 2700 timeframe == "60" => 3600 // 1 hour timeframe == "120"=> 7200 // 2 hours timeframe == "180"=> 10800 // 3 hours timeframe == "240"=> 14400 // 4 hours timeframe == "480"=> 28800 // 8 hours timeframe == "720"=> 43200 // 12 hours timeframe == "D" => 86400 // 1 day timeframe == "W" => 604800 // 1 week timeframe == "M" => 2595000 // 1 monthct_int = tf_to_int(currentTF)ht1_int = tf_to_int(tf2)ht2_int = tf_to_int(tf3)ht1_mult = int(ht1_int / ct_int)ht2_mult = int(ht2_int / ct_int)manualRSI(time_mult, len)=> htclose = close u = math.max(htclose - htclose[time_mult], 0) // upward ta.change d = math.max(htclose[time_mult] - htclose, 0) // downward ta.change rs = ta.rma(u, len * time_mult) / ta.rma(d, len * time_mult) res = 100 - 100 / (1 + rs) resrsi2_man = manualRSI(ht1_mult, length)rsi3_man = manualRSI(ht2_mult, length)rsi2 = calcType == "Security Function" ? rsi2_sec : rsi2_manrsi3 = calcType == "Security Function" ? rsi3_sec : rsi3_manplot(rsi,color=color.yellow,title="RSI Current TF")plot(rsi2,color=color.new(color.yellow,50),title="RSI HT1")plot(rsi3,color=color.new(color.yellow,75),title="RSI HT2")lm=hline(os,title="Oversold")hm=hline(ob,title="Overbought")fill(hm,lm,color=color.new(color.blue,95))// Long SettingshtCross = (ta.crossover(rsi2,os) and rsi3>os and rsi>os) or (ta.crossover(rsi3,os) and rsi2>os and rsi>os)buySig = (ta.crossover(rsi,os) and rsi2 < os and rsi3 < os) or htCrosssellSig = ta.crossunder(rsi,ob)// Short SettingshtCross_short = (ta.crossunder(rsi2,ob) and rsi3<ob and rsi<ob) or (ta.crossunder(rsi3,ob) and rsi2<ob and rsi<ob)shortEntry = (ta.crossunder(rsi,ob) and rsi2 > ob and rsi3 > ob) or htCross_shortshortExit = ta.crossover(rsi,os)//Risk Settingsema200 = ta.ema(close,emaLen)filter = use200ma ? close>ema200 ? true : false : trueshortfilter = use200ma ? close<ema200 ? true : false : truestoplosslevel_long = (1-(stoplosspercent/100)) * ta.valuewhen(buySig and filter,close,0)stoplosslevel_short = (1+(stoplosspercent/100)) * ta.valuewhen(shortEntry and shortfilter,close,0)initiate_stoploss_long = stoploss ? ta.crossunder(close,stoplosslevel_long) : nainitiate_stoploss_short = stoploss ? ta.crossover(close,stoplosslevel_short) : naif buySig and filter strategy.entry("Long",strategy.long)if sellSig or initiate_stoploss_long strategy.close("Long")if shortEntry and shortfilter and tradeType == "Long and Short" strategy.entry("Short",strategy.short)if shortExit or initiate_stoploss_short strategy.close("Short")plotshape(buySig and filter,title="Buysig",style=shape.triangleup,location=location.bottom,color=color.green,size=size.tiny)plotshape(sellSig or initiate_stoploss_long,title="Sellsig",style=shape.triangledown,location=location.top,color=color.red,size=size.tiny)