
ゴールド・クロス・セルツ・チャネルトレンド追跡戦略は,トレンドの方向のみで取引する戦略である.移動平均のゴールド・クロスとセルツ・チャネルを入場信号として組み合わせて,トレンドの方向を捉える.
この戦略は,トレンドの方向を判断するために,短期移動平均と長期移動平均という2つの移動平均を使用し,黄金クロスと死クロスを形成します. 同時に,ユーザー定義の倍数を使用して,ケルターチャネルの上下軌道を描画し,価格がチャネルを突破すると取引信号を生成します.
具体的には,戦略はまず,長期移動平均が短期移動平均の上にあるかどうかを判断し,もしそうなら,黄金の交差で,上昇傾向として判断し,短期移動平均が長期移動平均の下にあるなら,死亡交差で,下方傾向として判断する.
トレンド判断に基づいて,価格が上線を突破した場合,多行シグナルが生成され;価格が下線を突破した場合,空行シグナルが生成される. ユーザーは,移動平均周期とチャネル幅を自分で調整して,戦略のパラメータを調整することができる.
入場後,戦略はユーザー定義のストップストップ損失ATR倍数を使用してストップストップ損失レベルを設定する.同時に,戦略は,さらに突破的なストップストップとストップ損失条件を提供し,ポジションをより柔軟に制御することができます.
この戦略は,トレンド追跡とチャネルブレイクの利点と組み合わせて,市場の動きとトレンドの機会を効果的に判断できます.具体的には以下の通りです.
黄金のクロスを使ってトレンドの方向を判断し,大きなトレンドに合わないノイズ取引を効果的にフィルターすることができます.
ケルト通路の突破は,トレンドの方向判断と組み合わせて,入札のタイミングの精度を向上させることができる.
ストップ・ストップ・ロスの仕組みは,利益をロックし,リスクを積極的に制御する.
戦略のパラメータは,異なる品種と市場環境に適用して柔軟に調整できます.
戦略の適用範囲を拡大するために,同時に多空を行うことができます.
この戦略には多くの利点がありますが,注意すべきリスクもあります.
しかし,この状況の改善には,いくつかのリスクがあります.
逆走勢が変化すれば,逆走勢の損失のリスクが生じます.
パラメータ設定が不適切である場合,取引が過度に緩やかまたは過度に頻繁になる可能性があります.
海外の旅行者は,その旅行の旅先で,
カーブフィットするリスクがあります.
これに対して,パラメータ最適化,適時な移動平均周期調整,または適切なポジションサイズ縮小によってリスクを低減することができる.
この戦略はさらに改善できる余地があります.
より多くの判断指標を追加し,多要素モデルを形成し,戦略の精度を向上させることを考えることができます.例えば,MACD,RSIなどを追加します.
マシン・ラーニングによるパラメータの最適化により,異なる市場環境に適合させることができる.
ストップ・ストップ・損失条件を動的に調整して,利益の確保を前提に,より大きな利益を追求することも考えられます.
ポジションの規模は変動率の変動に合わせて調整できます.
異なる品種のパラメータの好みを研究し,異なる品種に適したパラメータの組み合わせを作成する.
取引料金の影響を軽減するために取引頻度を減らす仕組みを追加します.
ゴールド・クロス・ケルト・チャネル・トレンド・トラッキング・ストラテジーは,全体的に比較して安定し,信頼性の高いトレンド・トラッキング・ストラテジーである.トレンド判断とチャネル・ブレイクの優位性を組み合わせて,市場トレンドの方向を効果的に識別し,高確率の取引機会を選択することができる.パラメータの最適化とメカニズム改善により,このストラテジーは強力な量化取引ツールとなる.
/*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")