# London Open Breakout

> London Open Breakout is a strategy that trades GBPUSD on 5-minute bars. It holds at most 1 open trade and trades only during the London session.

Source: https://algobarsx.com/docs/ex-13-london-open-breakout/

```algobarsx
strategy "London Open Breakout"
    market: GBPUSD
    bars: 5m
    max_open: 1
    trade_only: within sessions london

input range_bars = 12
input buffer = 2 pips

range_high = highest(high, range_bars)
range_low = lowest(low, range_bars)

when time_of_day == 08:00 max 1 per day:
    buy stop: range_high + buffer, risk: 0.5%, stop_loss: range_low - buffer, target: 2R, expires: 24 bars, tag: "breakout"
    sell stop: range_low - buffer, risk: 0.5%, stop_loss: range_high + buffer, target: 2R, expires: 24 bars, tag: "breakout"

when time_of_day >= 16:00:
    close_all tag: "breakout"
    cancel orders.pending(tag: "breakout")

plot range_high, color: green, style: step
plot range_low, color: red, style: step
```
What this script says

London Open Breakout is a strategy that trades GBPUSD on 5-minute bars. It holds at most 1 open trade and trades only during the London session.

You can change 2 inputs: `range_bars` (default 12) and `buffer` (default 2 pips).

It calculates `range_high` as the highest high of the last `range_bars` bars and `range_low` as the lowest low of the last `range_bars` bars.

When the time of day is 08:00 (at most 1 time per day), it buys with a stop order at `range_high` plus `buffer`, risking 0.5% of the balance, with a stop-loss at `range_low` minus `buffer`, with a target 2R from the entry, expiring after 24 bars and tagged "breakout"; it also sells with a stop order at `range_low` minus `buffer`, risking 0.5% of the balance, with a stop-loss at `range_high` plus `buffer`, with a target 2R from the entry, expiring after 24 bars and tagged "breakout".

When the time of day is at or above 16:00, it closes all trades tagged "breakout" and cancels pending orders tagged "breakout".

On the chart, it plots `range_high` and `range_low`.
