
この戦略は,移動平均金叉とデッドフォークをベースに,長時間多空を行い,先駆者の利益の統計に基づいて,午後の閉盘・ストップ・ストップのみで,午前盤の高波動率に囲まれないようにする.
この戦略は,3つの異なるパラメータの移動平均を使用しています: 14 日線,28 日線,56 日線. 14 日線が56 日線を横切るときに多行し,14 日線が56 日線を横切るときに空行します.これは,長線のトレンドを追跡する基本的な方法です. 騒音の一部をフィルターするために,戦略は28 日線を参照として追加し,14 日線が同時に 28 日線より上または下にある場合にのみ取引信号を発します.
この戦略の重要な革新は,午後4時から5時までの間にのみストップ・ストップ・ロスを行うことにある.統計によると,一日の最高値と最低値の70%の確率は,開盤の最初の1時間以内に発生する.開盤時の高い波動が戦略に与える衝撃を回避するために,午後取引時間のみでストップ・ストップ・ロスを行う.
この戦略には以下の利点があります.
この戦略には以下のリスクもあります.
この戦略は,以下の点でさらに最適化できます.
この戦略の全体的な考え方は明確で分かりやすく,開設特性の設計の止損論理を有効に活用し,早盤の高波動の檻を避けるため,さらなるテストと最適化の価値があります.しかし,被套され,機会を逃すリスクもあります.個別の株式に合わせてパラメータを調整する必要があります.全体的に,この戦略は,初心者にとってシンプルで効果的な量化取引考え方を提供しています.
/*backtest
start: 2023-11-23 00:00:00
end: 2023-11-30 00:00:00
period: 10m
basePeriod: 1m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=2
strategy("MAC 1st Trading Hour Walkover", overlay=true)
// Setting up timeperiod for testing
startPeriodYear = input(2014, "Backtest Start Year")
startPeriodMonth = input(1, "Backtest Start Month")
startPeriodDay = input(2, "Backtest Start Day")
testPeriodStart = timestamp(startPeriodYear, startPeriodMonth, startPeriodDay, 0, 0)
stopPeriodYear = input(2025, "Backtest Stop Year")
stopPeriodMonth = input(12, "Backtest Stop Month")
stopPeriodDay = input(30, "Backtest Stop Day")
testPeriodStop = timestamp(stopPeriodYear, stopPeriodMonth, stopPeriodDay, 0, 0)
// Moving Averages
ema14 = ema(close, 14)
ema28 = ema(close, 28)
sma56 = sma(close, 56)
// Plot
plot(ema14, title="ema14", linewidth=2, color=green)
plot(ema28, title="ema28", linewidth=2, color=red)
plot(sma56, title="sma56", linewidth=3, color=blue)
// Strategy
goLong = cross(ema14, sma56) and ema14 > ema28
goShort = cross(ema14, sma56) and ema14 < ema28
// Strategy.When to enter
if time >= testPeriodStart
if time <= testPeriodStop
strategy.entry("Go Long", strategy.long, 1.0, when=goLong)
strategy.entry("Go Short", strategy.short, 1.0, when=goShort)
// Strategy.When to take profit
if time >= testPeriodStart
if time <= testPeriodStop
strategy.exit("Close Long", "Go Long", profit=2000)
strategy.exit("Close Short", "Go Short", profit=2000)
// Strategy.When to stop out
// Some studies show that 70% of the days high low happen in the first hour
// of trading. To avoid having that volatility fire our loss stop we
// ignore price action in the morning, but allow stops to fire in the afternoon.
if time("60", "1000-1600")
strategy.exit("Close Long", "Go Long", loss=500)
strategy.exit("Close Short", "Go Short", loss=500)