
이 전략은 간단한 평균선 교차와 평균 실제 파장 지표를 사용하여 구매 및 판매 신호를 생성합니다. 이것은 트렌드 추적 방식의 전략입니다. 주로 50 일 평균선과 100 일 평균선의 교차를 사용하여 트렌드를 판단하고 ATR 지표를 사용하여 스톱 스포트 포인트를 설정하여 위험을 제어합니다.
보시다시피, 이 전략은 주로 일률적인 경향 판단 능력과 ATR 지표의 위험 제어 능력에 의존한다. 기본 원칙은 간단하고 명확하며 이해하기 쉽고 구현된다.
위험 관리 방법:
이 전략은 전형적인 트렌드 추적 전략에 속하며, 평균선 판단 트렌드 방향, ATR 설정 중지 손실을 사용하여 위험을 제어합니다. 원칙은 간단하고 명확하며, 쉽게 파악할 수 있습니다. 그러나 약간의 지연과 잘못된 신호 위험이 있지만, 매개 변수 조정, 지표 최적화, 더 많은 요소를 결합하는 방법을 통해 전략을 더 잘 적응시킬 수 있습니다.
/*backtest
start: 2023-12-27 00:00:00
end: 2024-01-03 00:00:00
period: 1m
basePeriod: 1m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=5
strategy("SMA and ATR Strategy", overlay=true)
// Step 1. Define strategy settings
lengthSMA1 = input.int(50, title="50 SMA Length")
lengthSMA2 = input.int(100, title="100 SMA Length")
atrLength = input.int(14, title="ATR Length")
atrMultiplier = input.int(4, title="ATR Multiplier")
// Step 2. Calculate strategy values
sma1 = ta.sma(close, lengthSMA1)
sma2 = ta.sma(close, lengthSMA2)
atr = ta.atr(atrLength)
// Step 3. Output strategy data
plot(sma1, color=color.blue, title="50 SMA")
plot(sma2, color=color.red, title="100 SMA")
// Step 4. Determine trading conditions
longCondition = ta.crossover(sma1, sma2)
shortCondition = ta.crossunder(sma1, sma2)
longStopLoss = close - (atr * atrMultiplier)
shortStopLoss = close + (atr * atrMultiplier)
// Step 5. Execute trades based on conditions
if (longCondition)
strategy.entry("Buy", strategy.long)
strategy.exit("Sell", "Buy", stop=longStopLoss)
if (shortCondition)
strategy.entry("Sell", strategy.short)
strategy.exit("Buy", "Sell", stop=shortStopLoss)