Appearance

Personalize your experience

Mode
Accent Color
Direction
MarketplacestrategiesFractal Trend Rider
QuaScript

Fractal Trend Rider

Free

EMA crosses filtered by the fractal dimension of price

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
quascriptstrategytrendfractal
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.

Fractal Trend Riderengine 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

Trades moving-average crosses only when the price path is smooth enough to trend. The Sevcik fractal dimension of price is low (near 1) for a clean trend and high (near 2) for chop; crosses in choppy conditions, where most whipsaws come from, are skipped. Entry: fast EMA crosses the slow EMA while the fractal dimension is below the trend level. Exit: opposite cross, ATR trailing stop, or the path turning choppy. Risk: 1 % per trade. Method: Sevcik (1998) fractal dimension.


Settings

Fast EMA: 21

Slow EMA: 55

Fractal window: 40

Trend level: 1.38

Trailing stop (ATR): 2.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

  • ▸ fast EMA crosses the slow EMA while the fractal dimension is below the trend level

Exit Conditions

  • ▸ opposite cross, ATR trailing stop, or the path turning choppy

Measured backtest

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

Backtest this strategy

-18.6%

Return

-1.05

Sharpe

-25.4%

Max DD

15.6%

Win Rate

128

Trades

MarketTradesReturnSharpeMax DDWin rateProfit factor
BTCUSDT 1h128-18.6%-1.05-25.4%15.6%0.67
ETHUSDT 1h138-1.9%0.02-25.2%15.9%0.97

Past results on historical data do not predict future returns.

Source Code

Edit in IDE
quascript
1strategy "Fractal Trend Rider" {
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/// Trades moving-average crosses only when the price path is smooth enough to trend. The Sevcik
12/// fractal dimension of price is low (near 1) for a clean trend and high (near 2) for chop; crosses
13/// in choppy conditions, where most whipsaws come from, are skipped.
14/// Entry: fast EMA crosses the slow EMA while the fractal dimension is below the trend level.
15/// Exit: opposite cross, ATR trailing stop, or the path turning choppy.
16/// Risk: 1 % per trade. Method: Sevcik (1998) fractal dimension.
17use "viz/premium" as pr
18fast_l = param.int(21, title = "Fast EMA", min = 2, max = 200, group = "Trend")
19slow_l = param.int(55, title = "Slow EMA", min = 5, max = 500, group = "Trend")
20fd_len = param.int(40, title = "Fractal window", min = 10, max = 500, group = "Filter")
21fd_max = param.float(1.38, title = "Trend level", min = 1.05, max = 1.9, step = 0.01, group = "Filter")
22stop_k = param.float(2.5, title = "Trailing stop (ATR)", min = 0.5, max = 8, step = 0.1, group = "Risk")
23f = ta.ema(close, fast_l)
24s = ta.ema(close, slow_l)
25fd = stat.fractal_dim(close, fd_len)
26a = ta.atr(20)
27smooth = fd < fd_max
28up_x = ta.cross_up(f, s)
29dn_x = ta.cross_down(f, s)
30if up_x and smooth {
31 order.market("L", side.long)
32 exit.bracket("L exit", entry = "L", stop = close - stop_k * a, trail_offset = stop_k * a, trail_trigger = close)
33}
34if dn_x and smooth {
35 order.market("S", side.short)
36 exit.bracket("S exit", entry = "S", stop = close + stop_k * a, trail_offset = stop_k * a, trail_trigger = close)
37}
38if (position.side > 0 and dn_x) or (position.side < 0 and up_x) { exit.close_all() }
39risk.max_drawdown(25)
40pf = render.line(f, "Fast EMA", color = smooth ? color.sky.300 : color.slate.500, width = 2)
41ps = render.line(s, "Slow EMA", color = color.translucent(color.slate.300, 30), width = 1.5)
42render.band(pf, ps, color = color.translucent(f > s ? color.sky.500 : color.rose.500, smooth ? 84 : 96), opacity = 1, title = "Trend ribbon")
43persist t = draw.table.create(anchor.top_right, 4, 2)
44if bar.is_last {
45 pr.heading(t, 2, "Fractal Trend Rider", "Strategy · Sevcik dimension filter")
46 pr.row(t, 2, "Fractal dimension", str.format("{:.3f}", fd), smooth ? pr.BULL : pr.LABEL)
47 pr.row(t, 3, "Crosses", smooth ? "Taken" : "Skipped (chop)", color.white)
48}
49 
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.