Important Notice: Our web hosting provider recently started charging us for additional visits, which was unexpected. In response, we're seeking donations. Depending on the situation, we may explore different monetization options for our Community and Expert Contributors. It's crucial to provide more returns for their expertise and offer more Expert Validated Answers or AI Validated Answers. Learn more about our hosting issue here.

How can I specify the end of the range for functions that take a period as an input?

0
Posted

How can I specify the end of the range for functions that take a period as an input?

0

Many functions, such as Summation, Moving Average, Highest, and Lowest, that take a period of time as an input. In most cases, this period is the number of samples to include in the calculation, up to and including the current sample. However, there are times when it may be desirable to calculate these values for a range that does not include the current example. For example, you may want to calculate the highest value between 10 and 14 bars ago. You can do this by using the Lag function around the function you are performing. The Lag function delays the value of its input by a specified number of samples. Therefore, you can use this function to report a previous value of functions such as the Summation, Moving Average, Highest, and Lowest. For example, calculating the highest value between 10 and 14 bars ago could be entered as Lag(Highest(Value,5),10). In other words, the highest value over a period of 5 bars from 10 bars ago.

What is your question?

*Sadly, we had to bring back ads too. Hopefully more targeted.

Experts123