A lot of our built-in indicators are coded in Pine Script. You can see the source code of each indicator right from the Pine Editor. Just click the New button and you will see all available Pine built-ins:
Click on the Indicator title, and the Pine Script code would appear in the Editor window. Modify the code, if you need, and then apply it to your chart.