
이 전략은 해파리 지표에 기반한 암호화폐 트렌드 추적 전략이다. 이 전략은 두 개의 서로 다른 주기의 지수 이동 평균과 해파리 지표가 여러 가지 조건을 결합하여 거래 신호를 생성한다. 이 전략은 중·장선 가격 트렌드를 식별하고, 트렌드가 변할 때 적시에 진입하는 것을 목표로 한다.
이 전략은 50주기 및 100주기 EMA의 평균선을 사용합니다. 동시에, 해파리선을 계산합니다. 이것은 시장의 소음을 필터링 할 수있는 특별한 해파리입니다. 전략은 해파리 선의 개시 가격, 종료 가격, 최고 가격 및 최저 가격을 사용하여 100주기 EMA 라인에 적용하여 더 정확한 거래 신호가 발생합니다.
구체적으로 말하면, 100주기 해수선의 개시 가격이 닫기 가격보다 높고, 상위 K선의 개시 가격이 닫기 가격보다 낮으면 더 많은 신호를 낸다. 반대로, 100주기 해수선의 개시 가격이 닫기 가격보다 낮고, 상위 K선의 개시 가격이 닫기 가격보다 높으면 빈 신호를 낸다.
이 전략은 이중 EMA 시스템과 해파리 지표를 결합하여 중장선 트렌드가 형성될 때 적시에 기회를 잡는 것을 목적으로 한다. 이 전략은 해파리 지표를 사용하여 단기 시장 소음을 필터링하여 거래 신호를 더 신뢰할 수 있게 한다.
위험을 줄이기 위해, 적절하게 중지 손실을 줄일 수 있습니다, 또는 다른 지표와 함께 추세 반전을 판단 고려. 시장이 흔들림 영역에 들어갈 때,이 전략을 일시 중지하고 새로운 추세가 나타날 때까지 기다릴 수 있습니다.
이 전략은 다음과 같은 방향으로 최적화될 수 있습니다.
해파리 지표에 기반한 암호화폐 트렌드 추적 전략은 트렌드 판단, 입시 시점, 스톱 손실 제어의 여러 측면을 종합적으로 고려하여, 암호화폐의 이러한 높은 변동성 품종에 매우 잘 적응합니다. 이 전략은 해파리 지표의 필터링 소음, 안정적인 위험 제어 방법을 사용하여, 중장선 가격 트렌드에서 가져오는 거래 기회를 효과적으로 잡을 수 있습니다. 파라미터 설정, 지표 선택 및 위험 제어 방법을 추가로 최적화하면 이 전략의 성과는 크게 향상될 수 있습니다.
/*backtest
start: 2023-01-12 00:00:00
end: 2024-01-18 00:00:00
period: 1d
basePeriod: 1h
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=4
//@SoftKill21
strategy(title="CRYPTO HA Strategy", shorttitle="CRYPTO HA Strategy", overlay=true , default_qty_type =strategy.percent_of_equity, default_qty_value =100, commission_type= strategy.commission.percent,commission_value =0.1 )
ma1_len = input(50)
ma2_len = input(100)
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 = 2020, title = "To Year", minval = 1970)
startDate = timestamp(fromYear, fromMonth, fromDay, 00, 00)
finishDate = timestamp(toYear, toMonth, toDay, 00, 00)
time_cond = true
//First Moving Average data
o = ema(open, ma1_len)
c = ema(close, ma1_len)
h = ema(high, ma1_len)
l = ema(low, ma1_len)
// === HA calculator ===
ha_t = heikinashi(syminfo.tickerid)
ha_o = security(ha_t, timeframe.period, o)
ha_c = security(ha_t, timeframe.period, c)
ha_h = security(ha_t, timeframe.period, h)
ha_l = security(ha_t, timeframe.period, l)
//Second Moving Average data
o2 = ema(ha_o, ma2_len)
c2 = ema(ha_c, ma2_len)
h2 = ema(ha_h, ma2_len)
l2 = ema(ha_l, ma2_len)
// === Color def ===
ha_col = o2 > c2 ? color.white : color.lime
sell = o2 > c2 and o2[1] < c2[1] and time_cond
buy = o2 < c2 and o2[1] > c2[1] and time_cond
plotshape(buy, color=color.green, text= "Buy", location= location.belowbar,style= shape.labelup, textcolor=color.white, size = size.tiny, title="Buy Alert",editable=false, transp=60)
plotshape(sell, color=color.red, text= "Sell", location= location.abovebar,style= shape.labeldown, textcolor=color.white, size = size.tiny, title="Sell Alert", editable=false, transp=60)
trendColor = buy ? color.red : sell ? color.green : na
plot( buy ? close: sell ? close : na , color=trendColor, style=plot.style_line, linewidth=4, editable=false)
onlylong=input(true)
original=input(false)
if(onlylong)
strategy.entry("long",1,when=buy)
strategy.close("long",when=sell)
if(original)
strategy.entry("long",1,when=buy)
strategy.entry("short",0,when=sell)
sl = input(0.075)
strategy.exit("closelong", "long" , loss = close * sl / syminfo.mintick, alert_message = "sl point")
strategy.exit("closeshort", "short" , loss = close * sl / syminfo.mintick, alert_message = "sl point")