모멘텀 압축 전략

저자:차오장, 날짜: 2023-11-14 14:04:24
태그:

img

전반적인 설명

이 전략의 주요 아이디어는 게으른 곰의 모멘텀 지표와 Crypto Face의 MFI 지표를 결합하여 트렌드가 상승할 때 길게, 트렌드가 하락할 때 짧게 이동하여 시장 트렌드를 따르는 양적 거래 전략을 실현하는 것입니다.

전략 논리

  1. 트렌드 방향을 결정하기 위해 20 일 최고 최고, 최저 하위 및 근 평균에 비해 폐쇄 가격의 선형 회귀를 계산하는 Lazy Bear의 모멘텀 지표 BlueWave를 사용하십시오. 블루 웨이브가 0을 넘으면 상승 추세를 나타냅니다. 0을 넘으면 하락 추세를 나타냅니다.

  2. 통화 흐름을 결정하기 위해 지난 58일 동안의 가격 변화와 부피의 합을 계산하는 Crypto Face의 개선된 MFI 지표를 사용하십시오. 0 이상의 MFI는 통화 유입을 나타냅니다. 0 이하의 MFI는 출동을 나타냅니다.

  3. 블루 웨이브가 0을 넘고 MFI가 0보다 크면, 구매 신호가 생성되어 긴 포지션을 개설합니다. 블루 웨이브가 0을 넘고 MFI가 0보다 작으면 판매 신호가 생성되어 짧은 포지션을 개설합니다.

  4. 스톱 로스 조건과 수익 조건을 설정하여 리스크를 제어하면서 수익을 위한 시장 트렌드를 따라가십시오.

장점

  1. 두 가지 지표를 결합하면 시장 동향 방향을 더 정확하게 결정할 수 있습니다.

  2. 블루 웨이브의 부드러운 곡선은 외형의 편견을 피하고 트렌드 판단을 더 신뢰할 수 있습니다.

  3. MFI는 현금 흐름을 결정할 수 있고, 가짜 유출로 인한 손실을 피할 수 있습니다.

  4. 이 전략은 몇 가지 매개 변수를 가지고 있으며 실행 및 운영이 쉽습니다.

  5. 유연한 스톱 로스 및 수익 취득 설정은 거래 위험을 제어하는 데 도움이 됩니다.

  6. 특정 시장 시간 동안 비정상적인 변동성을 피하기 위해 거래 세션이 설정 될 수 있습니다.

위험성

  1. 계속되는 하락 추세는 연속적인 단장 및 손실로 이어질 수 있습니다.

  2. 잘못된 신호가 포착될 수도 있습니다.

  3. 너무 큰 스톱 로즈는 손실을 증폭시킬 수 있습니다.

  4. 높은 변동성은 종종 스톱 로스 포인트에 도달 할 수 있습니다.

  5. 부적절한 매개 변수 최적화는 전략 성능의 저하로 이어질 수 있습니다.

  6. 너무 빈번한 거래 신호는 거래 비용과 미끄러짐을 증가시킬 수 있습니다.

강화

  1. 더 안정적이고 신뢰할 수 있는 신호를 위해 블루 웨이브와 MFI의 매개 변수를 최적화합니다.

  2. 지속적인 단축 손실을 피하기 위해 트렌드 지표를 포함합니다.

  3. 동적으로 스톱 로스/프로피트 취업 비율을 조정하여 함락될 확률을 낮추는 것.

  4. 거짓 신호를 줄이기 위해 입구 조건을 정비해

  5. 포지션 사이즈를 고려하여 릴리 추격 및 덤핑 다이프를 피하십시오.

  6. 기계 학습 모델과 결합하여 보다 정확한 출입점과 출입점을 얻을 수 있습니다.

결론

이 전략은 트렌드 방향을 결정하기 위해 블루 웨이브와 MFI 지표를 결합하여 상승 추세에 길고 하락 추세에 짧아 수익을 위해 시장 추세를 효과적으로 따라간다. 그러나 매개 변수 설정, 스톱 로스/프로피트 취득, 지속적인 하락 추세 등에 위험이 존재하며, 전략 성과와 탄력성을 향상시키기 위해 매개 변수 조정, 스톱 로스 메커니즘, 필터 조건 등을 추가적으로 최적화해야합니다. 전반적으로 전략은 직관적이며 장기적인 추세를 잘 따라 작동하지만, 범위 시장에 갇혀있을 때 손실이 발생할 수 있습니다.


