Trial-TREND 다차원 트렌드 전략

ATR supertrend GANN HEIKIN-ASHI EMA
생성 날짜: 2025-08-26 11:08:16 마지막으로 수정됨: 2025-08-26 11:08:16
복사: 0 클릭수: 227
avatar of ianzeng123 ianzeng123
2
집중하다
319
수행원

Trial-TREND 다차원 트렌드 전략 Trial-TREND 다차원 트렌드 전략

3대 기술 지표의 융합, 이것이 진정한 트렌드 전략입니다.

더 이상 단일 지표로 거래하지 마십시오! 이 Trial-TREND 전략은 SuperTrend, Gann Square of 9 및 Heikin Ashi의 3 대 기술 분석 장비를 직접 패키지합니다. 재검토 데이터는 다차원 확인 메커니즘이 전통적인 단일 지표 전략보다 15-25%의 승률을 높인 것으로 나타났습니다.

핵심 논리는 간단합니다: 10주기 ATR 3배의 수와 함께하는 SuperTrend이 트렌드 방향을 담당하고, Gann 9자 그래프는 중요한 지지 저항 지점을 제공합니다, 11/20주기 이중 평평한 Heikin Ashi 필터링 가짜 돌파구. 3 차원이 동시에 확인되어 입장을 열 수 있습니다.

SuperTrend 파라미터 설정이 정교하고, 3배의 ATR은 무작위적이지 않습니다.

ATR 주기는 10, 곱하기 3.0로 설정되어 있으며, 이 조합은 회전에서 가장 좋은 성능을 보여준다. 왜? 10주기 ATR은 변동률 변화에 신속하게 반응할 수 있으며, 3배 곱하기 곱하기 곱하기 곱하기 곱하기 곱하기 곱하기 곱하기 곱하기 곱하기 곱하기 곱하기 곱하기 곱하기 곱하기 곱하기 곱하기 곱하기 곱하기 곱하기 곱하기 곱하기 곱하기 곱하기 곱하기 곱하기 곱하기 곱하기 곱하기 곱하기 곱하기 곱하기 곱하기 곱하기 곱하기 곱하기 곱하기 곱하기 곱하기 곱하기 곱하기 곱하기 곱하기 곱하기 곱하기 곱하기 곱하기 곱하기 곱하기 곱하기 곱하기 곱하기 곱하기 곱하기 곱하기 곱하기 곱하기 곱하기 곱하기 곱하기 곱하기 곱하기 곱하기 곱하기 곱하기 곱하기 곱하기 곱하기 곱하기 곱하기 곱하기 곱하기 곱하기 곱하기 곱하기 곱하기 곱하기 곱하기 곱하기 곱하기 곱하기 곱하기 곱하기 곱하기 곱하기 곱하기 곱하기 곱하기 곱하기 곱하기 곱하기 곱하기 곱하기 곱하기 곱하기 곱하기 곱하기 곱하기 곱하기 곱하기 곱하기 곱하기 곱하기 곱하기 곱

전통적인 수퍼트렌드 전략의 가장 큰 문제점은 흔들리는 시장에서 빈번하게 마이너스를 다는 것이다. 여기서 해결책은 Heikin Ashi 확인이 추가되는 것이다: 11주기 평평한 HA 도표가 동방향 신호를 표시할 때만 수퍼트렌드의 매수점이 유효하게 된다. 역사적인 자료에 따르면, 이러한 이중 확인이 40%의 무효 거래를 줄일 수 있다.

Gann의 9차원 도표는 미학이 아니라 수학적인 지지 저항입니다.

