Hedged Breakout

Hedged Breakout is a strategy that trades EURUSD on 1-hour bars. It holds at most 2 open trades (1 per side) and hedges on an opposite signal.

core language

hedged-breakout.abx
1strategy "Hedged Breakout"
2market: EURUSD
3bars: 1h
4opposite: hedge
5max_open: 2
6max_open_per_side: 1
7
8when crosses_above(close, highest(high, 24)[1]):
9buy risk: 0.5%, stop: 40 pips, target: 80 pips, tag: "up"
10
11when crosses_below(close, lowest(low, 24)[1]):
12sell risk: 0.5%, stop: 40 pips, target: 80 pips, tag: "down"
13
14for trade in trades.open():
15if trade.bars_open >= 48:
16close trade
What this script says

Hedged Breakout is a strategy that trades EURUSD on 1-hour bars. It holds at most 2 open trades (1 per side) and hedges on an opposite signal.

When the close crosses above the previous bar's highest high of the last 24 bars, it buys at market, risking 0.5% of the balance, with a stop 40 pips from the entry, with a target 80 pips from the entry and tagged "up".

When the close crosses below the previous bar's lowest low of the last 24 bars, it sells at market, risking 0.5% of the balance, with a stop 40 pips from the entry, with a target 80 pips from the entry and tagged "down".

On each bar, it goes through each trade in open trades and checks whether trade.bars_open is at or above 48 and, if so, closes trade.

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

Create my free account