
三均線交差戦略は,異なる時間周期の移動平均の交差を買入と売却の信号として使用し,トレンド追跡戦略の1つである.この戦略は,短期移動平均,中期移動平均,長期移動平均を含む3つの移動平均を使用して,それらの交差に基づいて取引信号を形成する.
この戦略は,まず,短期移動平均 (デフォルト7日),中期移動平均 (デフォルト25日),長期移動平均 (デフォルト99日) を計算し,次のルールに従って取引シグナルを生成します.
短期移動平均線が中期移動平均線を突破すると,買い信号が生じます.
短期移動平均線の下から中期移動平均線を突破すると,セールシグナルが生成される.
短期移動平均の上で長期移動平均を穿越すると,迅速な買入シグナルが生成されます.
短期移動平均線が長期移動平均線を横切ると,急速な売り込み信号が生じる.
この戦略では,短期移動平均線上を中期移動平均線を横切ると,市場の傾向が上昇して買い信号が生じると考えられ,短期移動平均線下を中期移動平均線を横切ると,市場の傾向が低下して売り信号が生じると考えられる.同様に,短期移動平均線と長期移動平均線の交差は,より長い線の傾向の変化を捕捉するために急速な取引信号を生成する.
移動平均周期を適切に調整したり,フィルタリング条件を追加したりして最適化して,偽信号を減らすことができる。また,迅速取引周期を適切に短縮して,取引頻度を減らすことができる。
三均線交差戦略は,全体的に比較的単純で直接で,異なる時間周期の均線を交差してトレンドの方向を判定し,取引信号を生成する.この戦略は,実行し易く,パラメータ調整が柔軟で,トレンドの変化を捉えることができる.しかし,移動平均の遅れの問題と偽信号の過剰なリスクもある.フィルタ条件を追加し,パラメータの組み合わせを最適化する方法などで戦略の効果を向上させることができる.この戦略は,トレンド交差に興味のあるトレーダーに最適化されたアプリケーションに適している.
/*backtest
start: 2023-10-06 00:00:00
end: 2023-11-05 00:00:00
period: 1h
basePeriod: 15m
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/
// © dadashkadir
//@version=4
strategy("Üç Hareketli Ortalama Str.", overlay=true, initial_capital=10000, commission_value=0.047, default_qty_type=strategy.percent_of_equity, default_qty_value=100, pyramiding=0, calc_on_order_fills=true)
kisa = input(title = "Kısa Vade - Gün", defval = 7, minval = 1)
orta = input(title = "Orta Vade - Gün", defval = 25, minval = 1)
uzun = input(title = "Uzun Vade - Gün", defval = 99, minval = 1)
sma7 = sma(close, kisa)
sma25 = sma(close, orta)
sma99 = sma(close, uzun)
alTrend = plot (sma7, color=#2323F1, linewidth=2, title="Har.Ort. Kısa Vade", transp=0)
satTrend = plot (sma25, color=#FF0C00, linewidth=3, title="Har.Ort. Orta Vade", transp=0)
ort99 = plot (sma99, color=#DFB001, linewidth=3, title="Har.Ort. Uzun Vade", transp=0)
zamanaralik = input (2020, title="Backtest Başlangıç Tarihi")
al = crossover (sma7, sma25) and zamanaralik <= year
sat = crossover (sma25, sma7) and zamanaralik <= year
hizlial = crossover (sma7, sma99) and zamanaralik <= year
hizlisat = crossover (sma99, sma7) and zamanaralik <= year
alkosul = sma7 >= sma25
satkosul = sma25 >= sma7
hizlialkosul = sma7 >= sma99
hizlisatkosul = sma99 >= sma7
plotshape(al, title = "Buy", text = 'Al', style = shape.labelup, location = location.belowbar, color= color.green, textcolor = color.white, transp = 0, size = size.tiny)
plotshape(sat, title = "Sell", text = 'Sat', style = shape.labeldown, location = location.abovebar, color= color.red, textcolor = color.white, transp = 0, size = size.tiny)
plotshape(hizlial, title = "Hızlı Al", text = 'Hızlı Al', style = shape.labelup, location = location.belowbar, color= color.blue, textcolor = color.white, transp = 0, size = size.tiny)
plotshape(hizlisat, title = "Hızlı Sat", text = 'Hızlı Sat', style = shape.labeldown, location = location.abovebar, color= #6106D6 , textcolor = color.white, transp = 0, size = size.tiny)
fill (alTrend, satTrend, color = sma7 >= sma25? #4DFF00 : #FF0C00, transp=80, title="Al-Sat Aralığı")
//fill (ort99, satTrend, color = sma7 >= sma25? #6106D6 : color.blue, transp=80, title="Hızlı Al-Sat Aralığı")
if (al)
strategy.entry("LONG", strategy.long)
if (sat)
strategy.entry("SHORT", strategy.short)
//if (hizlial)
// strategy.entry("My Short Entry Id", strategy.long)
//if (hizlisat)
// strategy.entry("My Short Entry Id", strategy.short)