이 전략은 두 개의 무작위 동력 지표 ((SMI와 RSI) 를 사용하여 다공간 판단을 하고, 마팅거와 신체 필터와 함께 거래 신호를 필터링하여 중단계 트렌드를 포착하여 가격 변동을 추적하는 것을 목표로 한다.
이 전략은 양자 무작위 동력 지표 SMI와 RSI를 사용하여 오버로 판단한다. SMI는 K선 실물 가격 차원과 종결 가격의 이동 평균을 통해 계산되며, 역점을 효과적으로 식별할 수 있다. RSI는 다중 오버 모션 비교를 통해 초과 구매를 결정한다. 전략은 SMI가 50 미만이고 RSI가 20 미만일 때 초과하고, SMI가 50 미만이고 RSI가 80 미만일 때 공백한다.
가짜 돌파를 필터링하기 위해, 전략은 10주기 신체 평행선의 1/3을 돌파 필터링 조건으로 사용한다. 실체가 평행선의 1/3을 돌파하면 돌파가 유효하다고 본다.
또한, 전략은 선택적인 마틴겔 전략을 사용한다. 즉, 손실 거래에 비례하여 가설을 추가하여 이전 손실을 회수하기를 기대한다.
Backtest 기능은 시작 및 종료 시간을 입력하여 전략 효과를 재검토합니다.
이 전략은 복합적으로 쌍용 무작위 지표와 필터를 사용하여 반전점을 효과적으로 식별하고, 중단계 트렌드를 포착하고, 가격 변동을 추적할 수 있다.
SMI 및 RSI 파라미터를 최적화하여 추격 고치 하락의 확률을 줄일 수 있다. 마팅겔 전략을 합리적으로 사용하여, 상장 비율과 수를 제어한다. 시장 상황에 따라 필터를 켜는지 여부를 선택하여, 필터valid 신호의 확률을 줄인다.
이 전략은 종합적으로 이중 무작위 지표를 사용하여 역전점을 포착하고 필터와 마팅거를 사용하여 거래 신호를 필터링하고 추적하여 중간에 짧은 선의 추세를 효과적으로 식별하고 가격 변동을 추적할 수 있습니다. 높은 승률을 추구하는 투자자에게 적합합니다. 지표를 사용할 때 지연 후 및 흔들림 시장의 위험을 주의해야합니다. 매개 변수 최적화 및 손실을 중지하여 위험을 제어 할 수 있습니다.
/*backtest
start: 2022-09-30 00:00:00
end: 2023-10-06 00:00:00
period: 2d
basePeriod: 1d
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=2
// strategy(title = "CS Basic Scripts - Stochastic Special (Strategy)", shorttitle = "Stochastic Special", overlay = false, default_qty_type = strategy.percent_of_equity, default_qty_value = 100, pyramiding = 0)
//Settings
needlong = input(true, defval = true, title = "Long")
needshort = input(true, defval = true, title = "Short")
usemar = input(false, defval = false, title = "Use Martingale")
capital = input(100, defval = 100, minval = 1, maxval = 10000, title = "Capital, %")
usesmi = input(true, defval = true, title = "Use SMI Strategy")
usersi = input(true, defval = true, title = "Use RSI Strategy")
usebod = input(true, defval = true, title = "Use Body-Filter")
a = input(5, "SMI Percent K Length")
b = input(3, "SMI Percent D Length")
limit = input(50, defval = 50, minval = 1, maxval = 100, title = "SMI Limit")
//Backtesting Input Range
fromyear = input(2017, defval = 2017, 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")
//Fast 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))
//Stochastic Momentum Index
ll = lowest (low, a)
hh = highest (high, a)
diff = hh - ll
rdiff = close - (hh+ll)/2
avgrel = ema(ema(rdiff,b),b)
avgdiff = ema(ema(diff,b),b)
SMI = avgdiff != 0 ? (avgrel/(avgdiff/2)*100) : 0
SMIsignal = ema(SMI,b)
//Lines
plot(SMI, color = blue, linewidth = 3, title = "Stochastic Momentum Index")
plot(SMIsignal, color = red, linewidth = 3, title = "SMI Signal Line")
plot(limit, color = black, title = "Over Bought")
plot(-1 * limit, color = black, title = "Over Sold")
plot(0, color = blue, title = "Zero Line")
//Body Filter
nbody = abs(close - open)
abody = sma(nbody, 10)
body = nbody > abody / 3 or usebod == false
//Signals
up1 = SMI < -1 * limit and close < open and body and usesmi
dn1 = SMI > limit and close > open and body and usesmi
up2 = fastrsi < 20 and close < open and body and usersi
dn2 = fastrsi > 80 and close > open and body and usersi
exit = ((strategy.position_size > 0 and close > open) or (strategy.position_size < 0 and close < open)) and body
//Trading
profit = exit ? ((strategy.position_size > 0 and close > strategy.position_avg_price) or (strategy.position_size < 0 and close < strategy.position_avg_price)) ? 1 : -1 : profit[1]
mult = usemar ? exit ? profit == -1 ? mult[1] * 2 : 1 : mult[1] : 1
lot = strategy.position_size == 0 ? strategy.equity / close * capital / 100 * mult : lot[1]
if up1 or up2
if strategy.position_size < 0
strategy.close_all()
strategy.entry("long", strategy.long, needlong == false ? 0 : lot, when=(time > timestamp(fromyear, frommonth, fromday, 00, 00) and time < timestamp(toyear, tomonth, today, 23, 59)))
if dn1 or dn2
if strategy.position_size > 0
strategy.close_all()
strategy.entry("Short", 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()