
이중 이동 평균 브레이크아웃 전략 (Dual Moving Average Breakout Strategy) 은 빠른 이동 평균과 느린 이동 평균을 기반으로 한 양적 거래 전략이다. 그것은 두 개의 다른 주기의 지수 이동 평균 (EMA) 을 거래 신호로 사용한다. 빠른 이동 평균 상에서 느린 이동 평균을 통과하면 구매 신호가 발생하고 빠른 이동 평균 아래에서 느린 이동 평균을 통과하면 판매 신호가 발생한다.
이 전략의 핵심 논리는 빠른 이동 평균선과 느린 이동 평균선을 사용하여 거래 신호를 형성하는 것이다. 전략은 빠른 이동 평균선 주기 12일, 느린 이동 평균선 주기 26일로 정의한다. 계산 방법은 다음과 같다:
빠른 이동 평균선과 느린 이동 평균선의 교차로 시장의 추세를 판단하고 거래 신호를 생성하는 전형적인 쌍 이동 평균선 전략이다.
이중 이동 평균선 돌파 전략은 다음과 같은 장점이 있다:
이중 이동평균선 돌파전략에는 위험도 있습니다.
해결책:
이중 이동 평행선 돌파 전략은 다음과 같은 측면에서 최적화될 수 있다:
쌍용 이동평균선 돌파 전략은 간단하고 실용적인 정량화 거래 전략이다. 전략 논리가 간단하고 구현하기 쉬운 장점이 있지만, 시장 적응성 문제도 있다. 우리는 파라미터 최적화, 신호 필터링, 위험 제어 등의 방법을 통해 안정적으로 수익을 창출하는 거래 시스템으로 만들 수 있다.
/*backtest
start: 2023-01-17 00:00:00
end: 2024-01-23 00:00:00
period: 1d
basePeriod: 1h
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=4
strategy("CDC Action Zone V.2", overlay=true)
// CDC ActionZone V2 29 Sep 2016
// CDC ActionZone is based on a simple 2MA and is most suitable for use with medium volatility market
// 11 Nov 2016 : Ported to Trading View with minor UI enhancement
LSB = input(title="Long/Short", defval="Long only", options=["Long only", "Short only" , "Both"])
src = input(title="Data Array",type=input.source,defval=ohlc4)
prd1=input(title="Short MA period", type=input.integer,defval=12)
prd2=input(title="Long MA period",type=input.integer,defval=26)
AP = ema(src,2)
Fast = ema(AP,prd1)
Slow = ema(AP,prd2)
Bullish = Fast>Slow
Bearish = Fast<Slow
Green = Bullish and AP>Fast
Red = Bearish and AP<Fast
Yellow = Bullish and AP<Fast
Blue = Bearish and AP>Fast
Buy = Bullish and Bearish[1]
Sell = Bearish and Bullish[1]
alertcondition(Buy,"Buy Signal","Buy")
alertcondition(Sell,"Sell Signal","Sell")
//Plot
l1=plot(Fast,"Fast", linewidth=1,color=color.red)
l2=plot(Slow,"Slow", linewidth=2,color=color.blue)
bcolor = Green ? color.lime : Red ? color.red : Yellow ? color.yellow : Blue ? color.blue : na
barcolor(color=bcolor)
fill(l1,l2,bcolor)
// === INPUT BACKTEST RANGE ===
FromYear = input(defval = 2000, title = "From Year", minval = 1920)
FromMonth = input(defval = 1, title = "From Month", minval = 1, maxval = 12)
FromDay = input(defval = 1, title = "From Day", minval = 1, maxval = 31)
ToYear = input(defval = 9999, title = "To Year", minval = 1921)
ToMonth = input(defval = 12, title = "To Month", minval = 1, maxval = 12)
ToDay = input(defval = 31, title = "To Day", minval = 1, maxval = 31)
// === FUNCTION EXAMPLE ===
start = timestamp(FromYear, FromMonth, FromDay, 00, 00) // backtest start window
finish = timestamp(ToYear, ToMonth, ToDay, 23, 59) // backtest finish window
window() => true // create function "within window of time"
if LSB == "Long only" and Buy and window()
strategy.entry("L",true)
if LSB == "Long only" and Sell and window()
strategy.close("L",qty_percent=100,comment="TP Long")
if LSB == "Both" and Buy and window()
strategy.entry("L",true)
if LSB == "Both" and Sell and window()
strategy.entry("S",false)
if LSB == "Short only" and Sell and window()
strategy.entry("S",false)
if LSB == "Short only" and Buy and window()
strategy.close("S",qty_percent=100,comment="TP Short")