Hurst Regime Switch

Hurst Regime Switch is a strategy that trades EURUSD on 4-hour bars. It holds at most 1 open trade.

statistics and matrices

hurst-regime-switch.abx
1strategy "Hurst Regime Switch"
2market: EURUSD
3bars: 4h
4max_open: 1
5
6input window = 200
7
8h = hurst(close, window)
9trending = h > 0.55
10mean_reverting = h < 0.45
11z = zscore(close, 50)
12
13when trending and crosses_above(close, kama(close, 20)):
14buy risk: 1%, stop: 2 * atr(14), target: 3R, tag: "trend"
15
16when mean_reverting and z < -2:
17buy risk: 0.5%, stop: 1.5 * atr(14), target: mean(close, 50), tag: "revert"
18
19when mean_reverting and z > 2:
20sell risk: 0.5%, stop: 1.5 * atr(14), target: mean(close, 50), tag: "revert"
What this script says

Hurst Regime Switch is a strategy that trades EURUSD on 4-hour bars. It holds at most 1 open trade.

You can change one input: window (default 200).

It calculates h as the hurst (source the close, length window), trending as whether h is above 0.55, mean_reverting as whether h is below 0.45 and z as the 50-bar z-score of the close.

When trending and the close crosses above the 20-bar KAMA of the close, it buys at market, risking 1% of the balance, with a stop 2 × the 14-bar ATR from the entry, with a target 3R from the entry and tagged "trend".

When mean_reverting and z is below -2, it buys at market, risking 0.5% of the balance, with a stop 1.5 × the 14-bar ATR from the entry, with a target at the 50-bar average of the close and tagged "revert".

When mean_reverting and z is above 2, it sells at market, risking 0.5% of the balance, with a stop 1.5 × the 14-bar ATR from the entry, with a target at the 50-bar average of the close and tagged "revert".

Try this in the Terminal. AlgoBars is free: $0 a month, no card needed.

Create my free account