
Chiến lược này là một hệ thống giao dịch theo dõi xu hướng dựa trên phân tích đa chu kỳ, kết hợp các chỉ số trung bình di chuyển ((EMA) và chỉ số ngẫu nhiên ((Stochastic) để xác định hướng giao dịch và thời gian nhập. Chiến lược xác nhận hướng xu hướng trong chu kỳ 15 phút và tìm kiếm cơ hội nhập cụ thể trong chu kỳ 1-5 phút để tối ưu hóa hiệu suất giao dịch thông qua quản lý rủi ro nghiêm ngặt và lợi nhuận phân chia.
Chiến lược này sử dụng các cơ chế xác minh điều kiện giao dịch đa cấp:
Chiến lược này xây dựng một hệ thống giao dịch theo dõi xu hướng tốt hơn thông qua phân tích đa chu kỳ và kết hợp nhiều chỉ số kỹ thuật. Điểm mạnh cốt lõi của chiến lược là quản lý rủi ro nghiêm ngặt và chương trình thu lợi nhuận linh hoạt, nhưng trong ứng dụng thực tế, vẫn cần tối ưu hóa các tham số thích hợp theo môi trường thị trường và quy mô vốn.
/*backtest
start: 2024-02-19 00:00:00
end: 2025-02-16 08:00:00
period: 1d
basePeriod: 1d
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=6
strategy("15-Min Trend Strategy", overlay=true, default_qty_type=strategy.fixed, default_qty_value=1)
// Define EMA for trend confirmation
ema50 = ta.ema(close, 50)
trendLong = close > ema50
trendShort = close < ema50
// Stochastic settings
length = 14
smoothK = 3
smoothD = 3
stochK = ta.sma(ta.stoch(close, high, low, length), smoothK)
stochD = ta.sma(stochK, smoothD)
// Entry conditions
longCondition = stochK < 30 and trendLong
shortCondition = stochK > 70 and trendShort
// ATR-based stop-loss calculation
atrValue = ta.atr(14)
stopLossLong = close - (1.5 * atrValue)
stopLossShort = close + (1.5 * atrValue)
takeProfitLong = close + (2 * atrValue)
takeProfitShort = close - (2 * atrValue)
// Execute trades
if longCondition
strategy.entry("Long", strategy.long, qty=2)
strategy.exit("TP Long 1", from_entry="Long", qty=1, stop=stopLossLong, limit=takeProfitLong)
strategy.exit("TP Long 2", from_entry="Long", qty=1, stop=stopLossLong, limit=takeProfitLong * 1.5)
if shortCondition
strategy.entry("Short", strategy.short, qty=2)
strategy.exit("TP Short 1", from_entry="Short", qty=1, stop=stopLossShort, limit=takeProfitShort)
strategy.exit("TP Short 2", from_entry="Short", qty=1, stop=stopLossShort, limit=takeProfitShort * 1.5)
// Move SL to breakeven after 50% move to target
if strategy.position_size > 0
if strategy.position_avg_price != 0
moveToBELong = close >= (strategy.position_avg_price + (takeProfitLong - strategy.position_avg_price) * 0.5)
if moveToBELong
strategy.exit("BE Long", from_entry="Long", qty=1, stop=strategy.position_avg_price)
moveToBEShort = close <= (strategy.position_avg_price - (strategy.position_avg_price - takeProfitShort) * 0.5)
if moveToBEShort
strategy.exit("BE Short", from_entry="Short", qty=1, stop=strategy.position_avg_price)