
Đây là một hệ thống chiến lược kết hợp nhận dạng hình dạng phân tích kỹ thuật đa dạng và mức kháng cự hỗ trợ. Chiến lược này được thực hiện để đưa ra quyết định giao dịch chủ yếu bằng cách nhận ra hình dạng hai đáy ( hình dạng đáy của Adam và Eve), kết hợp với mức Fibonacci và đường kháng cự hỗ trợ.
Chiến lược sử dụng cơ chế xác minh ba lần để đưa ra quyết định giao dịch: đầu tiên, thông qua các thuật toán cụ thể để xác định hình dạng hai đáy, bao gồm “bottom Adam” sắc nét hơn và “bottom Eve” hình tròn hơn; tiếp theo, sử dụng các mức Fibonacci hồi phục ((0.618 và 1.618) để xác định khu vực mục tiêu; và cuối cùng, bằng cách xác nhận mức kháng cự hỗ trợ để xác nhận giao dịch. Tạo ra tín hiệu giao dịch cần đáp ứng các điều kiện về nhận dạng hình dạng, mức Fibonacci và mức kháng cự hỗ trợ. Cụ thể, kích hoạt nhiều tín hiệu khi mức kháng cự hỗ trợ cao hơn 1.618 độ mở rộng Fibonacci và kích hoạt tín hiệu không khí khi mức kháng cự hỗ trợ thấp hơn 0.618 độ trở lại.
Chiến lược này xây dựng một hệ thống giao dịch tương đối hoàn hảo bằng cách sử dụng các phương pháp phân tích kỹ thuật đa dạng như nhận dạng hình thức, mức Fibonacci và đường kháng cự hỗ trợ. Ưu điểm của chiến lược là cơ chế xác minh nhiều lần cung cấp độ tin cậy cao, và khả năng điều chỉnh của nó cũng cho phép nó thích nghi với các môi trường thị trường khác nhau. Mặc dù có một số rủi ro vốn có, chiến lược này có khả năng đạt được hiệu suất ổn định trong giao dịch thực tế thông qua việc tối ưu hóa và hoàn thiện liên tục.
/*backtest
start: 2019-12-23 08:00:00
end: 2024-12-04 00:00:00
period: 1d
basePeriod: 1d
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=5
strategy("Double Bottom with Support/Resistance Strategy - Aynet", overlay=true)
// Inputs
lookbackPeriod = input(21, "Lookback Period")
swingLowThreshold = input(1.5, "Swing Low Threshold")
fibLevel1 = input(0.618, "Fibonacci Level 1")
fibLevel3 = input(1.618, "Fibonacci Level 2")
srPeriod = input(21, "Support/Resistance Period")
srThreshold = input(3, "Support/Resistance Touch Points")
// Support/Resistance Function
get_sr_level(idx) =>
var level = 0.0
var count = 0
if bar_index % srPeriod == 0
highCount = 0
lowCount = 0
for i = 0 to srPeriod - 1
if math.abs(high[i] - high) < (high * 0.001)
highCount += 1
if math.abs(low[i] - low) < (low * 0.001)
lowCount += 1
if highCount >= srThreshold
level := high
count := highCount
if lowCount >= srThreshold
level := low
count := lowCount
[level, count]
// Pattern Detection Functions
isSwingLow(src, left, right) =>
isLow = true
for i = 0 to left + right
if src[i] < src[right]
isLow := false
isLow
getSpikeSharpness(index) =>
priceRange = high[index] - low[index]
bodyRange = math.abs(close[index] - open[index])
sharpness = priceRange / bodyRange
sharpness
// Pattern Variables
var float firstBottom = na
var float secondBottom = na
var bool isAdam = false
var bool isEve = false
var float level1Value = na
var float level3Value = na
// Pattern Detection
bottom = isSwingLow(low, lookbackPeriod, lookbackPeriod)
if bottom
sharpness = getSpikeSharpness(0)
if na(firstBottom)
firstBottom := low
isAdam := sharpness > swingLowThreshold
else if low <= firstBottom * 1.02 and low >= firstBottom * 0.98
secondBottom := low
isEve := sharpness <= swingLowThreshold
// Calculate Fibonacci
if not na(secondBottom)
highPoint = ta.highest(high, lookbackPeriod)
fibDistance = highPoint - math.min(firstBottom, secondBottom)
level1Value := math.min(firstBottom, secondBottom) + fibDistance * fibLevel1
level3Value := math.min(firstBottom, secondBottom) + fibDistance * fibLevel3
// Get S/R Level
[srLevel, srCount] = get_sr_level(0)
// Trading Logic
longCondition = srLevel > level3Value
shortCondition = srLevel < level1Value
if longCondition
strategy.entry("Long", strategy.long)
if shortCondition
strategy.entry("Short", strategy.short)
// Reset Pattern
if high > ta.highest(high[1], lookbackPeriod)
firstBottom := na
secondBottom := na
isAdam := false
isEve := false
var table logo = table.new(position.top_right, 1, 1)
table.cell(logo, 0, 0, 'Double Bottom with Support/Resistance Strategy - Aynet', text_size=size.large, text_color=color.white)
// Plots
plot(level1Value, "0.236", color=color.rgb(245, 0, 0), style=plot.style_line)
plot(level3Value, "0.618", color=color.rgb(82, 166, 255), style=plot.style_line)
plot(srLevel, "S/R Level", color=color.white)
plotshape(bottom and not na(firstBottom) and na(secondBottom), "Adam Bottom", shape.circle, location.belowbar, color.green)
plotshape(bottom and not na(secondBottom), "Eve Bottom", shape.circle, location.belowbar, color.yellow)