Parabolic SAR strategy
On GC futures from January 2016 to July 2026, the Parabolic SAR strategy lost $50,210 after costs and made money in 6 of 11 years.
TrendSwingDaily barsBacktested Nov 6, 2026
Parabolic SAR backtest, the result
Contract
Gold
-
−$50.2K
Net after costs
After $6,620 in fees and slippage
-
6 of 11
Years that made money
January 2016 to July 2026
-
−$164K
Largest drawdown
Peak to trough, 1 contract
-
−$154
Average trade
296 trades
Net after costs by month, January 2016 to July 2026.
Parabolic SAR rules
A stop trails price and speeds up as the trend runs. A close through it reverses the position, so it is always in the market.
A drawing of the rules on a made-up day, not a result.
- On the CME trading day's bars, the acceleration factor starts at 0.02, rises by 0.02 with each new extreme in the trend's direction, and stops at 0.2.
- Each day the SAR is a stop and reverse, tested on every one-second close: long, a close at or below it turns the position short; short, a close at or above it turns it long; at most once a day.
- At the day's close the next day's SAR is SAR + AF x (EP - SAR), held beyond the last two days' range.
- The strategy is always in the market.
- Decides on
- Daily bars
- Holds
- Overnight and across days
- Parameters
- step 0.02, af max 0.2, session minute 1,080
Results by year
It made money in 6 of 11 years on GC. Its best year was 2023, +$39,207, and its worst 2020, −$51,103.
| Year | Net | Trades | Win rate | Drawdown | Buy and hold |
|---|---|---|---|---|---|
| 2016 | +$9,114 | 24 | 46% | −$20,624 | +$6,888 |
| 2017 | +$19,810 | 25 | 48% | −$14,156 | +$13,120 |
| 2018 | −$11,731 | 30 | 33% | −$17,913 | −$5,270 |
| 2019 | −$24,561 | 30 | 33% | −$36,441 | +$19,820 |
| 2020 | −$51,103 | 30 | 27% | −$65,551 | +$30,139 |
| 2021 | +$25,792 | 26 | 54% | −$17,061 | −$8,111 |
| 2022 | −$13,714 | 30 | 37% | −$36,080 | −$4,541 |
| 2023 | +$39,207 | 25 | 44% | −$14,242 | +$13,369 |
| 2024 | +$2,918 | 29 | 38% | −$37,257 | +$43,279 |
| 2025 | +$22,593 | 30 | 33% | −$66,327 | +$151,669 |
| 2026, Jan to Jul | −$68,533 | 17 | 35% | −$164,015 | −$38,803 |
Parabolic SAR backtest results
On GC it lost $43,590 before costs, then paid $6,620 in fees and slippage.
- Net = before costs − fees − slippage
- GC: −$43,590 − $1,220 − $5,400 = −$50,210
The interval holds zero: this test cannot tell the average trade from no edge.
Parabolic SAR code and Pine Script
The strategy as the backtest ran it, and the Pine Script our compiler wrote from it for TradingView.
1from atlantive import BUY, NEW_YORK, SELL, Bars, Session, Strategy2 3 4class ParabolicSar(Strategy):5 """Wilder's Parabolic SAR on daily bars, step 0.02 to 0.2, always in the market.6 7 A day is the CME trading day, 18:00 to 17:00 New York, built from one-second bars. After two days8 the trend starts up if the second close is above the first (down otherwise), its SAR at the two9 days' extreme on the other side and its extreme point (EP) at the second day's. Each day the SAR10 is a stop and reverse, tested on every one-second close: long, a close at or below it turns the11 position short; short, a close at or above it turns it long; at most once a day. At the day's12 close the SAR for the next day is SAR + AF x (EP - SAR), held beyond the last two days' range13 (no higher than their lows when long, no lower than their highs when short). A new extreme in14 the trend's direction moves the EP there and raises the AF by 0.02, to 0.2 at most. On a15 reversal day the SAR restarts at the old EP (or the day's extreme beyond it), the EP at the16 day's extreme in the new direction, and the AF at 0.02.17 """18 19 data = "bars"20 21 class Params:22 step: float = 0.0223 af_max: float = 0.224 session_minute: int = 108025 clip: int = 126 27 class State:28 clock: Session(zone=NEW_YORK)29 bars: Bars(interval_ns=1_000_000_000)30 day_key: int31 day_high: float32 day_low: float33 day_close: float34 days: int35 last_high: float36 last_low: float37 first_close: float38 trend: int39 sar: float40 ep: float41 af: float42 reversed_day: int43 44 def on_event(self, view, ev, orders):45 self.clock.update(ev)46 if not self.bars.update(ev):47 return48 minute = self.clock.prev_minute49 day = self.clock.prev_day50 high = float(self.bars.prev_high)51 low = float(self.bars.prev_low)52 close = float(self.bars.prev_close)53 trade_day = day54 if minute >= self.p.session_minute:55 trade_day = day + 156 if trade_day != self.day_key:57 if self.day_key != 0:58 h = self.day_high59 lo = self.day_low60 self.days += 161 if self.days == 1:62 self.first_close = self.day_close63 elif self.days == 2:64 if self.day_close > self.first_close:65 self.trend = 166 self.sar = min(lo, self.last_low)67 self.ep = h68 else:69 self.trend = -170 self.sar = max(h, self.last_high)71 self.ep = lo72 self.af = self.p.step73 elif self.reversed_day == self.day_key:74 if self.trend == -1:75 self.sar = max(self.ep, h)76 self.ep = lo77 else:78 self.sar = min(self.ep, lo)79 self.ep = h80 self.af = self.p.step81 self.sar = self.sar + self.af * (self.ep - self.sar)82 if self.trend == -1:83 self.sar = max(self.sar, h, self.last_high)84 else:85 self.sar = min(self.sar, lo, self.last_low)86 else:87 if self.trend == 1:88 if h > self.ep:89 self.ep = h90 self.af = min(self.af + self.p.step, self.p.af_max)91 self.sar = self.sar + self.af * (self.ep - self.sar)92 self.sar = min(self.sar, lo, self.last_low)93 else:94 if lo < self.ep:95 self.ep = lo96 self.af = min(self.af + self.p.step, self.p.af_max)97 self.sar = self.sar + self.af * (self.ep - self.sar)98 self.sar = max(self.sar, h, self.last_high)99 self.last_high = h100 self.last_low = lo101 self.day_key = trade_day102 self.day_high = high103 self.day_low = low104 else:105 self.day_high = max(self.day_high, high)106 self.day_low = min(self.day_low, low)107 self.day_close = close108 if self.days < 2:109 return110 if self.reversed_day != trade_day:111 if self.trend == 1 and close <= self.sar:112 self.trend = -1113 self.reversed_day = trade_day114 elif self.trend == -1 and close >= self.sar:115 self.trend = 1116 self.reversed_day = trade_day117 if self.trend == 1:118 if view.position < 0:119 orders.ioc(side=BUY, qty=abs(view.position) + self.p.clip)120 elif view.position == 0:121 orders.ioc(side=BUY, qty=self.p.clip)122 else:123 if view.position > 0:124 orders.ioc(side=SELL, qty=abs(view.position) + self.p.clip)125 elif view.position == 0:126 orders.ioc(side=SELL, qty=self.p.clip) 1//@version=62// ParabolicSar, exported from Atlantive.3// Chart simulation: decisions use completed bars; market orders fill at the next bar open.4// Native fills, fees, data gaps and session boundaries can differ. Re-test on the target symbol.5// Use standard time-based candles and the strategy's timeframe, not synthetic chart prices.6// Pine v6 trims old trade records at its order limit; the strategy keeps calculating.7// Margin is explicitly disabled to retain the native signal simulation's sizing.8strategy("ParabolicSar", overlay=true, initial_capital=100000.0, commission_type=strategy.commission.cash_per_contract, commission_value=1.96, default_qty_type=strategy.fixed, default_qty_value=1, calc_on_every_tick=false, process_orders_on_close=false, slippage=0, margin_long=0, margin_short=0)9 10if timeframe.in_seconds() != 111 runtime.error("ParabolicSar was exported for the 1 second timeframe; set the chart to 1S.")12 13step = input.float(0.02, "step")14af_max = input.float(0.2, "af_max")15session_minute = input.int(1080, "session_minute", minval=-9007199254740991, maxval=9007199254740991)16clip = input.int(1, "clip", minval=-9007199254740991, maxval=9007199254740991)17 18_q_safe_int(x) =>19 if math.abs(x) > 900719925474099120 runtime.error("an integer left the exact chart range; this run cannot be compared faithfully")21 int(x)22_q_int(x) => _q_safe_int(x < 0 ? math.ceil(x) : math.floor(x))23_q_iadd(a, b) => _q_safe_int(a + b)24 25_q_high = _q_int(math.round(high * 1000000000.0))26_q_low = _q_int(math.round(low * 1000000000.0))27_q_close = _q_int(math.round(close * 1000000000.0))28 29var int day_key = 030var float day_high = 0.031var float day_low = 0.032var float day_close = 0.033var int days = 034var float last_high = 0.035var float last_low = 0.036var float first_close = 0.037var int trend = 038var float sar = 0.039var float ep = 0.040var float af = 0.041var int reversed_day = 042// clock: completed chart bar's opening timestamp (America/New_York).43_q_clock_prev_minute = hour(time, "America/New_York") * 60 + minute(time, "America/New_York")44_q_clock_prev_second = _q_clock_prev_minute * 60 + second(time, "America/New_York")45_q_clock_prev_weekday = (dayofweek(time, "America/New_York") + 5) % 746_q_clock_prev_day = int(timestamp("UTC", year(time, "America/New_York"), month(time, "America/New_York"), dayofmonth(time, "America/New_York"), 0, 0) / 86400000)47// Current clock: this chart bar's scheduled close, known without a future bar.48// A native next event after a data gap can carry a later time.49_q_clock_minute = hour(time_close, "America/New_York") * 60 + minute(time_close, "America/New_York")50_q_clock_second = _q_clock_minute * 60 + second(time_close, "America/New_York")51_q_clock_weekday = (dayofweek(time_close, "America/New_York") + 5) % 752_q_clock_day = int(timestamp("UTC", year(time_close, "America/New_York"), month(time_close, "America/New_York"), dayofmonth(time_close, "America/New_York"), 0, 0) / 86400000)53_q_clock_seen = 154int minute_l = na55int day = na56float high_l = na57float low_l = na58float close_l = na59int trade_day = na60float h = na61float lo = na62 63bool _q_running = true64minute_l := _q_int(_q_clock_prev_minute)65day := _q_int(_q_clock_prev_day)66high_l := _q_high * 1.067low_l := _q_low * 1.068close_l := _q_close * 1.069trade_day := _q_int(day)70if minute_l >= session_minute71 trade_day := _q_int(_q_iadd(day, 1))72if trade_day != day_key73 if day_key != 074 h := day_high75 lo := day_low76 days := _q_int(_q_iadd(days, 1))77 if days == 178 first_close := day_close79 else if days == 280 if day_close > first_close81 trend := _q_int(1)82 sar := math.min(lo, last_low)83 ep := h84 else85 trend := _q_int(-1)86 sar := math.max(h, last_high)87 ep := lo88 af := step89 else if reversed_day == day_key90 if trend == -191 sar := math.max(ep, h)92 ep := lo93 else94 sar := math.min(ep, lo)95 ep := h96 af := step97 sar := sar + af * (ep - sar)98 if trend == -199 sar := math.max(sar, math.max(h, last_high))100 else101 sar := math.min(sar, math.min(lo, last_low))102 else103 if trend == 1104 if h > ep105 ep := h106 af := math.min(af + step, af_max)107 sar := sar + af * (ep - sar)108 sar := math.min(sar, math.min(lo, last_low))109 else110 if lo < ep111 ep := lo112 af := math.min(af + step, af_max)113 sar := sar + af * (ep - sar)114 sar := math.max(sar, math.max(h, last_high))115 last_high := h116 last_low := lo117 day_key := _q_int(trade_day)118 day_high := high_l119 day_low := low_l120else121 day_high := math.max(day_high, high_l)122 day_low := math.min(day_low, low_l)123day_close := close_l124if days < 2125 _q_running := false126if _q_running127 if reversed_day != trade_day128 if trend == 1 and close_l <= sar129 trend := _q_int(-1)130 reversed_day := _q_int(trade_day)131 else if trend == -1 and close_l >= sar132 trend := _q_int(1)133 reversed_day := _q_int(trade_day)134if _q_running135 if trend == 1136 if _q_int(strategy.position_size) < 0137 _q_qty1 = _q_int(_q_iadd(math.abs(_q_int(strategy.position_size)), clip))138 if _q_qty1 <= 0139 runtime.error("market order quantity must be a positive whole unit")140 _q_pos1 = _q_int(strategy.position_size)141 if _q_pos1 > 0 or _q_pos1 < 0 and _q_qty1 < -_q_pos1142 runtime.error("this order would add to or partially reduce a position, so its trade ledger would not be faithful")143 strategy.order("q1", strategy.long, _q_qty1)144 else if _q_int(strategy.position_size) == 0145 _q_qty2 = _q_int(clip)146 if _q_qty2 <= 0147 runtime.error("market order quantity must be a positive whole unit")148 _q_pos2 = _q_int(strategy.position_size)149 if _q_pos2 > 0 or _q_pos2 < 0 and _q_qty2 < -_q_pos2150 runtime.error("this order would add to or partially reduce a position, so its trade ledger would not be faithful")151 strategy.order("q2", strategy.long, _q_qty2)152 else153 if _q_int(strategy.position_size) > 0154 _q_qty3 = _q_int(_q_iadd(math.abs(_q_int(strategy.position_size)), clip))155 if _q_qty3 <= 0156 runtime.error("market order quantity must be a positive whole unit")157 _q_pos3 = _q_int(strategy.position_size)158 if _q_pos3 < 0 or _q_pos3 > 0 and _q_qty3 < _q_pos3159 runtime.error("this order would add to or partially reduce a position, so its trade ledger would not be faithful")160 strategy.order("q3", strategy.short, _q_qty3)161 else if _q_int(strategy.position_size) == 0162 _q_qty4 = _q_int(clip)163 if _q_qty4 <= 0164 runtime.error("market order quantity must be a positive whole unit")165 _q_pos4 = _q_int(strategy.position_size)166 if _q_pos4 < 0 or _q_pos4 > 0 and _q_qty4 < _q_pos4167 runtime.error("this order would add to or partially reduce a position, so its trade ledger would not be faithful")168 strategy.order("q4", strategy.short, _q_qty4) How it was tested
The published rules, never tuned on the data, with real costs on every fill. Every strategy here is tested the same way.
- Market data
- CME Globex daily bars, Jan 2, 2016 to Jul 31, 2026
- Rules
- As published, with the published parameters, never tuned on this data
- Size
- 1 contract on every trade
- Contract
- The most traded one, rolled as the market moved
- Fees
- The broker's $0.50 a side, plus CME's and the NFA's fees when the window opens
- Slippage
- 1 tick a side on ES, 2 in NQ's regular session and 3 outside it, 1 on other markets, where it was not measured
- Stops and entries
- Tested on 1-second closes and filled at the next bar
- Contracts traded
- GC: 54 contracts, GCG6 to GCQ66E: 43 contracts, 6EH6 to 6EU6
- Costs paid
- GC: $1,220 in fees, $5,400 in slippage6E: $1,370 in fees, $3,838 in slippage
- Warm-up
- None: each contract reads only its own bars
- Flagged days
- GC: None6E: None Days the data holds too few bars for. Flagged, not removed.
Could you pass
a prop firm challenge
with the Parabolic SAR strategy?
A backtest says whether a strategy makes money. Our AI runs its trades through the rules of every prop firm account, then tells you which one it would pass and at what size.
No card needed. Free credits every month.
- Most money: Blue Guardian Futures Direct 50K, $5,084
- Best payout odds: Funded Futures Family Straight to Funded 50K, 98%
- Fastest pass: Phidias Express to Live 50K, 11 days
$5,084
Median net across 2,000 simulated runs
- Evaluation
- None
- First payout
- 97%
- Fees paid
- $1,521
Median net across 2,000 simulated runs
Questions about the Parabolic SAR strategy
What is the Parabolic SAR strategy?
A stop trails price and speeds up as the trend runs. A close through it reverses the position, so it is always in the market. The rules follow J. Welles Wilder Jr., New Concepts in Technical Trading Systems (1978). Atlantive backtested it on CME futures from January 2016 to July 2026 after costs.
Is the Parabolic SAR strategy profitable on GC futures?
Not in this backtest: on GC futures from January 2016 to July 2026 it lost $50,210 after costs, over 296 trades, positive in 6 of 11 years; on 6E it lost $62,039. Buying and holding one GC contract over the same window made $221,560. The average trade was −$154, its 95% interval −$1,097 to $883. These are hypothetical results of a backtest, not of trading.
What are the Parabolic SAR strategy's rules?
On the CME trading day's bars, the acceleration factor starts at 0.02, rises by 0.02 with each new extreme in the trend's direction, and stops at 0.2. Each day the SAR is a stop and reverse, tested on every one-second close: long, a close at or below it turns the position short; short, a close at or above it turns it long; at most once a day. At the day's close the next day's SAR is SAR + AF x (EP - SAR), held beyond the last two days' range. The strategy is always in the market. The rules follow J. Welles Wilder Jr., New Concepts in Technical Trading Systems (1978). Its parameters are the published ones, never tuned on the data it was tested on.
How was the Parabolic SAR strategy backtested?
On CME Globex data from January 2016 to July 2026, one contract, on daily bars, rolled to the most traded contract as the market moved, with the broker's and CME's fees and the slippage measured on each market. Stops and entries were tested on 1-second closes and filled at the next bar. Nothing was fitted to the data.
Can I run the Parabolic SAR strategy in TradingView?
Yes. The page carries its Pine Script, written by Atlantive's compiler from the same code the backtest ran, for TradingView's strategy tester. A chart's fills and fees can differ from the backtest's, so test it again on the symbol you trade.
Can I change the Parabolic SAR strategy and test it again?
Yes. Rerun it in Atlantive: a new chat opens with the strategy's rules in the box, for you to read, change and send. The agent writes the code, backtests it on the market and window you name, and reports the result with its costs.