이동 평균 AO 지표 거래 전략

저자:차오장, 날짜: 2023-09-12 16:09:01
태그:

이 전략은 이동 평균과 AO 오시레이터를 결합하여 트렌드 및 무역 인하를 식별합니다. 그것은 가격 변동의 단기 반전을 포착하는 것을 목표로합니다.

전략 논리:

  1. 이동 평균 시스템을 만들기 위해 빠른 EMA와 느린 SMA를 계산합니다.

  2. 빠른 AO선과 느린 AO선과 그 사이의 차이를 계산합니다.

  3. 빠른 MA가 느린 MA를 넘어서면 긴, 가까운 것이 느린 MA를 넘어서면 AO가 상승합니다.

  4. 빠른 MA가 느린 MA보다 낮을 때 단축하고, 닫는 것은 느린 MA보다 낮고 AO는 떨어집니다.

  5. AO는 잘못된 신호를 피하기 위해 차이를 비교합니다.

장점:

  1. MA는 주요 트렌드를 결정하고 AO는 반전을 결정합니다.

  2. AO 차이점은 잘못된 신호를 필터링합니다.

  3. 지표를 조합하면 정확도가 높아집니다.

위험성:

  1. MA와 AO를 시장 조건에 맞추기 위해 필요한 조정.

  2. MA와 AO 모두 뒤떨어져서 최고의 항목을 놓치고 있습니다.

  3. 다양한 시장에서 멈출 수 있는 것이 어렵고 손실 위험이 증가합니다.

요약하자면, 이 전략은 거래에 MA와 AO의 강점을 결합합니다. 이것은 어느 정도 신호 품질을 향상시킬 수 있지만 안정적인 수익을 위해 위험을 관리하기 위해 적절한 정지점이 여전히 필요합니다.


/*backtest
start: 2023-09-04 00:00:00
end: 2023-09-11 00:00:00
period: 30m
basePeriod: 15m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/

//@version=4
strategy("MA&AO", overlay = true, default_qty_type=strategy.percent_of_equity, default_qty_value=100, commission_type=strategy.commission.percent, commission_value=0.075, currency='USD')
startP = timestamp(input(2017, "Start Year"), input(12, "Month"), input(17, "Day"), 0, 0)
end   = timestamp(input(9999, "End Year"),   input(1, "Month"),   input(1, "Day"),   0, 0)
_testPeriod() =>
    true

//Inputs
fast_ma = input(8, title="Fast EMA", minval=2)
slow_ma = input(20, minval=1, title="Slow SMA")
AO_fast = input(5, minval=1, title="Awesome Length Fast")
AO_slow = input(8, minval=1, title="Awesome Length Slow")

//MA
fast  = ema(close, fast_ma)
slow =  sma(close, slow_ma)

//AO
AO_1 = sma(hl2, AO_fast)
AO_2 = sma(hl2, AO_slow)
dif = AO_1 - AO_2
AO = dif>=0? dif > dif[1] ? 1 : 2 : dif > dif[1] ? -1 : -2

long   =  crossover(fast, slow) and close > slow and abs(AO)==1
short =   fast < slow and close < slow and abs(AO)==2

long_condition =  long and _testPeriod() 
strategy.entry('BUY', strategy.long, when=long_condition)  
 
short_condition = short 
strategy.close('BUY', when=short_condition)


plot(fast, color=color.green)
plot(slow, color=color.red)

더 많은