0

Which function schould I use to find higher high and lower low values of a single candle?

For example 30 candles before, exactly -30. Candle informations and plot them?

Thanks in advice

  • What do you mean by a single candle? A single candle has only one `high` and one `low` value. Do you want to get the highest high within 30 candles? – vitruvius Nov 16 '21 at 13:48

1 Answers1

0

If you want to find the highest or lowest value for a given number of bars back, you can use highest() or lowest():

h = highest(high, 30)
l = lowest(low, 30)

Or, if you want to get the value of exactly 30 bars ago, you can use the history reference operator []:

h = high[30]
l = low[30]
vitruvius
  • 15,740
  • 3
  • 16
  • 26
  • Thanks a lot. This was for close. What if there're another parameters? How can I define the value of them? For example this TK: TK = math.avg(ta.lowest(TKlength), ta.highest(TKlength)) And I plotted that as a line plot(TKk, linewidth=2, color=color.new(color.blue, 0), title='TrueAvg') How can I get exactly the Value of TK 30 bars (candles) ago? Thanks – Babakartal Nov 16 '21 at 17:07
  • You can use any variable with the history reference operator. So, just use `TK[30]`. – vitruvius Nov 16 '21 at 17:13
  • Thank you. And how can I put a little green dot under excatly this candle or if possible on the TK line? – Babakartal Nov 16 '21 at 17:21
  • Please ask another question for that with more details and your full code. We would like to have one question per post here, as it might also help others. – vitruvius Nov 16 '21 at 17:41
  • I did. https://stackoverflow.com/questions/69994000/how-to-assign-a-previous-candle-and-plot-a-dot-below Thanks – Babakartal Nov 16 '21 at 18:01