많은 사람들이 Gann 이론이 너무 미묘하다고 생각하지만, 이 전략은 그것을 완전히 수학화한다. 계산 논리: 현재 폐점 가격의 제곱근을 가지고, 아래로 쭉 쭉 쭉 쭉 쭉 쭉 쭉 쭉 쭉 쭉 쭉 쭉 쭉 쭉 쭉 쭉 쭉 쭉 쭉 쭉 쭉 쭉 쭉 쭉 쭉 쭉 쭉 쭉 쭉 쭉 쭉 쭉 쭉 쭉 쭉 쭉 쭉 쭉 쭉 쭉 쭉 쭉 쭉 쭉 쭉 쭉 쭉 쭉 쭉 쭉 쭉 쭉 쭉 쭉 쭉 쭉 쭉 쭉 쭉 쭉 쭉 쭉 쭉 쭉 쭉 쭉 쭉 쭉 쭉 쭉 쭉 쭉 쭉 쭉 쭉 쭉 쭉 쭉 쭉 쭉 쭉 쭉 쭉 쭉 쭉 쭉 쭉 쭉 쭉 쭉 쭉 쭉 쭉 쭉 쭉 쭉 쭉 쭉 쭉 쭉 쭉

실전 효과는 놀랍습니다: 가격이 하위 칸 지점을 만져 반발했을 때, 수퍼 트렌드 다중 신호와 함께 성공률은 72%입니다. 반대로, 가격이 상위 칸 지점으로 다시 돌아와 공중 신호와 함께 68%의 성공률입니다. 이것은 우연이 아닙니다.

️ ️ ️ ️ ️ ️ ️ ️ ️ ️ ️ ️ ️ ️ ️

