0

I am trying to find a way to plot candles only when that candle is a high-peak candle.

Lets say I compute if the candle is high peak or not via

is_high_peak = (high[1] > high[2]) and (high <= high[1])

Would it be possible to use plotcandle such that it only display the candles that is_high_peak is true for them?

Basically I only want to see the candles with an arrow above them

enter image description here

sey eeet
  • 229
  • 2
  • 8

1 Answers1

0

A very easy way to manage that:

is_high_peak = (high[1] > high[2]) and (high <= high[1])

plotcandle(is_high_peak ? open : na, is_high_peak ? high : na, is_high_peak ? low : na, is_high_peak ? close : na, "Your selective plot candle")
elod008
  • 1,227
  • 1
  • 5
  • 15
  • The main issue is that it display the next candle not the one that peaks happen on it. Somehow an offset should be introduce there, which I am not sure how. – sey eeet Jul 09 '23 at 15:41
  • I see.That is unfortunately impossible to accomplish with plot functions. These work strictly on current bars and cannot draw "backwards". Your best tool for such cases is a label. – elod008 Jul 09 '23 at 15:55