Max
Max

Reputation: 37

Pinescript - Transfer price from real-time candle to non-real-time candle

I would like to save a price in a real-time candle in a varip. As far as I know, this is done with close in a real-time candle. The problem is that the real-time price that was written into the var in the real-time candle with varip myprice = close is overwritten in the next candle with the last candle close of the real-time candle.

I can't manage to save the real-time price in a var for later calculation. Is there another way to query the price in the real-time candle without using the close of the real-time candle?

I tried to query the price only once with a locking. This works in the real-time candle, but as soon as it is no longer a real-time candle, the last close of the real-time candle is written into the varip again. Is there any other solution? I've already tried ta.valuewhen() but that doesn't work either.

Upvotes: 0

Views: 30

Answers (0)

Related Questions