0bps

Strategy vault / Mean reversion

RSI and BBand simultaneously OverSold

This indicator is created by combining the standard period RSI indicator with an Oversold limit of 32, an Overbought limit of 70 and a period of 14 (these values can be changed optionally from the entries and still…

Author
ChaoZhang
Complexity
Intermediate · 53 lines
Parameters
7
Backtest bar
10m · intraday
Tested on
BTC/USDT · futures

This indicator is created by combining the standard period RSI indicator with an Oversold limit of 32, an Overbought limit of 70 and a period of 14 (these values can be changed optionally from the entries and still tabs of the indicator settings) and the Bollinger Band . indicator with a standard deviation of 2 and a period of 20. Also, the RSI Oversold is an upward green triangle where the price simultaneously falls below the BB and the lower limit (Low) (i.e. below 32), where the RSI Overbought (i.e. above 70) at the same time the price rises above the BB and the upper limit (Upper) is a downward red triangle. is indicated by a triangle. An alarm condition is established on these conditions. Source codes are posted visually and written in clear language and with explanations for beginners to learn to pine.

backtest

IMG

Parameters

NameDefaultWhat it controls
v_input_1_close0RSI Kaynagi: close | high | low | open | hl2 | hlc3 | hlcc4 | ohlc4
v_input_214RSI Periodu
v_input_332RSI Taban Değerini gir
v_input_470RSI Taban Değerini gir
v_input_520bbPeriodu
v_input_6_close0Source: close | high | low | open | hl2 | hlc3 | hlcc4 | ohlc4
v_input_72Standart Sapma

Source Pine Script

/*backtest
start: 2022-02-11 00:00:00
end: 2022-05-11 00:00:00
period: 10m
basePeriod: 1m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/

//@version=4
study(title="RSI & BB'de aynı anda Oversold Yakalama", shorttitle="RSI&BB OS", overlay=true)


//RSI hesabı ile kaynak ve period seçimi için seçki kutusu ve değer giriş kutuları burada yapıldı
rsiKaynagi = input(title="RSI Kaynagi", type=input.source, defval=close)
rsiPeriodu = input(title="RSI Periodu", type=input.integer, defval=14)
rsiDegeri = rsi(rsiKaynagi, rsiPeriodu)
rsiTabanDegeri = input(title="RSI Taban Değerini gir", type=input.integer, defval=32) // defval: default value yani varsayılan değer
rsiTavanDegeri = input(title="RSI Taban Değerini gir", type=input.integer, defval=70)


// Bollinger Bandı hesabı ve kaynak ve period seçimi için seçki kutusu ve değer giriş kutuları burada yapıldı
bbPeriodu = input(20, minval=1)
bbKaynagi = input(close, title="Source")
standartSapmaDegeri = input(2.0, minval=0.001, maxval=50, title="Standart Sapma")
bandOrtasi = sma(bbKaynagi, bbPeriodu)
sapmaHesabi = standartSapmaDegeri * stdev(bbKaynagi, bbPeriodu)
bbUstSiniri = bandOrtasi + sapmaHesabi
bbAltsiniri = bandOrtasi - sapmaHesabi
bandOrtaCizgisi = plot(bandOrtasi, "Orta Çizgi", color=color.black) 
ustSinirCizgisi = plot(bbUstSiniri, "Üst Sınır Çizgisi", color=color.black)
altSinirCizgisi = plot(bbAltsiniri, "Alt Sınır Çizgisi", color=color.black)
fill(ustSinirCizgisi, altSinirCizgisi, title = "Arka Plan", color=color.rgb(33, 150, 243, 95)) // arka plan renkleri RGB cinsinden

// RSI'nin değerinin 20 altındayken aynı anda fiyatın Bollinger Bandının altı sınırının altında olduğu durum için şart oluşturma
bullishkosulu = rsiDegeri<rsiTabanDegeri and low<bbAltsiniri
bearishkosulu = rsiDegeri>rsiTavanDegeri and high>bbUstSiniri

// bu kosulun sağlandığı yerleri belirtilen yazı ve / veya şekille gösterme
plotshape((bullishkosulu)? 1 : 0, style=shape.triangleup, text="Bullish", color=color.green, location=location.belowbar, size=size.small)
plotshape((bearishkosulu)? 1 : 0, style=shape.triangledown, text="Bearish", color=color.red, location=location.abovebar, size=size.small)
//triangleup: yukarı yönlü üçgen
//text: görünmesi istenen yazı 
//color: yazı ve şekil rengi
//location: mumun altında mı üstünde mi görünsün
//belowbar: mumun yani barın altında görünsün
//size : büyüklük küçüklük ölçüsü (burada small ile küçük olsun istendi)
alertcondition(bullishkosulu, title="Bullish koşulu üzerine alarm kur", message="{{interval}} - RSI<33 ve Fiyat<BB Lower - {{ticker}} - En düşük fiyat:{{low}} - {{timenow}}")
alertcondition(bearishkosulu, title="Bearish koşulu üzerine alarm kur", message="{{interval}} - RSI>70 ve Fiyat>BB Upper - {{ticker}} - En yüksek fiyat:{{high}} - {{timenow}}")

if bearishkosulu
    strategy.entry("Enter Long", strategy.long)
else if bullishkosulu
    strategy.entry("Enter Short", strategy.short)

Published by ChaoZhang on the FMZ strategy square · last modified 2022-05-12. Collected in the Quant Trading Vault. Unvalidated research: re-test with your own data and costs before trusting it.

Build this with AgenKit

A spec is not a trading system. Paste this into your coding agent and AgenKit runs a specialist team — architecture, test-first build, risk gates, review — with paper trading on by default.

in Claude Code, Cursor, Codex & 4 more
/agenkit build a production-grade trading bot with a backtest engine, risk controls and paper trading by default from strategies/RSI-and-BBand-simultaneously-OverSold.md
  1. npx agenkit install engineering-kit in your project
  2. Paste the command into your agent and approve each phase
  3. Get tests, backtest, risk controls and a paper-trading switch

Understand it first

Before you run this, read the lesson behind the idea and how to backtest it honestly. Specs like this one are the survivors of an unknown number of trials; deflate their results accordingly.

Related specs

esc

Try , , or .

↑↓ move↵ open