# EMA Cross

> EMA Cross is a strategy that trades EURUSD on 15-minute bars.

Source: https://algobarsx.com/docs/ex-01-ema-cross/

```algobarsx
strategy "EMA Cross"
    market: EURUSD
    bars: 15m

input fast = 20
input slow = 50

when crosses_above(ema(close, fast), ema(close, slow)):
    buy risk: 1%, stop: 25 pips, target: 2R

when crosses_below(ema(close, fast), ema(close, slow)):
    close_all
```
What this script says

EMA Cross is a strategy that trades EURUSD on 15-minute bars.

You can change 2 inputs: `fast` (default 20) and `slow` (default 50).

When the EMA of the close over `fast` bars crosses above the EMA of the close over `slow` bars, it buys at market, risking 1% of the balance, with a stop 25 pips from the entry and with a target 2R from the entry.

When the EMA of the close over `fast` bars crosses below the EMA of the close over `slow` bars, it closes all trades.
