이 전략은 단순하고 효율적인 거래 전략으로, 진동 지표 MACD와 이동 평균 EMA를 결합한다. 현재는 4시간 K선으로 설정되어 있으며, 필요에 따라 다른 시간 주기로 조정할 수 있다. 그것은 비트코인과 이더리온의 지난 3년 데이터에서 우수한 성과를 내고, 단순한 보유 전략보다 우수하다. 최적화 및 수정을 통해, 미래에셋, 주식, 외환 주식 등의 시장으로 조정할 수 있다.
이 전략은 다음과 같은 주요 구성 요소로 구성됩니다.
MACD 지표: 가격 동력의 변화를 판단한다.
EMA 평균선: 가격 추세 방향을 판단한다.
시간 조건: 제한된 전략 유효 기간.
더 많은 공간을 선택: 더 많은 것을 선택하거나 빈 방향을 선택하십시오.
거래 규칙은 다음과 같습니다.
상점/공점: 매트리스가 EMA보다 높을 때, MACD 기둥이 긍정적이며, 현재 K 선이 전날보다 높을 때 상점/공점한다.
공백/평평: 마감 가격이 EMA보다 낮고 MACD 기둥이 마이너스이며 현재 K 선이 전날보다 낮을 때 공백/평평이다.
이 전략은 간단하고 명확하며, 트렌드와 단기간의 두 가지 거래 아이디어가 결합되어 효율적인 양적 의사 결정 시스템을 형성합니다.
단일 지표에 비해 이 전략은 다음과 같은 장점이 있습니다.
MACD는 단기 동력을 판단하고, EMA는 트렌드 방향을 판단하며, 지표는 밀접하게 조화를 이룬다.
규칙은 간단하고 명확하며, 이해하기 쉽고, 실행에 옮기는 데에는 큰 어려움이 없습니다.
유연하게 조정 가능한 파라미터는 다른 품종과 시간 주기에도 적용된다.
단방향으로 상장하거나 상장하거나 양방향으로 거래할 수 있습니다.
전략 유효 기간을 설정하여 불필요한 거래를 방지할 수 있습니다.
“이번 대회에서 가장 좋은 성적을 거뒀고, 몇 년 동안 꾸준히 수익을 올리고 있다.
자금 관리가 가능하여 단독 손실이 너무 커지는 것을 방지할 수 있습니다.
기계 학습 기술을 도입하여 최적화 및 개선할 수 있습니다.
이 전략의 장점은 많지만, 다음과 같은 위험도 있습니다.
변수 최적화 범위가 넓고, 과대 최적화 위험이 있다.
스톱 스톱을 설정하지 않은 경우, 손실이 확대될 위험이 있습니다.
트랜스포메이션을 고려하지 않고 가짜 돌파구가 발생할 수 있습니다.
트렌드 전환점을 인식하는 데 지연을 하면 손실을 완전히 피할 수 없습니다.
시장 환경의 변화로 인해 효과가 약해질 수 있습니다.
역사적인 데이터에 기초하여 모델의 안정성에 주의를 기울여야 합니다.
거래 빈도가 높고 거래 비용이 더 많이 들 수 있습니다.
수익 회수율에 주의를 기울여 곡선이 너무 커지지 않도록 주의해야 합니다.
위와 같은 분석을 통해, 이 전략은 다음과 같은 측면에서 최적화될 수 있습니다.
거래량 지표에 추가하여 가짜 돌파구를 피하십시오.
단기 손실을 제어하기 위해 스톱 로드 설정을 추가합니다.
다른 시간 동안의 파라미터의 효과를 평가한다.
기계 학습 기술을 도입하여 동적 최적화를 구현하십시오.
다중 시장 검증, 안정성 향상.
포지션 크기를 조정하여 거래 빈도를 낮추십시오.
자금 관리 전략을 최적화하라
테스트 가격 차이 계약, 증가 빈도.
계속적으로 재검토를 통해 과일접합을 방지한다.
이 전략은 전체적으로 MACD와 EMA 지표와 함께 간단하고 효율적인 양적 전략을 형성합니다. 그러나 모든 전략은 시장 환경의 변화에 대한 적응성과 안정성을 유지하기 위해 지속적으로 최적화하고 검증해야합니다. 거래 전략은 지속적으로 진화하고 업데이트해야합니다.
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © SoftKill21
//@version=4
strategy("My Script", overlay=true)
//heiking ashi calculation
UseHAcandles = input(false, title="Use Heikin Ashi Candles in Algo Calculations")
//
// === /INPUTS ===
// === BASE FUNCTIONS ===
haClose = UseHAcandles ? security(heikinashi(syminfo.tickerid), timeframe.period, close) : close
haOpen = UseHAcandles ? security(heikinashi(syminfo.tickerid), timeframe.period, open) : open
haHigh = UseHAcandles ? security(heikinashi(syminfo.tickerid), timeframe.period, high) : high
haLow = UseHAcandles ? security(heikinashi(syminfo.tickerid), timeframe.period, low) : low
//timecondition
fromDay = input(defval = 1, title = "From Day", minval = 1, maxval = 31)
fromMonth = input(defval = 1, title = "From Month", minval = 1, maxval = 12)
fromYear = input(defval = 2020, title = "From Year", minval = 1970)
//monday and session
// To Date Inputs
toDay = input(defval = 31, title = "To Day", minval = 1, maxval = 31)
toMonth = input(defval = 12, title = "To Month", minval = 1, maxval = 12)
toYear = input(defval = 2021, title = "To Year", minval = 1970)
startDate = timestamp(fromYear, fromMonth, fromDay, 00, 00)
finishDate = timestamp(toYear, toMonth, toDay, 00, 00)
time_cond = true
//ema data -- moving average
len = input(9, minval=1, title="Length")
src = input(hl2, title="Source")
out = ema(src, len)
//plot(out, title="EMA", color=color.blue)
//histogram
fast_length = input(title="Fast Length", type=input.integer, defval=12)
slow_length = input(title="Slow Length", type=input.integer, defval=26)
signal_length = input(title="Signal Smoothing", type=input.integer, minval = 1, maxval = 50, defval = 9)
sma_source = input(title="Simple MA (Oscillator)", type=input.bool, defval=false)
sma_signal = input(title="Simple MA (Signal Line)", type=input.bool, defval=false)
// Calculating
fast_ma = sma_source ? sma(src, fast_length) : ema(src, fast_length)
slow_ma = sma_source ? sma(src, slow_length) : ema(src, slow_length)
macd = fast_ma - slow_ma
signal = sma_signal ? sma(macd, signal_length) : ema(macd, signal_length)
hist = macd - signal
//main variables to apply conditions are going to be out(moving avg) and hist(macd)
long = haClose > out and haClose > haClose[1] and out > out[1] and hist> 0 and hist[1] < 0 and time_cond
short = haClose < out and haClose < haClose[1] and out < out[1] and hist < 0 and hist[1] > 0 and time_cond
//limit to 1 entry
var longOpeneda = false
var shortOpeneda = false
var int timeOfBuya = na
longCondition= long and not longOpeneda
if longCondition
longOpeneda := true
timeOfBuya := time
longExitSignala = short
exitLongCondition = longOpeneda[1] and longExitSignala
if exitLongCondition
longOpeneda := false
timeOfBuya := na
plotshape(longCondition, style=shape.labelup, location=location.belowbar, color=color.green, size=size.tiny, title="BUY", text="BUY", textcolor=color.white)
plotshape(exitLongCondition, style=shape.labeldown, location=location.abovebar, color=color.red, size=size.tiny, title="SELL", text="SELL", textcolor=color.white)
//automatization
longEntry= input(true)
shortEntry=input(false)
if(longEntry)
strategy.entry("long",strategy.long,when=longCondition)
strategy.close("long",when=exitLongCondition)
if(shortEntry)
strategy.entry("short",strategy.short,when=exitLongCondition)
strategy.close("short",when=longCondition)