简体   繁体   中英

Pinescript getting price value of lowest stoch value

I am looking for the lowest stoch value between 2 stoch up crosses. I have found how to do this and this code works nicely. Now what i would like to do, is find the bar_index of this pivotlow so i can find the price candle it's open or close price. How can i achieve this? The code i sed for finding the lowest pivot value is:

stochLow = pivotlow(k, stochCrossUpAt - stochCrossUpAtPrevious, 1)

This gives me the correct lowest value, but now i want to know the lowest price went at this point.

Any ideas?

You can easily do this by using valuewhen()

sBarIndex = valuewhen(stochLow == k, bar_index, 0)
sLow  = valuewhen(stochLow == k, low, 0)
sOpen = valuewhen(stochLow == k, open, 0)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM