
この戦略は,高速と遅いインデックス移動平均 ((EMA) の交差に基づくトレンド追跡取引システムである.これは,価格と二重均線の位置関係を確認することにより,より信頼できる買入シグナルを生成する.戦略は,特定の時間帯で戦略のパフォーマンスを評価するために,反射時間帯の設定機能を内蔵している.
戦略は,10周期および20周期のEMAを核心指標として使用する. 急速なEMAが遅いEMAを上に向かって通過し,閉店価格が2つの平均線上にあるとき,多信号を触発する. 急速なEMAが遅いEMAを下に向かって通過し,閉店価格が2つの平均線の下にあるとき,空き信号を触発する. この二重確認機構は,信号の信頼性を向上させる.
これは,構造が明確で,論理が厳格なトレンド追跡戦略である. 双均線交差と価格確認機構を組み合わせて,信号のタイム性と信頼性を効果的にバランスしている. 戦略は,優れた拡張性があり,最適化によってパフォーマンスをさらに向上させることができる. 中長期のトレンド追跡のための基本的な戦略枠組みに適している.
/*backtest
start: 2024-02-21 00:00:00
end: 2024-10-01 00:00:00
period: 1h
basePeriod: 1h
exchanges: [{"eid":"Binance","currency":"BNB_USDT"}]
*/
// This Pine Script™ code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © BFXGold
//@version=5
strategy("BFX Buy and Sell", overlay=true)
// Inputs
ema_fast_length = input.int(10, title="Fast EMA Length")
ema_slow_length = input.int(20, title="Slow EMA Length")
// Calculate EMAs
ema_fast = ta.ema(close, ema_fast_length)
ema_slow = ta.ema(close, ema_slow_length)
// Confirmation candles
confirmation_above = close > ema_fast and close > ema_slow
confirmation_below = close < ema_fast and close < ema_slow
// Crossovers with confirmation
long_condition = ta.crossover(ema_fast, ema_slow) and confirmation_above
short_condition = ta.crossunder(ema_fast, ema_slow) and confirmation_below
// Plot signals
if (long_condition )
label.new(bar_index, low, text="BUY", style=label.style_label_up, color=color.new(color.green, 0), textcolor=color.white)
if (short_condition)
label.new(bar_index, high, text="SELL", style=label.style_label_down, color=color.new(color.red, 0), textcolor=color.white)
// Strategy execution for backtesting
if (long_condition)
strategy.entry("Long", strategy.long)
if (short_condition)
strategy.entry("Short", strategy.short)
// Plot EMAs
plot(ema_fast, title="Fast EMA (10)", color=color.blue, linewidth=1)
plot(ema_slow, title="Slow EMA (20)", color=color.orange, linewidth=1)