Appearance

Personalize your experience

Mode
Accent Color
Direction
MarketplacestrategiesAutocorrelation Fade
QuaScript

Autocorrelation Fade

Free

Fades outsized bars in a significant reversal regime

0.0(0)
0 installs 0 0 comments
Q
159 listings

The QuaTick team's QuaScript analyses, run by the native C++ engine.

View Profile
quascriptstrategymean-reversionautocorrelation
Free
Backtest this strategy Open in QuaTick IDE Edit in IDE
Version
Updated
Compatible

Live engine preview

QuaScriptQuaScript

The QuaScript engine's own output on the chart the terminal uses. Change the settings or edit the code and press Run to recompute it.

Autocorrelation Fadeengine result
Loading the engine result…
quatick-charts · QuaScript engine on synthetic 1-minute bars · drag to pan · scroll to zoom · Run executes the script on the engine (⌘/Ctrl+Enter while editing)

About

Fades outsized one-bar moves, but only while one-bar returns are significantly negatively autocorrelated, i.e. while the market has been giving back its moves. Outside that regime the same moves are left alone. Trades are short-lived by design. Entry: lag-1 autocorrelation below minus the significance band, and the bar's return beyond k standard deviations; the fade is against that bar. Exit: target half the bar's range back, ATR stop, or after `hold` bars. Risk: 1 % per trade. Method: sample autocorrelation with the 2 / sqrt(n) significance band.


Settings

Autocorrelation window: 150

Move size (sigma): 1.8

Maximum bars held: 6

Stop (ATR): 1.5


Measured backtests

Run by the backtest engine on public candles, 2025-11-01 to 2026-11-01, with the script's own commission and slippage, on BTCUSDT 1h (Binance) and ETHUSDT 1h (Binance). The figures per market are in the Measured backtest panel below. Past results do not predict future returns.


Backtest it yourself

Open it on the backtesting page to run it on any symbol, interval and date range, then use Monte Carlo, optimisation, walk-forward and robustness tests.

Strategy Rules

Entry Conditions

  • ▸ lag-1 autocorrelation below minus the significance band, and the bar's return beyond k standard deviations; the fade is against that bar

Exit Conditions

  • ▸ target half the bar's range back, ATR stop, or after `hold` bars

Measured backtest

BTCUSDT 1h (Binance), 2025-11-01 to 2026-11-01 · backtest engine, script costs included

Backtest this strategy

-4.3%

Return

-1.43

Sharpe

-6.0%

Max DD

47.1%

Win Rate

17

Trades

MarketTradesReturnSharpeMax DDWin rateProfit factor
BTCUSDT 1h17-4.3%-1.43-6.0%47.1%0.45
ETHUSDT 1h6-1.2%-0.62-1.9%50.0%0.58

Past results on historical data do not predict future returns.

Source Code

Edit in IDE
quascript
1strategy "Autocorrelation Fade" {
2 overlay = true
3 capital = 100000
4 commission = 0.05
5 slippage = 1
6 sizing = risk_percent
7 max_leverage = 1
8 size = 1
9 pyramiding = 1
10}
11/// Fades outsized one-bar moves, but only while one-bar returns are significantly negatively
12/// autocorrelated, i.e. while the market has been giving back its moves. Outside that regime the
13/// same moves are left alone. Trades are short-lived by design.
14/// Entry: lag-1 autocorrelation below minus the significance band, and the bar's return beyond
15/// k standard deviations; the fade is against that bar. Exit: target half the bar's range back,
16/// ATR stop, or after `hold` bars. Risk: 1 % per trade.
17/// Method: sample autocorrelation with the 2 / sqrt(n) significance band.
18use "viz/premium" as pr
19len = param.int(150, title = "Autocorrelation window", min = 30, max = 3000, group = "Regime")
20k_sd = param.float(1.8, title = "Move size (sigma)", min = 0.5, max = 5, step = 0.1, group = "Entry")
21hold = param.int(6, title = "Maximum bars held", min = 1, max = 100, group = "Exit")
22stop_k = param.float(1.5, title = "Stop (ATR)", min = 0.3, max = 6, step = 0.1, group = "Risk")
23r = math.log(close / close[1])
24ac = stat.autocorr(r, len, 1)
25sd_now = stat.stdev(r, len)
26sd = sd_now[1]
27sig = 2 / math.sqrt(len)
28reverting = ac < -sig
29a = ta.atr(20)
30big_up = r > k_sd * sd
31big_dn = r < -k_sd * sd
32flat = position.size == 0
33if flat and reverting and big_dn {
34 order.market("L", side.long)
35 exit.bracket("L exit", entry = "L", stop = close - stop_k * a, target = close + 0.5 * (high - low))
36}
37if flat and reverting and big_up {
38 order.market("S", side.short)
39 exit.bracket("S exit", entry = "S", stop = close + stop_k * a, target = close - 0.5 * (high - low))
40}
41if position.size != 0 and position.bars_held >= hold { exit.close_all() }
42risk.max_drawdown(25)
43render.mark(reverting and big_dn, shape = shape.circle, at = anchor.below_bar, color = color.lime.300, size = 0.6, title = "Fade down move")
44render.mark(reverting and big_up, shape = shape.circle, at = anchor.above_bar, color = color.violet.300, size = 0.6, title = "Fade up move")
45render.background(reverting ? color.translucent(color.lime.500, 95) : na)
46persist t = draw.table.create(anchor.top_right, 4, 2)
47if bar.is_last {
48 pr.heading(t, 2, "Autocorrelation Fade", "Strategy · lag-1 reversal regime")
49 pr.row(t, 2, "Lag-1 autocorrelation", str.format("{:+.3f}", ac), reverting ? pr.BULL : pr.LABEL)
50 pr.row(t, 3, "Regime", reverting ? "Reverting: fading" : "No edge", color.white)
51}
52 
Read-only preview. Open in the QuaTick IDE to edit and deploy.

Reviews

No reviews yet. Be the first to review this listing.

Discussion

Sign in to join the discussion. Your posts and replies show up on your profile.