RSI 지표 빨판 거래 전략


생성 날짜: 2024-01-29 11:42:46 마지막으로 수정됨: 2024-01-29 11:42:46
복사: 0 클릭수: 732
avatar of ChaoZhang ChaoZhang
1
집중하다
1617
수행원

RSI 지표 빨판 거래 전략

개요

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