# Learning: how to get the High and Low price of a specific bar?

**URL:** <https://community.tradovate.com/t/learning-how-to-get-the-high-and-low-price-of-a-specific-bar/7510>\
**Category:** Custom Indicators\
**Created:** [July 8, 2023, 3:12pm UTC](https://community.tradovate.com/t/learning-how-to-get-the-high-and-low-price-of-a-specific-bar/7510 "2023-07-08T15:12:07Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Scott\_Gaul](https://avatars.discourse-cdn.com/v4/letter/s/b782af/32.png) [@Scott\_Gaul](https://community.tradovate.com/u/Scott_Gaul)\
**Post date:** [July 8, 2023, 3:12pm UTC](https://community.tradovate.com/t/learning-how-to-get-the-high-and-low-price-of-a-specific-bar/7510/1 "2023-07-08T15:12:07Z")

</div>

I am teaching myself how to code indicators.  
How do I get values from a specific bar? For example, if I want the high price of the 5th bar back from the current bar, how would I do that? How can I choose that specific bar? How can I find the high price?  
Thanks for helping me.

---

<div class="post-metadata">

**Author:** ![KE\_vf](https://avatars.discourse-cdn.com/v4/letter/k/f0a364/32.png) [@KE\_vf](https://community.tradovate.com/u/KE_vf)\
**Post date:** [July 13, 2023, 12:27am UTC](https://community.tradovate.com/t/learning-how-to-get-the-high-and-low-price-of-a-specific-bar/7510/2 "2023-07-13T00:27:08Z")

</div>

It really depends on what you’re trying to accomplish. Below are two different scenarios.

You can add something like this to your map{} and remember to add It to the return{}:

map{}

```auto
        const high5CandlesAgo = history.get(i - 5).high();
        const low5CandlesAgo = history.get(i - 5).low();

```

return{}

```auto
            high5CandlesAgo: high5CandlesAgo,
            low5CandlesAgo: low5CandlesAgo

```

and if you want too calculate a level of the current candle relative to the previous candles high or low etc…add it to the return and you can do something like this:

return{}

```auto
            high: d.high(),
            open: d.open(),
            close: d.close(),
            low: d.low(),

```

```auto
function trendPlotter

```

```auto
   if (next !== null) {
                        // Calculate the center point between the prior high and the next candle's open
                        const centerPoint = (prior.high + next.open) / 2;

```

hope that gives you some ideas…

---

<div class="post-metadata">

**Author:** ![Fred\_Naef](https://avatars.discourse-cdn.com/v4/letter/f/dc4da7/32.png) [@Fred\_Naef](https://community.tradovate.com/u/Fred_Naef)\
**Post date:** [July 13, 2023, 6:58am UTC](https://community.tradovate.com/t/learning-how-to-get-the-high-and-low-price-of-a-specific-bar/7510/3 "2023-07-13T06:58:43Z")

</div>

Thankyou !

I will work on this soon

Right now I am overwhelmed learning about Tradovate.

Relatively new user. No real computer coding skills but can hack

Quick Question.

What are the steps to load this on Tradovate?

Example where do I start to copy and paste code in order to build an indicator.

I can do this on ThinkorSwim all the time, but for some reason I am not immediately

Grasping the steps to place a new custom indicator on my platform

Are you able to quickly give me a 1,2,3 example? If so , I would greatly appreciate it.

Best wishes.

Fred

7/12/2023 11:58 PM

😊

---

<div class="post-metadata">

**Author:** ![baaaaaaa](https://avatars.discourse-cdn.com/v4/letter/b/8491ac/32.png) [@baaaaaaa](https://community.tradovate.com/u/baaaaaaa)\
**Post date:** [November 19, 2024, 10:02pm UTC](https://community.tradovate.com/t/learning-how-to-get-the-high-and-low-price-of-a-specific-bar/7510/4 "2024-11-19T22:02:28Z")

</div>

i know this forum is dead and this is an old post but this isnt working?

if i use the history.get to return any index further than one bar back i am getting an undefined error for any bar properties (open/high/low etc…).

if i return the previous bar (i - 1) or use history.prior() i am able to access whatever i want.

running the following code:

 ![image](https://us1.discourse-cdn.com/flex015/uploads/tradingforum/original/2X/b/bd1b28617f8b441eb4855109f04cc1ddd0d4073e.png)

returns this:  
 ![image](https://us1.discourse-cdn.com/flex015/uploads/tradingforum/original/2X/4/4c12aa07c2d03fc1ee054e273088276a42ceeee3.png)

if i change the index:

 ![image](https://us1.discourse-cdn.com/flex015/uploads/tradingforum/original/2X/9/9a02433acf5bcdfa1df9ac2741082ee23077693a.png)

i get this:  
 ![image](https://us1.discourse-cdn.com/flex015/uploads/tradingforum/original/2X/b/bcce5f3f5f7750aad04c639fe8c39e2d922afada.png)

on the off chance that one of the 3 people who still check this forum knows, is there really no way to access data further than one bar back?

---

<div class="post-metadata">

**Author:** ![Johann\_Birle](https://sea1.discourse-cdn.com/flex015/user_avatar/community.tradovate.com/johann_birle/32/3032_2.png) [@Johann\_Birle](https://community.tradovate.com/u/Johann_Birle)\
**Post date:** [November 21, 2024, 5:00pm UTC](https://community.tradovate.com/t/learning-how-to-get-the-high-and-low-price-of-a-specific-bar/7510/5 "2024-11-21T17:00:09Z")

</div>

To get the high price of the 5th bar back from the current bar in Tradovate, use:

csharp

Copy code

```auto
double highPrice = High[5];

```

This retrieves the high of the bar 5 periods ago.

**Automation Tip:** For automating your trades, consider _PickMyTrade_, which integrates with trading platforms like Tradovate. It helps optimize and automate your strategies for more efficient, consistent trading

---

<div class="post-metadata">

**Author:** ![baaaaaaa](https://avatars.discourse-cdn.com/v4/letter/b/8491ac/32.png) [@baaaaaaa](https://community.tradovate.com/u/baaaaaaa)\
**Post date:** [November 21, 2024, 8:30pm UTC](https://community.tradovate.com/t/learning-how-to-get-the-high-and-low-price-of-a-specific-bar/7510/6 "2024-11-21T20:30:28Z")

</div>

im trying to build an indicator within tradovates javascript environment, not using their api so this does not work.

specifically i am trying to access the profile data(bidvol/askvol) from previous bars

---

<div class="post-metadata">

**Author:** ![Tim\_Fain](https://avatars.discourse-cdn.com/v4/letter/t/c6cbf5/32.png) [@Tim\_Fain](https://community.tradovate.com/u/Tim_Fain)\
**Post date:** [January 22, 2025, 3:59pm UTC](https://community.tradovate.com/t/learning-how-to-get-the-high-and-low-price-of-a-specific-bar/7510/7 "2025-01-22T15:59:33Z")

</div>

I am code developer and can assist you with this. if you send me an email on [timmfain@gmail.com](mailto:timmfain@gmail.com), we can see how to implement your requirements.
