트렌드 추적 역전 전략

저자:차오장, 날짜: 2024-01-16 14:44:35
태그:

img

전반적인 설명

트렌드 추적 역전 전략은 15분 NQ 선물에 기반한 단기 트렌드 거래 전략이다. 트렌드 필터링과 역전 패턴 인식을 통해 거래 기회를 식별한다. 이 간단한 그러나 효과적인 전략은 활성 단기 거래자에게 적합하다.

전략 논리

이 전략은 주로 다음과 같은 원칙에 따라 작동합니다.

  1. 주요 트렌드 필터로 8주기 EMA를 사용하며, EMA 위의 긴 신호와 EMA 아래의 짧은 신호를 사용합니다.

  2. 입력 신호로서 특정 촛불 반전 패턴을 식별하십시오. 긴 신호를 위해 긴 녹색 촛불을 따라 짧은 빨간 촛불, 짧은 신호를 위해 짧은 녹색 촛불을 따라 긴 빨간 촛불을 포함합니다. 이러한 패턴은 잠재적 인 트렌드 반전을 제안합니다.

  3. 엔트리 포인트는 반전 촛불의 높기/하위 근처에 설정되며, 반전 촛불 자체의 높기/하위에서 스톱 로스 레벨을 설정하여 효율적인 리스크/어워드 비율을 허용합니다.

  4. 촛불 관계 규칙을 사용하여 반전 신호를 검증하십시오. 예를 들어 빨간 촛불의 오픈 가격은 마지막 녹색 촛불의 몸 위에 있으며, 몸 전체는 소음을 필터하기 위해 완전히 삼키고 있습니다.

  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

더 많은