
Chiến lược này dựa trên các hình thức đảo ngược trong phân tích kỹ thuật (đường trục, hình thức nuốt và ngôi sao) và các vị trí hỗ trợ và kháng cự, giao dịch trên biểu đồ 1 giờ. Chiến lược này thực hiện giao dịch bằng cách xác định các điểm đảo ngược thị trường tiềm năng và các mức dừng và dừng lỗ dự kiến.
Ý tưởng chính của chiến lược này là mở nhiều vị trí khi có hình thức đảo ngược bullish gần vị trí hỗ trợ (như đường nét, hình thức nuốt bullish hoặc hình ảnh thập giá) và mở vị trí trống khi có hình thức đảo ngược bullish gần vị trí kháng cự (như đường nét, hình thức nuốt bullish hoặc hình ảnh thập giá). Đồng thời thiết lập mức dừng và dừng để kiểm soát rủi ro và khóa lợi nhuận.
Giải pháp:
Chiến lược này nắm bắt các cơ hội giao dịch tiềm năng bằng cách xác định các hình thức đảo ngược gần mức hỗ trợ và kháng cự. Nó đơn giản, dễ sử dụng và phù hợp với các môi trường thị trường khác nhau. Tuy nhiên, sự thành công của chiến lược phụ thuộc vào việc đánh giá chính xác các hình thức đảo ngược và kháng cự hỗ trợ.
/*backtest
start: 2024-05-07 00:00:00
end: 2024-06-06 00:00:00
period: 2h
basePeriod: 15m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
// This Pine Script™ code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © Kingcoinmilioner
//@version=5
strategy("Reversal Patterns at Support and Resistance", overlay=true, default_qty_type=strategy.percent_of_equity, default_qty_value=100)
// Parameters
support_resistance_lookback = input.int(50, title="Support/Resistance Lookback Period")
reversal_tolerance = input.float(0.01, title="Reversal Tolerance (percent)", step=0.01) / 100
take_profit_percent = input.float(3, title="Take Profit (%)") / 100
stop_loss_percent = input.float(1, title="Stop Loss (%)") / 100
// Functions to identify key support and resistance levels
findSupport() =>
ta.lowest(low, support_resistance_lookback)
findResistance() =>
ta.highest(high, support_resistance_lookback)
// Identify reversal patterns
isHammer() =>
body = math.abs(close - open)
lowerWick = open > close ? (low < close ? close - low : open - low) : (low < open ? open - low : close - low)
upperWick = high - math.max(open, close)
lowerWick > body * 2 and upperWick < body
isEngulfing() =>
(close[1] < open[1] and close > open and close > open[1] and open < close[1])
(close[1] > open[1] and close < open and close < open[1] and open > close[1])
isDoji() =>
math.abs(open - close) <= (high - low) * 0.1
// Identify support and resistance levels
support = findSupport()
resistance = findResistance()
// Check for reversal patterns at support and resistance
hammerAtSupport = isHammer() and (low <= support * (1 + reversal_tolerance))
engulfingAtSupport = isEngulfing() and (low <= support * (1 + reversal_tolerance))
dojiAtSupport = isDoji() and (low <= support * (1 + reversal_tolerance))
hammerAtResistance = isHammer() and (high >= resistance * (1 - reversal_tolerance))
engulfingAtResistance = isEngulfing() and (high >= resistance * (1 - reversal_tolerance))
dojiAtResistance = isDoji() and (high >= resistance * (1 - reversal_tolerance))
// Trading logic
if (hammerAtSupport or engulfingAtSupport or dojiAtSupport)
strategy.entry("Long", strategy.long)
stop_level = low * (1 - stop_loss_percent)
take_profit_level = close * (1 + take_profit_percent)
strategy.exit("Take Profit/Stop Loss", from_entry="Long", stop=stop_level, limit=take_profit_level)
if (hammerAtResistance or engulfingAtResistance or dojiAtResistance)
strategy.entry("Short", strategy.short)
stop_level = high * (1 + stop_loss_percent)
take_profit_level = close * (1 - take_profit_percent)
strategy.exit("Take Profit/Stop Loss", from_entry="Short", stop=stop_level, limit=take_profit_level)
// Plot support and resistance levels for visualization
plot(support, color=color.green, linewidth=1, title="Support Level")
plot(resistance, color=color.red, linewidth=1, title="Resistance Level")
// Plot reversal patterns on the chart for visualization
plotshape(series=hammerAtSupport, location=location.belowbar, color=color.green, style=shape.labelup, text="Hammer at Support")
plotshape(series=engulfingAtSupport, location=location.belowbar, color=color.green, style=shape.labelup, text="Engulfing at Support")
plotshape(series=dojiAtSupport, location=location.belowbar, color=color.green, style=shape.labelup, text="Doji at Support")
plotshape(series=hammerAtResistance, location=location.abovebar, color=color.red, style=shape.labeldown, text="Hammer at Resistance")
plotshape(series=engulfingAtResistance, location=location.abovebar, color=color.red, style=shape.labeldown, text="Engulfing at Resistance")
plotshape(series=dojiAtResistance, location=location.abovebar, color=color.red, style=shape.labeldown, text="Doji at Resistance")