
골드 분할 이동 평균 거래 전략은 장기 단기 이동 평균의 골드 크로스를 거래 신호로 이용하려고 시도하는 정량 거래 전략이다. 이 전략은 RSI 지표와 결합하여 지역 높은 곳에서 입장을 개설하는 것을 피하기 위해 위험을 제어합니다.
이 전략은 주로 두 개의 이동 평균을 기반으로 합니다: 200 일선으로 장기 평균, 10 일선으로 단기 평균. 단기 평균 선이 장기 평균 선을 통과하면 구매 신호가 발생하고, 단기 평균 선이 장기 평균 선을 통과하면 판매 신호가 발생합니다. 이것은 유명한 황금 크로스 입니다. 이 전략은 RSI 지표와 결합되며, RSI가 30 미만이라면 전략은 초매 지역에서만 상장을합니다.
특히, 다음과 같은 조건이 충족될 경우, 상장할 수 있습니다.
평지 조건은 다음과 같습니다:
이 전략은 다음과 같은 장점을 가지고 있습니다.
이 전략에는 몇 가지 위험도 있습니다.
이러한 위험을 줄이기 위해 다음과 같은 최적화 조치를 고려할 수 있습니다.
이 전략에는 더 많은 최적화 가능성이 있습니다:
골드 분할 이동 평균 거래 전략은 전체적으로 간단하고 효과적인 트렌드 추적 전략이다. 그것은 고전적인 평선 교차 신호를 사용하여 거래 기회를 생성하고, 위험을 제어하기 위해 손실을 막는 스톱을 갖추고 있다. 이 전략은 다중 지표 조합, 매개 변수 최적화, 기계 학습 등의 방법으로 추가적으로 개선될 수 있어 더 나은 전략 효과를 얻을 수 있다.
/*backtest
start: 2022-12-29 00:00:00
end: 2024-01-04 00:00:00
period: 1d
basePeriod: 1h
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/
// © tsujimoto0403
//@version=5
strategy("聖杯", overlay=true,default_qty_type=strategy.percent_of_equity,
default_qty_value=100)
//ユーザーインプットの準備
malongperiod=input.int(200,"長期移動平均BASE200",group = "パラメータ")
mashortperiod=input.int(10,"長期移動平均BASE10",group = "パラメータ")
stop=input.int(20,title = "損切の割合%",group = "パラメータ")
profit=input.int(5,title = "利食いの割合%",group = "パラメータ")
startday=input(title="バックテストを始める日", defval=timestamp("01 Jan 2018 13:30 +0000"), group="期間")
endday=input(title="バックテスを終わる日", defval=timestamp("1 Jan 2099 19:30 +0000"), group="期間")
//使う変数
var float stopprice=0
var float takeprofit=0
//とりあえず使うインジケーターをプロット
malong=ta.sma(close,malongperiod)
mashort=ta.sma(close,mashortperiod)
plot(malong,color=color.aqua,linewidth = 2)
plot(mashort,color=color.yellow,linewidth = 2)
bgcolor(ta.rsi(close,3)<30?color.rgb(229, 86, 86, 48):na)
//期間条件
datefilter = true
//エントリー条件
if close>malong and close<mashort and strategy.position_size == 0 and datefilter and ta.rsi(close,3)<30
strategy.entry(id="long", direction=strategy.long)
if strategy.position_size>0
strategy.exit(id="long",stop=(1-0.01*stop)*strategy.position_avg_price)
//売り
if strategy.position_size > 0 and close>mashort and close<low[1]
strategy.close(id ="long")