단기 추세 추종 반전 전략


생성 날짜: 2024-01-16 14:44:35 마지막으로 수정됨: 2024-01-16 14:44:35
복사: 0 클릭수: 698
avatar of ChaoZhang ChaoZhang
1
집중하다
1617
수행원

단기 추세 추종 반전 전략

개요

트렌드 추적 반전 전략은 15분 NQ 선물에 기반한 단기 트렌드 거래 전략이다. 트렌드 파동과 반전 형태를 식별하여 거래 기회를 찾는다. 이 전략은 간단하고 효과적이며 짧은 선의 활성 트레이더에 적합하다.

전략 원칙

이 전략은 다음과 같은 몇 가지 원칙에 기초하여 작동합니다.

  1. 8주기 EMA를 주요 트렌드 필터 지표로 사용하며, EMA는 위쪽이 더 많고, EMA는 아래쪽이 적다.

  2. 특정 K 선 반전 형태를 입문 신호로 식별하고, 긴 선에 따른 짧은 선의 볼 수 있는 다중 신호와 긴 선에 따른 짧은 선의 볼 수 없는 신호를 포함합니다. 이러한 형태는 트렌드가 반전을 시작할 수 있음을 알려줍니다.

  3. 입수 지점은 반전 K 선의 고점 또는 낮은 지점 근처로 설정하고, 정지 지점은 반전 K 선 자체의 고점 또는 낮은 지점으로 설정하여 효율적인 리스크 수익률을 달성한다.

  4. K선 엔티티 관계를 사용하여 역전 신호의 유효성을 판단합니다. 예를 들어, 음선 개시값이 상위 K선 엔티티보다 높고, 엔티티는 완전히 포함됩니다.

  5. 특정 거래 시간에만 작동하는 전략, 시장의 주요 계약 교환 달과 같은 특별한 기간을 피하고, 비정상적인 상황이 불필요한 손실을 초래하는 것을 방지한다.

우위 분석

이 전략은 다음과 같은 주요 장점을 가지고 있습니다.

  1. 전략적 신호는 간단하고 효과적이며 실행하기 쉽습니다.

  2. 트렌드와 반향을 기반으로 판단하여 황소 시장과 곰 시장의 두 번째 희생을 피하십시오.

  3. 리스크가 통제되고, 스톱 로즈 설정이 합리적이고, 자금 관리에 도움이 됩니다.

  4. 데이터 요구량은 작고, 다양한 소프트웨어와 플랫폼에 적합하다.

  5. 거래 빈도가 높으며, 짧은 라인 활발한 거래에 열중하는 투자자에게 적합하다.

위험과 대책

이 전략에는 몇 가지 위험이 있습니다. 주요 문제는 다음과 같습니다.

  1. 역형 기회는 부족하고 신호는 적다. 역형 판단 규칙을 적절히 완화할 수 있다.

  2. 가짜 돌파 문제가 발생했을 때 더 많은 필터링 지표를 추가하여 공동 판단을 할 수 있습니다.

  3. 밤 디스크와 비주류 시간에는 불안정성이 있다. 미국 거래 시간에만 작동하도록 설정할 수 있다.

  4. 매개 변수를 최적화할 수 있는 공간은 제한되어 있다. 더 나은 매개 변수를 찾기 위해 기계 학습과 같은 기술을 시도할 수 있다.

최적화 방향

이 전략에는 몇 가지 개선방안이 있습니다.

  1. 더 긴 주기의 EMA 변수를 테스트하여 트렌드 판단을 개선한다.

  2. 추가적인 트렌드 필터링 지표로 주식시장 지수를 추가한다.

  3. 기계 학습과 같은 기술을 사용하여 자동으로 입점 및 중지 지점을 최적화하십시오.

  4. 변동성에 기반한 포지션 및 손해 중지 동적 조정 메커니즘을 추가하십시오.

  5. 여러 품종의 중매를 시도하여 한 품종의 시스템적 위험을 더욱 분산시킵니다.

요약하다

트렌드 추적 반전 전략은 전체적으로 매우 실용적인 단선 전략 아이디어로, 간단한 매개 변수가 적고, 실무가 쉬운 편이며, 개인 위험을 잘 제어할 수 있으며, 주식 시장의 적극적인 단선 거래자에게 적합하다. 이 전략에는 약간의 최적화 공간이 있으며, 연구 개발에 약간의 에너지를 투입하면 중장기 자금에 적합한 프로그램 운영을 할 수 있으며, 좋은 발전 잠재력을 가지고 있다.

