# Coverage-Aware Scalper

> Coverage-Aware Scalper is a strategy that trades EURUSD on 10-tick range bars. It holds at most 1 open trade.

Source: https://algobarsx.com/docs/ex-42-coverage-aware-scalper/

```algobarsx
strategy "Coverage-Aware Scalper"
    market: EURUSD
    bars: range(10)
    max_open: 1

coverage = data.coverage(EURUSD, bars: range(10))
enough_history = coverage.exact and coverage.bars >= 5000

when enough_history and crosses_above(close, ema(close, 34)):
    buy risk: 0.5%, stop: 8 pips, target: 1.5R

when enough_history and crosses_below(close, ema(close, 34)):
    sell risk: 0.5%, stop: 8 pips, target: 1.5R

on start:
    log "Data from {coverage.from} to {coverage.to}, {coverage.bars} bars from {coverage.source}"
```
What this script says

Coverage-Aware Scalper is a strategy that trades EURUSD on 10-tick range bars. It holds at most 1 open trade.

It calculates `coverage` as the data.coverage (symbol EURUSD, bars the range (size 10)) and `enough_history` as whether `coverage.exact` and `coverage.bars` is at or above 5000.

When `enough_history` and the close crosses above the 34-bar EMA of the close, it buys at market, risking 0.5% of the balance, with a stop 8 pips from the entry and with a target 1.5R from the entry.

When `enough_history` and the close crosses below the 34-bar EMA of the close, it sells at market, risking 0.5% of the balance, with a stop 8 pips from the entry and with a target 1.5R from the entry.

When the script starts, it logs "Data from {coverage.from} to {coverage.to}, {coverage.bars} bars from {coverage.source}".
