
平均線突破トラップ戦略は,1分と1時間の時間枠に適用される多時間枠の通用取引ツールである.この戦略は21日移動平均を利用して重要な市場トレンドを識別し,同時にATR指標を使用して潜在的な多頭と空頭トラップを識別する.この戦略は,高利率で85%,最適な状況では88%に達する.
この戦略は,まず21日の指数移動平均を計算して,全体的なトレンドと方向を判断する.それから,最近N日の最高値と最低値を計算する (Nは調整可能なパラメータである).もし,閉盘価格が最近の一日の最高値より高く,その後の低値が最近の高値とATR指数相乗した後の価格を下回っていると,閉盘価格が21日線を下回っていると判断すると,多頭トラップ信号と判断する.空頭トラップ信号の判断の論理は類似する.
トラップ信号が認識されたら,最新の最高価格と最低価格の間の距離の80%に従ってストップ・ロスを設定し,逆操作を行う.例えば,多頭トラップが認識されたら,空頭取引を行い,ストップ・ロスを設定する.空頭トラップが認識されたら,多頭取引を行い,ストップ・ロスを設定する.
EMAパラメータの最適化,ATR係数の調整,動的トレーリングストプロスなどの方法によってリスクを軽減することができる.
均線突破トラップ戦略は,トレンド判断とトラップ識別の利点を統合し,小回撤,高利率で,多種多様な取引スタイルに適しており,推奨される高効率戦略である.パラメータ最適化とメカニズム最適化により,安定性と利潤の空間をさらに強化することができる.
/*backtest
start: 2023-02-14 00:00:00
end: 2024-02-20 00:00:00
period: 1d
basePeriod: 1h
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=5
strategy("Bull and Bear Trap Strategy with EMA 21 - 1min Chart", overlay=true)
// Inputs
length = input(5, "Length")
atrMultiplier = input(1.0, "ATR Multiplier")
emaLength = input(21, "EMA Length")
price = close
atr = ta.atr(length)
// EMA Calculation
ema21 = ta.ema(price, emaLength)
// Define recent high and low
recentHigh = ta.highest(high, length)
recentLow = ta.lowest(low, length)
// Bull and Bear Trap Detection
bullTrap = price > recentHigh[1] and low <= recentHigh - atr * atrMultiplier and price < ema21
bearTrap = price < recentLow[1] and high >= recentLow + atr * atrMultiplier and price > ema21
// Plotting
plotshape(series=bullTrap, title="Bull Trap", location=location.abovebar, color=color.red, style=shape.triangleup, size=size.small)
plotshape(series=bearTrap, title="Bear Trap", location=location.belowbar, color=color.green, style=shape.triangledown, size=size.small)
plot(ema21, title="EMA 21", color=color.blue)
// Measured Move Implementation
moveSize = recentHigh - recentLow
targetDistance = moveSize * 0.8 // Target at 80% of the move size
// Strategy Execution with Measured Move Targets
if (bullTrap)
strategy.entry("Enter Short (Sell)", strategy.short)
strategy.exit("Exit Short (Buy to Cover)", "Enter Short (Sell)", limit=price - targetDistance)
if (bearTrap)
strategy.entry("Enter Long (Buy)", strategy.long)
strategy.exit("Exit Long (Sell)", "Enter Long (Buy)", limit=price + targetDistance)