
이중 이동 평균 튼튼한 거래 전략은 상대적으로 약한 지수 ((RSI) 와 변화율 지수 ((ROC) 의 이중 힘을 결합하여 중장선 트렌드의 방향을 식별합니다. 이 전략은 필터링 조건과 중지 조건을 동시에 설정하여 트렌드 방향 확인에 기초하여 엔트리를 수행하여 가짜 돌파구로 인한 위험을 효과적으로 줄일 수 있습니다.
이 전략은 RSI 지표와 ROC 지표의 조합을 기반으로 진입 시기를 판단한다. 가격이 상대적으로 초과 지역에 가까워지면 구조적 전환점으로 간주되어 반전 신호를 형성한다. 가격이 상대적으로 초과 지역에서 변동하면 현재 추세가 한동안 지속될 것을 나타냅니다. ROC 지표는 변화율의 관점에서 가격 변화의 추세와 힘을 판단한다. 두 가지의 조합은 시장 구조에 대한 판단을 형성한다.
또한, 이 전략은 중장선 트렌드 판단의 SMA와 단기 손실선 두 가지 필터링 조건을 추가하여, 전략은 중장선 트렌드 방향 확인, 단기 손실 위험이 없는 전제에서만 출전할 수 있게 한다. 이러한配置 방식은 충격적인 상황에서 갇혀있는 기회를 줄일 수 있으며, 거래자에게 위험은 제어할 수 있다.
이 전략의 유연한 입력 항목 설정은 또한 거래자가 RSI 또는 ROC 중 하나의 지표만을 입시 기준으로 사용하거나 두 가지의 조합을 사용하여 다른 품종과 시장 유형에 최적화 할 수 있도록 자유롭게 선택할 수있게하여 전략의 적용 범위를 더욱 확장합니다.
이 전략의 가장 큰 장점은 트렌드 및 역전 신호를 결합하여 진입 판단을 하는 데 있습니다. 트렌드 요소와 구조적 기회를 동시에 고려하여 시장 구조의 변화에 기반하여 진입 시기를 정확하게 보장 할 수 있습니다. RSI와 ROC의 조합은 단일 지표에 비해 전략이 시장의 무작위적 잡음에 대한 더 강한 방해를 방지 할 수 있습니다.
또 다른 장점은 전략에 내장된 트렌드 필터 (SMA) 와 단기 스톱머인이 있으며, 이는 불안정한 상황에서 피지배의 확률을 효과적으로 줄일 수 있다. 트렌드 판단과 단기 스톱머인의 두 가지 방어선을 설정하는 것이 위험을 통제할 수 있는 안정적인 전략이다.
마지막으로, 이 전략은 여러 가지 파라미터 설정을 내장하고, 거래자는 다양한 품종과 시장 유형에 대해 최적화 할 수 있습니다. 이것은 전략의 적용 면이 매우 광범위하게 만듭니다. 트렌드 상황이나 평형 상황이든, 이 전략은 시장 변화에 적응하기 위해 파라미터를 조정할 수 있습니다.
이 전략의 가장 큰 위험은 RSI와 ROC와 같은 반전 신호 지표가 일정하게 지연되어 있다는 것입니다. 트렌드가 변할 때, 이러한 지표는 종종 일정하게 지연되어서 파라미터가 설정된 임계 수준에 도달하게됩니다. 이러한 지연은 전략의 진입 시간이 늦어지고 트렌드의 초기 시작 단계를 포착하지 못하게합니다.
또 다른 잠재적인 위험은 흔들리는 추세에서 RSI와 ROC의 파라미터 설정이 너무 민감하게 작용하여 특정 가짜 신호를 발생시킬 수 있다는 것입니다. 단기 스톱이 발동되면 이러한 가짜 신호는 실제 손실을 직접 초래할 수 있습니다.
이 전략은 다음과 같은 부분에서 최적화될 수 있습니다.
KDJ, MACD 등과 같은 더 많은 지표를 조합하여 더 많은 차원을 사용하여 시장 구조를 판단하여 신호의 정확성을 향상시킵니다.
RSI와 ROC의 파라미터 설정에 적응 최적화 메커니즘을 추가하여 실시간 변동성에 따라 지표 파라미터를 동적으로 조정할 수 있습니다.
진입 논리를 최적화하여 트렌드 표시기와 역전 표시기가 조건에 도달할 때 특정 확인 메커니즘을 설정하여 흔들림에서 발생하는 잘못된 신호를 피합니다.
중지 범위를 넓히거나 이동 중지 설정, 회전 더 많은 공간을 제공, 중지 과 밀성으로 인한 누락 수익을 줄이기
이중 이동 평균 안정 거래 전략은 트렌드 판단과 반전 지표를 성공적으로 결합하여 중장선 트렌드 확인을 기반으로 구조적 기회를 포착한다. 이 전략은 또한 강력한 구성성을 갖추고 있으며, 거래자는 개별 주식 및 상황 유형에 대한 파라미터를 최적화 할 수 있다. 내장 된 이중 보호 메커니즘은 또한 위험을 통제 할 수 있도록 한다. 더 많은 지표를 추가로 통합하거나, 또는 적응 파라미터 조정 메커니즘을 구축하는 것을 선택하면, 이 전략의 성능은 확장 할 여지가 있습니다.
/*backtest
start: 2024-01-05 00:00:00
end: 2024-02-04 00:00:00
period: 1h
basePeriod: 15m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © GlobalMarketSignals
//@version=4
strategy("GMS: RSI & ROC Strategy", overlay=true)
LongShort = input(title="Long Only or Short Only or Both?", type=input.string, defval="Both", options=["Both", "Long Only", "Short Only"])
RSIroc = input(title="RSI Only, ROC Only, Both?", type=input.string, defval="Both", options=["Both", "RSI Only", "ROC Only"])
RSILength = input(title="RSI Length", type = input.integer ,defval=14)
RSIUpper = input(title="RSI Upper Threshold", type = input.float ,defval=70)
RSILower = input(title="RSI Lower Threshold", type = input.float ,defval=30)
ROCLength = input(title="ROC Length", type = input.integer ,defval=14)
ROCUpper = input(title="ROC Upper Threshold", type = input.float ,defval=0.01)
ROCLower = input(title="ROC Lower Threshold", type = input.float ,defval=-0.01)
LongExit = input(title="Long Exit SMA Length", type = input.integer ,defval=5)
ShortExit = input(title="Short Exit SMA Length", type = input.integer ,defval=5)
AboveBelow = input(title="Trend SMA Filter?", type=input.string, defval="Above", options=["Above", "Below", "Don't Include"])
TrendLength = input(title="Trend SMA Length", type = input.integer ,defval=200)
//RSI ONLY
//Long Side
if LongShort =="Long Only" and AboveBelow == "Above" and RSIroc == "RSI Only"
strategy.entry("LONG", true, when = rsi(close,RSILength)<RSILower and close< sma(close,LongExit) and close>sma(close,TrendLength))
strategy.close("LONG", when = close>sma(close,LongExit))
if LongShort =="Long Only" and AboveBelow == "Below" and RSIroc == "RSI Only"
strategy.entry("LONG", true, when = rsi(close,RSILength)<RSILower and close< sma(close,LongExit) and close<sma(close,TrendLength))
strategy.close("LONG", when = close>sma(close,LongExit))
if LongShort =="Long Only" and AboveBelow == "Don't Include" and RSIroc == "RSI Only"
strategy.entry("LONG", true, when = rsi(close,RSILength)<RSILower and close< sma(close,LongExit))
strategy.close("LONG", when = close>sma(close,LongExit))
if LongShort =="Both" and AboveBelow == "Above" and RSIroc == "RSI Only"
strategy.entry("LONG", true, when = rsi(close,RSILength)<RSILower and close< sma(close,LongExit) and close>sma(close,TrendLength))
strategy.close("LONG", when = close>sma(close,LongExit))
if LongShort =="Both" and AboveBelow == "Below" and RSIroc == "RSI Only"
strategy.entry("LONG", true, when = rsi(close,RSILength)<RSILower and close< sma(close,LongExit) and close<sma(close,TrendLength))
strategy.close("LONG", when = close>sma(close,LongExit))
if LongShort =="Both" and AboveBelow == "Don't Include" and RSIroc == "RSI Only"
strategy.entry("LONG", true, when = rsi(close,RSILength)<RSILower and close< sma(close,LongExit))
strategy.close("LONG", when = close>sma(close,LongExit))
//RSI ONLY
//SHORT SIDE
if LongShort =="Short Only" and AboveBelow == "Above" and RSIroc == "RSI Only"
strategy.entry("SHORT", false, when = rsi(close,RSILength)>RSIUpper and close> sma(close,ShortExit) and close>sma(close,TrendLength))
strategy.close("SHORT", when = close<sma(close,ShortExit))
if LongShort =="Short Only" and AboveBelow == "Below" and RSIroc == "RSI Only"
strategy.entry("SHORT", false, when = rsi(close,RSILength)>RSIUpper and close> sma(close,ShortExit) and close<sma(close,TrendLength))
strategy.close("SHORT", when = close<sma(close,ShortExit))
if LongShort =="Short Only" and AboveBelow == "Don't Include" and RSIroc == "RSI Only"
strategy.entry("SHORT", false, when = rsi(close,RSILength)>RSIUpper and close> sma(close,ShortExit))
strategy.close("SHORT", when = close<sma(close,ShortExit))
if LongShort =="Both" and AboveBelow == "Above" and RSIroc == "RSI Only"
strategy.entry("SHORT", false, when = rsi(close,RSILength)>RSIUpper and close> sma(close,ShortExit) and close>sma(close,TrendLength))
strategy.close("SHORT", when = close<sma(close,ShortExit))
if LongShort =="Both" and AboveBelow == "Below" and RSIroc == "RSI Only"
strategy.entry("SHORT", false, when = rsi(close,RSILength)>RSIUpper and close> sma(close,ShortExit) and close<sma(close,TrendLength))
strategy.close("SHORT", when = close<sma(close,ShortExit))
if LongShort =="Both" and AboveBelow == "Don't Include" and RSIroc == "RSI Only"
strategy.entry("SHORT", false, when = rsi(close,RSILength)>RSIUpper and close> sma(close,ShortExit))
strategy.close("SHORT", when = close<sma(close,ShortExit))
///////-----------------/////////////
///////-----------------/////////////
///////-----------------/////////////
//ROC ONLY
//Long Side
if LongShort =="Long Only" and AboveBelow == "Above" and RSIroc == "ROC Only"
strategy.entry("LONG", true, when = roc(close,ROCLength)<ROCLower and close< sma(close,LongExit) and close>sma(close,TrendLength))
strategy.close("LONG", when = close>sma(close,LongExit))
if LongShort =="Long Only" and AboveBelow == "Below" and RSIroc == "ROC Only"
strategy.entry("LONG", true, when = roc(close,ROCLength)<ROCLower and close< sma(close,LongExit) and close<sma(close,TrendLength))
strategy.close("LONG", when = close>sma(close,LongExit))
if LongShort =="Long Only" and AboveBelow == "Don't Include" and RSIroc == "ROC Only"
strategy.entry("LONG", true, when = roc(close,ROCLength)<ROCLower and close< sma(close,LongExit))
strategy.close("LONG", when = close>sma(close,LongExit))
if LongShort =="Both" and AboveBelow == "Above" and RSIroc == "ROC Only"
strategy.entry("LONG", true, when = roc(close,ROCLength)<ROCLower and close< sma(close,LongExit) and close>sma(close,TrendLength))
strategy.close("LONG", when = close>sma(close,LongExit))
if LongShort =="Both" and AboveBelow == "Below" and RSIroc == "ROC Only"
strategy.entry("LONG", true, when = roc(close,ROCLength)<ROCLower and close< sma(close,LongExit) and close<sma(close,TrendLength))
strategy.close("LONG", when = close>sma(close,LongExit))
if LongShort =="Both" and AboveBelow == "Don't Include" and RSIroc == "ROC Only"
strategy.entry("LONG", true, when = rsi(close,ROCLength)<ROCLower and close< sma(close,LongExit))
strategy.close("LONG", when = close>sma(close,LongExit))
//ROC ONLY
//SHORT SIDE
if LongShort =="Short Only" and AboveBelow == "Above" and RSIroc == "ROC Only"
strategy.entry("SHORT", false, when = roc(close,ROCLength)>ROCUpper and close> sma(close,ShortExit) and close>sma(close,TrendLength))
strategy.close("SHORT", when = close<sma(close,ShortExit))
if LongShort =="Short Only" and AboveBelow == "Below" and RSIroc == "ROC Only"
strategy.entry("SHORT", false, when = roc(close,ROCLength)>ROCUpper and close> sma(close,ShortExit) and close<sma(close,TrendLength))
strategy.close("SHORT", when = close<sma(close,ShortExit))
if LongShort =="Short Only" and AboveBelow == "Don't Include" and RSIroc == "ROC Only"
strategy.entry("SHORT", false, when = roc(close,ROCLength)>ROCUpper and close> sma(close,ShortExit))
strategy.close("SHORT", when = close<sma(close,ShortExit))
if LongShort =="Both" and AboveBelow == "Above" and RSIroc == "ROC Only"
strategy.entry("SHORT", false, when = roc(close,ROCLength)>ROCUpper and close> sma(close,ShortExit) and close>sma(close,TrendLength))
strategy.close("SHORT", when = close<sma(close,ShortExit))
if LongShort =="Both" and AboveBelow == "Below" and RSIroc == "ROC Only"
strategy.entry("SHORT", false, when = roc(close,ROCLength)>ROCUpper and close> sma(close,ShortExit) and close<sma(close,TrendLength))
strategy.close("SHORT", when = close<sma(close,ShortExit))
if LongShort =="Both" and AboveBelow == "Don't Include" and RSIroc == "ROC Only"
strategy.entry("SHORT", false, when = roc(close,ROCLength)>ROCUpper and close> sma(close,ShortExit))
strategy.close("SHORT", when = close<sma(close,ShortExit))
///////-----------------/////////////
///////-----------------/////////////
///////-----------------/////////////
//BOTH
//Long Side
if LongShort =="Long Only" and AboveBelow == "Above" and RSIroc == "Both"
strategy.entry("LONG", true, when = rsi(close,RSILength)<RSILower and roc(close,ROCLength)<ROCLower and close< sma(close,LongExit) and close>sma(close,TrendLength))
strategy.close("LONG", when = close>sma(close,LongExit))
if LongShort =="Long Only" and AboveBelow == "Below" and RSIroc == "Both"
strategy.entry("LONG", true, when = rsi(close,RSILength)<RSILower and roc(close,ROCLength)<ROCLower and close< sma(close,LongExit) and close<sma(close,TrendLength))
strategy.close("LONG", when = close>sma(close,LongExit))
if LongShort =="Long Only" and AboveBelow == "Don't Include" and RSIroc == "Both"
strategy.entry("LONG", true, when = rsi(close,RSILength)<RSILower and roc(close,ROCLength)<ROCLower and close< sma(close,LongExit))
strategy.close("LONG", when = close>sma(close,LongExit))
if LongShort =="Both" and AboveBelow == "Above" and RSIroc == "Both"
strategy.entry("LONG", true, when = rsi(close,RSILength)<RSILower and roc(close,ROCLength)<ROCLower and close< sma(close,LongExit) and close>sma(close,TrendLength))
strategy.close("LONG", when = close>sma(close,LongExit))
if LongShort =="Both" and AboveBelow == "Below" and RSIroc == "Both"
strategy.entry("LONG", true, when = rsi(close,RSILength)<RSILower and roc(close,ROCLength)<ROCLower and close< sma(close,LongExit) and close<sma(close,TrendLength))
strategy.close("LONG", when = close>sma(close,LongExit))
if LongShort =="Both" and AboveBelow == "Don't Include" and RSIroc == "Both"
strategy.entry("LONG", true, when = rsi(close,RSILength)<RSILower and roc(close,ROCLength)<ROCLower and close< sma(close,LongExit))
strategy.close("LONG", when = close>sma(close,LongExit))
//BOTH
//SHORT SIDE
if LongShort =="Short Only" and AboveBelow == "Above" and RSIroc == "Both"
strategy.entry("SHORT", false, when = rsi(close,RSILength)>RSIUpper and roc(close,ROCLength)>ROCUpper and close> sma(close,ShortExit) and close>sma(close,TrendLength))
strategy.close("SHORT", when = close<sma(close,ShortExit))
if LongShort =="Short Only" and AboveBelow == "Below" and RSIroc == "Both"
strategy.entry("SHORT", false, when = rsi(close,RSILength)>RSIUpper and roc(close,ROCLength)>ROCUpper and close> sma(close,ShortExit) and close<sma(close,TrendLength))
strategy.close("SHORT", when = close<sma(close,ShortExit))
if LongShort =="Short Only" and AboveBelow == "Don't Include" and RSIroc == "Both"
strategy.entry("SHORT", false, when = rsi(close,RSILength)>RSIUpper and roc(close,ROCLength)>ROCUpper and close> sma(close,ShortExit))
strategy.close("SHORT", when = close<sma(close,ShortExit))
if LongShort =="Both" and AboveBelow == "Above" and RSIroc == "Both"
strategy.entry("SHORT", false, when = rsi(close,RSILength)>RSIUpper and roc(close,ROCLength)>ROCUpper and close> sma(close,ShortExit) and close>sma(close,TrendLength))
strategy.close("SHORT", when = close<sma(close,ShortExit))
if LongShort =="Both" and AboveBelow == "Below" and RSIroc == "Both"
strategy.entry("SHORT", false, when = rsi(close,RSILength)>RSIUpper and roc(close,ROCLength)>ROCUpper and close> sma(close,ShortExit) and close<sma(close,TrendLength))
strategy.close("SHORT", when = close<sma(close,ShortExit))
if LongShort =="Both" and AboveBelow == "Don't Include" and RSIroc == "Both"
strategy.entry("SHORT", false, when = rsi(close,RSILength)>RSIUpper and roc(close,ROCLength)>ROCUpper and close> sma(close,ShortExit))
strategy.close("SHORT", when = close<sma(close,ShortExit))