
この戦略は,平滑型ハイキン・アシグラフと簡易移動平均 (SMA) の交差に基づくトレンド追跡システムである.戦略は,EMAの平滑処理後のハイキン・アシグラフと44周期SMAの交差によるトレンドの変化を識別し,市場における主要なトレンドの機会を捕捉する.戦略は,価格が長期平均線から近距離過ぎるときに自動的に平仓するダイナミックなポジション管理機構を設計し,市場全体の変動のリスクを回避する.
戦略の核心的な論理には3つの重要な要素が含まれている.第一に,従来のK線をハイキン・アシ図に変換し,四つの価格の算術平均を計算して市場のノイズをフィルターする.次に,6周期EMAを使用してハイキン・アシを滑らかに処理し,信号の信頼性をさらに高めること.そして最後に,滑らかなハイキン・アシの閉盘価格を44周期SMAと組み合わせ,上を穿越して多行シグナルを生じ,下を穿越して空調シグナルを生じさせる.また”,無ポジション位値”の概念を導入し,価格と長期平均線との距離が値より小さいときに,横盤の平仓シグナルに触れて,横行整理状況による頻繁な取引を効果的に回避する.
この戦略は,Heikin-Ashi図とSMA均線システムを組み合わせて,堅牢なトレンド追跡取引システムを構築している.戦略の信号生成機構は完善し,リスク管理は合理的で,特に傾向が顕著な市場での適用に適している.戦略の実戦効果は,提案された方向の最適化によってさらに向上することができる.全体的には,合理的に設計され,論理的に明確なトレンド追跡戦略である.
/*backtest
start: 2024-10-01 00:00:00
end: 2024-10-31 23:59:59
period: 1h
basePeriod: 1h
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=5
strategy("Smoothed Heikin Ashi with SMA Strategy", overlay=true)
// Input parameters for SMAs
s1 = input.int(11, title="Short SMA Period")
s2 = input.int(44, title="Long SMA Period")
noPositionThreshold = input.float(0.001, title="No Position Threshold", step=0.0001)
// Calculate the original Heikin-Ashi values
haClose = (open + high + low + close) / 4
var float haOpen = na
haOpen := na(haOpen[1]) ? (open + close) / 2 : (haOpen[1] + haClose[1]) / 2
haHigh = math.max(high, math.max(haOpen, haClose))
haLow = math.min(low, math.min(haOpen, haClose))
// Smoothing using exponential moving averages
smoothLength = input.int(6, title="Smoothing Length")
smoothedHaClose = ta.ema(haClose, smoothLength)
smoothedHaOpen = ta.ema(haOpen, smoothLength)
smoothedHaHigh = ta.ema(haHigh, smoothLength)
smoothedHaLow = ta.ema(haLow, smoothLength)
// Calculate SMAs
smaShort = ta.sma(close, s1)
smaLong = ta.sma(close, s2)
// Plotting the smoothed Heikin-Ashi values
plotcandle(smoothedHaOpen, smoothedHaHigh, smoothedHaLow, smoothedHaClose, color=(smoothedHaClose >= smoothedHaOpen ? color.green : color.red), title="Smoothed Heikin Ashi")
plot(smaShort, color=color.blue, title="SMA Short")
plot(smaLong, color=color.red, title="SMA Long")
// Generate buy/sell signals based on SHA crossing 44 SMA
longCondition = ta.crossover(smoothedHaClose, smaLong)
shortCondition = ta.crossunder(smoothedHaClose, smaLong)
noPositionCondition = math.abs(smoothedHaClose - smaLong) < noPositionThreshold
// Strategy logic
if (longCondition)
strategy.entry("Long", strategy.long)
if (shortCondition)
strategy.entry("Short", strategy.short)
if (noPositionCondition and strategy.position_size != 0)
strategy.close_all("No Position")
// Plot buy/sell signals
plotshape(series=longCondition, location=location.belowbar, color=color.green, style=shape.labelup, text="BUY", size=size.small)
plotshape(series=shortCondition, location=location.abovebar, color=color.red, style=shape.labeldown, text="SELL", size=size.small)
plotshape(series=noPositionCondition and strategy.position_size != 0, location=location.belowbar, color=color.yellow, style=shape.labeldown, text="EXIT", size=size.small)