3개 이동평균 저지연 고속 트레이딩 전략


생성 날짜: 2023-12-25 14:24:38 마지막으로 수정됨: 2023-12-25 14:24:38
복사: 0 클릭수: 669
avatar of ChaoZhang ChaoZhang
1
집중하다
1623
수행원

3개 이동평균 저지연 고속 트레이딩 전략

전략 원칙

이 전략은 12주기, 26주기, 55주기의 낮은 시간 연장 테마 평균을 포함하는 세 개의 낮은 시간 연장 이동 평균을 사용합니다. 이 세 개의 평균은 각각: 빠른 평균, 중간 평균, 느린 평균을 나타냅니다. 빠른 평균 상에서 중간 평균을 통과하면 구매 신호가 발생하고, 빠른 평균 아래에서 중간 평균을 통과하면 판매 신호가 발생합니다.

코드에서 템플릿 함수 tema () 를 정의하여 낮은 시간 지연tema 평균선을 계산한다. 계산 공식은: TEMA = 2이다.*EMA - EMA ((EMA), 2차 지수 이동 평균 EWMA를 사용하여 계산, 본질적으로 쌍 지수 평탄 이동 평균, 주요 장점은 크게 지연을 줄입니다. 이렇게 가격 변화에 더 빨리 반응하고 거래 신호 판단의 실시간성을 향상시킬 수 있습니다.

구체적으로, 이 전략의 입수 판단은: 빠른 평균선 상에서 중간 평균선과 빠른 평균선이 느린 평균선보다 높을 때 구매 신호를 생성하고, 빠른 평균선 아래에서 중간 평균선과 빠른 평균선이 느린 평균선보다 낮을 때 판매 신호를 생성한다.

우위 분석

이 전략의 가장 큰 장점은 출전 판단이 빠르고 정확하다는 것이다. 삼중선 낮은 시간 연장 설계는 지연을 크게 줄여주고, 가격 변화에 빠르게 반응할 수 있다. 동시에 삼중선을 사용하여 교차 판단을 하고, 잘못된 판단을 피한다.

또한, 이 전략은 높은 주파수 거래에 적합하며, 짧은 선의 가격 변동에서 이익을 얻을 수 있다. 신속하고 신속한 출구 운영 모드를 통해, 변동성이 높은 시장에서 이익을 얻을 수 있다.

위험 분석

이 전략의 가장 큰 위험은 초단계 하도 (超短線套利) 가 발생할 수 있다는 것이다. 삼평선 저시장 지연 설계는 가격 변화에 매우 민감한 것으로 결정되어 일부 시장에서 초단계 흔들림이 발생할 수 있다. 이 때 쉽게 잡힐 수 있다.

또한, 고주파 거래는 더 많은 수수료와 지점을 지불해야 합니다. 수익성이 부족하면 거래 비용으로 역거래가 될 수 있습니다.

또한, 이 전략은 거래자의 실시간 모니터링 능력에 대한 요구가 높으며, 정지점과 정지점을 제때 업데이트해야 한다.

최적화 방향

이 전략은 다음과 같은 부분에서 최적화될 수 있습니다.

  1. 삼중선의 주기적 변수를 최적화하여 다른 시장의 특성에 더 잘 적응하도록 한다.

  2. 변동성 지표 또는 거래량 지표를 추가하여 신호를 확인하고 흔들리는 상황에서 피하는 것입니다.

  3. 더 많은 요소와 결합하여 스톱 스톱 메커니즘을 설정하여 동적 추적을 구현합니다.

  4. 포지션 관리를 최적화하고, 자금 관리를 통해 단위 위험을 통제합니다.

  5. 기계 학습 알고리즘과 결합하여 전략 파라미터를 동적으로 최적화한다.

요약하다

이 전략은 3평균선 낮은 시간에 연장되는 빠른 거래 전략이다. 낮은 시간 연장 설계, 신속한 출구를 구현하여 고주파 거래에 적합한 단선 기회를 잡는다. 이 전략의 가장 큰 장점은 신호 판단의 신속한 정확성이며, 가장 큰 단점은 흔들림 상황에서 쉽게 잡힐 수 있다.

||

The strategy is named “Low Lag Triple Moving Average Fast Trading Strategy”. Its main idea is to determine entries and exits based on the golden cross and death cross of three moving averages with different parameters and low lag design.

Strategy Principle

The strategy uses three low-lag moving averages, including 12-, 26-, and 55-period low-lag TEMA. These three MAs represent fast, medium and slow MAs. When the fast MA crosses over the medium MA, a buy signal is generated. When the fast MA crosses below the medium MA, a sell signal is generated. By using the crossover of the three MAs to determine market entry and exit points, high frequency trading can be achieved.

The template function tema() is defined in the code to calculate the low-lag TEMA. Its calculation formula is: TEMA = 2*EMA - EMA(EMA). It uses the double exponential moving average EWMA for calculation. Essentially it is a double smoothed EMA with the main merit of largely reducing the lagging effect. Thus it can respond to price changes faster and improve the timeliness of trading signals.

Specifically, the entry rules of this strategy are: when the fast MA crosses over the medium MA and the fast MA is above the slow MA, a buy signal is generated. When the fast MA crosses below the medium MA and the fast MA is below the slow MA, a sell signal is generated.

Advantage Analysis

The biggest advantage of this strategy is that the entries and exits are determined quickly and accurately. The low-lag design of the three MAs greatly reduces the lagging effect so that they can respond to price changes rapidly. Also, using the crossover of three MAs to determine signals avoids false signals.

In addition, this strategy is suitable for high-frequency trading to capture profits from short-term price fluctuations. Through fast entries and exits it can profit from high volatility markets.

Risk Analysis

The biggest risk is that ultra short-term whipsaws may occur. Due to the high sensitivity to price changes from the low-lag design, some markets may experience high-frequency oscillations. Then whipsaws are very likely to happen.

Also, high-frequency trading requires paying relatively high commissions and slippage costs. If the profiting ability is insufficient, it is easy to suffer losses from the trading costs.

Moreover, this strategy requires the trader to have strong real-time monitoring abilities to update the stop loss and take profit timely.

Optimization Directions

The strategy can be optimized from the following aspects:

  1. Optimize the period parameters of the three MAs to better suit different market characteristics.

  2. Add volatility indicators or volume indicators to confirm signals and avoid whipsaws in ranging markets.

  3. Incorporate more factors to set up dynamic trailing stop mechanisms.

  4. Optimize position sizing to control single trade risks through money management techniques.

  5. Incorporate machine learning algorithms to dynamically optimize the strategy parameters.

Conclusion

This is a low-lag triple moving average fast trading strategy. Through its low-lag design, fast entries and exits can be achieved, which is suitable for high-frequency trading to capture short-term opportunities. The biggest advantage of this strategy is that its signal determination is fast and accurate. The biggest disadvantage is that it is prone to be whipsawed in ranging markets. This article comprehensively summarizes this trading strategy through detailed analysis of its rationale, advantages, risks and optimization directions.
[/trans]

전략 소스 코드
/*backtest
start: 2023-11-24 00:00:00
end: 2023-12-24 00:00:00
period: 4h
basePeriod: 15m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/

//@version=4
strategy("scalping low lag tema etal", shorttitle="Scalping tema",initial_capital=10000, overlay=true)
mav = input(title="Moving Average Type", defval="temadelay", options=["nkclose", "ema", "emadelay", "fastema", "tema", "temadelay"])
lenb = 3
N = input(8)
K = input(1.2)
fracCap = input(1.0)
in = close + K*mom(close,N)
source = close
length = 8
sigma  = 12.0
offset = 0.9
p = 4
// length = 10
// sigma  = 6.0
// offset = 0.85
tema(src,len) => fastemaOut = 2*ema(src, len) - ema(ema(src, len), len)


a = 0.0
b = 0.0
c = 0.0
if mav == "nkclose"
    a := ema(in, 12)
    b := a[1]
    c := a[2]
if mav == "ema"
    a := ema(close, 12)
    b := ema(close, 26)
    c := ema(close, 55)
if mav == "emadelay"
    a := ema(close, 12)
    b := a[1]
    c := a[2]
if mav == "fastema"
    a := ema(in, 12)
    b := ema(in, 26)
    c := ema(in, 55)
if mav == "tema"
    a := tema(close, 12)
    b := tema(close, 26)
    c := tema(close, 55)
if mav == "temadelay"
    a := tema(close, 12)
    b := a[1]
    c := a[2]

TP = input(200)
SL = input(130)
TS = input(1)
// TP = input(50)
// SL = input(110)
// TS = input(1)

orderSize = floor((fracCap * strategy.equity) / close)
long = cross(a, c) and a > b
short = cross(a, c) and a < b
plot(a, title="12", color=color.red, linewidth=1)
plot(b, title="26", color=color.blue, linewidth=1)
plot(c, title="55", color=color.green, linewidth=1)

strategy.entry("Long", strategy.long, qty=orderSize,  when=long)
strategy.entry("Short", strategy.short, qty=orderSize,  when=short)
// strategy.entry("Long", strategy.long,  100.0, when=long)
// strategy.entry("Short", strategy.short,  100.0, when=short)
// strategy.entry("Long", strategy.long, 100.0, when=long)
// strategy.entry("Short", strategy.short, 100.0, when=short)
// strategy.entry("Long", strategy.long, 1.0, when=long)
// strategy.entry("Short", strategy.short, 1.0, when=short)

TPP = (TP > 0) ? TP : na
SLP = (SL > 0) ? SL : na
TSP = (TS > 0) ? TS : na
// strategy.exit("Close Short", "Short", qty_percent=100, profit=TPP, loss=SLP, trail_points=TSP, when=long)
// strategy.exit("Close Long", "Long", qty_percent=100, profit=TPP, loss=SLP, trail_points=TSP, when=short)
// strategy.exit("Close Long", "Long", qty_percent=100, profit=TPP, loss=SLP, trail_points=TSP, when=long[1])
// strategy.exit("Close Short", "Short", qty_percent=100, profit=TPP, loss=SLP, trail_points=TSP, when=short[1])
strategy.exit("Close Long", "Long", qty_percent=100, profit=TPP, loss=SLP, trail_points=TSP)
strategy.exit("Close Short", "Short", qty_percent=100, profit=TPP, loss=SLP, trail_points=TSP)