Tesi
CCI-gated ATR ratchet — long on a bullish wick break of the trail, short on the mirror.
Si adatta ai setup Trend following — funziona meglio quando il comportamento del mercato sottostante combacia con la tesi, e si rompe quando no. Abbinala alla modalità walk-forward del backtester prima di impegnare capitale reale.
Selective entries — the wick-cross condition is strict, so trades fire only when momentum really pushes through. Strong in trending regimes, quiet during balanced ranges.
Set di regole YAML
Incollalo nella scheda «Text» del Strategy Designer, oppure usa il pulsante della dashboard sopra per caricarlo come template.
_template:
title: Trend Magic — CCI-gated ATR ratchet
category: trend_following
skill: intermediate
name: trend_magic
weight: 1.0
long_only: false
indicators:
tm:
kind: trend_magic
period: 20
atr_period: 5
coeff: 1.0
low_:
kind: sma
period: 1
source: low
high_:
kind: sma
period: 1
source: high
entry:
combine: OR
rules:
- combine: AND
direction: long
rules:
- {lhs: {indicator: low_}, op: crosses_up, rhs: {indicator: tm, field: trail}}
- combine: AND
direction: short
rules:
- {lhs: {indicator: high_}, op: crosses_down, rhs: {indicator: tm, field: trail}}
exit:
combine: OR
rules:
- {lhs: {indicator: tm, field: state}, op: crosses_down, rhs: {value: 0}}
- {lhs: {indicator: tm, field: state}, op: crosses_up, rhs: {value: 0}}
risk:
trailing_stop_pct: 0.04
cooldown_bars: 2
Indicatori
tmTrend Magic (period 20, ATR 5, coeff 1.0)Port of KivancOzbilgic's Pine v4 Trend Magic: an SMA-of-TR ATR band ratcheted by the CCI(20) regime — up while CCI ≥ 0, down while CCI < 0.
low_ / high_SMA(1) wick wrappers (low / high)One-bar SMAs over low and high so the wick-based crossing predicates have tracked previous values. The native bar.low / bar.high collapse prev = now and never fire crossings.
Condizioni d'ingresso
Il bot apre una posizione nella candela successiva al verificarsi di tutte le condizioni qui sotto.
- Long when the bar's low wick crosses up through the Trend Magic trail line.
- Short when the high wick crosses down through the trail line.
Condizioni di uscita
Una qualsiasi delle condizioni qui sotto chiude la posizione.
- CCI regime flip through zero closes the active position.
- 4% trailing stop, 2-bar cooldown.
Comportamento atteso
Selective entries — the wick-cross condition is strict, so trades fire only when momentum really pushes through. Strong in trending regimes, quiet during balanced ranges.
Carattere della curva di equity, non una previsione di rendimento. I backtest non sono promesse sulla performance live.
Provala con i tuoi dati
Apri il template nella dashboard per fare backtest su BTC, ETH o qualsiasi simbolo CCXT — oppure copia il YAML nel Strategy Designer per modificarlo prima.
Il comportamento passato nei backtest non garantisce la performance futura. I mercati cambiano; i set di regole vanno rivalidati. Si fa trading a proprio rischio.