
この戦略は,SMA (Simple Moving Average) を交差した空頭取引システムで,市場の下落傾向を捉えることに焦点を当てています.この戦略は,20周期と50周期のSMAを中心の指標として使用し,短期SMA (Simple Moving Average) を下方から長いSMA (Smaller Moving Average) を越えたとき,システムは空白信号を生成します.短期SMA (Smaller Moving Average) を上方から長いSMA (Smaller Moving Average) を越えたとき,システムは平仓します.
この戦略は,技術分析の古典的な移動平均の交差理論に基づいています. その核心論理は以下の通りです.
策略は,Pine Script言語のta.crossunder () とta.crossover () 関数を用いて均線交差の出来事を正確に捉え,strategy.entry () とstrategy.close () 関数によって取引を実行する.さらに,策略は,取引シグナルをグラフに直観的に表示し,トレーダーが取引論理の実行を即座に理解できるようにする.
SMA20/50のスマート空券取引システムは,シンプルな移動平均の交差信号を捕捉して空頭取引を実行する簡潔で効率的な量化取引戦略である.この戦略は,下落のトレンドで優れたパフォーマンスを発揮し,操作ロジックは明確で,理解し,実行することが容易である.揺れ動いている市場の偽信号や均線遅れなどの固有のリスクがあるにもかかわらず,トレンドフィルターを追加し,パラメータ設定を最適化し,資金管理と停止の仕組みを完善させることで,戦略のパフォーマンスは著しく向上します.下落の機会を把握しようとするトレーダーにとって,この戦略は,信頼性の高い枠組みを提供し,特に15分間の時間枠の下での取引に適しています.
/*backtest
start: 2025-01-01 00:00:00
end: 2025-03-31 00:00:00
period: 1d
basePeriod: 1d
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=6
strategy("SMA20/50 Short-Only Strategy", overlay=true, initial_capital=5000, default_qty_type=strategy.percent_of_equity, default_qty_value=100)
// Input sources and calculations
src = close
sma20 = ta.sma(src, 20)
sma50 = ta.sma(src, 50)
// Generate sell signal when sma20 crosses below sma50
sellSignal = ta.crossunder(sma20, sma50)
// Generate exit signal when sma20 crosses above sma50
exitSignal = ta.crossover(sma20, sma50)
// Plot SMAs
plot(sma20, color = color.blue, title = "SMA 20")
plot(sma50, color = color.black, title = "SMA 50")
// Plot sell signal
plotshape(sellSignal, style = shape.triangledown, location = location.abovebar, color = color.red, size = size.tiny, title = "Sell Signal")
// Plot exit signal
plotshape(exitSignal, style = shape.xcross, location = location.belowbar, color = color.green, size = size.tiny, title = "Exit Signal")
// Add label for sell signals
if sellSignal
label.new(bar_index, high, text="SELL", color = color.red, style = label.style_label_down, textcolor = color.white, size = size.small)
// Add label for exit signals
if exitSignal
label.new(bar_index, low, text="EXIT", color = color.green, style = label.style_label_up, textcolor = color.white, size = size.small)
// Strategy entry and exit - SHORT ONLY
if sellSignal
strategy.entry("Short", strategy.short)
if exitSignal
strategy.close("Short")
// Strategy performance stats
var cumPnL = 0.0
if strategy.closedtrades > 0
cumPnL := strategy.netprofit