
이 전략은 22주기 지수 이동 평균 (EMA) 의 교차 신호와 흔들림 점의 거래 시스템이다. 가격과 EMA의 교차를 통해 거래 신호를 생성하고, 적응된 흔들림 고위와 낮은 점을 사용하여 스톱포스트 위치를 설정한다. 이 방법은 트렌드 추적의 기본 기능을 보장하고, 위험 관리의 유연성을 증가시킨다.
전략의 핵심 논리에는 다음과 같은 핵심 요소가 포함됩니다.
이것은 구조적이고, 논리적으로 명확한 트렌드 추적 전략이다. EMA 교차를 통해 거래 신호를 생성하고, 스윙 포인트의 위험을 이용해서 균형 잡힌 거래 시스템을 형성한다. 전략의 주요 장점은 동적으로 시장에 적응하는 능력에 있으며, 주요 위험은 시장 상태의 변동에서 비롯된다. 제안된 최적화 방향에 의해 전략의 안정성과 수익성이 더욱 향상될 전망이다.
/*backtest
start: 2024-02-21 00:00:00
end: 2025-02-18 08:00:00
period: 1d
basePeriod: 1d
exchanges: [{"eid":"Binance","currency":"SOL_USDT"}]
*/
// This Pine Script™ code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © GlenMabasa
//@version=6
strategy("22 EMA Crossover Strategy", overlay=true)
// Input for the EMA length
ema_length = input.int(22, title="EMA Length")
// Calculate the 22-day Exponential Moving Average
ema_22 = ta.ema(close, ema_length)
// Plot the 22 EMA
plot(ema_22, color=color.blue, title="22 EMA")
// Buy condition: Price crosses and closes above the 22 EMA
buy_condition = ta.crossover(close, ema_22) and close > ema_22
// Sell condition: Price crosses or closes below the 22 EMA
sell_condition = ta.crossunder(close, ema_22) or close < ema_22
// Swing high and swing low calculations
swing_high_length = input.int(14, title="Swing High Lookback")
swing_low_length = input.int(14, title="Swing Low Lookback")
swing_high = ta.highest(high, swing_high_length) // Previous swing high
swing_low = ta.lowest(low, swing_low_length) // Previous swing low
// Profit target and stop loss for buys
buy_profit_target = swing_high
buy_stop_loss = swing_low
// Profit target and stop loss for sells
sell_profit_target = swing_low
sell_stop_loss = swing_high
// Plot buy and sell signals
plotshape(series=buy_condition, title="Buy Signal", location=location.belowbar, color=color.green, style=shape.labelup, text="BUY")
plotshape(series=sell_condition, title="Sell Signal", location=location.abovebar, color=color.red, style=shape.labeldown, text="SELL")
// Strategy logic for backtesting
if (buy_condition)
strategy.entry("Buy", strategy.long)
strategy.exit("Take Profit/Stop Loss", "Buy", limit=buy_profit_target, stop=buy_stop_loss)
if (sell_condition)
strategy.entry("Sell", strategy.short)
strategy.exit("Take Profit/Stop Loss", "Sell", limit=sell_profit_target, stop=sell_stop_loss)