TradingView Pine script - create and read elements from array

Job ID: 30959989

Budget: $30 – $50 USD

I have a list of conditions for a candle. This is just an example:

aa = (close > open) and (low > low[1])
bb = (close[1] > open[1]) and (close[1] > 5)
cc = (close > ((high[1] - low[1])*23.6/100 + low[1]))
dd = (close > EMA34) and (close > ema(close, 10))

I set alert using the following code:

if aa
alert("A- " + tostring(close, "#.######"), alert.freq_once_per_bar)
else if bb
alert("B- " + tostring(close, "#.######"), alert.freq_once_per_bar)
else if cc
alert("C- " + tostring(close, "#.######"), alert.freq_once_per_bar)
else if dd
alert("D- " + tostring(close, "#.######"), alert.freq_once_per_bar)

With each condition, I will get an alert with a letter at the beginning of the message so I can know the priority of the conditions, ie A is the best, D is the last one.

Now I want to get a better alert with the conditions as descripted below:

I would like to know if there is any way to check all conditions at the same time, so I can set the priority like:

if the alert has all conditions fulfilled, so it's the best A
if the alert has at least 3 conditions fulfilled, then it's B
if the alert has at least 2 conditions, then it's C
and if there is only 1 condition fulfilled, then it will be D

The real list has more than 10 conditions so I cannot check them manually. Please give me some code to do it programmatically.

It would be something like this:

if (all-alert-fulfilled)
alert("A- " + tostring(close, "#.######"), alert.freq_once_per_bar)
else if (at least 9 conditions fulfilled)
alert("B- " + tostring(close, "#.######"), alert.freq_once_per_bar)
else if (at least 8 conditions fulfilled)
alert("C- " + tostring(close, "#.######"), alert.freq_once_per_bar)
else if (at least 7 conditions fulfilled)
alert("D- " + tostring(close, "#.######"), alert.freq_once_per_bar)
else
....


I think, we can make an array with all conditions, then read elements from that array. Something like that, But I dont know how to do it.

So please give me some working code.
Related categories: PHP Charts Pine Script Trading