이 전략은 가격의 표준 차이를 계산하여 가격이 비정상적으로 큰 변동이 있는지 판단합니다. 가격이 비정상적으로 큰 변동이있을 때, 가격 반전의 기회로 판단하여 역전 작업을 수행합니다.
이 전략은 크게 두 가지 지표를 사용합니다.
wvf = ((highest(close, pd)-low)/(highest(close, pd)))*100
sDev = mult * stdev(wvf, bbl)
midLine = sma(wvf, bbl)
lowerBand = midLine - sDev
upperBand = midLine + sDev
그 중, wvf는 가격 변동률, sDev는 표준 차, midLine는 평균, lowerBand와 upperBand는 각각 하위 한계선과 상위 한계선이다. 가격이 상위 한계를 넘어서면 비정상적인 변동이 있다고 본다.
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))
RSI가 특정 값보다 낮으면 가격이 초과 상태임을 나타내고 반전이 발생할 수 있습니다. RSI가 특정 값을 초과하면 가격이 초과 상태임을 나타내고 반전이 발생할 수 있습니다.
이 전략은 다음과 같은 출전 및 출전 논리를 가지고 있습니다.
다중 입점: 가격이 상한선을 넘거나 변동률이 하위치를 넘고 RSI가 특정 값보다 낮으면 더 많이 입점한다.
빈 포지션 입시: 가격이 상한선을 넘거나 변동률이 하위치를 넘고 RSI가 어떤 수치를 넘으면 공백한다.
출구 조건: 포지션 개설 방향과 K선 실체의 방향이 반대일 때 평점.
이 전략은 가격 변동률의 표준 차이를 계산하여 가격이 비정상적으로 변동하는지 판단하여 역전 기회를 잡습니다. 입시 시점에선 RSI 지표와 결합하여 가격의 과매매 상태를 판단하여 정확도를 높입니다. 중지 방식에 간단한 실물 방향을 사용하여 중지합니다. 전체적으로 이 전략은 통계 데이터를 사용하여 비정상적 변동을 판단하는 것이 효과적이지만 변수를 추가적으로 최적화하여 안정성을 높이는 것이 필요합니다.
/*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()