If you are building a trading algo, a widget is usually the right choice. Most algos have parameters the user wants to adjust, status the user wants to see, and activity worth keeping on screen — all of which a widget's HTML surface provides naturally. A widget can also display its activity by embedding a trading chart and then decorating it with drawings, event markers etc - for example, to visualize signals it has detected, or to mark its entries and exits on the chart. A script is appropriate for one-shot actions, scheduled tasks, or algos whose parameters are fixed at creation time. A UDIX is appropriate for algos that are fundamentally about chart analysis: it reads the same bars the chart displays and can draw directly onto the chart where signals trigger. See the canonical widget skeleton and examples.