The AS instruction in ProBuilder language is used to assign a custom name to a line or indicator that is displayed on a chart. This naming is particularly useful for clarity and readability when multiple indicators are used on the same chart. The AS instruction is always used in conjunction with the RETURN statement.
RETURN expression AS "Custom Name"
Suppose you want to display a moving average on a chart and name it “My Moving Average” for easy identification. Here’s how you would write this:
MAVariable = average[14](close)
RETURN MAVariable AS "My Moving Average"
In this example, MAVariable calculates the moving average of the closing prices over the last 14 periods. The RETURN statement then outputs this moving average onto the chart with the name “My Moving Average”.
Using the AS instruction helps in maintaining clear and organized chart visualizations, making it easier to follow and analyze the data presented.