Definition and Purpose:
The Volume function in ProBuilder language is used to retrieve the trading volume of a specific bar in a price chart. Trading volume represents the total number of shares or contracts traded during a given period and is a crucial indicator in technical analysis. It helps traders to understand the strength of a price movement and the level of investor interest at different price levels.
Volume[N]
Here, N represents the index of the bar relative to the current bar. N can be 0 for the current bar, 1 for the previous bar, and so on.
To calculate the volume of the current bar and the average volume over the past 50 bars, you can use the following code:
currentVolume = Volume[0]
averageVolume = Average[50](Volume)
RETURN currentVolume, averageVolume
This example demonstrates how to access the volume of the current trading session and compute the average volume over a specified number of previous sessions.
Understanding volume patterns can provide insights into potential reversals, continuations, and the overall sentiment in the market.