
이것은 일선 높낮이 브레이크와 다중 시간 주기 EMA 트렌드를 결합한 양적 거래 전략이다. 전략은 주로 가격의 전날 높낮이 브레이크를 모니터링하여 EMA 평균선과 자금 흐름 지표 ((CMF)) 과 결합하여 거래 시기를 판단한다. 전략은 동시에 시간선과 일선 두 시간 주기의 200 주기 EMA 평균선을 사용하며, 다중 기술 지표의 검증을 통해 거래의 정확성을 향상시킨다.
전략의 핵심 논리에는 다음과 같은 핵심 요소가 포함됩니다.
구체적인 거래 규칙은 다음과 같습니다. 다중 조건: 가격이 하루 전 최고치를 넘기기 전에 + EMA 상위에서 마감 가격 + CMF의正值 공백 조건: 1일 전 하락한 가격 + EMA 아래의 종결 가격 + CMF의 마이너스 평지 조건: 상장시 가격 하락 EMA, 상장시 가격 돌파 EMA
위험 관리 제안:
이것은 여러 기술 지표와 여러 시간 주기의 분석을 결합한 완전한 거래 시스템입니다. 전략은 일일 고저 파격, 평균선 추세 및 자본 흐름의 통합 분석을 통해 거래 기회를 찾습니다.
/*backtest
start: 2024-10-28 00:00:00
end: 2024-11-27 00:00:00
period: 1h
basePeriod: 1h
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=5
strategy(title='The security Daily HIGH/LOW strategy', overlay=true, initial_capital=10000, calc_on_every_tick=true,
default_qty_type=strategy.percent_of_equity, default_qty_value=100,
commission_type=strategy.commission.percent, commission_value=0.1)
// General Inputs
len = input.int(24, minval=1, title='Length MA', group='Optimization parameters')
src = input.source(close, title='Source MA', group='Optimization parameters')
out = ta.ema(src, len)
length = input.int(20, minval=1, title='CMF Length', group='Optimization parameters')
ad = close == high and close == low or high == low ? 0 : (2 * close - low - high) / (high - low) * volume
mf = math.sum(ad, length) / math.sum(volume, length)
// Function to get daily high and low
f_secureSecurity(_symbol, _res, _src) =>
request.security(_symbol, _res, _src[1], lookahead=barmerge.lookahead_on)
pricehigh = f_secureSecurity(syminfo.tickerid, 'D', high)
pricelow = f_secureSecurity(syminfo.tickerid, 'D', low)
// Plotting previous daily high and low
plot(pricehigh, title='Previous Daily High', style=plot.style_linebr, linewidth=2, color=color.new(color.white, 0))
plot(pricelow, title='Previous Daily Low', style=plot.style_linebr, linewidth=2, color=color.new(color.white, 0))
// Entry Conditions
short = ta.crossunder(low, pricelow) and close < out and mf < 0
long = ta.crossover(high, pricehigh) and close > out and mf > 0
if short and barstate.isconfirmed
strategy.entry('short', strategy.short, stop=pricelow[1])
strategy.close('short', when=close > out)
if long and barstate.isconfirmed
strategy.entry('long', strategy.long, stop=pricehigh[1])
strategy.close('long', when=close < out)
// 200 EMA on 1-hour timeframe
ema_200 = ta.ema(close, 200)
ema_200_1h = request.security(syminfo.tickerid, "60", ta.ema(close, 200))
plot(ema_200_1h, color=color.purple, title="200 EMA (1H)")
plot(ema_200, color=color.white, title="200 EMA")