RvBVakama
RvBVakama

Reputation: 101

How to next highest point after the days lowest low in pinescript

I want to find the best low/high range.

//@version=4
study("Daily Open High Range")
plot(((high-low)/low)*100)

This works mostly fine except it will return results for the low against the high even if the high precedes the low, I want to filter these out.

Example of what I want to be filtered out example of what I want to be filtered out

This would be great to be able to find, but I cannot begin to imagine how to code this.

The challenge here is that the high following the lowest low does not account for the best range in the day.

best low high

Example of a correct chart
What works so far

Upvotes: 0

Views: 474

Answers (1)

Idli
Idli

Reputation: 31

Even I am struggling with with the same problem. I get error

Pinescript is refusing to accept value returned by barssince(somecondition) as length parameter although there are few documents that seem to say that it is correct.

simply put

valueA = highest(high, 20) // point A
valueB = lowest (low , 20) // point B

valueC = lowest(low  , max(1, barssince(valueA == high)))

Even after ensuring that the length variable can never be zero, pine script keeps giving run-time error (pink exclamation bar) stating that parameter of lowest cannot be zero..

Upvotes: 3

Related Questions