Parabolic SAR扇形跟踪止损策略是一个基于Parabolic SAR指标的交易策略。该策略旨在识别趋势的反转点,在趋势反转时及时止损退出仓位。
Parabolic SAR指标能够识别价格趋势并给出潜在的反转信号。当SAR点上穿K线时代表着由多头进入空头;当SAR点下穿K线时代表由空头进入多头。
该策略基于Parabolic SAR指标的这一特性,在SAR点穿越K线时识别出趋势反转,并相应地进行做多或做空操作。具体来说,策略逻辑如下:
计算Parabolic SAR值。
判断是否有趋势反转信号。如果SAR点从上方穿越到K线下方,代表空头信号,做空;如果SAR点从下方穿越到K线上方,代表多头信号,做多。
在穿越发生时开仓,并以反向的SAR点再次穿越K线时平仓止损。
利用Parabolic SAR指标识别趋势反转点,避免在趋势中反向操作。
在识别到反转信号时快速开仓,捕捉趋势的更替。
设定SAR再次穿越K线的止损点,可以快速止损,及时控制亏损。
策略思路简单清晰,容易实现。
Parabolic SAR指标可能会产生大量假信号,造成不必要的交易。可以适当调整SAR的参数,降低假信号率。
快速反转的市场中,容易被套。可以考虑增加过滤条件,避开剧烈波动的时间段。
止损点过于靠近可能会过于频繁止损。可以适当放宽止损范围,给予价格一定的回调空间。
仅依靠一个指标易受特定市场限制,可考虑加入其它指标或过滤条件来提高拟合性。
Parabolic SAR扇形跟踪止损策略利用Parabolic SAR指标的趋势识别能力,在趋势反转时快速止损切换方向。策略思路简单清晰,容易掌握。但仅依靠Parabolic SAR一个指标也存在一定局限性,实际应用中需要综合考虑市场环境,适当调整参数,并配合其他技术指标来实现。
/*backtest
start: 2023-08-16 00:00:00
end: 2023-09-15 00:00:00
period: 3h
basePeriod: 15m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=4
strategy(title="Parabolic SAR Strategy (on close) [QuantNomad]", shorttitle="SAR Strategy [QN]", overlay=true)
start = input(0.02)
increment = input(0.02)
maximum = input(0.2)
psar = 0.0 // PSAR
af = 0.0 // Acceleration Factor
trend_dir = 0 // Current direction of PSAR
ep = 0.0 // Extreme point
sar_long_to_short = trend_dir[1] == 1 and close <= psar[1] // PSAR switches from long to short
sar_short_to_long = trend_dir[1] == -1 and close >= psar[1] // PSAR switches from short to long
trend_change = barstate.isfirst[1] or sar_long_to_short or sar_short_to_long
// Calculate trend direction
trend_dir := barstate.isfirst[1] and close[1] > open[1] ? 1 :
barstate.isfirst[1] and close[1] <= open[1] ? -1 :
sar_long_to_short ? -1 :
sar_short_to_long ? 1 : nz(trend_dir[1])
// Calculate Acceleration Factor
af := trend_change ? start :
(trend_dir == 1 and high > ep[1]) or
(trend_dir == -1 and low < ep[1]) ?
min(maximum, af[1] + increment) :
af[1]
// Calculate extreme point
ep := trend_change and trend_dir == 1 ? high :
trend_change and trend_dir == -1 ? low :
trend_dir == 1 ? max(ep[1], high) :
min(ep[1], low)
// Calculate PSAR
psar := barstate.isfirst[1] and close[1] > open[1] ? low[1] :
barstate.isfirst[1] and close[1] <= open[1] ? high[1] :
trend_change ? ep[1] :
trend_dir == 1 ? psar[1] + af * (ep - psar[1]) : psar[1] - af * (psar[1] - ep)
plot(psar, style=plot.style_cross, color=trend_dir == 1 ? color.green : color.red, linewidth = 2)
// Strategy
strategy.entry("Long", true, when = sar_short_to_long)
strategy.entry("Short", false, when = sar_long_to_short)