
この戦略は,一見均衡図雲と短期 (<=55) と長期 (<=200) の単純な移動平均 (<=SMA) を組み合わせて,潜在的な買入シグナルを識別する.買入シグナルには,雲層と長期SMAよりも高い価格が必要で,短期SMAを上を通過した後,短期SMAを踏む必要がある.売出シグナルには,雲層と長期SMAを下を通過した後,短期SMAを踏む必要がある.この戦略は,横断市場または重大ニュースイベントの間にシグナルを生成することを避ける.これらの期間に偽のシグナルが多くあるため,この戦略は,1時間および2時間の時間枠で最高のパフォーマンスを示している.
この戦略は以下の原則に基づいています.
プログラムはまず,必要な一目的なクラウド構成要素 ((変換線,基準線,先行スパンAおよびB),および短期および長期のSMAを計算する. そして,価格の雲層および均等線に対する位置を識別するために複数の条件を定義する. すべての買入/売却条件が満たされると,プログラムはそれぞれ買入と売却の信号を生成する.
この”一雲多均線取引戦略”は,一目平衡グラフ雲と簡易移動平均を組み合わせて,既定のトレンドの中で反転均線を踏む低リスクの入場機会を探している.横断市場と重大ニュースイベントの間の取引をフィルタリングすることによって,この戦略は偽信号のリスクを軽減し,その結果,全体的なパフォーマンスを向上させる.この戦略は,主に中長期の取引を行う者に適用され,1時間および2時間などの時間枠で良好なパフォーマンスを発揮している.しかし,この戦略には,明確なストップ・ロスの導入,信号の最適化,対参数調節などのさらなる最適化の余地がある.
/*backtest
start: 2023-05-11 00:00:00
end: 2024-05-16 00:00:00
period: 1d
basePeriod: 1h
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=5
strategy("Ichimoku Cloud and Moving Average Strategy", shorttitle="ICMA", overlay=true)
// Input parameters
shortMA = input.int(55, title="Short-term Moving Average Length")
longMA = input.int(200, title="Long-term Moving Average Length")
// Calculate moving averages
shortSMA = ta.sma(close, shortMA)
longSMA = ta.sma(close, longMA)
// Ichimoku Cloud settings
conversionPeriod = input.int(9, title="Conversion Line Period")
basePeriod = input.int(26, title="Base Line Period")
spanBPeriod = input.int(52, title="Span B Period")
displacement = input.int(26, title="Displacement")
// Calculate Ichimoku Cloud components
conversionLine = ta.sma(high + low, conversionPeriod) / 2
baseLine = ta.sma(high + low, basePeriod) / 2
leadSpanA = (conversionLine + baseLine) / 2
leadSpanB = ta.sma(high + low, spanBPeriod) / 2
// Plot Ichimoku Cloud components
plot(leadSpanA, color=color.blue, title="Leading Span A")
plot(leadSpanB, color=color.red, title="Leading Span B")
// Entry conditions
aboveCloud = close > leadSpanA and close > leadSpanB
belowCloud = close < leadSpanA and close < leadSpanB
aboveShortMA = close > shortSMA
aboveLongMA = close > longSMA
belowShortMA = close < shortSMA
belowLongMA = close < longSMA
// Buy condition (Price retests 55 moving average after being above it)
buyCondition = aboveCloud and aboveLongMA and close[1] < shortSMA and close > shortSMA
// Sell condition (Price retests 55 moving average after being below it)
sellCondition = belowCloud and belowLongMA and close[1] > shortSMA and close < shortSMA
// Strategy entry and exit
strategy.entry("Buy", strategy.long, when = buyCondition)
strategy.entry("Sell", strategy.short, when = sellCondition)
// Plot moving averages
plot(shortSMA, color=color.green, title="Short-term SMA")
plot(longSMA, color=color.red, title="Long-term SMA")
// Plot buy and sell signals
plotshape(series=buyCondition, style=shape.triangleup, location=location.belowbar, color=color.green, size=size.small, title="Buy Signal")
plotshape(series=sellCondition, style=shape.triangledown, location=location.abovebar, color=color.red, size=size.small, title="Sell Signal")