DMI Trend Filter

DMI Trend Filter is a strategy that trades EURJPY on 1-hour bars. It holds at most 1 open trade and reverses on an opposite signal.

core language

dmi-trend-filter.abx
1strategy "DMI Trend Filter"
2market: EURJPY
3bars: 1h
4max_open: 1
5opposite: reverse
6
7input adx_floor = 25
8
9d = dmi(14)
10trending = d.adx > adx_floor
11
12when trending and crosses_above(d.plus, d.minus):
13buy risk: 1%, stop: psar(), target: 3R
14
15when trending and crosses_above(d.minus, d.plus):
16sell risk: 1%, stop: psar(), target: 3R
17
18plot psar(), style: circles, color: yellow
What this script says

DMI Trend Filter is a strategy that trades EURJPY on 1-hour bars. It holds at most 1 open trade and reverses on an opposite signal.

You can change one input: adx_floor (default 25).

It calculates d as the directional movement (length 14) and trending as whether d.adx is above adx_floor.

When trending and d.plus crosses above d.minus, it buys at market, risking 1% of the balance, with a stop at the parabolic SAR and with a target 3R from the entry.

When trending and d.minus crosses above d.plus, it sells at market, risking 1% of the balance, with a stop at the parabolic SAR and with a target 3R from the entry.

On the chart, it plots the parabolic SAR.

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

Create my free account