
Chiến lược này là một hệ thống theo dõi xu hướng cao cấp dựa trên nguyên tắc Fibonacci Reversal. Nó xác định các vùng hỗ trợ và kháng cự tiềm năng bằng cách tính toán động các mức Fibonacci Reversal quan trọng: 23,6%, 38,2%, 50%, 61,8%, 78,6% . Hệ thống sử dụng cửa sổ quay ngược 100 chu kỳ để xác định điểm cao nhất và thấp nhất, và dựa trên đó tính toán các mức Reversal.
Lý luận cốt lõi của chiến lược được xây dựng trên lý thuyết rằng giá sẽ đảo ngược trong xu hướng chính gần mức rút lui Fibonacci quan trọng. Cụ thể:
Đây là một chiến lược giao dịch có hệ thống dựa trên lý thuyết phân tích kỹ thuật cổ điển. Bằng cách thực hiện theo chương trình, nó có tính khách quan và có thể lặp lại. Điểm mạnh cốt lõi của chiến lược là kết hợp lý thuyết Fibonacci với kiểm soát rủi ro nghiêm ngặt, phù hợp để sử dụng trong thị trường đang có xu hướng. Bằng cách tối ưu hóa và hoàn thiện liên tục, chiến lược này có thể duy trì hiệu suất ổn định trong nhiều môi trường thị trường.
/*backtest
start: 2024-11-11 00:00:00
end: 2024-12-10 08:00:00
period: 1h
basePeriod: 1h
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=5
strategy("Fibonacci Retracement Strategy", overlay=true)
// Inputs
lookback_period = input.int(100, title="Lookback Period")
level_1 = input.float(0.236, title="Fibonacci Level 1")
level_2 = input.float(0.382, title="Fibonacci Level 2")
level_3 = input.float(0.5, title="Fibonacci Level 3")
level_4 = input.float(0.618, title="Fibonacci Level 4")
level_5 = input.float(0.786, title="Fibonacci Level 5")
// Calculate highest high and lowest low over the lookback period
high_level = ta.highest(high, lookback_period)
low_level = ta.lowest(low, lookback_period)
// Calculate Fibonacci retracement levels
fib_236 = low_level + (high_level - low_level) * level_1
fib_382 = low_level + (high_level - low_level) * level_2
fib_50 = low_level + (high_level - low_level) * level_3
fib_618 = low_level + (high_level - low_level) * level_4
fib_786 = low_level + (high_level - low_level) * level_5
// Plot Fibonacci levels on the chart
plot(fib_236, color=color.green, title="Fib 23.6%")
plot(fib_382, color=color.blue, title="Fib 38.2%")
plot(fib_50, color=color.orange, title="Fib 50%")
plot(fib_618, color=color.red, title="Fib 61.8%")
plot(fib_786, color=color.purple, title="Fib 78.6%")
// Entry and Exit Conditions
buy_signal = ta.crossover(close, fib_618)
sell_signal = ta.crossunder(close, fib_382)
// Strategy Orders
if buy_signal
strategy.entry("Buy", strategy.long)
// Exit based on stop-loss and take-profit conditions
take_profit = high_level // Exit at the highest Fibonacci level (100%)
stop_loss = low_level // Exit at the lowest Fibonacci level (0%)
strategy.exit("Sell", from_entry="Buy", limit=take_profit, stop=stop_loss)
// Visualization of Signals
plotshape(series=buy_signal, title="Buy Signal", location=location.belowbar, color=color.green, style=shape.labelup, text="BUY")
plotshape(series=sell_signal, title="Sell Signal", location=location.abovebar, color=color.red, style=shape.labeldown, text="SELL")