
자기 적응 가격 크로스 일률 거래 전략은 헐 이동 평균 (Hull Moving Average, HMA) 을 기반으로 한 양적 거래 방법이다. 이 전략은 가격과 HMA의 크로스를 사용하여 구매 및 판매 신호를 생성하며, 고정된 중지 및 중지 수준을 설정하여 위험과 수익을 관리한다. 이 전략은 104주기의 HMA를 주요 지표로 사용하고, 가격 크로스와 결합하여 거래를 촉발한다.
이 전략의 핵심은 Hull 이동 평균 ((HMA) 을 주요 지표로 사용하는 것입니다. HMA는 가격 변화에 빠르게 반응하면서 지연을 줄일 수 있는 고급 이동 평균입니다. 전략 논리는 다음과 같습니다.
전략은 오픈 포지션을 추적하여 기존의 포지션을 재개시하지 않도록합니다. 거래가 평정되면 시스템이 새로운 거래 신호가 적용되도록 표시를 재설정합니다.
자동화 된 가격 크로스 일률 거래 전략은 간단하고 효과적인 양적 거래 방법입니다. 헐 이동 평균의 장점을 활용하여 시장 추세를 포착 할 수 있으며 고정 된 위험 관리 조치로 자금을 보호 할 수 있습니다. 전략에는 몇 가지 잠재적인 위험이 있지만 지속적인 최적화 및 개선으로 성능과 적응력을 더욱 향상시킬 수 있습니다. 자동화 된 거래 솔루션을 찾는 거래자에게는 고려해야 할 기본 전략 프레임 워크입니다.
/*backtest
start: 2024-01-01 00:00:00
end: 2024-03-23 00:00:00
period: 1d
basePeriod: 1d
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=5
strategy("SHIESTD", overlay=true)
// Function to calculate Hull Moving Average (HMA)
hma(src, length) =>
wma1 = ta.wma(src, length)
wma2 = ta.wma(src, length / 2)
hma = ta.wma(2 * wma2 - wma1, math.round(math.sqrt(length)))
hma
// Parameters
hma_length = 104
// Calculate Hull Moving Average
hma_value = hma(close, hma_length)
// Plot HMA
plot(hma_value, title="104-period Hull Moving Average", color=color.blue, linewidth=2)
// Define SL and TP values in dollars
long_sl_amount = 1.25
long_tp_amount = 37.5
short_sl_amount = 1.25
short_tp_amount = 37.5
// Number of contracts
contracts = 2
// Function to calculate SL and TP prices based on entry price and dollar amounts
long_sl_price(entry_price) =>
entry_price - long_sl_amount
long_tp_price(entry_price) =>
entry_price + long_tp_amount
short_sl_price(entry_price) =>
entry_price + short_sl_amount
short_tp_price(entry_price) =>
entry_price - short_tp_amount
// Trading conditions
price_intersects_hma = ta.crossover(close, hma_value) or ta.crossunder(close, hma_value)
// Long and Short Conditions based on price intersecting HMA
long_condition = ta.crossover(close, hma_value)
short_condition = ta.crossunder(close, hma_value)
// Track open positions
var bool long_open = false
var bool short_open = false
// Handle Long Positions
if (long_condition and not long_open)
entry_price = close
strategy.entry("Long", strategy.long, qty=contracts)
strategy.exit("Exit Long", from_entry="Long", stop=long_sl_price(entry_price), limit=long_tp_price(entry_price))
long_open := true
// Handle Short Positions
if (short_condition and not short_open)
entry_price = close
strategy.entry("Short", strategy.short, qty=contracts)
strategy.exit("Exit Short", from_entry="Short", stop=short_sl_price(entry_price), limit=short_tp_price(entry_price))
short_open := true
// Reset flags when the position is closed
if (strategy.opentrades == 0)
long_open := false
short_open := false