환전 종료 가격 브레이크업 전략

저자:차오장, 날짜: 2023-12-11 11:44:49
태그:

img

전반적인 설명

이 전략은 리스크 관리에 대한 가격 브레이크아웃 신호와 오스실레이팅 스톱 로스 메커니즘을 활용합니다. 가격이 저항을 깨는 경우 길고 가격이 지원을 깨는 경우 짧습니다. 동시에 더 나은 리스크 통제를 위해 오스실레이팅 스톱 로스와 수익 취득 스톱이 적용됩니다.

전략 논리

이 전략은 다음의 핵심 요점들에 기초하고 있습니다.

  1. 트렌드 방향을 결정하기 위해 MA를 사용한다. 빠른 및 느린 MA는 그래프로 표시되며, 느린 MA 이상의 빠른 MA가 상승 추세를 나타내고, 하단의 신호가 하향 추세를 나타냅니다.

  2. 레지스탕스 브레이크 긴 신호입니다. 가격이 급격히 상승하고 최근 스윙 높은점을 깨면 레지스탕스 레벨을 깨는 것으로 간주됩니다.

  3. 마이너스 마이너스 마이너스 마이너스 마이너스

  4. 스톱 로스 오스ilyating stop loss. 진입 후, 스톱 로스 라인이 설정되어 가격 변동에 따라 조정되며, 오스ilyating stop loss 메커니즘을 형성합니다.

  5. 손해를 멈추고 수익을 취합니다. 손해를 멈추고 수익을 취합니다.

특히, 높은 가격과 낮은 가격의 평균을 원천으로 사용하여 트렌드를 결정하기 위해 빠르고 느린 EMA를 그래프화합니다. 빠른 EMA가 느린 EMA를 넘어서고 저항 브레이크 아웃 신호가 나타나면 길어집니다. 빠른 EMA가 느린 EMA 아래로 떨어지고 지원 브레이크 아웃이 나타나면 짧아집니다. 진입 후 특정 기간의 가장 낮은 가격은 스톱 로스 라인으로 설정되어 가격 상승에 따라 계속 조정됩니다. 수익을 확보하기 위해 수익 라인을 그래프화합니다. 전략은 트렌드에서 수익을 얻는 동안 위험을 효과적으로 제어합니다.

이점 분석

이 전략의 장점은 다음과 같습니다.

  1. 안정적인 수익성. 추세를 따라가는 것은 장기적인 추세로부터 안정적인 이익을 얻을 수 있습니다.

  2. 우수한 위험 통제, 오시일레이션 스톱과 보호 스톱으로 손실을 빠르게 줄일 수 있습니다.

  3. 정확한 신호입니다. 저항은 길고 지원은 짧습니다.

  4. 간단한 규칙. 표시와 신호는 간단하고 따라하기 쉽습니다.

  5. 시장 적응력이 있습니다. 다른 제품과 시장 조건에 잘 맞습니다.

위험 분석

이 전략에서 주목해야 할 몇 가지 위험:

  1. 브레이크오웃 실패 위험. 가격은 초기 브레이크오웃 후 환전 또는 인기를 끌 수 있으며, 스톱 로스를 유발할 수 있습니다.

  2. 매개 변수 최적화 위험. 잘못된 매개 변수 조정으로 인해 신호가 너무 많거나 너무 적습니다. 최적화는 신중해야 합니다.

  3. 지표 실패 위험: 극한 조건에서 EMA는 작동을 중단하거나 가격에 뒤떨어질 수 있습니다.

  4. 트렌드 역전 위험. 트렌드 역전 시 트렌드 반대 입장을 보유하면 누적 손실이 발생합니다.

적절한 매개 변수 조정, 넓은 스톱 손실, 엄격한 규칙을 따르는 것은 위 위험을 크게 완화시킬 수 있습니다.

최적화 방향

이 전략은 다음과 같은 측면에서 더 개선될 수 있습니다.

  1. 타임프레임 최적화. MAs 및 가격 패턴의 계산 기간을 조정, 최고의 조합을 찾습니다.

  2. 적응성 최적화, 다른 제품들의 매개 변수를 조정합니다.

  3. 스톱 로스 최적화. 트레일링 스톱, 캔들리어 스톱과 같은 더 고급 스톱 로스 방법을 테스트합니다.

  4. 이윤 최적화를 취해 보세요. 더 나은 보상을 위해 적응성 또는 기하급수적 이윤을 취해 나가세요.

  5. 필터, 부피, 변동성 필터를 추가해

  6. 입구 신호를 강화하고, 더 많은 지표나 패턴을 조합하여 입구를 확인합니다.

