ゴールデンクロス・ケルトナー・チャネル 戦略をフォローする

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

img

概要

ゴールデンクロス・ケルトナー・チャネル・トレンドフォロー戦略は,トレンドの方向にのみ取引する戦略です.トレンドの方向を把握するために,移動平均金十字とケルトナー・チャネルをエントリー信号として組み合わせます.

原則

この戦略は,トレンド方向を決定するために,金色の十字と死の十字を形成するために,短期間の移動平均と長期間の移動平均を2つの移動平均を使用する.同時に,ケルトナーチャネルの上下線をプロットするために,ユーザー定義の倍数を使用し,価格がチャネルを突破すると取引信号を生成する.

具体的には,戦略はまず,長期移動平均が短期移動平均よりも高いかどうかを確認し,黄金十字と上昇傾向を示します.短期MAが長期MAよりも低い場合は,死亡十字であり,低下傾向を示します.

トレンド決定に基づいて,価格が上部レールの上を突破した場合,長い信号が生成されます.価格が下部レールの下を突破した場合,短い信号が生成されます.ユーザーは,戦略パラメータをカスタマイズするためにMA期間とチャネル幅を調整できます.

入場後,この戦略は,ユーザー定義のATR倍数を利用し,利益とストップ・ロスを取る.また,より柔軟なポジション制御のために追加のブレイク・イブンとストップ・ロスの条件を提供します.

利点分析

この戦略は,トレンドフォローとチャネルブレイクアウトの利点を組み合わせ,効果的なトレンド識別と機会の捉え方を可能にします.主な利点は以下の通りです.

  1. 黄金十字は 傾向に合致しない 誤った信号をフィルターします

  2. トレンド方向のチャネルブレイクにより 入力の精度が向上します

  3. 利益とストップ・ロスは利益を維持し リスクを制御します

  4. 柔軟なパラメータ調整は,異なる製品や環境に適しています.

  5. 適用範囲を広げています

リスク分析

利点 に かかわらず,注意 を 払わ れる リスク が ある:

  1. 逆転の機会を逃した

  2. 傾向の変化は損失につながる可能性があります.

  3. 不適切なパラメータは,過剰な取引または稀有な取引を引き起こす可能性があります.

  4. 一晩で危険は存在します

  5. カーブフィッティングリスク

解決策には,パラメータ最適化,間に合うMA期間調整,位置サイズ制御が含まれます.

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

さらに改善の余地があります.

  1. マルチファクターモデルを構築し,正確性を向上させるため,より多くの指標を追加します.例えばMACD,RSI.

  2. マシン学習によるパラメータ最適化

  3. 収益性と報酬をバランスさせる ダイナミックな利益とストップ・ロスのルール

  4. 動的ポジションのサイズ設定は波動性に基づいています.

  5. 異なる製品に対して最適なパラメータを研究します

  6. 取引頻度を減らして手数料を最小限に抑える

結論

ゴールデンクロス・ケルトナー・チャネル・トレンドフォロー戦略は,一般的に安定した信頼性の高いトレンドフォローシステムである.トレンドフィルタリングとチャネルブレイクアウトを組み合わせることで,トレンド方向に一致する高い確率の機会を特定する.さらなる最適化と強化により,堅牢な取引フレームワークとなる.


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

// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © OversoldPOS

//@version=5
// strategy("Keltner Channel Strategy by OversoldPOS", overlay=true,initial_capital = 100000,default_qty_type = strategy.percent_of_equity,default_qty_value = 10, commission_type = strategy.commission.cash_per_order, commission_value = 7)

// Parameters
length = input(21, title="MA Length")
Entrymult = input(1, title="Entry ATR")
profit_mult = input(4, title="Profit Taker")
exit_mult = input(-1, title="Exit ATR")

// Moving Average Type Input
ma_type = input.string("SMA", title="Moving Average Type", options=["SMA", "EMA", "WMA"])

// Calculate Keltner Channels for different ATR multiples
atr_value = ta.atr(length)

basis = switch ma_type
    "SMA" => ta.sma(close, length)
    "EMA" => ta.ema(close, length)
    "WMA" => ta.wma(close, length)
 

