# Values that carry over: starts

A name reading its own prev, with a starts line for the first bar.

A value that builds up from bar to bar (a trailing stop, a counter, a state) reads its own `prev`. A `starts` line says what `prev` gives before there is an earlier bar. This is Pine's `var`.

**A trailing stop**

```vex
name("ATR stop", where = chart)

stop starts close
stop = if close > prev(stop)
       then max(prev(stop), close - 2 * atr(14))
       else min(prev(stop), close + 2 * atr(14))
plot(stop, "Stop", style = steps)
```

**A yes/no state**

```vex
name("Long or flat", where = pane)

long starts false
long = if crosses_above(close, ema(close, 50)) then true
       else if crosses_below(close, ema(close, 50)) then false
       else prev(long)
plot(long ? 1 : 0, "Long", style = steps)
```

Lines may read each other's `prev` in any order, so counters that reset each other work:

```vex
name("Run counters", where = pane)

rises starts 0
falls starts 0
rises_next = if close > open then prev(rises) + 1 else prev(rises)
falls_next = if close < open then prev(falls) + 1 else prev(falls)
rises = if falls_next > 3 then 0 else rises_next
falls = if rises_next > 3 then 0 else falls_next
plot(rises, "Rises")
plot(falls, "Falls")
```

See also: [starts](/documentation/vex/reference/formulas#starts), [Looking back: prev](/documentation/vex/looking-back-prev)
