RSI指標グリッド取引戦略

作者: リン・ハーンチャオチャン,日付: 2024-01-29 11:42:46
タグ:

img

概要

RSI指標グリッド取引戦略は,RSIとCCIの技術指標を固定グリッド取引アプローチと統合している.RSIとCCI指標の値を入力信号を決定するために使用し,固定利益比とグリッドの数に基づいて利益オーダーと追加のグリッドオーダーをセットする.この戦略には,変動する価格動向に対するヘッジメカニズムも含まれている.

戦略の論理

入国条件

ロングシグナルは,5分間のRSIと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

もっと