# Accessing previous bar's close

**URL:** <https://community.tradovate.com/t/accessing-previous-bars-close/8294>\
**Category:** Custom Drawings\
**Created:** [November 29, 2023, 6:04am UTC](https://community.tradovate.com/t/accessing-previous-bars-close/8294 "2023-11-29T06:04:33Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![funk101](https://avatars.discourse-cdn.com/v4/letter/f/f14d63/32.png) [@funk101](https://community.tradovate.com/u/funk101)\
**Post date:** [November 29, 2023, 6:04am UTC](https://community.tradovate.com/t/accessing-previous-bars-close/8294/1 "2023-11-29T06:04:33Z")

</div>

How do I access the previous bar’s data? high(), low(), close(). Please, I see many questions regarding this but absolutely no answers.

---

<div class="post-metadata">

**Author:** ![Goldanker](https://avatars.discourse-cdn.com/v4/letter/g/5e9695/32.png) [@Goldanker](https://community.tradovate.com/u/Goldanker)\
**Post date:** [November 29, 2023, 9:10am UTC](https://community.tradovate.com/t/accessing-previous-bars-close/8294/2 "2023-11-29T09:10:10Z")

</div>

This one is fairly easy:

map(d,index, history) {

```
        const currentHigh = d.high();
        const currentLow = d.low();
        
        const prevHigh = history.prior().high();
        const prevLow = history.prior().low();

```

}

Other commands you can find here:

> <https://github.com/tradovate/custom-indicators/blob/master/typescript/TimeSeries.d.ts#L62>

I would suggest you go through tradovates custom indicator intro:

[https://tradovate.github.io/custom-indicators/pages/Tutorial/index.html](https://tradovate.github.io/custom-indicators/pages/Tutorial/index.html)

I wouldn´t call it a tutorial.

Latter day traders youtube playlist helped me too.

https://www.youtube.com/embed/videoseries?list=PL3QPzzKKYyzV9ou67qLEEi3sMJnxXejSh&wmode=transparent&rel=0&autohide=1&showinfo=1&enablejsapi=1

---

<div class="post-metadata">

**Author:** ![funk101](https://avatars.discourse-cdn.com/v4/letter/f/f14d63/32.png) [@funk101](https://community.tradovate.com/u/funk101)\
**Post date:** [November 29, 2023, 9:47am UTC](https://community.tradovate.com/t/accessing-previous-bars-close/8294/3 "2023-11-29T09:47:01Z")

</div>

Thank you. Some of the links will help I’m sure. I must say, so far the _developer_ experience has been nothing less than _brutal_ here 😉

---

<div class="post-metadata">

**Author:** ![Goldanker](https://avatars.discourse-cdn.com/v4/letter/g/5e9695/32.png) [@Goldanker](https://community.tradovate.com/u/Goldanker)\
**Post date:** [November 29, 2023, 1:20pm UTC](https://community.tradovate.com/t/accessing-previous-bars-close/8294/4 "2023-11-29T13:20:52Z")

</div>

Update:

since index is set to 0 at the start, you need to add an if clause:

map(d,index, history) {

```auto
if(index > 0){
        const currentHigh = d.high();
        const currentLow = d.low();
        
        const prevHigh = history.prior().high();
        const prevLow = history.prior().low();

```

}

}
