
이동 평균 크로스 라인 거래 전략은 서로 다른 주기의 이동 평균을 계산하여 금 포크 또는 사다리 발생 시 구매 또는 판매 작업을 수행하는 기술 분석 유형의 거래 전략에 속한다. 이 전략은 간단하고 간편하며 자금이 적게 차지하며 회수량이 작으며 중장선 운영에 적합하다.
이 전략은 20주기 및 50주기 EMA의 지수 이동 평균을 계산하여 EMA를 다. 20주기 EMA 위에 50주기 EMA를 때 매매를 한다. 20주기 EMA 아래에 50주기 EMA를 때 매매를 한다.
EMA 지수 지수 이동 평균은 최근 데이터에 더 큰 무게를 준다. EMA의 계산 공식은 다음과 같다:
EMAtoday = (Pricetoday * k) + EMAyesterday * (1-k)
여기서, k = 2/(주기수+1)
따라서, 단기 EMA 위에 장기 EMA를 뚫을 때, 가격 움직임이 부시, LONG; 단기 EMA 아래에 장기 EMA를 뚫을 때, 가격 움직임이 베어시, SHORT。
이 전략은 다음과 같은 장점을 가지고 있습니다.
이 전략에는 다음과 같은 위험도 있습니다.
이 전략은 다음과 같은 측면에서 최적화될 수 있습니다.
이동 평균 크로스 라인 거래 전략은 간단하고 효과적인 기술 거래 전략으로, 이해하기 쉽고, 시장 테스트를 거쳐 실행됩니다. 매개 변수 최적화, 보조 조건을 추가하는 등의 방법을 통해 거래 위험을 더욱 줄이고 전략의 안정성을 향상시킬 수 있습니다. 이 전략은 양적 거래의 기본 모듈이 될 수 있습니다.
/*backtest
start: 2022-11-20 00:00:00
end: 2023-11-26 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/
// © brandlabng
//@version=5
//study(title="Holly Grail", overlay = true)
strategy('HG|E15m', overlay=true)
src = input(close, title='Source')
price = request.security(syminfo.tickerid, timeframe.period, src)
ma1 = input(20, title='1st MA Length')
type1 = input.string('EMA', '1st MA Type', options=['EMA'])
ma2 = input(50, title='2nd MA Length')
type2 = input.string('EMA', '2nd MA Type', options=['EMA'])
price1 = if type1 == 'EMA'
ta.ema(price, ma1)
price2 = if type2 == 'EMA'
ta.ema(price, ma2)
//plot(series=price, style=line, title="Price", color=black, linewidth=1, transp=0)
plot(series=price1, style=plot.style_line, title='1st MA', color=color.new(#219ff3, 0), linewidth=2)
plot(series=price2, style=plot.style_line, title='2nd MA', color=color.new(color.purple, 0), linewidth=2)
longCondition = ta.crossover(price1, price2)
if longCondition
strategy.entry('Long', strategy.long)
shortCondition = ta.crossunder(price1, price2)
if shortCondition
strategy.entry('Short', strategy.short)