I use studies to plot resistance and support areas on the chart.
If I use SU and RE as the study IDs, is it possible to use a loop to get the location of multiple studies with the same ID?
Or if this is not possible, how does the STUDY() function decide which one to retrieve?
STUDY ID is a two-character identifier of the study. identifiers are: "UP" - uptrend, "DN" - downtrend, "SU" - support, "RE" - resistance, "ST" - stop loss, however you can use ANY identifiers (there are no limitations except that AmiBroker accepts only 2 letter codes).
However, I work with up to five support and resisance zones on either side of the current market price, each identified by a study line. And I constantly add and delete new lines. So to manage them manually would be difficult to avoid having holes or duplicates in the ordering. This why I thought of the possibility of using a loop to retrieve the value of each SU and RE study in turn.
If this isn't possible, then I'll use R1, R2, etc.
But what is retrieved if there are two study lines with the same ID?
I did just that, and I found that AB uses the oldest study line. However, it maintains a stack of studies per ID, because when I deleted the oldest study, it uses the next-oldest study for that ID. Which makes me think that a useful addition to the Study() function would be add an index/iterator, to specify the study to be returned.