
이 전략은 그램을 평형 나무 위에 춤추는 것과 같습니다. 이 전략은 일반적인 K그램을 더 부드러운 Heiken Ashi 로 바꾸고, 이치모쿠 클라우드 의 기준선과 결합하여 기술 분석계의 “두 사람 스키”를 만듭니다.
이 전략의 핵심은 “트리플 필터 시스템”으로, 당신이 심도검사 대상을 선택하는 것처럼 엄격합니다. 첫째, 하이켄 아시은 이치모쿠 기준선의 올바른 쪽에 있어야 합니다 (이것은 기본 임계입니다); 둘째, 200주기 EMA는 당신이 큰 추세에 따라가는 것을 보장합니다 (류를 거슬러 올라가지 마십시오); 마지막으로, 이치모쿠는 필터로부터 뒤로 떨어져서 운동량 방향이 올바른 것을 보장합니다 (실조 돌파를 방지하는 구멍).
이것은 마치 운전하는 것과 같습니다. 녹색 신호가 켜져 있고, 도로 상태가 좋으며, 앞쪽에는 역행 차량이 없는 상태입니다.
도랑 피 가이드는 여기에 있습니다! 이 전략의 가장 똑똑한 부분은 ATR을 사용하여 스톱 스톱을 설정하는 것입니다. 그것은 자동차의 적응 항해 시스템과 마찬가지로 시장의 변동성에 따라 자동으로 조정됩니다. 시장의 변동성이 큰 경우 스톱 스톱 거리가 자동으로 넓어집니다.
더 놀라운 것은, 그것은 또한 여러 시간 프레임을 사용한다는 것입니다: 높은 시간 프레임의 ATR은 중지하기 위해 사용된다 (이윤을 충분히 실행), 낮은 시간 프레임의 ATR은 손실을 막기 위해 사용된다 (빠른 손실 보호).
이 전략은 특히 트렌드가 뚜렷한 시장 환경에 적합합니다. 시장이 수평으로 흔들릴 때 잠시 지켜보는 것이 좋습니다. 왜냐하면 하이켄 아시는 흔들리는 시장에서 가짜 신호를 일으킬 수 있기 때문입니다.
어떤 전략도 만능이 아니라는 것을 기억하십시오. 이 전략의 강점은 중장기적 추세를 포착하는 것입니다. 만약 당신이 빠른 진출과 빠른 출퇴근의 짧은 라인 거래자를 좋아한다면, 당신은 파라미터를 조정하거나 다른 전략을 찾아야 할 수 있습니다.
/*backtest
start: 2024-10-20 00:00:00
end: 2025-10-18 08:00:00
period: 1d
basePeriod: 1d
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT","balance":500000}]
*/
// This Pine Script® code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © MahdiSalari8
//@version=6
strategy("Heiken Ashi Bas", overlay=true,
default_qty_type=strategy.fixed,
default_qty_value=0.1,
commission_type=strategy.commission.percent,
commission_value=0.07,
initial_capital=10000000,
pyramiding=0) // Changed to 0
// Inputs
useTrendFilter = input.bool(true, "Use 200 EMA Trend Filter", group="Filters")
showSignals = input.bool(true, "Show Buy/Sell Signals", group="Visuals")
showEma = input.bool(false, "Show 200 EMA", group="Visuals")
atrPeriod = input.int(14, "ATR Period", minval=1, group="Risk Management")
htf = input.timeframe("5", "Higher Timeframe for TP", group="Timeframes")
ltf = input.timeframe("1", "Lower Timeframe for SL", group="Timeframes")
tpMultiplier = input.float(2.0, "TP Multiplier", minval=0.1, group="Risk Management")
slMultiplier = input.float(1.0, "SL Multiplier", minval=0.1, group="Risk Management")
// Ichimoku Divergence Settings
useDivergenceFilter = input.bool(true, "Use Ichimoku Divergence Filter", group="Ichimoku Divergence")
showDivergenceLine = input.bool(true, "Show Divergence Line", group="Ichimoku Divergence")
divergenceLookback = input.int(2, "Divergence Lookback (bars)", minval=1, maxval=20, group="Ichimoku Divergence")
divergenceLineWidth = input.int(5, "Divergence Line Width", minval=1, maxval=5, group="Ichimoku Divergence")
// Heiken Ashi Calculation
var float haOpen = na
var float haClose = na
var float haHigh = na
var float haLow = na
haClose := (open + high + low + close) / 4
haOpen := na(haOpen[1]) ? (open + close) / 2 : (haOpen[1] + haClose[1]) / 2
haHigh := math.max(high, math.max(haOpen, haClose))
haLow := math.min(low, math.min(haOpen, haClose))
// Ichimoku Baseline (Kijun-sen)
kijunPeriod = 26
kijunSen = (ta.highest(high, kijunPeriod) + ta.lowest(low, kijunPeriod)) / 2
// Ichimoku Baseline Divergence Calculation
currentBaseline = kijunSen
pastBaseline = kijunSen[divergenceLookback]
// Calculate slope (divergence)
baselineSlope = (currentBaseline - pastBaseline) / divergenceLookback
// Determine bullish/bearish divergence (exclude when slope is 0)
bullishDivergence = baselineSlope > 0
bearishDivergence = baselineSlope < 0
slopeIsZero = baselineSlope == 0
// Trend Filter (200 EMA)
ema200 = ta.ema(close, 200)
// ATR Calculation for different timeframes
htfAtr = request.security(syminfo.tickerid, htf, ta.atr(atrPeriod))
ltfAtr = request.security(syminfo.tickerid, ltf, ta.atr(atrPeriod))
// Enhanced Entry Conditions with Divergence Filter (exclude when slope is 0)
longCondition = haClose > kijunSen and
haClose[1] >= kijunSen[1] and
haClose > haOpen and
(haHigh - haClose) >= (haClose - haOpen) * 0.3 and
(not useTrendFilter or close > ema200) and
(not useDivergenceFilter or (bullishDivergence and not slopeIsZero))
shortCondition = haClose < kijunSen and
haClose[1] <= kijunSen[1] and
haClose < haOpen and
(haClose - haLow) >= (haOpen - haClose) * 0.3 and
(not useTrendFilter or close < ema200) and
(not useDivergenceFilter or (bearishDivergence and not slopeIsZero))
// Dynamic TP/SL based on ATR
longTp = close + (htfAtr * tpMultiplier)
longSl = close - (ltfAtr * slMultiplier)
shortTp = close - (htfAtr * tpMultiplier)
shortSl = close + (ltfAtr * slMultiplier)
// Strategy Execution
if (longCondition)
strategy.entry("Long", strategy.long)
strategy.exit("Long Exit", "Long", limit=longTp, stop=longSl)
if (shortCondition)
strategy.entry("Short", strategy.short)
strategy.exit("Short Exit", "Short", limit=shortTp, stop=shortSl)
// Plotting
plot(kijunSen, color=color.blue, title="Ichimoku Baseline", linewidth=2, display=display.all)
// Plot Divergence Line (gray when slope is 0)
plot(showEma ? ema200 : na, color=color.purple, title="200 EMA", linewidth=1, display=display.all)
// Heiken Ashi Candles with 25% opacity
candleColor = haClose > haOpen ? color.new(color.green, 75) : color.new(color.red, 75)
plotcandle(haOpen, haHigh, haLow, haClose, title="Heiken Ashi", color=candleColor, wickcolor=candleColor, bordercolor=candleColor, display=display.all)
// Plot Buy/Sell Signals with labelup/labeldown shapes
plotshape(showSignals and longCondition, style=shape.labelup, location=location.belowbar, color=color.new(color.green, 0), size=size.small, title="Buy Signal", display=display.all)
plotshape(showSignals and shortCondition, style=shape.labeldown, location=location.abovebar, color=color.new(color.red, 0), size=size.small, title="Sell Signal", display=display.all)
// Plot TP/SL levels - TP as lines with breaks, SL hidden by default
plot(strategy.position_size > 0 ? longTp : na, "Long TP", color=color.green, style=plot.style_linebr, linewidth=1, display=display.all)
plot(strategy.position_size > 0 ? longSl : na, "Long SL", color=color.red, style=plot.style_linebr, linewidth=1, display=display.none)
plot(strategy.position_size < 0 ? shortTp : na, "Short TP", color=color.green, style=plot.style_linebr, linewidth=1, display=display.all)
plot(strategy.position_size < 0 ? shortSl : na, "Short SL", color=color.red, style=plot.style_linebr, linewidth=1, display=display.none)
// Alerts
alertcondition(longCondition, "Long Signal", "HA Cross Above Kijun-sen with Bullish Divergence")
alertcondition(shortCondition, "Short Signal", "HA Cross Below Kijun-sen with Bearish Divergence")