/*backtest
start: 2022-11-07 00:00:00
end: 2023-11-13 00:00:00
period: 1d
basePeriod: 1h
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/

// @version=4
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © Bunghole 2021
strategy(title="Crypto Squeeze Strategy", initial_capital = 100000, default_qty_type = strategy.percent_of_equity, default_qty_value = 100, pyramiding = 0, currency = 'USD', overlay=true)

//// Stoploss and Take Profit Parameters
// Enable Long Strategy
enable_long_strategy = input(true, title="Enable Long Strategy", group="SL/TP For Long Strategy",inline="1")
long_stoploss_value = input(defval=50, title='Stoploss %', type=input.float, minval=0.1, group="SL/TP For Long Strategy",inline="2")
long_stoploss_percentage = (close * (long_stoploss_value / 100)) / syminfo.mintick
long_takeprofit_value = input(defval=50, title='Take Profit %', type=input.float, minval=0.1, group="SL/TP For Long Strategy",inline="2")
long_takeprofit_percentage = (close * (long_takeprofit_value / 100)) / syminfo.mintick

// Enable Short Strategy
enable_short_strategy = input(true, title="Enable Short Strategy", group="SL/TP For Short Strategy",inline="3")
short_stoploss_value = input(defval=50, title='Stoploss %', type=input.float, minval=0.1, group= "SL/TP For Short Strategy",inline="4")
short_stoploss_percentage = (close * (short_stoploss_value / 100)) / syminfo.mintick
short_takeprofit_value = input(defval=50, title='Take Profit %', type=input.float, minval=0.1, group="SL/TP For Short Strategy",inline="4")
short_takeprofit_percentage = (close * (short_takeprofit_value / 100)) / syminfo.mintick

// Plot Stoploss & Take Profit Levels
long_stoploss_price = strategy.position_avg_price * (1 - long_stoploss_value/100)
long_takeprofit_price = strategy.position_avg_price * (1 + long_takeprofit_value/100)
short_stoploss_price = strategy.position_avg_price * (1 + short_stoploss_value/100)
short_takeprofit_price = strategy.position_avg_price * (1 - short_takeprofit_value/100)
plot(enable_long_strategy and not enable_short_strategy ? long_stoploss_price: na, color=#ff0000, style=plot.style_linebr, linewidth=2, title="Long SL Level")
plot(enable_long_strategy and not enable_short_strategy ? long_takeprofit_price: na, color=#008000, style=plot.style_linebr, linewidth=2, title="Long TP Level")
plot(enable_short_strategy and not enable_long_strategy ? short_stoploss_price: na, color=#ff0000, style=plot.style_linebr, linewidth=2, title="Short SL Level")
plot(enable_short_strategy and not enable_long_strategy ? short_takeprofit_price: na, color=#008000, style=plot.style_linebr, linewidth=2, title="Short TP Level")

// Date Range
start_date = input(title="Start Date", type=input.integer, defval=1, minval=1, maxval=31, group="Date Range")
start_month = input(title="Start Month", type=input.integer, defval=1, minval=1, maxval=12, group="Date Range")
start_year = input(title="Start Year", type=input.integer, defval=1804, minval=1800, maxval=3000, group="Date Range")
end_date = input(title="End Date", type=input.integer, defval=1, minval=1, maxval=3, group="Date Range")
end_month = input(title="End Month", type=input.integer, defval=1, minval=1, maxval=12, group="Date Range")
end_year = input(title="End Year", type=input.integer, defval=2077, minval=1800, maxval=3000, group="Date Range")
in_date_range = (time >= timestamp(syminfo.timezone, start_year, start_month, start_date, 0, 0)) and (time < timestamp(syminfo.timezone, end_year, end_month, end_date, 0, 0))


//// Indicator Inputs
// Lazy Bear's Momentum Indicator
BlueWave = linreg(close - avg(avg(highest(high, 20), lowest(low, 20)), sma(close, 20)), 20, 0)

// Replicated version of Crypto Face's MFI Indicator
mfiUpper = sum(volume * (change(hlc3) <= 0 ? 0 : hlc3), 58)
mfiLower = sum(volume * (change(hlc3) >= 0 ? 0 : hlc3), 58)
_mfiRsi(mfiUpper, mfiLower) =>
    if mfiLower == 0
        100
    if mfiUpper == 0
        0
	100.0 - (100.0 / (1.0 + mfiUpper / mfiLower))

mf = _mfiRsi(mfiUpper, mfiLower)
mfi = (mf - 50) * 3


//// Strategy
// Creating Long and Short Strategy
buy_signal = crossover(BlueWave, 0) and mfi > 0 
sell_signal = crossunder(BlueWave, 0) and mfi < 0 

// Long Strategy
if buy_signal and in_date_range and enable_long_strategy == true
    strategy.entry("Long", true, when=buy_signal, alert_message="Open Long Position")
    strategy.exit("Long  SL/TP", from_entry="Long", loss=long_stoploss_percentage, profit=long_takeprofit_percentage, alert_message="Your Long SL/TP Limit As Been Triggered.")
    strategy.close("Long", when=sell_signal, alert_message="Close Long Position")

// Short Strategy
if sell_signal and in_date_range and enable_short_strategy == true
    strategy.entry("Short", false, when = sell_signal, alert_message="Open Short Position")
    strategy.exit("Short SL/TP", from_entry="Short", loss=short_stoploss_percentage, profit=short_takeprofit_percentage, alert_message="Your Short SL/TP Limit As Been Triggered.")
    strategy.close("Short", when=buy_signal, alert_message="Close Short Position")


더 많은