# Tick Scalper

> Tick Scalper is a strategy that trades XAUUSD on 1-minute bars, checking its rules on every price change. It holds at most 1 open trade.

Source: https://algobarsx.com/docs/ex-10-tick-scalper/

```algobarsx
strategy "Tick Scalper"
    market: XAUUSD
    bars: 1m
    evaluate: tick
    max_open: 1

input max_stretch = 2.0

when crosses_above(close, vwap()) once per bar cooldown 2 bars:
    buy risk: 0.5%, stop: 30 points, target: 1.5R, ghost: true

on tick:
    if not bar.confirmed and close < vwap() - atr(14) * max_stretch:
        close_all side: long
```
What this script says

Tick Scalper is a strategy that trades XAUUSD on 1-minute bars, checking its rules on every price change. It holds at most 1 open trade.

You can change one input: `max_stretch` (default 2.0).

When the close crosses above VWAP (at most once per bar and waiting at least 2 bars between actions), it buys at market, risking 0.5% of the balance, with a stop 30 points from the entry, with a target 1.5R from the entry and kept hidden from the broker until it triggers.

On every price change, it checks whether not the bar has closed and the close is below VWAP minus the 14-bar ATR × `max_stretch` and, if so, closes all long trades.
