Strategi ini menilai apakah terdapat turun naik yang luar biasa besar dengan mengira perbezaan piawai harga. Apabila terdapat turun naik yang luar biasa besar, ia dinilai sebagai peluang untuk membalikkan harga dan mengambil tindakan balas.
Strategi ini menggunakan dua penunjuk utama:
wvf = ((highest(close, pd)-low)/(highest(close, pd)))*100
sDev = mult * stdev(wvf, bbl)
midLine = sma(wvf, bbl)
lowerBand = midLine - sDev
upperBand = midLine + sDev
Di antaranya, wvf adalah kadar turun naik harga, sDev adalah perbezaan piawai, midLine adalah purata, dan lowerBand dan upperBand adalah garis bawah dan atas. Apabila harga melebihi garis atas, ia dianggap sebagai turun naik yang luar biasa.
fastup = rma(max(change(close), 0), 7)
fastdown = rma(-min(change(close), 0), 7)
fastrsi = fastdown == 0 ? 100 : fastup == 0 ? 0 : 100 - (100 / (1 + fastup / fastdown))
Apabila RSI berada di bawah nilai tertentu, harga berada dalam keadaan oversold dan mungkin berlaku rebound. Apabila RSI melebihi nilai tertentu, harga berada dalam keadaan oversold dan mungkin berlaku pulangan.
Logik masuk dan keluar dari strategi ini adalah seperti berikut:
Masukkan posisi berbilang: apabila harga melebihi garis atas atau kadar turun naik melebihi nilai paras, dan RSI adalah lebih rendah daripada nilai tertentu, buat lebih banyak.
Masukkan kedudukan kosong: apabila harga melebihi garisan atas atau kadar turun naik melebihi nilai paras, dan RSI melebihi nilai tertentu, kosongkan.
Keadaan keluar: kedudukan terbuka berlawanan dengan arah entiti K line.
Strategi ini menangkap peluang untuk berbalik dengan mengira perbezaan piawai dalam kadar turun naik harga, untuk menentukan apakah harga mengalami turun naik yang luar biasa. Pada pilihan masa masuk, ia digabungkan dengan indikator RSI untuk menentukan keadaan harga yang terlalu banyak dibeli dan dijual, meningkatkan ketepatan. Dalam cara menghentikan kerugian, ia menggunakan arah entiti yang mudah untuk menghentikan kerugian. Secara keseluruhannya, strategi ini menggunakan data statistik untuk menentukan turun naik yang luar biasa.
/*backtest
start: 2022-10-04 00:00:00
end: 2023-10-10 00:00:00
period: 2d
basePeriod: 1d
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//Noro
//2018
//@version=2
strategy(title = "Noro's VixFix + RSI Strategy v1.0", shorttitle = "VixFix + RSI str 1.0", overlay = true, default_qty_type = strategy.percent_of_equity, default_qty_value = 100, pyramiding = 5)
//Settings
needlong = input(true, defval = true, title = "Long")
needshort = input(true, defval = true, title = "Short")
leverage = input(1, defval = 1, minval = 1, maxval = 100, title = "leverage")
limit = input(40, defval = 40, minval = 2, maxval = 50, title = "RSI Limit")
pd = input(22, title="LookBack Period Standard Deviation High")
bbl = input(20, title="Bolinger Band Length")
mult = input(2.0, minval = 1, maxval = 5, title = "Bollinger Band Standard Devaition Up")
lb = input(50, title="Look Back Period Percentile High")
ph = input(.85, title="Highest Percentile - 0.90=90%, 0.95=95%, 0.99=99%")
pl = input(1.01, title="Lowest Percentile - 1.10=90%, 1.05=95%, 1.01=99%")
hp = input(false, title="Show High Range - Based on Percentile and LookBack Period?")
sd = input(false, title="Show Standard Deviation Line?")
fromyear = input(1900, defval = 1900, minval = 1900, maxval = 2100, title = "From Year")
toyear = input(2100, defval = 2100, minval = 1900, maxval = 2100, title = "To Year")
frommonth = input(01, defval = 01, minval = 01, maxval = 12, title = "From Month")
tomonth = input(12, defval = 12, minval = 01, maxval = 12, title = "To Month")
fromday = input(01, defval = 01, minval = 01, maxval = 31, title = "From day")
today = input(31, defval = 31, minval = 01, maxval = 31, title = "To day")
//Vix Fix
wvf = ((highest(close, pd)-low)/(highest(close, pd)))*100
sDev = mult * stdev(wvf, bbl)
midLine = sma(wvf, bbl)
lowerBand = midLine - sDev
upperBand = midLine + sDev
rangeHigh = (highest(wvf, lb)) * ph
rangeLow = (lowest(wvf, lb)) * pl
col = wvf >= upperBand or wvf >= rangeHigh ? lime : gray
//RSI
fastup = rma(max(change(close), 0), 7)
fastdown = rma(-min(change(close), 0), 7)
fastrsi = fastdown == 0 ? 100 : fastup == 0 ? 0 : 100 - (100 / (1 + fastup / fastdown))
//Body
body = abs(close - open)
abody = sma(body, 10)
//Signals
up = (wvf >= upperBand or wvf >= rangeHigh) and fastrsi < limit and close < open
dn = (wvf >= upperBand or wvf >= rangeHigh) and fastrsi > (100 - limit) and close > open
exit = ((strategy.position_size > 0 and close > open) or (strategy.position_size < 0 and close < open)) and body > abody / 3
//Trading
lot = strategy.position_size == 0 ? strategy.equity / close * leverage : lot[1]
if up
if strategy.position_size < 0
strategy.close_all()
strategy.entry("Bottom", strategy.long, needlong == false ? 0 : lot, when=(time > timestamp(fromyear, frommonth, fromday, 00, 00) and time < timestamp(toyear, tomonth, today, 23, 59)))
if dn
if strategy.position_size > 0
strategy.close_all()
strategy.entry("Top", strategy.short, needshort == false ? 0 : lot, when=(time > timestamp(fromyear, frommonth, fromday, 00, 00) and time < timestamp(toyear, tomonth, today, 23, 59)))
if time > timestamp(toyear, tomonth, today, 23, 59) or exit
strategy.close_all()