결론

이것은 좋은 위험 통제, 안정적인 이익 모델 및 직선적 인 논리 흐름과 함께 효과적인 브레이크아웃 전략입니다. 정밀 조정 및 모듈성 향상으로 복잡한 시장에 더 견고하고 적응이 가능합니다. 더 많은 제품에 큰 응용 잠재력을 가지고 있습니다.


/*backtest
start: 2023-12-03 00:00:00
end: 2023-12-10 00:00:00
period: 30m
basePeriod: 15m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/

// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © EduardoMattje

//@version=4
strategy("Reversal closing price", overlay=true, default_qty_type=strategy.percent_of_equity, default_qty_value=10, initial_capital=10000)

src = input(hl2, "Price source")
order_direction = input("Both", "Order direction", options=["Both", "Long", "Short"])

// EMA calculation and plot

ema_long_period = input(80, "EMA long period")
ema_short_period = input(8, "EMA short period")
ema_long = ema(src, ema_long_period)
ema_short = ema(src, ema_short_period)
ema_bull = ema_short > ema_long
ema_bear = ema_short < ema_long
plot(ema_long, "EMA long", ema_bull ? color.green : color.red, 3)
plot(ema_short, "EMA short", ema_bull ? color.green : color.red, 3)

// Settings

risk_reward_ratio = input(2.0, "Risk to reward ratio", minval=1.0, step=0.1)
stop_lookback = input(3, "Stoploss candle lookback", minval=1)
ema_cross_stop = input(true, "Close if EMA crosses in oposite direction")
allow_retracing = input(true, "Allow price retracing")

// RCP calculation

rcp_bull = low[0] < low[1] and low[0] < low[2] and close[0] > close[1]
rcp_bear = high[0] > high[1] and high[0] > high[2] and close[0] < close[1]

// Order placement

in_market = strategy.position_size != 0

long_condition = rcp_bull and ema_bull and not in_market and order_direction != "Short"
short_condition = rcp_bear and ema_bear and not in_market and order_direction != "Long"

bought = strategy.position_size[0] > strategy.position_size[1] and strategy.position_size[1] == 0
sold = strategy.position_size[0] < strategy.position_size[1] and strategy.position_size[1] == 0
closed = not in_market and in_market[1]

long_position = strategy.position_size > 0
short_position = strategy.position_size < 0

buy_price = high + syminfo.mintick
sell_price = low - syminfo.mintick

if long_condition
    strategy.entry("Long", true, stop=buy_price)
if short_condition
    strategy.entry("Short", false, stop=sell_price)
    
if allow_retracing
    better_price_long = barssince(closed) > barssince(long_condition) and barssince(long_condition) >= 1 and not in_market and ema_bull and buy_price < valuewhen(long_condition, buy_price, 0) and buy_price[0] < buy_price[1]
    if better_price_long
        strategy.cancel("Long")
        strategy.entry("Long", true, stop=buy_price)
    
    better_price_short = barssince(closed) > barssince(short_condition) and barssince(short_condition) >= 1 and not in_market and ema_bear and sell_price > valuewhen(short_condition, sell_price, 0) and sell_price[0] > sell_price[1]
    if better_price_short
        strategy.cancel("Short")
        strategy.entry("Short", false, stop=sell_price)

// Stoploss orders

stop_price = long_position ? valuewhen(bought, lowest(stop_lookback)[1] - syminfo.mintick, 0) : short_position ? valuewhen(sold, highest(3)[1] + syminfo.mintick, 0) : na
stop_comment = "Stoploss triggered"
strategy.close("Long", low <= stop_price, stop_comment)
strategy.close("Short", high >= stop_price, stop_comment)
plot(stop_price, "Stop price", color.red, 2, plot.style_linebr)

// EMA cross close orders

if ema_cross_stop
    if long_position and ema_bear
        strategy.close("Long", comment=stop_comment)
    if short_position and ema_bull
        strategy.close("Short", comment=stop_comment)

// Take profit orders

stop_ticks = abs(strategy.position_avg_price - stop_price)
take_profit_price = long_position ? valuewhen(bought, strategy.position_avg_price + stop_ticks * risk_reward_ratio, 0) : short_position ? valuewhen(sold, strategy.position_avg_price  - (stop_ticks * risk_reward_ratio), 0) : na
target_comment = "Take profit"
strategy.close("Long", high >= take_profit_price, target_comment)
strategy.close("Short", low <= take_profit_price, target_comment)
plot(take_profit_price, "Target price", color.green, 2, plot.style_linebr)


더 많은