
이 전략은 다중 시간 주기의 동적 이동 평균 조합 전략이다. 그것은 다양한 길이의 지수 이동 평균 ((EMA) 을 사용하여 트렌드 판단과 입출구를 한다. 전략 이름의 MAX은 여러 개의 EMA가 사용되고, 동적 은 EMA 길이가 조정될 수 있음을 의미한다.
이 전략은 7개의 다른 속도의 EMA를 사용하며, 가장 빠른 것부터 가장 느린 것까지 각각 3주기, 15주기, 19주기, 50주기, 100주기, 150주기 및 200주기 EMA를 사용한다. 이 7개의 EMA는 계단 모양의 배열을 형성하며, 긴 포지션과 짧은 포지션 신호를 판단할 때, 클로즈 가격은 7개의 EMA를 차례로 뚫고 나가야 하며, 이렇게하면 트렌드 전환 후의 강도가 들어간다.
또한, 전략은 가격 혁신 높은 가격과 종결 가격의 역사적인 최고점을 깨는 두 가지 조건을 결합하여 장점 신호를 확인하고, 혁신 낮은 가격과 종결 가격의 역사적인 낮은 곳을 깨는 짧은 위치 신호를 확인하여 가짜 돌파구를 피할 수 있습니다.
평점 조건은 클로즈 가격이 급속한 EMA에서 느린 EMA로 번갈아가며 트렌드를 역전시키는 것을 요구합니다. 또는 최신 K 선의 최저 가격 또는 최고 가격은 4 개의 EMA를 뚫고 거래가 즉시 평점해야한다는 것을 나타냅니다.
해결책:
이 전략의 전체적인 생각은 명확하고, 7개의 다른 속도 EMA를 사용하여 추세를 판단하고, 이중 평점 조건이 있어 추세 반전에 대해 더 민감한 판단을 할 수 있다. 그러나 전략 자체는 중지 손실을 설정하지 않으며, 손실의 위험이 매우 높으며, 또한 조기 퇴출 문제를 일으킬 수 있다. 미래에는 중지 손실, 매개 변수 최적화, 지표 필터링과 같은 여러 차원의 전략 개선이 필요합니다.
/*backtest
start: 2023-12-01 00:00:00
end: 2023-12-31 23:59:59
period: 1h
basePeriod: 15m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=4
strategy(title="Crypto MAX Trend", shorttitle="Crypto MAX", overlay = true )
Length = input(3, minval=1)
Length2 = input(15, minval=1)
Length3 = input(19, minval=1)
//Length33 = input(25, minval=1)
Length4 = input(50, minval=1)
Length44 = input(100, minval=1)
Length5 = input(150, minval=1)
Length6 = input(171, minval=1)
Length66 = input(172, minval=1)
xPrice = input(close)
xEMA1 = ema(xPrice, Length)
xEMA2 = ema(xPrice, Length2)
xEMA3 = ema(xPrice, Length3)
//xEMA33 = ema(xPrice, Length33)
xEMA4 = ema(xPrice, Length4)
xEMA44 = ema(xPrice, Length44)
xEMA5 = ema(xPrice, Length5)
xEMA6 = ema(xPrice, Length6)
xEMA66 = ema(xPrice, Length66)
// plot(xEMA1, color=color.white)
// plot(xEMA2, color=color.red)
// plot(xEMA3, color=color.green)
// plot(xEMA4, color=color.purple)
// plot(xEMA44, color=color.gray)
// plot(xEMA5, color=color.maroon)
// plot(xEMA6, color=color.blue)
// plot(xEMA66, color=color.orange)
fromDay = input(defval = 1, title = "From Day", minval = 1, maxval = 31)
fromMonth = input(defval = 1, title = "From Month", minval = 1, maxval = 12)
fromYear = input(defval = 2000, title = "From Year", minval = 1970)
//monday and session
// To Date Inputs
toDay = input(defval = 31, title = "To Day", minval = 1, maxval = 31)
toMonth = input(defval = 12, title = "To Month", minval = 1, maxval = 12)
toYear = input(defval = 2020, title = "To Year", minval = 1970)
startDate = timestamp(fromYear, fromMonth, fromDay, 00, 00)
finishDate = timestamp(toYear, toMonth, toDay, 00, 00)
time_cond = true
long = close > xEMA1 and xEMA1 > xEMA2 and xEMA2 > xEMA3 and xEMA3 > xEMA4 and xEMA4 > xEMA44 and xEMA44 > xEMA5 and xEMA5> xEMA6 and xEMA6> xEMA66 and close > high[1] and high[1] > high[2] and close > high[3] and close > high[4] and close > high[5] and high[5] > high[6] and time_cond
short = close < xEMA1 and xEMA1 < xEMA2 and xEMA2 < xEMA3 and xEMA3 < xEMA4 and xEMA4 < xEMA44 and xEMA44 < xEMA5 and xEMA5< xEMA6 and xEMA6< xEMA66 and close < low[1] and low[1] < low[2] and close < low[3] and close < low[4] and close< low[5] and low[5] < low[6] and time_cond
notlong = close < xEMA1
strategy.entry("long",1,when=long)
strategy.entry("short",0,when=short)
exitlong1 = xEMA1 < xEMA2 and xEMA2 < xEMA3 and xEMA3 < xEMA4
exitlong2 = crossunder(low,xEMA1) and crossunder(low,xEMA2) and crossunder(low,xEMA3) and crossunder(low,xEMA4)
exitshort1 = xEMA1 > xEMA2 and xEMA2 > xEMA3 and xEMA3 > xEMA4
exitshort2 = crossover(high,xEMA1) and crossover(high,xEMA2) and crossover(high,xEMA3) and crossover(high,xEMA4)
strategy.close("long", when = exitlong1 or exitlong2)
strategy.close("short", when= exitshort1 or exitshort2)