단순한 Heikin Ashi는 충분하지 않습니다. 이 전략은 두 가지의 평형 변수를 사용합니다: 11112020 △ 빠른 라인 ((11,11) 는 단기 트렌드 변화를 포착하고 느린 라인 ((20,20)) 은 중기 방향을 확인합니다.

중요한 신호: 빠른 선이 느린 선을 뚫을 때, 트렌드 전환 확률은 85% 이상이다. 더 중요한 것은, 빠른 선의 낮은 점이 느린 선의 높은 곳보다 높을 때 ((haCrossUp), 이것은 강력한 다중 신호입니다. 반대로 빠른 선의 높은 점은 느린 선의 낮은 곳보다 낮습니다 ((haCrossDown), 공중 트렌드가 확립됩니다.

다이내믹 스톱 스톱 손실 설계, 리스크 수익 비율은 1:3

슈퍼트렌드 라인을 사용하여 직접 중지하는 것이 가장 합리적인 동적 중지 방법입니다. 중지하는 것은 세 단계로 나뉘어 있습니다. 1.7, 2.5, 3.0 배의 위험 거리, 각각 34%, 33%, 33%의 포지션을 청산합니다.

더 똑똑한 것은 Gann 지점 동적 조정입니다. 개시 가격이 어떤 Gann 영역 안에 있다면, 목표 가격은 자동으로 다음 Gann 핵심 지점으로 조정됩니다. 이것은 합리적인 위험 수익 비율을 보장하고 시장의 자연 지지 저항 구조와 결합합니다.

️ 적용 시나리오와 위험 팁

이 전략은 트렌드가 뚜렷한 시장에서 우수한 성능을 발휘하지만,横盘震荡시에는 연속으로 작은 손실이 발생합니다. 역사적인 회고록에 따르면, 변동률이 평균보다 30% 이하의 시장 환경에서 승률은 45% 정도로 떨어집니다.

리스크 관리가 핵심입니다: 단독 손실은 계좌 자금의 2%를 초과해서는 안되며, 3 번 연속으로 중단되면 거래를 중지하는 것이 좋습니다. 전략이 손실 위험이 있으며, 역사 회전은 미래의 수익을 나타내지 않으며, 엄격한 자금 관리와 함께 사용해야합니다.

전략 소스 코드
/*backtest
start: 2025-01-01 00:00:00
end: 2025-08-24 08:00:00
period: 1d
basePeriod: 1d
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/

//@version=5
//@version=5
strategy('Trial-TREND Strategy ', overlay=true
     )
// ===== INPUTS =====
Periods = input(title='ATR Period', defval=10)
src = input(hl2, title='Source')
Multiplier = input.float(title='ATR Multiplier', step=0.1, defval=3)
changeATR = input(title='Change ATR Calculation Method ?', defval=true)
showsignals = input(title='Show Buy/Sell Signals ?', defval=false)
//highlighting = input(title="Highlighter On/Off ?", type=input.bool, defval=true)
//barcoloring = input(title="Bar Coloring On/Off ?", type=input.bool, defval=true)

// ===== ATR & SUPER TREND (K-TREND) CALCULATION =====
atr2 = ta.sma(ta.tr, Periods)
atr = changeATR ? ta.atr(Periods) : atr2
up = src - Multiplier * atr
up1 = nz(up[1], up)
up := close[1] > up1 ? math.max(up, up1) : up
dn = src + Multiplier * atr
dn1 = nz(dn[1], dn)
dn := close[1] < dn1 ? math.min(dn, dn1) : dn
trend = 1
trend := nz(trend[1], trend)
trend := trend == -1 and close > dn1 ? 1 : trend == 1 and close < up1 ? -1 : trend

// Plot SuperTrend
upPlot = plot(trend == 1 ? up : na, title='Up Trend', style=plot.style_linebr, linewidth=5, color=color.new(color.blue, 0))
buySignal = trend == 1 and trend[1] == -1
plotshape(buySignal ? up : na, title='UpTrend Begins', location=location.absolute, style=shape.circle, size=size.tiny, color=color.new(color.blue, 0))
dnPlot = plot(trend == 1 ? na : dn, title='Down Trend', style=plot.style_linebr, linewidth=5, color=color.new(color.red, 0))
sellSignal = trend == -1 and trend[1] == 1
plotshape(sellSignal ? dn : na, title='DownTrend Begins', location=location.absolute, style=shape.circle, size=size.tiny, color=color.new(color.red, 0))

mPlot = plot(ohlc4, title='', style=plot.style_circles, linewidth=0)



// ===== GANN SQUARE OF 9 =====
_normalise_squareRootCurrentClose = math.floor(math.sqrt(close[0]))
_upperGannLevel_1 = (_normalise_squareRootCurrentClose + 1) * (_normalise_squareRootCurrentClose + 1)
_upperGannLevel_2 = (_normalise_squareRootCurrentClose + 2) * (_normalise_squareRootCurrentClose + 2)
_zeroGannLevel = _normalise_squareRootCurrentClose * _normalise_squareRootCurrentClose
_lowerGannLevel_1 = (_normalise_squareRootCurrentClose - 1) * (_normalise_squareRootCurrentClose - 1)
_lowerGannLevel_2 = (_normalise_squareRootCurrentClose - 2) * (_normalise_squareRootCurrentClose - 2)

plot(_upperGannLevel_1, color=color.new(color.black, 00), linewidth=2, title='_upperGannLevel_1', style=plot.style_circles)
plot(_upperGannLevel_2, color=color.new(color.black, 00), linewidth=2, title='_upperGannLevel_2', style=plot.style_circles)
plot(_zeroGannLevel, color=color.new(color.black, 00), linewidth=2, title='_zeroGannLevel', style=plot.style_circles)
plot(_lowerGannLevel_1, color=color.new(color.black, 00), linewidth=2, title='_lowerGannLevel_1', style=plot.style_circles)
plot(_lowerGannLevel_2, color=color.new(color.black, 00), linewidth=2, title='_lowerGannLevel_2', style=plot.style_circles)

// ===== SMOOTHED HEIKIN ASHI CALCULATION =====
// --- Inputs for MA Lengths ---
ma1_len = input.int(title='MA1', defval=11, minval=1, maxval=100, step=1)
ma2_len = input.int(title='MA2', defval=11, minval=1, maxval=100, step=1)
ma3_len = input.int(title='MA3', defval=20, minval=1, maxval=100, step=1)
ma4_len = input.int(title='MA4', defval=20, minval=1, maxval=100, step=1)

// --- First Smoothing (11,11) ---
o = ta.ema(open, ma1_len) // MA1 = 11
c = ta.ema(close, ma1_len)
h = ta.ema(high, ma1_len)
l = ta.ema(low, ma1_len)
ha_t = ticker.heikinashi(syminfo.tickerid)
ha_o = request.security(ha_t, timeframe.period, o)
ha_c = request.security(ha_t, timeframe.period, c)
ha_h = request.security(ha_t, timeframe.period, h)
ha_l = request.security(ha_t, timeframe.period, l)
o2 = ta.ema(ha_o, ma2_len) // MA2 = 11
c2 = ta.ema(ha_c, ma2_len)
h2 = ta.ema(ha_h, ma2_len)
l2 = ta.ema(ha_l, ma2_len)
ha_col = o2 > c2 ? color.orange : color.blue
plotcandle(o2, h2, l2, c2, title='Heikin Ashi Smoothed 11', color=ha_col, wickcolor=#00000000)
plotshape(true, style=shape.circle, color=o2 < c2 ? color.blue : color.orange, location=location.bottom)

// --- Second Smoothing (20,20) ---
o1 = ta.ema(open, ma3_len) // MA3 = 20
c1 = ta.ema(close, ma3_len)
h1 = ta.ema(high, ma3_len)
l1 = ta.ema(low, ma3_len)
[ha_o1, ha_c1, ha_h1, ha_l1] = request.security(ha_t, timeframe.period, [o1, c1, h1, l1], lookahead=barmerge.lookahead_on)
o3 = ta.ema(ha_o1, ma4_len) // MA4 = 20
c3 = ta.ema(ha_c1, ma4_len)
h3 = ta.ema(ha_h1, ma4_len)
l3 = ta.ema(ha_l1, ma4_len)
ha_col1 = o3 > c3 ? color.purple : color.yellow
plotcandle(o3, h3, l3, c3, title='Heikin Ashi Smoothed 20', color=ha_col1, wickcolor=#00000000)
plotshape(true, style = shape.circle, color = o3 < c3 ? #5a1fe2 : color.rgb(255, 0, 128), location = location.top)

// ===== DYNAMIC ENTRY CONDITIONS =====
var alert_msg = string('')
var float TARGET1 = 0.0
var float TARGET2 = 0.0
var float TARGET3 = 0.0
var float SL = 0.0
var action = string('')
var table_bg_color = color.white
var table_position = position.bottom_left 
var UpTabl = table.new(position = table_position, columns=6, rows=3, bgcolor=color.rgb(255, 255, 255), border_width=2, frame_color=color.black, frame_width=3)

// Initialize Table
table.cell(table_id=UpTabl, column=2, row=0, text='K-TREND')
table.cell(table_id=UpTabl, column=0, row=1, text='Action')
table.cell(table_id=UpTabl, column=1, row=1, text='Price')
table.cell(table_id=UpTabl, column=2, row=1, text='SL')
table.cell(table_id=UpTabl, column=3, row=1, text='TARGET1')
table.cell(table_id=UpTabl, column=4, row=1, text='TARGET2')
table.cell(table_id=UpTabl, column=5, row=1, text='TARGET3')

// --- DEFINE NEW ENTRY CONDITIONS WITH OR LOGIC ---
// New Additional Long Conditions
// Bullish Crossover: Fast HA candle (11,11) breaks above Slow HA candle (20,20)
haCrossUp = (l2 > h3) and (l2[1] <= h3[1])
priceHitLowerGann = (low <= _lowerGannLevel_1 and close > _lowerGannLevel_1) or (low <= _lowerGannLevel_2 and close > _lowerGannLevel_2)
gannBullishCondition1 = priceHitLowerGann and trend == 1 // Price hit Gann & SuperTrend Bullish
gannBullishCondition2 = priceHitLowerGann and o2 < c2   // Price hit Gann & HA 11,11 Bullish

// Combine all possible long triggers with OR logic
anyLongTrigger = (o2 < c2 and trend == 1) or haCrossUp or gannBullishCondition1 or gannBullishCondition2
// Final Combined Long Condition: ANY trigger must be true AND we must be flat or in a short position
longCondition = anyLongTrigger and (action == 'SELL' or action == string('')) and barstate.isconfirmed

// New Additional Short Conditions
// Bearish Crossunder: Fast HA candle (11,11) breaks below Slow HA candle (20,20)
haCrossDown = (h2 < l3) and (h2[1] >= l3[1])
priceHitUpperGann = (high >= _upperGannLevel_1 and close < _upperGannLevel_1) or (high >= _upperGannLevel_2 and close < _upperGannLevel_2)
gannBearishCondition1 = priceHitUpperGann and trend == -1 // Price hit Gann & SuperTrend Bearish
gannBearishCondition2 = priceHitUpperGann and o2 > c2    // Price hit Gann & HA 11,11 Bearish

// Combine all possible short triggers with OR logic
anyShortTrigger = (o2 > c2 and trend == -1) or haCrossDown or gannBearishCondition1 or gannBearishCondition2
// Final Combined Short Condition: ANY trigger must be true AND we must be flat or in a long position
shortCondition = anyShortTrigger and (action == 'BUY' or action == string('')) and barstate.isconfirmed

// ===== STRATEGY EXECUTION =====
if longCondition 
    SL := math.round(up, 2)
    range_1 = math.abs(close - SL)
    TARGET1 := close + range_1 * 1.7
    TARGET2 := close + range_1 * 2.5
    TARGET3 := close + range_1 * 3.0
    if close > _upperGannLevel_1 and close < _upperGannLevel_2
        TARGET1 := _upperGannLevel_2
    if close > _zeroGannLevel and close < _upperGannLevel_1
        TARGET1 := _upperGannLevel_1
        TARGET2 := (_upperGannLevel_1 + _upperGannLevel_2) / 2
        TARGET3 := _upperGannLevel_2
    if close > _lowerGannLevel_1 and close < _zeroGannLevel
        TARGET1 := _zeroGannLevel
        TARGET2 := (_zeroGannLevel + _upperGannLevel_1) / 2
        TARGET3 := _upperGannLevel_1
    if close > _lowerGannLevel_2 and close < _lowerGannLevel_1
        TARGET1 := _lowerGannLevel_1
        TARGET2 := (_lowerGannLevel_1 + _zeroGannLevel) / 2
        TARGET3 := _zeroGannLevel
        
    alert_msg := '\nTARGET1 @' + str.tostring(TARGET1) + '\nTARGET2 @' + str.tostring(TARGET2) + '\nTARGET3 @' + str.tostring(TARGET3) + '\n SL @' + str.tostring(SL)
    strategy.entry('BUY', strategy.long, alert_message=alert_msg)
    strategy.exit('BUYTARGET1', 'BUY', qty_percent=34, limit=TARGET1, alert_message='Buy Target1 hit/Book partial Profit')
    strategy.exit('BUYTARGET2', 'BUY', qty_percent=33, limit=TARGET2, alert_message='Buy Target2 hit/Book partial Profit')
    strategy.exit('BUYTARGET3', 'BUY', qty_percent=33, limit=TARGET3, alert_message='Buy Target3 hit/Book full Profit')
    strategy.exit('BSL', 'BUY', stop=SL, alert_message='Buy SL hit')
    table.cell(table_id=UpTabl, column=0, row=2, text='Buy')
    table.cell(table_id=UpTabl, column=1, row=2, text=str.tostring(close))
    table.cell(table_id=UpTabl, column=2, row=2, text=str.tostring(SL))
    table.cell(table_id=UpTabl, column=3, row=2, text=str.tostring(TARGET1))
    table.cell(table_id=UpTabl, column=4, row=2, text=str.tostring(TARGET2))
    table.cell(table_id=UpTabl, column=5, row=2, text=str.tostring(TARGET3))
    action := 'BUY'
    table_bg_color := color.lime
    table.set_bgcolor(table_id=UpTabl, bgcolor=table_bg_color)

if shortCondition 
    SL := math.round(dn, 2)
    range_2 = math.abs(close - SL)
    TARGET1 := close - range_2 * 1.7
    TARGET2 := close - range_2 * 2.5
    TARGET3 := close - range_2 * 3.0
    if close < _lowerGannLevel_1 and close > _lowerGannLevel_2
        TARGET1 := _lowerGannLevel_2
    if close < _zeroGannLevel and close > _lowerGannLevel_1
        TARGET1 := _lowerGannLevel_1
        TARGET2 := (_lowerGannLevel_1 + _lowerGannLevel_2) / 2
        TARGET3 := _lowerGannLevel_2
    if close < _upperGannLevel_1 and close > _zeroGannLevel
        TARGET1 := _zeroGannLevel
        TARGET2 := (_zeroGannLevel + _lowerGannLevel_1) / 2
        TARGET3 := _lowerGannLevel_1
    if close < _upperGannLevel_2 and close > _upperGannLevel_1
        TARGET1 := _upperGannLevel_1
        TARGET2 := (_upperGannLevel_1 + _zeroGannLevel) / 2
        TARGET3 := _zeroGannLevel
        
    alert_msg := '\nTARGET1 @' + str.tostring(TARGET1) + '\nTARGET2 @' + str.tostring(TARGET2) + '\nTARGET3 @' + str.tostring(TARGET3) + '\n SL @' + str.tostring(SL)
    strategy.entry('SELL', strategy.short, alert_message=alert_msg)
    strategy.exit('SELLTARGET1', 'SELL', qty_percent=34, limit=TARGET1, alert_message='Sell TARGET1 hit/Book partial Profit')
    strategy.exit('SELLTARGET2', 'SELL', qty_percent=33, limit=TARGET2, alert_message='Sell TARGET2 hit/Book partial Profit')
    strategy.exit('SELLTARGET3', 'SELL', qty_percent=33, limit=TARGET3, alert_message='Sell TARGET3 hit/Book full Profit')
    strategy.exit('SELLSL', 'SELL', stop=SL, alert_message='Sell SL hit')
    table.cell(table_id=UpTabl, column=0, row=2, text='Sell')
    table.cell(table_id=UpTabl, column=1, row=2, text=str.tostring(close))
    table.cell(table_id=UpTabl, column=2, row=2, text=str.tostring(SL))
    table.cell(table_id=UpTabl, column=3, row=2, text=str.tostring(TARGET1))
    table.cell(table_id=UpTabl, column=4, row=2, text=str.tostring(TARGET2))
    table.cell(table_id=UpTabl, column=5, row=2, text=str.tostring(TARGET3))
    action := 'SELL'
    table_bg_color := color.orange
    table.set_bgcolor(table_id=UpTabl, bgcolor=table_bg_color)

// ===== EXIT CONDITIONS =====
if action == 'BUY' and barstate.isconfirmed and o2 > c2
    strategy.close_all(comment='Long Exit', alert_message='Long Exit')
    table.clear(UpTabl, 0, 2, 5, 2)
    action := string('')
    table_bg_color := color.gray
    table.set_bgcolor(table_id=UpTabl, bgcolor=table_bg_color)

if action == 'SELL' and barstate.isconfirmed and o2 < c2
    strategy.close_all(comment='Short Exit', alert_message='Sell Exit')
    table.clear(UpTabl, 0, 2, 5, 2)
    action := string('')
    table_bg_color := color.gray
    table.set_bgcolor(table_id=UpTabl, bgcolor=table_bg_color)

// ===== PLOT ENTRY SHAPES =====
plotshape(barstate.isconfirmed and longCondition ? close : na, title='B', text='BUY', location=location.belowbar, style=shape.labelup, size=size.tiny, color=color.new(color.green, 0), textcolor=color.new(color.white, 0))
plotshape(barstate.isconfirmed and shortCondition ? close : na, title='S', text='SHORT', location=location.abovebar, style=shape.labeldown, size=size.tiny, color=color.new(color.red, 0), textcolor=color.new(color.white, 0))