Referencing a specific value from an array

#1
targetprice = Ref ( predefinedvariable , -BarsSince ( Buy ) ) ;

alt is an array that constantly changes from bar to bar. I want targetprice to reference the specific value of the alt array at the bar when the buy signal occurred. The problem with the above solution, is that if another buy signal occurs before the price meets the original targetprice value, the value of targetprice changes.


So, how do I reference the value of from the specific bar the buy signal occurred? Or, maybe this is a better way of framing the question: How do I make the value of a variable independent of the array it's drawn from? Because it keeps updating every refresh. How do I stop it from refreshing the value until a specified event occurs?

Thanks.
 

Similar threads