
회귀 회귀 왕 전략은 평균선, MACD, RSI, ADX 등의 지표들을 이용한 트렌드 회귀를 해 회귀 단계에 진입하는 전략이다. 이 전략은 특히 급진적인 왕을 대상으로 하여, 그 흔한 회귀 특성을 이용한 회귀 작전을 한다.
이 전략은 전체적인 트렌드 방향을 판단하기 위해 EMA 평선을 사용하며, 트렌드 강점의 약점을 구성한다. 가격이 강점의 영역에서 약점의 영역으로 돌아갔을 때, 전략은 트렌드 반전의 기회가 있다고 판단한다.
오류를 필터링하기 위해, 전략은 MACD 지표를 추가하여 단기 반전 신호를 판단한다. MACD의 절대 값이 일정 규모보다 크면 반전 기회가 증가한다고 간주한다. 동시에, ADX 값이 특정 수준보다 높을 것을 요구하여 현재 추세 시장에 있고 시중이 평형되지 않도록 한다.
마지막으로, RSI 지표의 역할은 오버 바이 영역을 구입하는 것을 피하고, 오버 판매 영역을 판매하는 것입니다. RSI 값이 특정 범위 내에서 제한되면 신호가 발생합니다.
매번 EMA 평균선이 교차할 때, 전략 거래의 수는 0이다. 또한 매번 교차하는 거래의 최대 수를 설정할 수 있으며, 반복되는 거래를 피한다.
조건이 충족될 때, 스톱로스/스톱스 비율에 따라 위탁을 설정하고, 반전 거래를 한다.
이 전략의 가장 큰 장점은 EMA가 구축한 강약 영역을 활용하여 급진적 ?? 왕의 철수 특성을 포착하는 것이다. 여러 지표가 사용되어 오차를 필터링하여 신뢰도가 높다.
단 하나의 충격 지표에 비해, 이 전략은 트렌드 판단을 더하여 불필요한 반전을 줄일 수 있다. 동시에 매 EMA 교차하는 거래의 최대 수를 제어하여 반복적인 거래가 큰 손실을 초래하는 것을 피할 수 있다.
이 전략의 가장 큰 위험은 왕이 후퇴하지 않는 상황이다. 왕이 직접 EMA를 뚫고 계속 상승하거나 하락하면 이 전략은 잘못된 신호를 발생시키고 상장한다. 이 때 손실을 통제하기 위해 손해를 중지해야 한다.
또한, 지표 매개 변수가 합리적이지 않으면 신호 품질이 떨어질 수 있다. 여러 가지 시장 상황에 적합한 최적화 매개 변수를 반복적으로 테스트해야 한다.
마지막으로, 너무 큰 스톱 스탠드를 설정하거나, 반전 후 급진적인 흔들림을 계속하는 것은 단독 손실을 확대할 수 있다. 이것은 합리적인 스톱 스탠드를 필요로 하며, 위험 관리를 강화해야 한다.
이 전략은 다음과 같은 측면에서 최적화될 수 있습니다.
다양한 시장과 매개 변수를 테스트하여 EMA가 트렌드를 더 정확하게 판단할 수 있도록 한다.
MACD 파라미터를 최적화하여 회전 신호를 더 정확하고 신뢰할 수 있게 한다.
RSI의 변수 범위를 조정하여 과격한 과매매 영역을 피하십시오.
단편적 손실을 줄이기 위해 스톱 스톱 비율을 최적화하십시오.
회전왕 전략은 적극적인 회전왕의 회전 특성을 위해 회전 조작을 할 수 있으며, 단기 회전 기회를 효과적으로 잡을 수 있습니다. 그것은 EMA의 여러 필터를 사용하여 트렌드 방향과 강점을 판단하고 MACD, RSI와 같은 지표를 사용하여 진입을 확인하고, 신뢰성이 높습니다. 매개 변수 테스트 및 최적화를 통해 다양한 시장 환경에 적응할 수 있으며, 매우 실용적인 트렌드 회전 전략입니다.
/*backtest
start: 2023-09-16 00:00:00
end: 2023-10-16 00:00:00
period: 3h
basePeriod: 15m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © npietronuto1
//@version=5
strategy("Hulk Scalper x35 Leverage", shorttitle = "Smash Pullback Strat", overlay=true, initial_capital=100, default_qty_type=strategy.percent_of_equity, default_qty_value=100)
//------------------------------------------------------------------------------------------------------------------------------------------------------------------------
//RSI
rsiLength = input.int(20)
RsiTopInput = input.int(2)
RsiBotInput = input.int(-2)
// toprsiLine = hline(RsiTopInput, title = "Rsi Top Line", linestyle = hline.style_solid)
// botrsiLine = hline(RsiBotInput, title = "Rsi Bottom Line", linestyle = hline.style_solid)
rsi = ta.rsi(close, rsiLength)
rsiWeighted = rsi - 50 //Zeros Rsi to look nicer
//------------------------------------------------------------------------------------------------------------------------------------------------------------------------
//------------------------------------------------------------------------------------------------------------------------------------------------------------------------
adxlen = input(14, title="ADX Smoothing")
dilen = input(14, title="DI Length")
dirmov(len) =>
up = ta.change(high)
down = -ta.change(low)
plusDM = na(up) ? na : (up > down and up > 0 ? up : 0)
minusDM = na(down) ? na : (down > up and down > 0 ? down : 0)
truerange = ta.rma(ta.tr, len)
plus = fixnan(100 * ta.rma(plusDM, len) / truerange)
minus = fixnan(100 * ta.rma(minusDM, len) / truerange)
[plus, minus]
adx(dilen, adxlen) =>
[plus, minus] = dirmov(dilen)
sum = plus + minus
adx = 100 * ta.rma(math.abs(plus - minus) / (sum == 0 ? 1 : sum), adxlen)
sig = adx(dilen, adxlen)
ADXfilterlevel = input.int(33, title = "ADX filter amount")
// plot(sig, color=color.red, title="ADX")
//------------------------------------------------------------------------------------------------------------------------------------------------------------------------
//------------------------------------------------------------------------------------------------------------------------------------------------------------------------
//MACD
FastMacdLength = input.int(12, group = "MACD")
SlowMacdLength = input.int(26, group = "MACD")
SignalLength = input.int(11, group = "MACD")
MacdTickAmountNeeded = input.float(5.45, title = "Tick Amount for entry", group = "MACD")
res = input.timeframe("1", group = "MACD")
// bullishgrow_col = input.color(defval = #3179f5)
// bullishweaken_col = input.color(defval = #00e1ff)
// bearishweaken_col = input.color(defval = #ff01f1)
// bearishgrow_col = input.color(defval = #9d00e5)
[FastMacd, SlowMacd, Macdhist] = ta.macd(close, FastMacdLength, SlowMacdLength, SignalLength)
//Pull MACD from Lower timeframe
MACD = request.security(syminfo.tickerid, res, Macdhist, gaps = barmerge.gaps_on)
//Grow and Fall Color
// getgrow_fall_col(Value) =>
// if Value >= 0
// if Value >= Value[1]
// color.new(bullishgrow_col, transp = 10)
// else if Value <= Value[1]
// color.new(bullishweaken_col, transp = 10)
// else if Value <= 0
// if Value <= Value[1]
// color.new(bearishgrow_col, transp = 10)
// else if Value >= Value[1]
// color.new(bearishweaken_col, transp = 10)
//CONDITIONS that check if MACD is overbought or oversold
MACDisAboveBand = MACD > MacdTickAmountNeeded
MACDisBelowBand = MACD < MacdTickAmountNeeded*-1
//Plot
// plot(MACD, style = plot.style_columns, color = getgrow_fall_col(MACD))
//------------------------------------------------------------------------------------------------------------------------------------------------------------------------
//------------------------------------------------------------------------------------------------------------------------------------------------------------------------
//EMAs
//Inputs
EmaFastLength = input.int(50, title = "Ema Fast Length")
EmaSlowLength = input.int(200, title = "Ema Slow Length")
StrongUpTrendCol = input.color(color.rgb(74, 255, 163))
//WeakUptrend = input.color(color.rgb(74, 255, 163, 50))
StrongDownTrendCol = input.color(color.rgb(255, 71, 84))
//WeakDownTrend = input.color(color.rgb(255, 71, 84, 50))
//Calculations
emaFast= ta.ema(close, EmaFastLength)
emaSlow= ta.ema(close, EmaSlowLength)
emaDist=emaFast-emaSlow
EmaLengthFraction = emaDist/4
emafrac5 = emaSlow + EmaLengthFraction
emafrac4 = emaSlow + EmaLengthFraction*2
emafrac3 = emaSlow + EmaLengthFraction*3
emafrac2 = emaSlow + EmaLengthFraction*4
UptrendCol_DowntrendCol= emaFast>=emaSlow ? StrongUpTrendCol:StrongDownTrendCol
//Plot
ema1p = plot(emaFast, color = color.new(#000000, transp = 100))
ema2p = plot(emafrac2, color = color.new(#000000, transp = 100))
ema3p = plot(emafrac3, color = color.new(#000000, transp = 100))
ema4p = plot(emafrac4, color = color.new(#000000, transp = 100))
ema5p = plot(emafrac5, color = color.new(#000000, transp = 100))
ema6p = plot(emaSlow, color = color.new(#000000, transp = 100))
fill(ema2p,ema3p, color = color.new(UptrendCol_DowntrendCol, 70))
fill(ema3p,ema4p, color = color.new(UptrendCol_DowntrendCol, 60))
fill(ema4p,ema5p, color = color.new(UptrendCol_DowntrendCol, 50))
fill(ema5p,ema6p, color = color.new(UptrendCol_DowntrendCol, 40))
//Conditons
FastEma_above_SlowEma = emaFast > emaSlow
FastEma_below_SlowEma = emaFast < emaSlow
emaCrossEvent = ta.crossover(emaFast, emaSlow) or ta.crossover(emaSlow, emaFast)
//------------------------------------------------------------------------------------------------------------------------------------------------------------------------
//------------------------------------------------------------------------------------------------------------------------------------------------------------------------
//Trade Cap per EMA X
//Inputs
MaxTrades_PerCross_Checkbox = input.bool(true, "Limit Trades Per Cross", group = "Filters")
TrdCount = 0//Variable that keeps current trade count
if(TrdCount[1] > 0)//Passes variable on to current candle
TrdCount := TrdCount[1]
//Reset trade count if EMAs X
emaXevent = ta.crossover(emaFast, emaSlow) or ta.crossover(emaSlow, emaFast) // Check for EMA cross
if(emaXevent)
TrdCount := 0
//Conditions
MaxTrades = input.int(6)
IsMaxTrades_BelowCap = TrdCount[1] < MaxTrades //Condition that applies max trade count
if(not MaxTrades_PerCross_Checkbox)
IsMaxTrades_BelowCap := true
//------------------------------------------------------------------------------------------------------------------------------------------------------------------------
//------------------------------------------------------------------------------------------------------------------------------------------------------------------------
//STRATEGY LOGIC
//Parameters
TakeProfitInput = input.float(0.0135, title = "Take Profit %", group = "TP/SL")
StopLossInput = input.float(0.011, title = "Stop Loss %", group = "TP/SL")
//TP/SL calculations
Long_takeProfit = close * (1 + TakeProfitInput)
Long_stopLoss = close * (1 - StopLossInput)
Short_takeProfit = close * (1 - TakeProfitInput)
Short_stopLoss = close * (1 + StopLossInput)
//LONG and Short
LongConditionPt1 = close > emaSlow and MACDisBelowBand and sig > ADXfilterlevel
LongConditionPt2 = FastEma_above_SlowEma and IsMaxTrades_BelowCap and strategy.position_size == 0
//Checks if Rsi Inbetween Lines
LongConditionPt3 = rsiWeighted < RsiTopInput and rsiWeighted > RsiBotInput
ShortConditionPt1 = close < emaSlow and MACDisAboveBand and sig > ADXfilterlevel
ShortConditionPt2 = FastEma_below_SlowEma and IsMaxTrades_BelowCap and strategy.position_size == 0
//Checks if Rsi Inbetween Lines
ShortConditionPt3 = rsiWeighted < RsiTopInput and rsiWeighted > RsiBotInput
// longCondition = FastEma_above_SlowEma and MACDisBelowBand and IsMaxTrades_BelowCap and rsiWeighted < RsiTopInput and strategy.position_size == 0
longCondition = LongConditionPt1 and LongConditionPt2 and LongConditionPt3
if(longCondition)
strategy.entry("long", strategy.long)
strategy.exit("exit", "long", limit = Long_takeProfit, stop = Long_stopLoss)
TrdCount := TrdCount + 1//ADD to Max Trades Count
alert("Go Long with TP at" + str.tostring(Long_takeProfit) + "and SL at" + str.tostring(Long_stopLoss), alert.freq_once_per_bar_close)
shortCondition = ShortConditionPt1 and ShortConditionPt2 and ShortConditionPt3
if(shortCondition )
strategy.entry("short", strategy.short)
strategy.exit("exit", "short", limit = Short_takeProfit, stop = Short_stopLoss)
TrdCount := TrdCount + 1 //ADD to Max Trades Count
alert("Go Short with TP at" + str.tostring(Short_takeProfit) + "and SL at" + str.tostring(Short_stopLoss), alert.freq_once_per_bar_close)