CCIとEMAに基づくスケールピング戦略

作者: リン・ハーンチャオチャン開催日:2024年01月31日 (火) 16:01:21
タグ:

img

概要

これは,EMA指標とCCI指標を組み合わせた短期振動取引戦略で,短期価格変動から得られる機会を把握するために,短期的傾向と市場における過買い/過売りレベルを特定します.

戦略の論理

この戦略は,主に10日EMA,21日EMA,50日EMAラインとCCI指標を使用して,入口と出口のタイミングを決定します.

具体的な論理は 短期移動平均値 (10日EMA) が中期移動平均値 (21日EMA) を越え,短期移動平均値が長期移動平均値 (50日EMA) を越え,CCI指標が0を超えると,長期移動平均値を下回り,短期移動平均値が長期移動平均値を下回り,CCI指標が0を下回ると,空行する上昇信号とみなされる.

エクシートロジックは,短期移動平均が中期移動平均を横切るとポジションを閉じる.

利点

  1. 移動平均システムとCCI指標を組み合わせることで,短期的な価格動向と過買い/過売りレベルを効果的に特定できます.

  2. 移動平均のクロスオーバーを使用して入口と出口を決定することは簡単で実用的です

  3. CCIパラメータとサイクルの設定は,いくつかの偽信号をフィルタリングするためにより合理的です.

  4. 移動平均の複数の時間枠を採用することで,振動する市場でより良い取引機会を得ることができます.

リスク

  1. 短期取引の大きな変動は,連続的なストップ損失につながる可能性があります.

  2. 誤ったCCIパラメータ設定は,誤った信号を増やす可能性があります.

  3. この戦略は,範囲限定期と統合期間に,複数の小さな損失を伴う可能性があります.

  4. 短期間の頻繁な取引者だけに適しており,長期の保有には適していません.

リスク緩和対策には,CCIパラメータの最適化,ストップ損失位置の調整,フィルター条件の追加などが含まれます.

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

  1. パラメータを最適化するために,EMA長さの異なる組み合わせを試験することができる.

  2. MACD,KDJなどの誤った信号をフィルタリングするために他の指標やフィルター条件を追加することができます.

  3. ダイナミックストップ・ロストを使用して 単一の損失を制御します

  4. 高時間枠のトレンド指標を組み合わせることで,トレンドに反する取引を避けることができます.

結論

一般的に,これは,短期間の逆転機会を把握するために,CCI指標の過買い/過売状態と組み合わせた移動平均線のクロスオーバーを使用する典型的な短期振動戦略である.この戦略は,頻繁な短期取引に適しているが,一定のストップ損失圧力に耐えなければならない.パラメータ最適化とフィルター条件を追加することによって,戦略の安定性と収益性がさらに向上することができる.


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

//@version=3
//study(title="Strat CCI EMA scalping", shorttitle="EMA-CCI-strat", overlay=true)
strategy("Strat CCI EMA scalping", shorttitle="EMA-CCI-strat", overlay=true)

exponential = input(true, title="Exponential MA")

// the risk management inputs
inpTakeProfit   = input(defval = 1000, title = "Take Profit", minval = 0)
inpStopLoss     = input(defval = 200, title = "Stop Loss", minval = 0)
inpTrailStop    = input(defval = 200, title = "Trailing Stop Loss", minval = 0)
inpTrailOffset  = input(defval = 0, title = "Trailing Stop Loss Offset", minval = 0)

// === RISK MANAGEMENT VALUE PREP ===
// if an input is less than 1, assuming not wanted so we assign 'na' value to disable it.
useTakeProfit   = inpTakeProfit  >= 1 ? inpTakeProfit  : na
useStopLoss     = inpStopLoss    >= 1 ? inpStopLoss    : na
useTrailStop    = inpTrailStop   >= 1 ? inpTrailStop   : na
useTrailOffset  = inpTrailOffset >= 1 ? inpTrailOffset : na

src = close

ma10 = exponential ? ema(src, 10) : sma(src, 10)
ma21 = exponential ? ema(src, 21) : sma(src, 21)
ma50 = exponential ? ema(src, 50) : sma(src, 50)

xCCI = cci(close, 200)

//buy_cond = cross(ma21, ma50) and ma10 > ma21 and (xCCI > 0)
//sell_cond = cross(ma21, ma50) and ma10 < ma21  and (xCCI < 0)

buy_cond = ma10 > ma21 and ma10 > ma50 and xCCI > 0
sell_cond = ma10 < ma21 and ma10 < ma50 and xCCI < 0



// === STRATEGY - LONG POSITION EXECUTION ===
enterLong() => buy_cond
exitLong() => ma10 < ma21
strategy.entry(id = "Long", long = true, when = enterLong()) // use function or simple condition to decide when to get in
strategy.close(id = "Long", when = exitLong()) // ...and when to get out
// === STRATEGY - SHORT POSITION EXECUTION ===
enterShort() => sell_cond
exitShort() => ma10 > ma21
strategy.entry(id = "Short", long = false, when = enterShort())
strategy.close(id = "Short", when = exitShort())

// === STRATEGY RISK MANAGEMENT EXECUTION ===
// finally, make use of all the earlier values we got prepped
//strategy.exit("Exit Long", from_entry = "Long", profit = useTakeProfit, loss = useStopLoss, trail_points = useTrailStop, trail_offset = useTrailOffset)
//strategy.exit("Exit Short", from_entry = "Short", profit = useTakeProfit, loss = useStopLoss, trail_points = useTrailStop, trail_offset = useTrailOffset)




//longCondition = buy_cond
//if(longCondition)
//    strategy.entry("Long", strategy.long)
//    strategy.exit("Close Long", "Long", when = exitLong())
    
//shortCondition = sell_cond
//if(shortCondition)
//    strategy.entry("Short", strategy.short)
//    strategy.exit("Close Short", "Short",  when = exitShort())

//plotshape(buy_cond, style=shape.flag, color=green, size=size.normal)
//plotshape(sell_cond, style=shape.flag, color=red, size=size.normal)

c1 = buy_cond==1 ? lime : sell_cond==1 ? red : #a3a3a3 // color

plot( ma10, color=red, style=line, title="10", linewidth=1)
plot( ma21, color=orange, style=line, title="21", linewidth=1)
plot( ma50, color=c1, style=line, title="50", linewidth=3)

//alertcondition(buy_cond, title = "Buy Condition", message = "Buy Condition Alert")
//alertcondition(sell_cond, title = "Sell Condition", message = "Sell Condition Alert")

もっと