
이 전략은 레지스너스 브레이크의 가격 형태 신호와 루프가 중단되는 위험을 제어하는 메커니즘을 사용한다. 그것은 레지스너스 지점을 뚫은 후 더 많은 포지션을 만들고, 지지 지점을 뚫은 후 포지션을 텅 비게 한다. 동시에 루프가 중단되고 손실이 발생하여 위험을 효과적으로 제어한다.
이 전략은 다음과 같은 몇 가지 요인에 기반합니다.
평균선을 사용하여 트렌드 방향을 판단한다. 전략에 빠른 느린 평균선을 설정하고, 빠른 라인에서 느린 라인을 뚫는 것은 긴 라인을 상승시키고, 긴 라인을 하락하는 것을 나타냅니다.
레지스너스 브레이크를 다중 신호한다. 가격 상승이 최근 고점을 돌파했을 때, 레지스너스 지점을 돌파한 신호로 간주하고, 더 많은 입장을 한다.
지지를 뚫고 하락하는 신호. 가격 하락이 최근 하락을 뚫고 하락하면 지지를 뚫고 하락하는 신호로 간주하고 상장한다.
루프 스톱을 설정한다. 진입 후 스톱 라인을 설정하고 가격 변동에 따라 조정하여 스톱 라인을 둘러싼 가격을 실행한다.
스톱로스 및 스톱 아웃 . 스톱로스 아웃은 위험을 효과적으로 제어하고, 스톱 아웃은 이익을 잠금할 수 있다.
구체적으로, 이 전략은 높은 낮은 가격의 평균을 가격 원천으로 사용하여, 트렌드 방향을 판단하는 느린 EMA를 계산한다. 빠른 선에서 느린 선을 통과하고 저항의 돌파 신호가 발생하면 더 많이 하고, 빠른 선 아래에서 느린 선을 통과하고 지원의 돌파 신호가 발생하면 공백한다.
이 전략에는 다음과 같은 장점이 있습니다.
이윤 안정성. 추세에 따라 작동하여 지수 수준의 긴 선 추세에서 이윤을 얻을 수 있다.
위험 통제가 잘 되어 있다. 회로 상쇄 및 상쇄를 설정하여 적시에 상쇄 및 상쇄를 할 수 있다.
신호 정확함. 저항 지점 돌파를 다하고 지지 지점 돌파를 공백, 신호 정확함.
간편한 조작. 지표와 신호 규칙은 간단하고 명확하며, 매개 변수 설정은 복잡하지 않다.
시장에 적응한다. 다양한 품종과 모든 시장 조건에서 작동한다.
이 전략에는 몇 가지 위험도 있습니다.
돌파 실패 위험. 저항지원 지점을 돌파한 후 재조정 및 재시험이 발생할 수 있으며, 이로 인해 손해가 발생한다.
매개 변수 최적화 위험. 매개 변수 설정이 잘못되면 신호가 빈번하거나 부족할 수 있다. 최적화 과정은 신중해야 한다.
지표 실패 위험. EMA 지표는 특별한 시장 상황 하에서 실패하거나 지연 될 수 있습니다.
트렌드 반전의 위험. 더 많은 코스피가 시장과 오차가 발생하면 손실이 증가할 수 있다.
이러한 위험은 파라미터 최적화, 적절한 무상 손실, 신호를 엄격하게 따르는 등의 방법으로 크게 제어 및 완화될 수 있다.
이 전략은 다음의 몇 가지 측면에서 더 개선될 수 있습니다.
시간주기 최적화. 평균선과 가격 형태를 계산하는 시간주기 변수를 조정하여 최적의 조합을 찾는다.
품종 적응성 최적화. 다양한 품종의 특성에 따라 변수 설정을 조정한다.
손해 차단 전략 최적화. 이동 손해 차단, 진동 손해 차단 등과 같은 더 안정적이고 정확한 손해 차단 방법을 사용한다.
스톱 스트립 전략을 최적화한다. 이동 스톱 또는 지수형 스톱을 설정하여 수익을 더 크게 만들 수 있다.
필터링 조건을 추가한다. 거래량, 변동률 등의 필터링 조건을 추가하고, 가짜 브레이크를 배제한다.
진입 신호를 강화한다. 진입 신호의 확인으로 더 많은 지표 또는 형태를 추가한다.
이 전략은 전체적으로 원활하게 작동하며, 핵심 아이디어는 명확하며, 안정성과 수익성이 강하다. 위험 제어 및 지표 적용도 적합하며, 사용할 가치가있는 획기적인 분류 전략이다. 이후 매개 변수 및 모듈을 통해 최적화하면 전략이 더 완성되어 더 많은 품종과 복잡한 시장 환경에 적응 할 수 있습니다.
/*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)