노로의 트렌드 이동 평균 전략의 극단적인 버전

저자:차오장, 날짜: 2024-01-31 17:00:53
태그:

img

전반적인 설명

이 전략은 트렌드 방향과 긴/단기 기회를 식별하기 위해 두 개의 이동 평균 지표를 사용합니다. 느린 이동 평균 (푸른 선) 은 전체 트렌드 방향을 결정하는 데 사용되며, 더 빠른 이동 평균 (붉은 선) 은 가격 채널과 결합하여 거래 기회를 발견하는 데 사용됩니다.

전략 논리

  1. 두 개의 이동 평균을 계산합니다. 전반적인 추세를 결정하기 위해 기간 21의 느린 MA와 거래 기회를 찾기 위해 가격 채널과 결합하는 기간 5의 더 빠른 MA.

  2. 현재 가격이 이전 기간에 형성 된 가격 채널을 통과하는지 확인하십시오. 브레이크업은 잠재적 인 거래 기회를 신호합니다.

  3. 최근 촛불의 수와 방향을 계산하십시오. 예를 들어, 여러 개의 연속적인 하락 촛불은 긴 기회를 신호할 수 있으며, 연속적인 상승 촛불은 짧은 기회를 신호할 수 있습니다. 촛불의 수는 Bars 매개 변수를 통해 구성됩니다.

  4. 위의 모든 요소를 결합하여 긴 / 짧은 신호를 생성합니다. 가격이 느린 MA 트렌드 방향과 일치 할 때 신호가 발생하며 빠른 MA 또는 가격 채널이 신호를 생성하고 촛불 움직임이 조건과 일치합니다.

장점

  1. 이중 이동 평균 시스템은 트렌드 방향을 효과적으로 추적합니다.

  2. 더 빠른 MA와 가격 채널이 결합되면 거래 기회를 잡기 위해 초기 브레이크아웃 포인트를 감지합니다.

  3. 또한 촛불의 방향과 계산을 고려하여 시장 전환에 걸리지 않도록 합니다.

  4. 사용자 정의 가능한 MA 매개 변수는 다른 제품과 시간 프레임에 적합합니다.

위험 및 완화

  1. 이중 MAs는 옆 시장에서 잘못된 신호를 생성 할 수 있습니다. 불안한 시장 거래를 피하기 위해 오시레이터 또는 ATR을 추가 할 수 있습니다.

  2. 시장의 특별한 움직임에 걸려있을 위험이 있습니다.

  3. 완전히 역전을 피할 수 없습니다. 더 강력한 전략을 만들기 위해 논리와 매개 변수를 계속 개선합니다.

더 나은 기회

  1. ADX, MACD와 같은 지원 지표를 추가하여 불안정한 시장에서 잘못된 거래를 피합니다.

  2. 동적 스톱 로스 계산, 예를 들어 ATR 및 리스크 우선 순위에 기초한 계산

  3. 기계 학습을 통한 매개 변수 최적화

  4. 기기 특성에 기반한 미세 조정 매개 변수, 예를 들어 암호화폐의 짧은 기간.

결론

전체적으로 이 전략은 트렌딩 시장을 추적하는 데 매우 잘 작동하며 추가적인 브레이크아웃 기회를 제공합니다. 적절한 개선으로 상업적으로 실행 가능한 고품질 양 전략으로 만들 수 있습니다. 우리는 더 많은 시장을 안정적으로 거래하도록 계속 개선 할 것입니다.


/*backtest
start: 2023-12-31 00:00:00
end: 2024-01-30 00:00:00
period: 1h
basePeriod: 15m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/

//@version=2
strategy(title = "Noro's Trend MAs Strategy v1.9 Extreme", shorttitle = "Trend MAs str 1.9 extreme", overlay=true, default_qty_type = strategy.percent_of_equity, default_qty_value=100.0, pyramiding=0)

//Settings
needlong = input(true, "long")
needshort = input(true, "short")
needstops = input(false, "stops")
stoppercent = input(5, defval = 5, minval = 1, maxval = 50, title = "Stop, %")
useohlc4 = input(false, defval = false, title = "Use OHLC4")
usefastsma = input(true, "Use fast MA Filter")
fastlen = input(5, defval = 5, minval = 1, maxval = 50, title = "fast MA Period")
slowlen = input(21, defval = 20, minval = 2, maxval = 200, title = "slow MA Period")
bars = input(2, defval = 2, minval = 0, maxval = 3, title = "Bars Q")
needbg = input(false, defval = false, title = "Need trend Background?")
needarr = input(false, defval = false, title = "Need entry arrows?")
needex = input(true, defval = true, title = "Need extreme? (crypto/fiat only!!!)")

src = useohlc4 == true ? ohlc4 : close

//PriceChannel 1
lasthigh = highest(src, slowlen)
lastlow = lowest(src, slowlen)
center = (lasthigh + lastlow) / 2

//PriceChannel 2
lasthigh2 = highest(src, fastlen)
lastlow2 = lowest(src, fastlen)
center2 = (lasthigh2 + lastlow2) / 2

//Trend
trend = low > center and low[1] > center[1] ? 1 : high < center and high[1] < center[1] ? -1 : trend[1]

//Bars
bar = close > open ? 1 : close < open ? -1 : 0
redbars = bars == 0 ? 1 : bars == 1 and bar == -1 ? 1 : bars == 2 and bar == -1 and bar[1] == -1 ? 1 : bars == 3 and bar == -1 and bar[1] == -1 and bar[2] == -1 ? 1 : 0
greenbars = bars == 0 ? 1 : bars == 1 and bar == 1 ? 1 : bars == 2 and bar == 1 and bar[1] == 1 ? 1 : bars == 3 and bar == 1 and bar[1] == 1 and bar[2] == 1 ? 1 : 0

//Signals
up = trend == 1 and (low < center2 or usefastsma == false) and (redbars == 1) ? 1 : 0
dn = trend == -1 and (high > center2 or usefastsma == false) and (greenbars == 1) ? 1 : 0

up2 = high < center and high < center2 and bar == -1 ? 1 : 0
dn2 = low > center and low > center2 and bar == 1 ? 0 : 0

//Lines
plot(center, color = blue, linewidth = 3, transp = 0, title = "Slow MA")
plot(center2, color = red, linewidth = 3, transp = 0, title = "PriceChannel 2")

//Arrows
plotarrow(up == 1 and needarr == true ? 1 : 0, colorup = black, colordown = black, transp = 0)
plotarrow(dn == 1 and needarr == true ? -1 : 0, colorup = black, colordown = black, transp = 0)

//Background
col = needbg == false ? na : trend == 1 ? lime : red
bgcolor(col, transp = 90)

//Alerts
alertcondition(up == 1, title='buy', message='Uptrend')
alertcondition(dn == 1, title='sell', message='Downtrend')

//Trading
stoplong = up == 1 and needstops == true ? close - (close / 100 * stoppercent) : stoplong[1]
stopshort = dn == 1 and needstops == true ? close + (close / 100 * stoppercent) : stopshort[1]

longCondition = up == 1 or (up2 == 1 and needex == true)
if (longCondition)
    strategy.entry("Long", strategy.long, needlong == false ? 0 : na)
    strategy.exit("Stop Long", "Long", stop = stoplong)

shortCondition = dn == 1
if (shortCondition)
    strategy.entry("Short", strategy.short, needshort == false ? 0 : na)
    strategy.exit("Stop Short", "Short", stop = stopshort)

더 많은