I try to give out the real price when a condition is met. I tried using ta.valuewhen for this. Since I have to provide a source in the code, the price is always displayed after the source. So if I specify close as the source, the price is also displayed that way. Same with open. How can I display the price that is determined directly when the condition is met? It is important that the script works in real-time mode and that I want to determine the price when the candle is set up and the conditions are met
This is what I tried:
preis_short := ta.valuewhen(show_short == true, open, 0)
You won't have the intrabar price actions on the historical bars. So, you won't be able to determine what the price was when something happened.
In real-time bars,
closerefers to the last (current) price. So, you can save/use that information.