전략 소스 코드
/*backtest
start: 2023-12-01 00:00:00
end: 2023-12-31 23:59:59
period: 3h
basePeriod: 15m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/

// This Pine Script™ code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © bdrex95

//@version=5

// Rob Reversal Strategy - Official
// Using Rob Reversal Indicator: Original
// Description
// This indicator is based on the strategy created by Trader Rob on the NQ 15m chart.
// 
// Timeframe for trading is 8:30am-1:15pm Central.
// 
// Above the EMA line, look for a long position. You will have a short candle, then a long candle that opens below the short candle. It will have a lower high and a lower low. Once the long candle closes, your entry will be 1 tick above the wick (green line) and stop loss will be at the bottom of the bottom wick (red line).
// 
// Below the EMA line, look for a short position. You will have a long candle, then a short candle that opens above the long candle. It will have a higher high and a higher low. Once the short candle closes, your entry will be 1 tick below the wick (green line) and stop loss will be at the top of the top wick (red line).
//

strategy("Trader Rob Reversal Strategy NQ 15min", shorttitle="Official Rob Rev Strat", overlay=true)


//--- Session Input ---
sess = input(defval = "0930-1415", title="Trading Session")
t = time(timeframe.period, sess)
sessionOpen = na(t) ? false : true

flat_time = input(defval = "1515-1558", title="Close All Open Trades")
ft = time(timeframe.period, flat_time)
flatOpen = na(ft) ? false : true


// Calculate start/end date and time condition
startDate = input(timestamp('2018-12-24T00:00:00'),group = "ALL STRATEGY SETTINGS BELOW")
finishDate = input(timestamp('2029-02-26T00:00:00'),group = "ALL STRATEGY SETTINGS BELOW")
time_cond = true


emaColor = input.color(color.orange, title="EMA Color")
emaLength = input.int(8, title="EMA Length")


emaInd = ta.ema(close, emaLength)


rr = input(1.0,"Enter RR",group = "TP/SL CONDITION INPUTS HERE")


sellShapeInput = input.string("Arrow", title="Sell Entry Shape", options=["Arrow", "Triangle"])
buyShapeInput = input.string("Arrow", title="Buy Entry Shape", options=["Arrow", "Triangle"])


sellShapeOption = switch sellShapeInput
    "Arrow" => shape.arrowdown
    "Triangle" => shape.triangledown
   
buyShapeOption = switch buyShapeInput
    "Arrow" => shape.arrowup
    "Triangle" => shape.triangleup


O = open
C = close
H = high
L = low


sellEntry = (C[1] > O[1]) and (C < O) and (H[1] < H) and (C < H[1]) and (C > L[1]) and (L > L[1]) and (C < emaInd) and sessionOpen and time_cond
buyEntry = (C[1] < O[1]) and (C > O) and (H[1] > H) and (L[1] > L) and (C < H[1]) and (C > L[1]) and (C > emaInd) and sessionOpen and time_cond


sellEntry_index = ta.valuewhen(sellEntry,bar_index,0)
sellEntry_hi = ta.valuewhen(sellEntry,high,0)
sellEntry_low = ta.valuewhen(sellEntry,low,0)
buyEntry_index = ta.valuewhen(buyEntry,bar_index,0)
buyEntry_hi = ta.valuewhen(buyEntry,high,0)
buyEntry_lo = ta.valuewhen(buyEntry,low,0)


plotshape(buyEntry, color = color.green, location = location.belowbar, style = buyShapeOption, size = size.small)
plotshape(sellEntry, color = color.red, location = location.abovebar, style = sellShapeOption, size = size.small)
plot(emaInd, color=emaColor)


// Risk Management
entry_price_long = (buyEntry_hi + syminfo.mintick)
entry_price_short = (sellEntry_low - syminfo.mintick)
long_sl_price = (buyEntry_lo-syminfo.mintick)
short_sl_price = (sellEntry_hi + syminfo.mintick)
long_tp_price = ((entry_price_long - long_sl_price)*rr) + entry_price_long
short_tp_price = entry_price_short - ((short_sl_price - entry_price_short)*rr)


long_sl_ticks = (entry_price_long - long_sl_price) / syminfo.mintick
short_sl_ticks = (short_sl_price - entry_price_short) / syminfo.mintick


long_tp_ticks = (long_tp_price - entry_price_long) / syminfo.mintick
short_tp_ticks = (entry_price_short - short_tp_price) / syminfo.mintick


// Positions
if (buyEntry)
    strategy.entry("Long", strategy.long,stop = H + syminfo.mintick)
if strategy.position_size > 0
    strategy.exit("Long Ex","Long", loss = long_sl_ticks, profit = long_tp_ticks, comment_loss = "SL Long", comment_profit = "TP Long")


if (sellEntry)
    strategy.entry("Short", strategy.short,stop = L - syminfo.mintick)
if strategy.position_size < 0
    strategy.exit("Short Ex","Short",loss = short_sl_ticks, profit = short_tp_ticks, comment_loss = "SL Short", comment_profit = "TP Short")


// Cancel order if close beyond ema
if (C < emaInd)
    strategy.cancel("Long")


if (C > emaInd)
    strategy.cancel("Short")


// Go flat at close (for futures funded account)
if strategy.position_size > 0 and flatOpen
    strategy.close_all(comment = "EOD Flat")
if strategy.position_size < 0 and flatOpen
    strategy.close_all(comment = "EOD Flat")
 
//END