Bitlinc MARSI トレーディング戦略

作者: リン・ハーンチャオチャン,日付: 2024-02-29 10:54:45
タグ:

img

概要

この戦略は,年間調整に基づいたRSI振動追跡戦略である.設定された上位および下位帯間のRSI指標の振動特性を追跡することによって,RSI指標が上位および下位帯に触ると取引信号が発行される.

戦略原則

  1. MA 長さ,RSI,上/下帯,取利益/ストップ損失,取引サイクルの範囲のパラメータを設定する.
  2. RSI値を計算する,RSI = (平均上向き変化) / ((平均上向き変化+平均下向き変化) *100
  3. グラフ RSI ラインと帯
  4. RSIが下帯を下回ると長い信号で,上帯を下回ると短い信号です
  5. オープンポジションとOCOオーダー
  6. 設定に基づいてストップ・ロスを実行し,利益を取ります.

利点分析

  1. 年間取引サイクルを設定することで,不適切な外部環境を回避できます.
  2. RSIは過買い/過売りを効率的に反映する.合理的な範囲の振動はノイズをフィルターする.
  3. OCOオーダー + ストップ・ロスト/利益設定により効率的なリスク管理が可能になります.

リスク分析

  1. RSI 限界値の判断の正確さは保証できないため,誤った判断が起こる可能性があります.
  2. 不適切な年周期設定により より良い機会を逃したり 不適切な環境に入ることもあります
  3. ストップ・ロスの設定が大きすぎると大きな損失が起こり得ますが 利益設定が小さすぎると小利益になります

RSIパラメータ,取引サイクル範囲,ストップ・ロスト/利益比の調整などの方法が最適化するために使用できます.

オプティマイゼーションの方向性

  1. 異なる市場やサイクルで最適なRSIパラメータをテストする
  2. 市場サイクルの全体的なパターンを分析し,最高の年間取引段階を設定します
  3. バックテストを通じて合理的なストップ損失/利益比を決定する
  4. 取引製品選択とポジションサイズを最適化
  5. さらに最適化するために他のより良い技術と組み合わせる

概要

この戦略は,RSIの年周期振動特征によってトレンドを追跡し,取引リスクを効果的に制御する.パラメータチューニングと論理最適化によってさらなるパフォーマンス改善を達成することができる.


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

//@version=3
strategy(title = "Bitlinc MARSI Study AST",shorttitle="Bitlinc MARSI Study AST",default_qty_type = strategy.percent_of_equity, default_qty_value = 100,commission_type=strategy.commission.percent,commission_value=0.1,initial_capital=1000,currency="USD",pyramiding=0, calc_on_order_fills=false)

// === General Inputs ===
lengthofma = input(62, minval=1, title="Length of MA")
len = input(31, minval=1, title="Length")
upperband = input(89, minval=1, title='Upper Band for RSI')
lowerband = input(10, minval=1, title="Lower Band for RSI")
takeprofit =input(1.25, title="Take Profit Percent")
stoploss =input(.04, title ="Stop Loss Percent")
monthfrom =input(8, title = "Month Start")
monthuntil =input(12, title = "Month End")
dayfrom=input(1, title= "Day Start")
dayuntil=input(31, title= "Day End")

// === Innput Backtest Range ===
//FromMonth = input(defval = 9, title = "From Month", minval = 1, maxval = 12)
//FromDay   = input(defval = 1, title = "From Day", minval = 1, maxval = 31)
//FromYear  = input(defval = 2018, title = "From Year", minval = 2017)
//ToMonth   = input(defval = 1, title = "To Month", minval = 1, maxval = 12)
//ToDay     = input(defval = 1, title = "To Day", minval = 1, maxval = 31)
//ToYear    = input(defval = 9999, title = "To Year", minval = 2017)

// === Create RSI ===
src=sma(close,lengthofma)
up = rma(max(change(src), 0), len)
down = rma(-min(change(src), 0), len)
rsi = down == 0 ? 100 : up == 0 ? 0 : 100 - (100 / (1 + up / down))
plot(rsi,linewidth = 2, color=purple)

// === Plot Bands ===
band1 = hline(upperband)
band0 = hline(lowerband)
fill(band1, band0, color=blue, transp=95)

// === Entry and Exit Methods ===
longCond =  crossover(rsi,lowerband)
shortCond =  crossunder(rsi,upperband)

// === Long Entry Logic ===
if (  longCond ) 
    strategy.entry("LONG", strategy.long, stop=close, oca_name="TREND", comment="LONG")
else
    strategy.cancel(id="LONG")

// === Short Entry Logic ===    
if ( shortCond   ) 
    strategy.entry("SHORT", strategy.short,stop=close, oca_name="TREND",  comment="SHORT")
else
    strategy.cancel(id="SHORT")

// === Take Profit and Stop Loss Logic ===
//strategy.exit("Take Profit LONG", "LONG", profit = close * takeprofit / syminfo.mintick, loss = close * stoploss / syminfo.mintick)
//strategy.exit("Take Profit SHORT", "SHORT", profit = close * takeprofit / syminfo.mintick, loss = close * stoploss / syminfo.mintick)
strategy.exit("LONG TAKE PROFIT", "LONG", profit = close * takeprofit / syminfo.mintick)
strategy.exit("SHORT STOP LOSS", "SHORT", profit = close * takeprofit / syminfo.mintick)
strategy.exit("LONG STOP LOSS", "LONG", loss = close * stoploss / syminfo.mintick)
strategy.exit("SHORT STOP LOSS", "SHORT", loss = close * stoploss / syminfo.mintick)



もっと