
쌍평선 지표 무작위 전략은 평선 지표와 무작위 지표의 조합을 사용하여 거래 기회를 찾기 위해 시도하는 전략이다. 그것은 빠른 EMA에서 느린 SMA를 통과 할 때 거래 신호를 생성하고, 동시에 무작위 지표 K 값을 사용하여 과매매가 초과되는지 판단하여 일부 신호를 제거한다.
이 전략은 크게 두 가지 기술적인 지표에 기초하고 있습니다.
평균선: 빠른 EMA, 느린 SMA, 느린 VWMA 세 개의 다른 파라미터의 평균선을 계산하여 빠른 EMA를 상회하거나 느린 SMA를 상회할 때 거래 신호를 생성한다.
무작위 지표: %K값을 계산하여, 설정된 오버 바이 지역 또는 오버 셀 지역 마이너스를 초과할 때, 시장이 역전될 수 있다고 생각하여, 일부 평균선 거래 신호를 제거할 수 있다.
이 전략의 신호는 다음과 같은 논리를 담고 있습니다.
빠른 EMA 상에서 느린 SMA를 통과하고 K%가 초상도 시점보다 낮을 때 더 많이; 빠른 EMA 아래에서 느린 SMA를 통과하고 K%가 초상도 시점보다 높을 때 더 많이 니다.
오픈 다단위 포지션의 경우, K값이 다시 오버셀 영역에 진입하거나, 가격이 스톱로스 라인을 넘어간다면, 평지한다. 오픈 공백 포지션의 경우, K값이 다시 오버빌 영역에 진입하거나, 가격이 스톱로스 라인을 넘어간다면, 평지한다.
평균선 지표와 무작위 지표를 조합하여, 이 전략은 높은 확률의 평균선 신호 지점에서 출전 신호를 발송하려고 하지만, 무작위 지표 필터링 부분의 실수 입력을 이용한다.
이 전략의 주요 장점은 다음과 같습니다.
이 전략에는 몇 가지 위험도 있습니다.
대응 방법:
이 전략은 다음의 몇 가지 측면에서 최적화될 수 있습니다.
쌍평선 지표 무작위 전략은 속속평선 지표와 무작위 지표의 조합을 통해 보다 안정적인 트렌드 추적 전략을 설계한다. 그러나 또한 파라미터 선택, 스톱 로드 방식 등과 같은 몇 가지 최적화 가능한 공간이 있다. 더 많은 지표 판단과 최적화를 추가로 도입하면 이 전략은 보다 안정적인 초과 수익을 얻을 수 있다.
/*backtest
start: 2023-01-22 00:00:00
end: 2024-01-28 00:00:00
period: 1d
basePeriod: 1h
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=4
strategy("TVIX MEAN REV V2 TREND", overlay=true)
length = input(16, minval=1)
OverBought = input(80)
OverSold = input(20)
TradeLong = input (true)
TradeShort = input (true)
OverBoughtClose = input(80)
OverSoldClose = input(20)
smoothK = 3
smoothD = 3
trail_points = input(50)
k = sma(stoch(close, high, low, length), smoothK)
d = sma(k, smoothD)
k2 = sma(stoch(close, high, low, length), smoothK)
d2 = sma(k, smoothD)
// === GENERAL INPUTS ===
// short Ema
maFastSource = input(defval=close, title="Fast EMA Source")
maFastLength = input(defval=1, title="Fast EMA Period", minval=1)
// long Sma
maSlowSource = input(defval=close, title="Slow SMA Source")
maSlowLength = input(defval=100, title="Slow SMA Period", minval=1)
// longer Sma
maSlowerSource = input(defval=close, title="Slower SMA Source")
maSlowerLength = input(defval=30, title="Slower SMA Period", minval=1)
//ATR Stop Loss Indicator by Keith Larson
atrDays = input(7, "ATR Days Lookback")
theAtr = atr(atrDays)
atrModifier = input(5.0, "ATR Modifier")
//plot(atr * atrModifier, title="ATR")
LstopLoss = close - (theAtr * atrModifier)
SstopLoss = close + (theAtr * atrModifier)
// === SERIES SETUP ===
/// a couple of ma's..
maFast = ema(maFastSource, maFastLength)
maSlow = sma(maSlowSource, maSlowLength)
maSlower = vwma(maSlowerSource, maSlowerLength)
rsi = rsi(maSlowerSource, maSlowerLength)
// === PLOTTING ===
fast = plot(maFast, title="Fast MA", color=color.red, linewidth=2, style=plot.style_line, transp=30)
slow = plot(maSlow, title="Slow MA", color=color.green, linewidth=2, style=plot.style_line, transp=30)
slower = plot(maSlower, title="Slower MA", color=color.teal, linewidth=2, style=plot.style_line, transp=30)
// === LOGIC === Basic - simply switches from long to short and vice-versa with each fast-slow MA cross
LongFilter = maFast > maSlow
ShortFilter = maSlow > maFast
BUY=crossover(k, d) and k < OverSold
SELL=crossunder(k, d) and k > OverBought
SELLCLOSE=crossover(k, d) and k < OverSoldClose
BUYCLOSE=crossunder(k, d) and k > OverBoughtClose
Open = open
if not na(k) and not na(d)
if crossover(k, d) and k < OverSold and LongFilter and TradeLong
strategy.entry("$", strategy.long, limit = Open, comment="Long")
strategy.close("$",when = crossunder(k, d) and k > OverBoughtClose or open < LstopLoss )
///strategy.close("$",when = open < LstopLoss )
if not na(k) and not na(d)
if crossunder(k, d) and k > OverBought and ShortFilter and TradeShort
strategy.entry("$1", strategy.short, limit = Open, comment="S")
strategy.close ("$1", when = crossover(k, d) and k < OverSoldClose or open > SstopLoss )
///strategy.close ("$1", when = open < SstopLoss)