MA 크로스오버

저자:차오장, 날짜: 2023-09-04 15:55:46
태그:

MA 크로스오버 전략은 이동 평균 크로스오버를 사용하여 거래 기회를 식별하는 기술적 거래 전략입니다. 전략은 매일 시간 프레임에서 사용할 수 있도록 설계되었으며 긴 포지션과 짧은 포지션을 거래하는 데 사용할 수 있습니다.

이 전략은 빠른 이동 평균과 느린 이동 평균 사이의 교차점을 식별하여 작동합니다. 빠른 이동 평균이 느린 이동 평균을 넘을 때 구매 신호가 생성됩니다. 빠른 이동 평균이 느린 이동 평균을 넘을 때 판매 신호가 생성됩니다.

MA 크로스오버 전략은 사용이 비교적 간단하지만 매우 효과적일 수 있습니다. 전략은 건전한 기술적 원리에 기반하고 있으며 시간이 지남에 따라 수익성이 입증되었습니다.

다음은 MA 크로스오버 전략을 사용하는 몇 가지 이점입니다.

그것은 사용하기 쉬운 전략으로 모든 경험 수준의 거래자에게 접근 할 수 있습니다. 그것은 건전한 기술적 원칙에 기초하고 있으며, 이는 성공 가능성이 높다는 것을 의미합니다. 트렌드를 따르는 전략입니다. 즉 트레이더들이 트렌드를 따라가는 것을 도울 수 있습니다. 그것은 긴 위치와 짧은 위치를 거래하는 데 사용할 수 있습니다. 다음은 MA 크로스오버 전략을 사용하는 것과 관련된 몇 가지 위험입니다.

이 전략은 역사적인 가격 데이터에 기초하고 있으며, 미래에 수익성이 보장되지 않습니다. 이 전략은 윙사 (whipsaw) 에 민감할 수 있습니다. 즉 자산의 가격이 두 방향으로 빠르게 움직일 때입니다. 이 전략은 변동적이기도 하고, 큰 손실의 위험이 있다는 뜻입니다. 전반적으로, MA 크로스오버 전략은 모든 경험 수준의 거래자가 사용할 수 있는 비교적 간단하고 효과적인 거래 전략입니다. 그러나 어떤 거래 전략도 수익성이 보장되지 않는다는 것을 기억하는 것이 중요합니다. 그리고 거래자는 항상 거래 전략을 사용할 때 신중해야 합니다.

MA 크로스오버 전략을 사용할 때 주의해야 할 몇 가지 추가 사항은 다음과 같습니다.

이동 평균의 길이는 당신의 거래 스타일과 위험 용도에 맞게 조정될 수 있습니다. 더 복잡한 전략을 만들기 위해 여러 이동 평균을 사용할 수도 있습니다. 실시간 거래에 사용하기 전에 전략이 수익성이 있는지 확인하기 위해 역사적 데이터에 대한 역 테스트가 중요합니다. 또한 손실을 제한하기 위해 스톱 로스를 사용해야 합니다. 이 기사 가 도움 이 되고 유익 한 내용 이 되었으면 좋겠습니다. 더 많은 질문 이 있으시면 자유롭게 질문 해 주십시오.


/*backtest
start: 2022-08-28 00:00:00
end: 2023-02-10 00:00:00
period: 1h
basePeriod: 15m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT","balance":10000}]
*/

//@version=5
strategy("EMA-Cross-JC Intraday with Trailing SL", overlay=true)

// emabasel = input(100, "Base Length")
emaslen = input(15, "Slow Length")
emaflen = input(9, "Fast Length")
intra =input(true, title = "Intraday?")
sq_time_hr = input(15, title="Exit Hr")
sq_time_min = input(20, title="Exit Min")

emaslow = ta.ema(close, emaslen)
emafast = ta.ema(close, emaflen)
// emabase = ta.ema(close, emabasel)

emaup = ta.crossover(emafast, emaslow)
emadown = ta.crossunder(emafast, emaslow)

tsival = ta.tsi(close, 13, 55)

plot(emaslow, title="Slow EMA", color=color.yellow, linewidth=1)
plot(emafast, title="Fast EMA", color=color.green, linewidth=1)
// plot(emabase, title="Base EMA", color=color.white, linewidth=3)

takeProfitPoints = input(200, title="Take Profit")
// tp_off = input(4000, title="Keep trailing")
stopLossPoints = input(100, title="Stop Loss")

// Define the time to square off positions
squareOffTime = timestamp(year, month, dayofmonth, sq_time_hr, sq_time_min)

var float trailingStop = na

if emaup and barstate.isconfirmed and time < squareOffTime //and tsival >=0
    strategy.entry("Buy", strategy.long)
    strategy.exit("Sell", "Buy", stop=close - stopLossPoints, limit=close + takeProfitPoints)
    // trailingStop := emabase - stopLossPoints
    strategy.exit("Trailing Stop", "Buy", stop=trailingStop)

if emadown and barstate.isconfirmed and time < squareOffTime //and tsival <=0
    strategy.entry("Sell", strategy.short)
    strategy.exit("Cover", "Sell", stop=close + stopLossPoints, limit=close - takeProfitPoints)
    // trailingStop := emabase + stopLossPoints
    strategy.exit("Trailing Stop", "Sell", stop=trailingStop)

// Close any open positions before the end of the trading day
if ta.barssince(strategy.opentrades) == 0 and time >= squareOffTime and intra == true
    strategy.close_all()

// plot(tsival, title = "TSI Value")
plotshape(emaup and barstate.isconfirmed, title="Crossover", style = shape.triangleup , size=size.small,color = color.green, location = location.belowbar)
plotshape(emadown and barstate.isconfirmed, title="Crossunder",style = shape.triangledown, size=size.small,color = color.red, location = location.abovebar)


더 많은