# Heikin-Ashi Trend

> Heikin-Ashi Trend is a strategy that trades BTCUSD on 1-hour Heikin-Ashi bars. It takes long trades only.

Source: https://algobarsx.com/docs/ex-20-heikin-ashi-trend/

```algobarsx
strategy "Heikin-Ashi Trend"
    market: BTCUSD
    bars: heikin_ashi(1h)
    direction: long

input slow = 50

when close > open and close[1] > open[1] and close > ema(close, slow):
    buy risk: 1%, stop: lowest(low, 5), target: 3R

when close < open and close[1] < open[1]:
    close_all
```
What this script says

Heikin-Ashi Trend is a strategy that trades BTCUSD on 1-hour Heikin-Ashi bars. It takes long trades only.

You can change one input: `slow` (default 50).

When the close is above the open and the previous bar's close is above the previous bar's open and the close is above the EMA of the close over `slow` bars, it buys at market, risking 1% of the balance, with a stop at the lowest low of the last 5 bars and with a target 3R from the entry.

When the close is below the open and the previous bar's close is below the previous bar's open, it closes all trades.
