역 개척 포용 전략

저자:차오장, 날짜: 2023-11-22 16:05:24
태그:

img

전반적인 설명

리버스 오픈 잉글링 전략 (Reverse Opening Engulfing Strategy) 은 오픈 후 첫 번째 촛불을 기반으로 한 간단한 내일 거래 전략이다. 이 전략의 핵심 아이디어는 매일 오픈 후 첫 번째 촛불이 나타날 때 상승 추세 또는 하락 추세를 판단하고 카운터 거래를 수행하는 것입니다. 첫 번째 촛불이 빨간색 양선이라면 길게 가십시오. 첫 번째 촛불이 녹색 선이라면 짧게 가십시오. 전략은 또한 지점 출출을 위해 손해를 멈추고 수익을 취하는 메커니즘을 설정합니다.

전략 논리

이 전략의 원리는 오픈 후 첫 번째 촛불의 특수성이다. 시장이 열릴 때, 장기 및 단편의 힘은 가장 강렬하게 대립하고, 반전 가능성이 상대적으로 크다. 첫 번째 촛불의 상승 추세 또는 하락 추세를 판단하고 카운터 작전을 수행하는 것이 이 전략의 핵심 아이디어이다.

특히, 새로운 하루가 열린 후, 전략은 첫 번째 촛불의 개막 가격, 종료 가격 및 가격 변화를 기록합니다. 개막 가격이 종료 가격 (녹색 진선) 보다 높으면 곰이 승리했고 우리는 길어야한다는 것을 의미합니다; 개막 가격이 종료 가격 (붉은 양선) 보다 낮다면 황소가 승리했고 우리는 짧아야한다는 것을 의미합니다. 그러한 카운터 운영을 수행함으로써 전략은 개막 후 반전 기회를 포착하려고합니다.

한편, 전략은 또한 긴 스톱 로스 가격, 긴 스톱 로스 가격, 짧은 스톱 로스 가격, 짧은 스톱 로스 가격, 짧은 스톱 로스 가격 등 스톱 로스 및 수익 메커니즘을 설정하여, 과도한 손실이나 조기 수익을 피하여 긴 포지션과 수익을 통제합니다.

이점 분석

리버스 오픈 앙글러핑 전략은 다음과 같은 장점을 가지고 있습니다.

  1. 논리는 간단하고 명확하고 이해하기 쉽고 실행하기 쉽습니다.
  2. 그것은 개시 세그먼트의 높은 예측 값을 활용하여 역전 기회를 포착합니다.
  3. 스톱 로즈와 취득 설정은 위험을 효과적으로 제어할 수 있습니다.
  4. 전략 아이디어는 보편성을 가지고 있으며 대부분의 주식에 적합합니다.
  5. 참여 비용은 상대적으로 낮고 자본 통제는 쉽습니다.

위험 분석

리버스 오픈 앙글러핑 전략은 또한 다음과 같은 몇 가지 위험을 가지고 있습니다.

  1. 열기 역전 실패의 확률 첫 번째 촛불의 역전 신호가 실패하면 엄청난 손실이 발생할 수 있습니다.
  2. 낮은 품질의 주식을 효과적으로 필터링 할 수 없습니다. 전략은 충분한 근본 분석이 부족하며 낮은 기초가있는 주식을 선택할 수 있습니다.
  3. 블랙 스완 사건의 체계적 위험을 효과적으로 제어 할 수 없다는 것, 예를 들어 상당히 부정적인 뉴스의 영향.
  4. 부적절한 스톱 로스 및 수익 취득 설정은 손실을 확대하거나 수익을 줄일 수 있습니다.

최적화 방향

리버스 오프닝 잉글링 전략은 다음과 같은 측면에서 최적화 될 수 있습니다.

  1. 무효 신호를 피하기 위해 열 역 신호의 유효성 테스트를 증가하십시오. 예를 들어 볼륨 분석을 결합하십시오.
  2. 낮은 품질의 주식을 필터링하기 위해 기초 분석과 기술 분석을 통합하여 주식 풀을 선택하십시오.
  3. 주요 이벤트와 뉴스를 모니터링하는 모듈을 추가하여 시스템 리스크를 제어합니다.
  4. 유전 알고리즘, 기계 학습 및 다른 방법을 사용하여 동적으로 스톱 손실을 최적화하고 수익 설정을 취합니다.

