
Chiến lược theo dõi xu hướng SAR parallax 6.0 là một chiến lược giao dịch toàn diện, sử dụng chỉ số SAR parallax để tạo tín hiệu giao dịch khi xu hướng đảo ngược. Chiến lược này áp dụng cho nhiều thị trường tài chính, bao gồm tiền điện tử, cổ phiếu, ngoại hối và hàng hóa, nhằm giúp các nhà giao dịch sử dụng phương pháp hệ thống để giao dịch ra khỏi thị trường, do đó kiếm lợi nhuận trong các biến động thị trường ở nhiều hướng.
Chiến lược này dựa trên các nguyên tắc sau:
Các lợi thế chính của chiến lược theo dõi xu hướng SAR 6.0 bao gồm:
Mặc dù có những lợi thế như trên, chiến lược này vẫn có một số rủi ro tiềm ẩn:
Chiến lược SAR theo dõi xu hướng 6.0 cung cấp một phương pháp giao dịch xu hướng có hệ thống. Bằng cách theo dõi các chỉ số SAR theo dõi, chiến lược có thể nắm bắt cơ hội đảo ngược xu hướng. Đồng thời, chiến lược này áp dụng các điều kiện nhập cảnh và xuất cảnh nghiêm ngặt và thiết lập quy tắc dừng lỗ để kiểm soát rủi ro. Mặc dù có một số lợi thế của chiến lược, nhưng vẫn có một số hạn chế và rủi ro tiềm ẩn.
/*backtest
start: 2024-02-29 00:00:00
end: 2024-03-07 00:00:00
period: 1m
basePeriod: 1m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=5
strategy("SAR Trend 6.0", default_qty_type = strategy.percent_of_equity, default_qty_value =20, initial_capital=500, commission_type=strategy.commission.percent, commission_value=0.08, pyramiding=5 )
// Parabolic SAR Parameters
start = input(0.02, title="Start Value")
increment = input(0.02, title="Increment Value")
maximum = input(0.2, title="Maximum Value")
long_win=input(0.1,title = "Preceding Increase for Long (%)")/100
short_win=input(2,title = "Preceding Decrease for Short (%)")/100
lose_pct=input (0.5, title="Stop Loss Percentage")
win_pct_long=input(0.2,title = "Take Profit for Long Positions")
win_pct_short=input(0.1,title = "Take Profit for Short Positions")
start1 = input(0.02, title="Start Value (1H)")
increment1 = input(0.02, title="Increment Value (1H)")
maximum1 = input(0.2, title="Maximum Value (1H)")
// Calculating Parabolic SAR
sarValue = ta.sar(start, increment, maximum)
// Generating Trading Signals
longSignal = ta.crossover(close, sarValue)
shortSignal = ta.crossunder(close, sarValue)
// Get Parabolic SAR value for 1-hour time frame
sarValue_1h = request.security(syminfo.tickerid, "5", ta.sar(start1, increment1, maximum1)[1])
// Generating Trading Signals
longSignal1 = close > sarValue_1h
shortSignal1 = close < sarValue_1h
if longSignal and (close - open)/open > long_win and longSignal1
strategy.entry("Long", strategy.long)
if shortSignal and (open - close)/open > short_win and shortSignal1
strategy.entry("Short", strategy.short)
if strategy.position_size > 0 and shortSignal and (close - strategy.position_avg_price)/strategy.position_avg_price > win_pct_long
strategy.close_all("Take Profit")
if strategy.position_size < 0 and longSignal and (strategy.position_avg_price - close)/strategy.position_avg_price > win_pct_short
strategy.close_all("Take Profit")
if strategy.position_size > 0 and (strategy.position_avg_price - close)/strategy.position_avg_price > lose_pct
strategy.close_all("Stop Loss")
if strategy.position_size < 0 and (close - strategy.position_avg_price)/strategy.position_avg_price > lose_pct
strategy.close_all("Stop Loss")