1. Is the price above/below the cloud?
2. Is the conversion line above/below the base line?
3. Is the lagging span above/below the cloud?
4. Is the rightmost cloud green/red?
If all conditions point the same direction, then the chart will be labelled "Bullish" or "Bearish". Otherwise it will be labelled "Mixed".
Also took the opportunity to reorganize the code and refactor for clarity and conciseness, as well as update the comments to be more helpful and informative.
Typically the way I've been using ichimoku clouds in my trading is looking for a nice bounce once the chart enters 'fully bullish' mode. My other script identifies these points, if you haven't checked that out. I buy on the signal with a stop in place. If/when the bounce comes in, I throw a trailing stop on it; otherwise after 5 or so sessions if it hasn't popped or stopped out, i give up on it. This indicator doesn't really help with that, but I just put it out there in case someone else finds it useful.