피보나치 이동 평균 입력 전략

저자:차오장, 날짜: 2023-11-01 16:42:41
태그:

img

전반적인 설명

피보나치 이동 평균 입력 전략은 이동 평균 크로스 오버 또는 크로스 언더 신호를 기반으로 거래 신호를 생성합니다. 단기 이동 평균이 장기 이동 평균보다 높을 때 상승 황금 십자 신호가 생성됩니다. 단기 이동 평균이 장기 이동 평균보다 낮을 때 하향 사망 십자 신호가 생성됩니다. 일반적으로 사용되는 이동 평균은 50 일 및 200 일 이동 평균입니다.

피보나치 이동 평균 입력 (FibMAI) 전략은 상승 또는 하락 크로스 (bullish or bearish crosses) 를 위해 어떤 값을 선택할 수 있습니다. 시각 표시를 위해, 나는 촛불을 숨기는 동안 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, 610, 987을 포함한 피보나치 이동 평균을 그래프화했습니다. 그러나 이 지표를 사용하기 위해, 나는 단지 두 마리의 MA을 활성화하여 눈에 띄는 크로스오버 또는 크로스온더 패턴이 있는지 확인하고, 그 다음 그 값을 FibMAI 전략 긴 또는 짧은 설정 입력으로 백테스트합니다.

예를 들어, 이 NQ1! 일 차트의 긴 또는 짧은 설정 입력값은:

상승률 = FibEMA34 크로스오버 FibEMA144

하향 = FibEMA55 횡단선 FibSMA144

보시다시피, 4개의 다른 MA 값을 혼합하고 일치시킬 수 있습니다.

기본 색상 설정: 상승값 = 녹색 감소 값 = 빨간색

Visual FibMA 기본 설정: 피베마 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, 610, 987, 1597, 2584, 4181

Visual MA 기본 설정: SMA 50, 100, 150, 200

기본 길거나 짧은 설정: 상승률 = FibEMA34 크로스오버 FibEMA144

하향 = FibEMA55 횡단선 FibSMA144

원칙

이 전략의 핵심 논리는 트레이딩 신호를 생성하기 위해 두 이동 평균 사이의 크로스오버 신호를 기반으로 합니다.

이동 평균은 시장 추세를 분석하는 데 사용되는 기술적 지표입니다. 특정 기간 동안 평균 폐쇄 가격을 계산하고 시장 변동을 효과적으로 필터링 할 수 있습니다. 이동 평균은 두 가지 유형이 있습니다. 간단한 이동 평균 (SMA) 및 기하급수적인 이동 평균 (EMA).

SMA는 기간 동안의 폐쇄 가격의 간단한 수학적 평균이다. EMA는 최근 가격에 더 많은 무게를 부여하여 폐쇄 가격에 기하급수적인 평형을 적용합니다. EMA는 가격 변화에 더 빠르게 반응합니다.

단기 이동 평균이 장기 이동 평균을 넘을 때 상승 추세 변화를 신호하고 구매 신호를 생성합니다. 이것은 골든 크로스라고 불립니다. 반대로 단기 이동 평균이 장기 이동 평균을 넘을 때 하향 추세 변화를 신호하고 판매 신호를 생성합니다. 이것은 죽음 크로스라고 불립니다.

이 전략의 유연성은 4개의 이동 평균에 대한 매개 변수를 수동으로 설정할 수 있는 능력에 있다. 기본 매개 변수는 상승 신호의 경우 34기 EMA가 144기 EMA를 넘고, 하락 신호의 경우 55기 SMA가 144기 EMA를 넘고 있다. 이 매개 변수는 입력 상자에 자유롭게 조정할 수 있다.

또한, 전략은 다양한 시간 프레임에 걸쳐 여러 피보나치 시퀀스 이동 평균을 그래프화합니다. 50 일, 100 일, 150 일 및 200 일과 같은 일반적인 이동 평균도 그래프화됩니다. 이것들은 참조로 사용됩니다. 키는 긴 / 짧은 설정에 입력된 크로스오버 이동 평균입니다.

