RSI 지표 그리드 거래 전략

저자:차오장, 날짜: 2024-01-29 11:42:46
태그:

img

전반적인 설명

RSI 지표 그리드 거래 전략은 RSI 및 CCI 기술 지표를 고정 그리드 거래 접근법으로 통합합니다. 그것은 입시 신호를 결정하기 위해 RSI 및 CCI 지표의 값을 사용하고 고정 수익 비율과 그리드 수에 따라 수익 주문과 추가 그리드 주문을 취합니다. 전략은 또한 변동적인 가격 움직임에 대한 헤지 메커니즘을 포함합니다.

전략 논리

입국 조건

긴 신호는 5분 및 30분 RSI가 임계값 이하이고 1시간 CCI가 임계값 이하일 때 생성된다. 현재 클로즈 가격은 엔트리 가격으로 기록되며, 첫 번째 오더의 크기는 계좌 자금과 그리드 수에 따라 계산된다.

수익 조건 을 취하라

영업이익 가격 수준은 입시 가격과 목표 영업이익 비율을 사용하여 계산됩니다. 영업이익 주문은이 가격 수준에서 배치됩니다.

네트워크 접속 조건

첫 번째 주문을 마친 후, 남은 고정 크기의 그리드 주문은 정해진 그리드 수에 도달할 때까지 하나씩 배치됩니다.

헤지 메커니즘

입시 시점부터 가격 상승이 설정된 헤딩 마이너스 비율을 초과하면 모든 오픈 포지션은 폐쇄함으로써 헤딩됩니다.

반전 메커니즘

만약 가격이 진입 시점부터 설정된 반전 마감 비율을 넘어서면, 모든 대기 주문은 새로운 진입 기회를 기다리기 위해 취소됩니다.

이점 분석

  • 수익성 향상을 위해 RSI와 CCI 지표를 결합합니다.
  • 고정 네트워크 목표 수익 고정확정
  • 유동적인 가격 변동에 대한 통합적 헤지 보호
  • 회전 메커니즘은 손실을 줄입니다.

위험 분석

  • 지표에서 나오는 잘못된 신호
  • 가격 상승은 헤지 임계점을 통과합니다.
  • 회귀에 대한 재입입수 실패

이 문제는 지표 매개 변수를 조정하고, 헤지 범위를 확장하고, 반전 범위를 줄임으로써 완화될 수 있습니다.

개선 영역

  • 더 많은 지표 조합을 테스트합니다.
  • 연구 적응적 이익 취득
  • 그리드 논리를 최적화

결론

RSI 그리드 전략은 지표와 함께 입력을 결정하고, 고정 그리드를 사용하여 안정적인 수익에 잠금하고, 수익과 입력을 취합니다. 또한 변동성 헤지 및 반전 후 재입구를 포함합니다. 여러 메커니즘의 통합은 거래 위험을 줄이고 수익률을 높이는 데 도움이됩니다. 지표 및 설정의 추가 최적화는 실시간 성능을 향상시킬 수 있습니다.


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

//@version=5
strategy("Custom RSI/CCI Strategy with Fixed Grid", shorttitle="INVESTCOIN_RSI_CCI_Fixed_Grid", overlay=true)

// Input parameters
input_rsi_5min_value = 55
input_rsi_30min_value = 65
input_cci_1hr_value = 85
input_profit_target_percent = 0.6 // Target profit in percentage
input_grid_size = 15 // Number of orders in grid
input_hedging_percent = 20 // Percentage price change for hedging
input_first_order_offset = 0.2 // Offset for the first order in percentage
input_reversal_percent = 0.4 // Percentage price change for reversal

// Calculating the RSI and CCI values
rsi_5min = ta.rsi(close, 5)
rsi_30min = ta.rsi(close, 30)
cci_1hr = ta.cci(close, 60)

// Define strategy conditions based on the provided screenshot
long_condition = (rsi_5min < input_rsi_5min_value) and (rsi_30min < input_rsi_30min_value) and (cci_1hr < input_cci_1hr_value)

// Plot signals
plotshape(series=long_condition, title="Long Entry Signal", location=location.belowbar, color=color.green, style=shape.triangleup, size=size.small)

// Initialize a variable to store the entry price
var float entry_price = na

// Initialize a variable to store the profit target
var float profit_target = na

// Hedge condition based on price change percentage
var float hedge_price = na

// Initialize a variable to count the total number of orders
var int total_orders = 0

// Calculate the initial order size based on account equity and grid size
var float initial_order_size = 1 / input_grid_size / 100

// Entry orders with fixed size
if (long_condition and total_orders < 9000)
    // Place first order with an offset
    if total_orders == 0
        strategy.order("First Long", strategy.long, qty=initial_order_size, limit=close * (1 - input_first_order_offset / 100))
    total_orders := total_orders + 1
    
    // Place remaining grid orders
    for i = 1 to input_grid_size - 1
        if (total_orders >= 9000)
            break // Stop if max orders reached
        strategy.entry("Long_" + str.tostring(i), strategy.long, qty=initial_order_size)
        total_orders := total_orders + 1

// Calculate the profit target in currency
if (long_condition)
    entry_price := close // Store the entry price when the condition is true

if (not na(entry_price))
    profit_target := entry_price * input_profit_target_percent / 100 // Calculate the profit target

// Setting up the profit target
if (not na(profit_target))
    strategy.exit("Take Profit", "Long", limit=entry_price + profit_target)

// Hedge by closing all positions if the price increases by the hedging percentage
if (strategy.position_size > 0)
    hedge_price := close * (1 + input_hedging_percent / 100)

if (not na(hedge_price) and close >= hedge_price)
    strategy.close_all(comment="Hedging")


// Reversal condition based on the price change percentage
var float reversal_price = na

if (strategy.position_size > 0 and total_orders > 1) // Check if at least one grid order has been placed
    reversal_price := entry_price * (1 - input_reversal_percent / 100)

// Cancel trades and wait for a new entry point if the price reverses by the specified percentage
if (not na(reversal_price) and close <= reversal_price)
    strategy.cancel_all()
    total_orders := 0 // Reset the total orders count after cancellation

더 많은