You can define any custom study as an actual function with a calculated value. There is no restriction as to how complex the studies can be. Hundreds of lines of code will compute just fine even on tick time frames.
Such studies are typically built to be plotted on charts or ran as the benchmark property to evaluate matrices and relative strength patterns inside portfolio systems.