장점

이 이동 평균 크로스오버 전략의 장점은 다음과 같습니다.

  1. 이동 평균을 사용 하 여 시장 소음을 필터하고 트렌드 방향을 식별

  2. 크로스오버 신호 는 어느 정도 신뢰성 이 있다

  3. 매개 변수 최적화를 위해 사용자 정의 가능한 길고 짧은 이동 평균 조합

  4. 트렌드를 식별하기 위해 여러 시간 프레임을 포함합니다.

  5. 기기 특성에 따라 EMA와 SMA를 모두 사용할 수 있습니다.

  6. 화면적으로 직관적인 색상 이동 평균 십자

  7. 이해하기 쉽고 초보자에게 적합합니다.

  8. 유연성 있는 다양한 도구에 적용됩니다.

위험성

이 전략에는 몇 가지 위험도 있습니다.

  1. 불안 한 시장 에서 너무 많은 윙사 신호, 과잉 거래로 이어지는

  2. 부적절한 이동 평균 조합이 사용되면 잘못된 신호

  3. 극심한 트렌드 반전 시 신호의 지연, 시간에 따라 가격 변화를 반영 할 수 없습니다.

  4. 이동 평균 교차는 손실을 완전히 피할 수 없습니다, 합리적인 스톱 손실이 필요합니다

  5. 과도한 최적화로 인해 곡선 부착이 발생합니다. 매개 변수는 시장 주기에 걸쳐 견고해야 합니다.

  6. 다른 기기에 대한 매개 변수는 정밀 조정이 필요할 수 있습니다.

최적화 방향

이 전략을 최적화하는 몇 가지 방법:

  1. 백테스팅을 사용하여 최적의 매개 변수를 찾기 위해 다른 길고 짧은 이동 평균 조합을 테스트하십시오.

  2. 이동 평균 유형을 조정하고 SMA와 EMA 성과를 비교하십시오. 더 명확한 트렌드를 가진 도구에 대한 SMA와 더 변동적인 도구에 대한 EMA를 사용하십시오.

  3. 잘못된 신호를 필터링하고 품질을 향상시키는 KDJ, MACD와 같은 다른 지표를 통합

  4. 트레이닝 스톱 로스 같은 단일 트레이드에서 손실을 제어하기 위해 스톱 로스 전략을 추가하십시오.

  5. 적립에 따라 포지션 크기를 조정하는 것과 같은 자금 관리 전략을 최적화하십시오.

  6. 견고성을 평가하기 위해 다른 기기와 시간 프레임에 대한 테스트 매개 변수 안정성

결론

전체적으로, 피보나치 이동 평균 입력 전략은 신뢰할 수있는 트렌드 다음 시스템입니다. 그것은 무역 신호를 위해 간단하고 직관적인 이동 평균 교차를 사용하고, 매개 변수 최적화를 통해 다른 도구에 적응 할 수 있습니다. 적절한 스톱 손실 및 돈 관리로 위험을 제어 할 수 있습니다. 과잉 최적화 및 후진 트렌드 역전 신호는 피해야합니다. 잘 선택 된 매개 변수와 거래 규율로, 이것은 효율적이고 안정적인 수익 창출 전략이 될 수 있습니다.


