What's the easiest way to add a slider or a another GUI element for user input?

I’m looking for interactive way to provide user input to the indicator via GUI elements. For example, I want a user to select, using a slider, etc, how many bars back to consider in onrender calculations (Indicator has a separate data structure aside of chart data).

EDIT: I’ve decided to run gui via addon separate from the indicator.