
이 전략은 T3 이동 평균, ATR 지표 및 하이클의 조합을 사용하여 구매 및 판매 신호를 식별하고 ATR에 따라 스톱 스톱 위치를 계산하여 트렌드 추적 거래를 구현합니다. 전략의 장점은 신속한 반응이며 거래 위험을 제어하는 것입니다.
T3 이동 평균: 트렌드 방향을 판단하기 위해 T3 이동 평균을 계산하여 T3 (기본 100) 의 매끄러운 변수를 계산합니다.
ATR: 계산 ATR ((평균 실제 변동폭)), 중지 중지 위치의 크기를 결정하기 위해 사용된다.
ATR 모바일 스톱: ATR을 기반으로 모바일 스톱 라인을 계산하여 가격 변화와 변동률에 따라 조정할 수 있으며, 트렌드 추적을 가능하게 한다.
구매 신호: ATR 이동 스톱 라인을 통과하고 T3 평균보다 낮을 때 구매 신호가 발생한다.
판매 신호: 종결 가격 아래 ATR 이동 스톱 라인을 통과하고 T3 평균보다 높을 때 판매 신호가 발생한다.
스톱로스 스톱: 입점 후, ATR 값과 사용자가 설정한 리스크 수익률에 따라 스톱로스 및 스톱 가격을 계산한다.
구매 후, 중지 가격은 입시 가격으로 ATR 값을 빼고, 중지 가격은 입시 가격으로 ATR 값을 더하여 리스크 수익률을 곱한다.
매각 후, 중지 가격은 입수 가격에 ATR 값을 더하고, 중지 가격은 입수 가격에 ATR 값을 빼고 리스크 수익률을 곱한다.
가격이 스톱로스 (stop loss) 또는 스톱 (stop loss) 값을 촉발하면 평점 포지션이 출발한다.
T3 평균 파라미터는 100을 기본으로 하고, 일반 이동 평균에 비해 더 민감하며 가격 변화에 더 빨리 반응할 수 있다.
ATR을 이용한 이동식 스톱로스는 시장의 변동성 트레일 가격에 따라 스톱로스가 뚫릴 위험을 피한다. 스톱로스 위치는 ATR을 기반으로 한 거래당 리스크 수익률을 제어한다.
ATR 모바일 스톱 라인은 트렌드를 추적할 수 있으며, 가격의 단기 회귀 시에도 오프라인으로 트리거되지 않기 때문에 잘못된 신호를 줄일 수 있다.
T3 평균주기와 ATR주기는 최적화되어 다양한 시장에 대한 변수를 조정하여 전략의 안정성을 향상시킬 수 있습니다.
급격한 상황이 발생하면 가격이 직접적으로 스톱 라인을 돌파하여 손실을 초래할 수 있습니다. ATR 주기 및 스톱 거리를 적절히 확장하여 완화 할 수 있습니다.
트렌드 반전 시, 가격의 이동 스톱 라인을 넘어서 손실을 초래할 수 있다. 다른 지표와 결합하여 트렌드를 판단하여 반전 지점 근처의 거래를 피한다.
변수 최적화는 풍부한 역사 데이터의 지원이 필요하며, 과잉 최적화 위험이 있습니다. 여러 시장과 여러 시간 주기 조합 최적화 변수는 채택되어야 하며, 단일 데이터 세트에 의존할 수 없습니다.
다양한 T3 평균 주기 변수를 테스트하여 민감성과 안정성을 균형 잡는 최적의 변수 조합을 찾습니다.
ATR 주기의 변수를 테스트하여 위험을 제어하고 취득 추세 사이의 최적의 균형을 찾습니다.
RSI, MACD 등의 지표와 결합하여 트렌드 반전점을 피하는 잘못된 거래
기계 학습 방법을 사용하여 최적의 변수를 훈련하여 인적 최적화의 한계를 줄입니다.
더 많은 포지션 관리 전략과 더 나은 위험 관리
이 전략은 T3 평균선과 ATR 지표의 장점을 통합하여 가격 변화에 신속하게 대응하고 위험을 통제 할 수 있습니다. 파라미터를 최적화하고 다른 지표와 결합하여 전략의 안정성과 거래 효율성을 더욱 향상시킬 수 있습니다. 그러나 거래자는 반전과 돌파의 위험을 경계하고 재검토 결과에 과도하게 의존하지 않도록해야합니다.
/*backtest
start: 2022-10-31 00:00:00
end: 2023-11-06 00:00:00
period: 1d
basePeriod: 1h
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=5
strategy(title='UT Bot Alerts (QuantNomad) Strategy w/ NinjaView', overlay=true)
T3 = input(100)//600
// Input for Long Settings
// Input for Long Settings
xPrice3 = close
xe1 = ta.ema(xPrice3, T3)
xe2 = ta.ema(xe1, T3)
xe3 = ta.ema(xe2, T3)
xe4 = ta.ema(xe3, T3)
xe5 = ta.ema(xe4, T3)
xe6 = ta.ema(xe5, T3)
b3 = 0.7
c1 = -b3*b3*b3
c2 = 3*b3*b3+3*b3*b3*b3
c3 = -6*b3*b3-3*b3-3*b3*b3*b3
c4 = 1+3*b3+b3*b3*b3+3*b3*b3
nT3Average = c1 * xe6 + c2 * xe5 + c3 * xe4 + c4 * xe3
//plot(nT3Average, color=color.white, title="T3")
// Buy Signal - Price is below T3 Average
buySignal3 = xPrice3 < nT3Average
sellSignal3 = xPrice3 > nT3Average
// Inputs
a = input(1, title='Key Value. "This changes the sensitivity"')
c = input(50, title='ATR Period')
h = input(true, title='Signals from Heikin Ashi Candles')
riskRewardRatio = input(1, title='Risk Reward Ratio')
xATR = ta.atr(c)
nLoss = a * xATR
src = h ? request.security(ticker.heikinashi(syminfo.tickerid), timeframe.period, close, lookahead=barmerge.lookahead_off) : close
xATRTrailingStop = 0.0
iff_1 = src > nz(xATRTrailingStop[1], 0) ? src - nLoss : src + nLoss
iff_2 = src < nz(xATRTrailingStop[1], 0) and src[1] < nz(xATRTrailingStop[1], 0) ? math.min(nz(xATRTrailingStop[1]), src + nLoss) : iff_1
xATRTrailingStop := src > nz(xATRTrailingStop[1], 0) and src[1] > nz(xATRTrailingStop[1], 0) ? math.max(nz(xATRTrailingStop[1]), src - nLoss) : iff_2
pos = 0
iff_3 = src[1] > nz(xATRTrailingStop[1], 0) and src < nz(xATRTrailingStop[1], 0) ? -1 : nz(pos[1], 0)
pos := src[1] < nz(xATRTrailingStop[1], 0) and src > nz(xATRTrailingStop[1], 0) ? 1 : iff_3
xcolor = pos == -1 ? color.red : pos == 1 ? color.green : color.blue
ema = ta.ema(src, 1)
above = ta.crossover(ema, xATRTrailingStop)
below = ta.crossunder(ema, xATRTrailingStop)
buy = src > xATRTrailingStop and above
sell = src < xATRTrailingStop and below
barbuy = src > xATRTrailingStop
barsell = src < xATRTrailingStop
plotshape(buy, title='Buy', text='Buy', style=shape.labelup, location=location.belowbar, color=color.new(color.green, 0), textcolor=color.new(color.white, 0), size=size.tiny)
plotshape(sell, title='Sell', text='Sell', style=shape.labeldown, location=location.abovebar, color=color.new(color.red, 0), textcolor=color.new(color.white, 0), size=size.tiny)
barcolor(barbuy ? color.new(color.green, 90) : na)
barcolor(barsell ? color.new(color.red, 90) : na)
var float entryPrice = na
var float takeProfitLong = na
var float stopLossLong = na
var float takeProfitShort = na
var float stopLossShort = na
if buy and buySignal3
entryPrice := src
takeProfitLong := entryPrice + nLoss * riskRewardRatio
stopLossLong := entryPrice - nLoss
takeProfitShort := na
stopLossShort := na
if sell and sellSignal3
entryPrice := src
takeProfitShort := entryPrice - nLoss * riskRewardRatio
stopLossShort := entryPrice + nLoss
takeProfitLong := na
stopLossLong := na
// Strategy order conditions
acct = "Sim101"
ticker = "ES 12-23"
qty = 1
OCOMarketLong = '{ "alert": "OCO Market Long", "account": "' + str.tostring(acct) + '", "ticker": "' + str.tostring(ticker) + '", "qty": "' + str.tostring(qty) + '", "take_profit_price": "' + str.tostring(takeProfitLong) + '", "stop_price": "' + str.tostring(stopLossLong) + '", "tif": "DAY" }'
OCOMarketShort = '{ "alert": "OCO Market Short", "account": "' + str.tostring(acct) + '", "ticker": "' + str.tostring(ticker) + '", "qty": "' + str.tostring(qty) + '", "take_profit_price": "' + str.tostring(takeProfitShort) + '", "stop_price": "' + str.tostring(stopLossShort) + '", "tif": "DAY" }'
CloseAll = '{ "alert": "Close All", "account": "' + str.tostring(acct) + '", "ticker": "' + str.tostring(ticker) + '" }'
strategy.entry("Long", strategy.long, when=buy ,alert_message=OCOMarketLong)
strategy.entry("Short", strategy.short, when=sell , alert_message=OCOMarketShort)
// Setting the take profit and stop loss for long trades
strategy.exit("Take Profit/Stop Loss", "Long", stop=stopLossLong, limit=takeProfitLong,alert_message=CloseAll)
// Setting the take profit and stop loss for short trades
strategy.exit("Take Profit/Stop Loss", "Short", stop=stopLossShort, limit=takeProfitShort,alert_message=CloseAll)
// Plot trade setup boxes
bgcolor(buy ? color.new(color.green, 90) : na, transp=0, offset=-1)
bgcolor(sell ? color.new(color.red, 90) : na, transp=0, offset=-1)
longCondition = buy and not na(entryPrice)
shortCondition = sell and not na(entryPrice)
var line longTakeProfitLine = na
var line longStopLossLine = na
var line shortTakeProfitLine = na
var line shortStopLossLine = na
if longCondition
longTakeProfitLine := line.new(bar_index, takeProfitLong, bar_index + 1, takeProfitLong, color=color.green, width=2)
longStopLossLine := line.new(bar_index, stopLossLong, bar_index + 1, stopLossLong, color=color.red, width=2)
label.new(bar_index + 1, takeProfitLong, str.tostring(takeProfitLong, "#.#####"), color=color.green, style=label.style_none, textcolor=color.green, size=size.tiny)
label.new(bar_index + 1, stopLossLong, str.tostring(stopLossLong, "#.#####"), color=color.red, style=label.style_none, textcolor=color.red, size=size.tiny)
if shortCondition
shortTakeProfitLine := line.new(bar_index, takeProfitShort, bar_index + 1, takeProfitShort, color=color.green, width=2)
shortStopLossLine := line.new(bar_index, stopLossShort, bar_index + 1, stopLossShort, color=color.red, width=2)
label.new(bar_index + 1, takeProfitShort, str.tostring(takeProfitShort, "#.#####"), color=color.green, style=label.style_none, textcolor=color.green, size=size.tiny)
label.new(bar_index + 1, stopLossShort, str.tostring(stopLossShort, "#.#####"), color=color.red, style=label.style_none, textcolor=color.red, size=size.tiny)
alertcondition(buy, 'UT Long', 'UT Long')
alertcondition(sell, 'UT Short', 'UT Short')