RSI 콜백으로 볼링거스 대역이 가격 이하로 넘어가면 단축 판매의 거래 전략

저자:차오장, 날짜: 2023-12-26 12:08:44
태그:

img

전반적인 설명

이 전략은 가격이 과잉 매입 지역으로 진입했는지 여부를 결정하기 위해 볼링거 밴드를 활용하고 콜백 기회를 식별하기 위해 RSI 지표를 결합합니다. 과잉 매입 지역에서 죽음의 십자가가 형성되면 짧아지고 가격이 다시 볼링거 상단보다 상승하면 멈춥니다.

거래 원칙

이 전략은 다음과 같은 원칙에 기초합니다.

  1. 클로즈 가격이 볼링거 상단 범위를 넘을 때 자산이 과잉 매입 지대에 진입했고 콜백이 가능하다는 것을 나타냅니다.
  2. RSI 지표는 과잉 구매/ 과잉 판매 수준을 효과적으로 결정합니다. RSI > 70은 과잉 구매로 간주됩니다.
  3. 닫기 가격이 상단 범위를 넘을 때 짧게
  4. RSI가 오버구입 구역에서 물러나거나 스톱 로스가 발생했을 때 포지션을 닫습니다.

이점 분석

이 전략의 장점:

  1. 볼링거 밴드는 과잉 구매/ 과잉 판매 수준을 정확하게 결정하여 거래 성공률을 향상시킵니다.
  2. RSI는 잘못된 브레이크오웃 신호를 필터링하여 불필요한 손실을 피합니다.
  3. 고위험/이익 비율은 위험을 효과적으로 통제함으로써 얻어진 것입니다.

위험 분석

이 전략의 위험:

  1. 가격은 상단 범위를 넘어선 후 계속 상승할 수 있으며, 추가 손실로 이어질 수 있습니다.
  2. 적시에 RSI 회귀가 실패하면 손실 증폭이 발생합니다.
  3. 단방향 단축 지점은 통합 거래에 대한 여지가 없습니다.

위험은 다음과 같이 최소화 될 수 있습니다.

  1. 정해진 시간 내에 정지 손실을 적절히 조정합니다.
  2. RSI 콜백을 확인하기 위해 지표를 추가합니다.
  3. 통합을 결정하기 위해 이동평균을 사용하는 것

최적화 방향

이 전략은 다음과 같이 개선될 수 있습니다.

  1. 더 많은 자산에 대한 볼링거 매개 변수 최적화
  2. 더 나은 신호를 위해 RSI 매개 변수를 정밀 조정
  3. 트렌드 반전 지점을 파악하기 위해 더 많은 지표를 추가합니다
  4. 긴 거래 논리를 포함
  5. 변동성에 기반한 동적 스톱 로드를 구현합니다.

결론

요약하자면, 이것은 전형적인 과잉 구매 빠른 단편 스칼핑 전략입니다. 거래 입력을 위해 볼링거 밴드 및 신호를 필터하기 위해 RSI를 활용합니다. 위험은 신중한 스톱 로스 배치로 관리됩니다. 추가 개선은 매개 변수 조정, 지표 추가, 무역 논리 확장 등으로 발생할 수 있습니다.


/*backtest
start: 2023-11-01 00:00:00
end: 2023-11-30 23:59:59
period: 1h
basePeriod: 15m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/

//@version=5
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © Coinrule


strategy("Bollinger Band Below Price with RSI",
         overlay=true,
         initial_capital=1000,
         process_orders_on_close=true,
         default_qty_type=strategy.percent_of_equity,
         default_qty_value=70,
         commission_type=strategy.commission.percent,
         commission_value=0.1)

showDate = input(defval=true, title='Show Date Range')
timePeriod = time >= timestamp(syminfo.timezone, 2022, 1, 1, 0, 0)
notInTrade = strategy.position_size <= 0

//Bollinger Bands Indicator
length = input.int(20, minval=1)
src = input(close, title="Source")
mult = input.float(2.0, minval=0.001, maxval=50, title="StdDev")
basis = ta.sma(src, length)
dev = mult * ta.stdev(src, length)
upper = basis + dev
lower = basis - dev
offset = input.int(0, "Offset", minval = -500, maxval = 500)
plot(basis, "Basis", color=#FF6D00, offset = offset)
p1 = plot(upper, "Upper", color=#2962FF, offset = offset)
p2 = plot(lower, "Lower", color=#2962FF, offset = offset)
fill(p1, p2, title = "Background", color=color.rgb(33, 150, 243, 95))

// RSI inputs and calculations
lengthRSI = 14
RSI = ta.rsi(close, lengthRSI)



// Configure trail stop level with input options
longTrailPerc = input.float(title='Trail Long Loss (%)', minval=0.0, step=0.1, defval=3) * 0.01
shortTrailPerc = input.float(title='Trail Short Loss (%)', minval=0.0, step=0.1, defval=3) * 0.01

// Determine trail stop loss prices
//longStopPrice = 0.0
shortStopPrice = 0.0

//longStopPrice := if strategy.position_size > 0
    //stopValue = close * (1 - longTrailPerc)
    //math.max(stopValue, longStopPrice[1])
//else
    //0

shortStopPrice := if strategy.position_size < 0
    stopValue = close * (1 + shortTrailPerc)
    math.min(stopValue, shortStopPrice[1])
else
    999999


//Entry and Exit
strategy.entry(id="short", direction=strategy.short, when=ta.crossover(close, upper) and RSI < 70 and timePeriod and notInTrade)

if (ta.crossover(upper, close) and RSI > 70 and timePeriod)
    strategy.exit(id='close', limit = shortStopPrice)











더 많은