トレーディング戦略をフォローするモメントインジケーター駆動傾向

作者: リン・ハーンチャオチャン開催日:2023年12月12日 14:52:11
タグ:

img

概要

この戦略は,モメントインジケーターRSIと価格の指数関数移動平均 (EMA) と単純な移動平均 (SMA) をベースに取引信号を構築する.これは,トレンド以下のタイプの戦略に属します.

戦略原則

戦略は,取引信号を生成するために3つの条件を使用します.

  1. RSI > 45: 45以上のRSI値は,良い買い信号とみなされます.
  2. EMA (RSI) >SMA (RSI): SMA線より大きい EMA線は,RSIが上昇する速度を表示し,これは良いモメント信号です.
  3. EMA (閉じる) >SMA (閉じる): SMA (閉じる) より大きい EMA線は,価格傾向が上昇する速度を表示します.

上記 3 つの条件のうち 2 つを満たすと購入信号が生成され,いずれも満たされていない場合は販売信号が生成されます.

この戦略では,システムにおける市場全体に対するパフォーマンスをテストするための"常に購入する"モードも用意されています.

利点分析

  1. 市場情勢を判断するためにモメント指標RSIを使用することで,市場の変動の間,ポジションを減少させることができます.
  2. EMAとSMAを組み合わせてトレンドの方向性を決定することで,価格変動の傾向を間に合って把握できます.
  3. シンプルで明瞭な条件規則,理解し最適化しやすい
  4. システムメリットをテストするために"常に購入"モードを提供します.

リスク分析

  1. パラメータ設定に依存し,不適切なパラメータは頻繁に取引または良い取引機会を逃す
  2. ストップ損失を導きます. ストップ損失を導きます.
  3. 傾向が逆転する時期を判断することはできません.他の指標を使って判断する必要があります.

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

  1. 最適なパラメータ組み合わせを見つけるために,RSI,EMA,SMAのパラメータを最適化
  2. ルール条件を豊かにするために,ボリューム,MACDなどの他の技術指標を増やす
  3. 損失の確率を減らすためにトレンド逆転指標を増加させる

結論

概要すると,この戦略は,短期間の市場変動を回避しながら,中期価格動向を把握することを目的とする中頻度取引戦略に属している.その利点とリスクポイントはかなり明らかである.パラメータ最適化と強化ルールの経由で安定性をさらに強化することで,研究と最適化に価値のある高効率の定量取引戦略となる.


/*backtest
start: 2022-12-05 00:00:00
end: 2023-12-11 00:00:00
period: 1d
basePeriod: 1h
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/

//@version=5
strategy("I11L Unitrend",overlay=false, initial_capital=1000000,default_qty_value=1000000,default_qty_type=strategy.cash,commission_type=strategy.commission.percent,commission_value=0.00)
tradingMode = input.string("Unitrend", "Trading Mode", ["Unitrend", "Always Buy"], tooltip="Choose the Trading Mode by trying Both in your Backtesting. I use it if one is far better then the other one.")
compoundingMode = input.bool(false)
leverage = input.float(1.0,step=0.1)
SL_Factor = 1 - input.float(1,"Risk Capital per Trade unleveraged (%)", minval=0.1, maxval=100, step=0.1) / 100
TPFactor = input.float(2, step=0.1)




var disableAdditionalBuysThisDay = false
var lastTrade = time
if(time > lastTrade + 1000 * 60 * 60 * 8 or tradingMode == "Always Buy")
    disableAdditionalBuysThisDay := false

if(strategy.position_size != strategy.position_size[1])
    lastTrade := time
    disableAdditionalBuysThisDay := true

//Trade Logic
SCORE = 0

//rsi momentum
RSIFast = ta.ema(ta.rsi(close,50),24)
RSISlow = ta.sma(ta.rsi(close,50),24)
RSIMomentum = RSIFast / RSISlow
goodRSIMomentum = RSIMomentum > 1
SCORE := goodRSIMomentum ? SCORE + 1 : SCORE

//rsi trend
RSITrend = RSISlow / 45
goodRSI = RSITrend > 1
SCORE := goodRSI ? SCORE + 1 : SCORE

//price trend
normalTrend = ta.ema(close,50) / ta.sma(close,50)
goodTrend = normalTrend > 1
SCORE := goodTrend ? SCORE + 1 : SCORE



isBuy =  SCORE > 1 or tradingMode == "Always Buy"
isSell = false //SCORE == 0

//plot(SCORE, color=isBuy ? color.green : #ffffff88)
//reduced some of the values just for illustrative purposes, you can buy after the signal if the trendlines seem to grow
plot(1, color=isBuy ? #77ff7733 : SCORE == 2 ? #ffff0033 : SCORE == 1 ? #ff888833 : #ff000033,linewidth=10)
plot(1 - (1 - RSIMomentum) * 6,color=#00F569)
plot(1 - (1 - RSITrend) * 0.25,color=#00DB9B)
plot(1 - (1 - normalTrend) * 20,color=#00F5EE)


strategy.initial_capital = 50000
if(isBuy and not(disableAdditionalBuysThisDay))
    if(compoundingMode)
        strategy.entry("Long", strategy.long, (strategy.equity / close) * leverage)
    else
        strategy.entry("Long", strategy.long, (strategy.initial_capital / close) * leverage)


if(strategy.position_size != 0)
    strategy.exit("TP/SL Long", "Long", stop=strategy.position_avg_price * (1 - (1 - SL_Factor)), limit=strategy.position_avg_price * (1 + (1 - SL_Factor) * TPFactor))




もっと