
この戦略は、クラウドチャート(一目均衡表)、MACDインジケーター、長期移動平均(EMA200)など、複数のテクニカルインジケーターを組み合わせたトレンド追跡システムです。これらの指標の協調的な協力を通じて、この戦略は完全な取引システムを形成し、市場の動向を正確に捉えるだけでなく、ATR を通じて利益確定と損切りのポジションを動的に調整して効果的なリスク管理を実現します。
この戦略では、取引シグナルを識別するために 3 重確認メカニズムを使用します。まず、一目均衡表を使って価格ポジションを決定します。価格が雲チャートの上にあるときは買い、下にあるときは売りになる傾向があります。次に、MACD インジケーターを使用して、MACD ラインとシグナル ラインの交点によってトレンドの方向を確認します。最後に、取引の方向が長期トレンドと一致するように、200 期間 EMA がトレンド フィルターとして導入されます。リスク管理の面では、この戦略は ATR インジケーターを使用してストップロスとテイクプロフィットのポジションを動的に設定し、市場のボラティリティに応じて適応的に調整できるようにします。
この戦略は、多次元のテクニカル指標を組み合わせて適用することで、比較的完全なトレンド追跡システムを構築します。その主な利点は、複数のシグナル確認メカニズムと動的なリスク管理方法にありますが、実際の市場環境に基づいてパラメータの最適化が依然として必要です。戦略の全体的な設計は明確かつ実用的であり、明らかなトレンドのある市場への適用に適しています。
/*backtest
start: 2019-12-23 08:00:00
end: 2025-01-16 00:00:00
period: 1d
basePeriod: 1d
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT","balance":49999}]
*/
//@version=6
strategy("JOJO长趋势", overlay=true, shorttitle="JOJO长趋势")
// Ichimoku 云图
conversionLine = ta.sma(high, 9) // 转换线
baseLine = ta.sma(low, 26) // 基准线
leadingSpanA = (conversionLine + baseLine) / 2 // 领先跨度A
leadingSpanB = (ta.sma(high, 52) + ta.sma(low, 52)) / 2 // 领先跨度B
laggingSpan = close[26] // 滞后跨度
// MACD 指标
macdLine = ta.ema(close, 12) - ta.ema(close, 26) // MACD 线
signalLine = ta.ema(macdLine, 9) // 信号线
macdHist = macdLine - signalLine // MACD 柱状图
// 长期均线
longTermEMA = ta.ema(close, 200) // 200周期EMA,用于确认长期趋势
// 声明多单和空单条件变量
var bool longCondition = false
var bool shortCondition = false
// 声明平仓条件变量
var bool exitLongCondition = false
var bool exitShortCondition = false
// 仅在K线完成后计算
if barstate.isconfirmed
longCondition := (close > leadingSpanA) and (macdLine > signalLine) and (close > longTermEMA) // 多单条件
shortCondition := (close < leadingSpanB) and (macdLine < signalLine) and (close < longTermEMA) // 空单条件
// 平仓条件
exitLongCondition := macdLine < signalLine or close < leadingSpanB // 多单平仓条件
exitShortCondition := macdLine > signalLine or close > leadingSpanA // 空单平仓条件
// 执行策略进入市场
if longCondition
strategy.entry("Long", strategy.long) // 多单进场
if shortCondition
strategy.entry("Short", strategy.short) // 空单进场
// 设置止损和止盈,使用 ATR 倍数动态调整
stopLoss = input.float(1.5, title="止损 (ATR 倍数)", step=0.1) * ta.atr(14) // 止损基于 ATR
takeProfit = input.float(3.0, title="止盈 (ATR 倍数)", step=0.1) * ta.atr(14) // 止盈基于 ATR
// 执行平仓
if exitLongCondition
strategy.exit("Exit Long", from_entry="Long", stop=close - stopLoss, limit=close + takeProfit) // 多单平仓
if exitShortCondition
strategy.exit("Exit Short", from_entry="Short", stop=close + stopLoss, limit=close - takeProfit) // 空单平仓
// 绘制买入和卖出信号
plotshape(series=barstate.isconfirmed and longCondition, location=location.belowbar, color=color.green, style=shape.labelup, text="BUY")
plotshape(series=barstate.isconfirmed and shortCondition, location=location.abovebar, color=color.red, style=shape.labeldown, text="SELL")