/*backtest
start: 2022-10-25 00:00:00
end: 2023-10-31 00:00:00
period: 1d
basePeriod: 1h
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/

//@version=5
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © Options360 : Fibonacci MAI (Moving Averages Input) beta 10/15/22
// © Options360 original public release = 2/25/23
// * This script uses altered pieces of code from my @Options360 "Fibonacci MA7" indicator*
// 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, 610, 987, 1597, 2584, 4181, 6765, 10946, 17711, 28657, 46368, 75025, 121393, 196418, 317811
////
strategy(title="Fibonacci Moving Averages Input", shorttitle = "FibMAI", overlay=true)

src = input(ohlc4, 'source')
//
string  GRP = "Long or Short Settings"
exponential1 = input(true, title="long EMA or SMA", tooltip="EMA checked or SMA unchecked", group = GRP)
long = input.int(34, minval=1, title="long", tooltip="Signal Moving average long input")
long1 = exponential1 ? ta.ema(src, long) : ta.sma(src, long)

exponential2 = input(true, title="crossover EMA or SMA", tooltip="EMA checked or SMA unchecked")
longer = input.int(144, minval=1, title="crossover", tooltip="Crossed over Moving average long input")
long2 = exponential2 ? ta.ema(src, longer) : ta.sma(src, longer)

exponential3 = input(true, title="short EMA or SMA", tooltip="EMA checked or SMA unchecked")
short = input.int(55, minval=1, title="short", tooltip="Signal Moving average short input")
short1 = exponential3 ? ta.ema(src, short) : ta.sma(src, short)

exponential4 = input(false, title="crossunder EMA or SMA", tooltip="EMA checked or SMA unchecked")
shorter = input.int(144, minval=1, title="crossunder", tooltip="Crossed under Moving average short input")
short2 = exponential4 ? ta.ema(src, shorter) : ta.sma(src, shorter)
//
string  GRP2 = "Visual FibMA Settings"
exponential = input(true, title="Fib EMA or SMA", tooltip="EMA checked or SMA unchecked", group = GRP2)
//
smaplot11 = input (true, title="MA1")
len11 = input.int(1, minval=1, title="ma Length")
out11 = exponential ? ta.ema(src, len11) : ta.sma(src, len11)
up11 = out11 > out11[1]
down11 = out11 < out11[1]
mycolor11 = up11 ? #3cfe12 : down11 ? #ff0202 : #008eff
plot(out11 and smaplot11 ? out11 :na, title="1", color=mycolor11, linewidth=1)

smaplot18 = input (true, title="MA2")
len18 = input.int(2, minval=1, title="ma Length")
out18 = exponential ? ta.ema(src, len18) : ta.sma(src, len18)
up18 = out18 > out18[1]
down18 = out18 < out18[1]
mycolor18 = up18 ? #3cfe12 : down18 ? #ff0202 : #008eff
plot(out18 and smaplot18 ? out18 :na , title="2", color=mycolor18, linewidth=1)

smaplot13 = input (true, title="MA3")
len13 = input.int(3, minval=1, title="ma Length")
out13 = exponential ? ta.ema(src, len13) : ta.sma(src, len13)
up13 = out13 > out13[1]
down13 = out13 < out13[1]
mycolor13 = up13 ? #3cfe12 : down13 ? #ff0202 : #008eff
plot(out13 and smaplot13 ? out13 :na , title="3", color=mycolor11, linewidth=1)

smaplot9 = input (true, title="MA5")
len9 = input.int(5, minval=1, title="ma Length")
out9 = exponential ? ta.ema(src, len9) : ta.sma(src, len9)
up9 = out9 > out9[1]
down9 = out9 < out9[1]
mycolor9 = up9 ? #3cfe12 : down9 ? #ff0202 : #008eff
plot(out9 and smaplot9 ? out9 :na , title="5", color=mycolor9, linewidth=1)

smaplot8 = input (true, title="MA8")
len8 = input.int(8, minval=1, title="ma Length")
out8 = exponential ? ta.ema(src, len8) : ta.sma(src, len8)
up8 = out8 > out8[1]
down8 = out8 < out8[1]
mycolor8 = up8 ? #3cfe12 : down8 ? #ff0202 : #008eff
plot(out8 and smaplot8 ? out8 :na , title="8", color=mycolor8, linewidth=1)

smaplot7 = input (true, title="MA13")
len7 = input.int(13, minval=1, title="ma Length")
out7 = exponential ? ta.ema(src, len7) : ta.sma(src, len7)
up7 = out7 > out7[1]
down7 = out7 < out7[1]
mycolor7 = up7 ? #3cfe12 : down7 ? #ff0202 : #008eff
plot(out7 and smaplot7 ? out7 :na , title="13", color=mycolor7, linewidth=1)

smaplot = input (true, title="MA21")
len = input.int(21, minval=1, title="ma Length")
out = exponential ? ta.ema(src, len) : ta.sma(src, len)
up = out > out[1]
down = out < out[1]
mycolor = up ? #3cfe12 : down ? #ff0202 : #008eff
plot(out and smaplot ? out :na, title="21", color=mycolor, linewidth=1)

smaplot2 = input (true, title="MA34")
len2 = input.int(34, minval=1, title="ma Length")
out2 = exponential ? ta.ema(src, len2) : ta.sma(src, len2)
up2 = out2 > out2[1]
down2 = out2 < out2[1]
mycolor2 = up2 ? #3cfe12 : down2 ? #ff0202 : #008eff
plot(out2 and smaplot2 ? out2 :na , title="34", color=mycolor2, linewidth=1)

smaplot3 = input (true, title="MA55")
len3 = input.int(55, minval=1, title="ma Length")
out3 = exponential ? ta.ema(src, len3) : ta.sma(src, len3)
up3 = out3 > out3[1]
down3 = out3 < out3[1]
mycolor3 = up3 ? #3cfe12 : down3 ? #ff0202 : #008eff
plot(out3 and smaplot3 ? out3 :na, title="55", color=mycolor3, linewidth=1)

smaplot4 = input (true, title="MA89")
len4 = input.int(89, minval=1, title="ma Length")
out4 = exponential ? ta.ema(src, len4) : ta.sma(src, len4)
up4 = out4 > out4[1]
down4 = out4 < out4[1]
mycolor4 = up4 ? #3cfe12 : down4 ? #ff0202 : #008eff
plot(out4 and smaplot4 ? out4 :na , title="89", color=mycolor4, linewidth=1)

smaplot5 = input (true, title="MA144")
len5 = input.int(144, minval=1, title="ma Length")
out5 = exponential ? ta.ema(src, len5) : ta.sma(src, len5)
up5 = out5 > out5[1]
down5 = out5 < out5[1]
mycolor5 = up5 ? #3cfe12 : down5 ? #ff0202 : #008eff
plot(out5 and smaplot5 ? out5 :na, title="144", color=mycolor5, linewidth=1)

smaplot6 = input (true, title="MA233")
len6 = input.int(233, minval=1, title="ma Length")
out6 = exponential ? ta.ema(src, len6) : ta.sma(src, len6)
up6 = out6 > out6[1]
down6 = out6 < out6[1]
mycolor6 = up6 ? #3cfe12 : down6 ? #ff0202 : #008eff
plot(out6 and smaplot6 ? out6 :na , title="233", color=mycolor6, linewidth=1)

smaplot10 = input (true, title="MA377")
len10 = input.int(377, minval=1, title="ma Length")
out10 = exponential ? ta.ema(src, len10) : ta.sma(src, len10)
up10 = out10 > out10[1]
down10 = out10 < out10[1]
mycolor10 = up10 ? #3cfe12 : down10 ? #ff0202 : #008eff
plot(out10 and smaplot10 ? out10 :na , title="377", color=mycolor10, linewidth=1)

smaplot14 = input (true, title="MA610")
len14 = input.int(610, minval=1, title="ma Length")
out14 = exponential ? ta.ema(src, len14) : ta.sma(src, len14)
up14 = out14 > out14[1]
down14 = out14 < out14[1]
mycolor14 = up14 ? #3cfe12 : down14 ? #ff0202 : #008eff
plot(out14 and smaplot14 ? out14 :na , title="610", color=mycolor14, linewidth=1)

smaplot15 = input (true, title="MA987")
len15 = input.int(987, minval=1, title="ma Length")
out15 = exponential ? ta.ema(src, len15) : ta.sma(src, len15)
up15 = out15 > out15[1]
down15 = out15 < out15[1]
mycolor15 = up15 ? #3cfe12 : down15 ? #ff0202 : #008eff
plot(out15 and smaplot15 ? out15 :na , title="987", color=mycolor15, linewidth=1)

smaplot16 = input (true, title="MA1597")
len16 = input.int(1597, minval=1, title="ma Length")
out16 = exponential ? ta.ema(src, len16) : ta.sma(src, len16)
up16 = out16 > out16[1]
down16 = out16 < out16[1]
mycolor16 = up16 ? #3cfe12 : down16 ? #ff0202 : #008eff
plot(out16 and smaplot16 ? out16 :na , title="1597", color=mycolor16, linewidth=1)

smaplot17 = input (true, title="MA2584")
len17 = input.int(2584, minval=1, title="ma Length")
out17 = exponential ? ta.ema(src, len17) : ta.sma(src, len17)
up17 = out17 > out17[1]
down17 = out17 < out17[1]
mycolor17 = up17 ? #3cfe12 : down17 ? #ff0202 : #008eff
plot(out17 and smaplot17 ? out17 :na , title="2584", color=mycolor17, linewidth=1)

smaplot19 = input (true, title="MA4181")
len19 = input.int(4181, minval=1, title="ma Length")
out19 = exponential ? ta.ema(src, len19) : ta.sma(src, len19)
up19 = out19 > out19[1]
down19 = out19 < out19[1]
mycolor19 = up19 ? #3cfe12 : down19 ? #ff0202 : #008eff
plot(out19 and smaplot19 ? out19 :na , title="4181", color=mycolor19, linewidth=1)
//
string  GRP3 = "Visual MA Settings"
exponential5 = input(false, title="EMA or SMA", tooltip="EMA checked or SMA unchecked", group = GRP3)

smaplot50 = input (true, title="MA50")
len50 = input.int(50, minval=1, title="ma Length")
ma50 = exponential5 ? ta.ema(src, len50) : ta.sma(src, len50)
up50 = ma50 > ma50[1]
down50 = ma50 < ma50[1]
mycolor50 = up50 ? #3cfe12 : down50 ? #ff0202 : #008eff
plot(ma50 and smaplot50 ? ma50 :na , title="50", color=mycolor50, linewidth=1)

smaplot100 = input (true, title="MA100")
len100 = input.int(100, minval=1, title="ma Length")
ma100 = exponential5 ? ta.ema(src, len100) : ta.sma(src, len100)
up100 = ma100 > ma100[1]
down100 = ma100 < ma100[1]
mycolor100 = up100 ? #3cfe12 : down100 ? #ff0202 : #008eff
plot(ma100 and smaplot100 ? ma100 :na , title="100", color=mycolor100, linewidth=1)

smaplot150 = input (true, title="MA150")
len150 = input.int(150, minval=1, title="ma Length")
ma150 = exponential5 ? ta.ema(src, len150) : ta.sma(src, len150)
up150 = ma150 > ma150[1]
down150 = ma150 < ma150[1]
mycolor150 = up150 ? #3cfe12 : down150 ? #ff0202 : #008eff
plot(ma150 and smaplot150 ? ma150 :na , title="150", color=mycolor150, linewidth=1)

smaplot200 = input (true, title="MA200")
len200 = input.int(200, minval=1, title="ma Length")
ma200 = exponential5 ? ta.ema(src, len200) : ta.sma(src, len200)
up200 = ma200 > ma200[1]
down200 = ma200 < ma200[1]
mycolor200 = up200 ? #3cfe12 : down200 ? #ff0202 : #008eff
plot(ma200 and smaplot200 ? ma200 :na , title="200", color=mycolor200, linewidth=1)
//
if (ta.crossover(long1, long2))
	strategy.entry("maL", strategy.long, comment="maLong")
if (ta.crossunder(short1, short2))
	strategy.entry("maS", strategy.short, comment="maShort")
////

더 많은