I want to write the candle price in a var for every true of my indicator. I also want to output every candle price that was achieved by the indicator over the day in a total. Therefore, I want to summarize all profits that were made using the indicator over a session day in a total. Since I work with realtime candles, I don’t want to have the close, open, high or low price because if I specify var myprice = close for realtime candles, I won’t see the current price when the indicator = true, but the last close price of the entire realtime candle. It would be important for me to save the realtime price for the indicator true in a var, which is available when the indicator goes to true
Is there a Pinescript solution for this problem?
I tried this solution but it doesn’t work here either:
varip myprice := ta.valuewhen(myindcator == true, close,0)