0

Basically I want to calculate the percentage of bars that closed between two calculated values. Not even sure if it's possible.

I tried ta.barsince, the math.sum function but couldn't get it. I think I'm just barely missing it and just need a push in the right direction

//@version=5
indicator("ATR Projection", overlay=true)

// Input for ATR length
atrLength = input(14, title="ATR Length")

// Calculate ATR
atr = ta.atr(atrLength)

// Calculate projected price
projectedPrice = close + atr/2
// Calculate projected price
projectedPrice1 = close - atr/2
  • Given the way the `projectedPrice` values are calculated, 100% of the bars will close between the set values, no need to calculate the percentage ;) – e2e4 Jul 01 '23 at 10:16

0 Answers0