AS

Category: Operators

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.

Syntax:

RETURN expression AS "Custom Name"

Example:

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”.

Additional Information:

  • The name provided after AS must be enclosed in double quotes.
  • This feature enhances the visualization of indicators by allowing users to easily distinguish between different data series on complex charts.
  • It is particularly useful in scripts where multiple indicators are calculated and returned.

Using the AS instruction helps in maintaining clear and organized chart visualizations, making it easier to follow and analyze the data presented.

Logo Logo
Loading...