요약

리버스 오픈 잉글링 전략은 첫 번째 촛불의 방향을 판단하고 카운터 운영을 통해 오픈 후 역전 기회를 포착하려고 시도합니다. 전략 아이디어는 낮은 참여 비용과 함께 간단하며 실질적인 가치가 있습니다. 그러나 우리는 또한 위험을 신중하게 인식하고 지속적으로 개선하고 최적화해야합니다.


/*backtest
start: 2023-10-22 00:00:00
end: 2023-11-21 00:00:00
period: 3h
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/
// © vikris
//@version=4
strategy("[VJ]First Candle Strategy", overlay = true,calc_on_every_tick = true,default_qty_type=strategy.percent_of_equity,default_qty_value=100,initial_capital=750,commission_type=strategy.commission.percent, 
     commission_value=0.02)


// ********** Strategy inputs - Start **********

// Used for intraday handling
// Session value should be from market start to the time you want to square-off 
// your intraday strategy
// Important: The end time should be at least 2 minutes before the intraday
// square-off time set by your broker
var i_marketSession = input(title="Market session", type=input.session, 
     defval="0915-1455", confirm=true)

// Make inputs that set the take profit % (optional)
longProfitPerc = input(title="Long Take Profit (%)",
     type=input.float, minval=0.0, step=0.1, defval=1) * 0.01

shortProfitPerc = input(title="Short Take Profit (%)",
     type=input.float, minval=0.0, step=0.1, defval=1) * 0.01
     
// Set stop loss level with input options (optional)
longLossPerc = input(title="Long Stop Loss (%)",
     type=input.float, minval=0.0, step=0.1, defval=0.5) * 0.01

shortLossPerc = input(title="Short Stop Loss (%)",
     type=input.float, minval=0.0, step=0.1, defval=0.5) * 0.01    


// ********** Strategy inputs - End **********


// ********** Supporting functions - Start **********

// A function to check whether the bar or period is in intraday session
barInSession(sess) => time(timeframe.period, sess) != 0



// Figure out take profit price
longExitPrice  = strategy.position_avg_price * (1 + longProfitPerc)
shortExitPrice = strategy.position_avg_price * (1 - shortProfitPerc)

// Determine stop loss price
longStopPrice  = strategy.position_avg_price * (1 - longLossPerc)
shortStopPrice = strategy.position_avg_price * (1 + shortLossPerc)


// ********** Supporting functions - End **********


// ********** Strategy - Start **********
// See if intraday session is active
bool intradaySession = barInSession(i_marketSession)

// Trade only if intraday session is active

//=================Strategy logic goes in here===========================
 
// If start of the daily session changed, then it's first bar of the new session
isNewDay = time("D") != time("D")[1]
var firstBarCloseValue = close
var firstBarOpenValue = open
if isNewDay
    firstBarCloseValue := close
    firstBarOpenValue := open


greenCandle = firstBarOpenValue < firstBarCloseValue
redCandle = firstBarOpenValue > firstBarCloseValue

buy = redCandle
sell = greenCandle


// plot(firstBarCloseValue)
// plot(firstBarOpenValue)



//Final Long/Short Condition
longCondition = buy
shortCondition =sell
 
//Long Strategy - buy condition and exits with Take profit and SL
if (longCondition and intradaySession)
    stop_level = longStopPrice
    profit_level = longExitPrice
    strategy.entry("My Long Entry Id", strategy.long)
    strategy.exit("TP/SL", "My Long Entry Id", stop=stop_level, limit=profit_level)


//Short Strategy - sell condition and exits with Take profit and SL
if (shortCondition and intradaySession)
    stop_level = shortStopPrice
    profit_level = shortExitPrice
    strategy.entry("My Short Entry Id", strategy.short)
    strategy.exit("TP/SL", "My Short Entry Id", stop=stop_level, limit=profit_level)
 
 
// Square-off position (when session is over and position is open)
squareOff = (not intradaySession) and (strategy.position_size != 0)
strategy.close_all(when = squareOff, comment = "Square-off")

// ********** Strategy - End **********

더 많은