//
EntryKeltLong = basis + Entrymult * ta.atr(10)
EntryKeltShort = basis - Entrymult * ta.atr(10)
upper_channel1 = basis + 1 * ta.atr(10)
lower_channel1 = basis - 1 * ta.atr(10)
upper_channel2 = basis + 2 * ta.atr(10)
lower_channel2 = basis - 2 * ta.atr(10)
upper_channel3 = basis + 3 * ta.atr(10)
lower_channel3 = basis - 3 * ta.atr(10)
upper_channel4 = basis + 4 * ta.atr(10)
lower_channel4 = basis - 4 * ta.atr(10)

// Entry condition parameters
long_entry_condition = input(true, title="Long Positions")
short_entry_condition = input(true, title="Enable Short Positions")

// Additional conditions for long and short entries
is_long_entry = ta.ema(close, 20) > ta.ema(close, 50)
is_short_entry = ta.ema(close, 20) < ta.ema(close, 50)

// Additional conditions for long and short entries
MAShort =  input(50, title="Short MA for Golden Cross")
MALong =  input(200, title="Long MA for Golden Cross")
is_long_entry2 = ta.ema(close, MAShort) > ta.ema(close, MALong)
is_short_entry2 = ta.ema(close, MAShort) < ta.ema(close, MALong)

// Exit condition parameters
long_exit_condition1_enabled = input(true, title="Enable Long Profit Taker")
long_exit_condition2_enabled = input(true, title="Enable Long Stop")
short_exit_condition1_enabled = input(true, title="Enable Short Profit Taker")
short_exit_condition2_enabled = input(true, title="Enable Short Stop")

// Take Profit condition parameters
take_profit_enabled = input(true, title="Enable Take Profit Condition")

Takeprofit = basis + profit_mult * atr_value
STakeprofit = basis - profit_mult * atr_value

// Long entry condition
long_condition = long_entry_condition and ta.crossover(close, EntryKeltLong) and is_long_entry2

// Short entry condition
short_condition = short_entry_condition and ta.crossunder(close, EntryKeltShort) and is_short_entry2

// Exit conditions
long_exit_condition1 = long_exit_condition1_enabled and close > Takeprofit
long_exit_condition2 = long_exit_condition2_enabled and close < basis + exit_mult * atr_value
short_exit_condition1 = short_exit_condition1_enabled and close < STakeprofit
short_exit_condition2 = short_exit_condition2_enabled and close > basis - exit_mult * atr_value

// Strategy logic
if (long_condition)
    strategy.entry("Long", strategy.long)
if (short_condition)
    strategy.entry("Short", strategy.short)

if (long_exit_condition1 or long_exit_condition2)
    strategy.close("Long")

if (short_exit_condition1 or short_exit_condition2)
    strategy.close("Short")

// Moving Averages
var float MA1 = na
var float MA2 = na

if (ma_type == "SMA")
    MA1 := ta.sma(close, MAShort)
    MA2 := ta.sma(close, MALong)
else if (ma_type == "EMA")
    MA1 := ta.ema(close, MAShort)
    MA2 := ta.ema(close, MALong)
else if (ma_type == "WMA")
    MA1 := ta.wma(close, MAShort)
    MA2 := ta.wma(close, MALong)

// Plotting Keltner Channels with adjusted transparency
transparentColor = color.rgb(255, 255, 255, 56)

plot(upper_channel1, color=transparentColor, title="Upper Channel 1")
plot(lower_channel1, color=transparentColor, title="Lower Channel 1")
plot(upper_channel2, color=transparentColor, title="Upper Channel 2")
plot(lower_channel2, color=transparentColor, title="Lower Channel 2")
plot(upper_channel3, color=transparentColor, title="Upper Channel 3")
plot(lower_channel3, color=transparentColor, title="Lower Channel 3")
plot(upper_channel4, color=transparentColor, title="Upper Channel 4")
plot(lower_channel4, color=transparentColor, title="Lower Channel 4")
plot(basis, color=color.white, title="Basis")
plot(MA1, color=color.rgb(4, 248, 216), linewidth=2, title="Middle MA")
plot(MA2, color=color.rgb(220, 7, 248), linewidth=2, title="Long MA")


もっと