Hello,
I have following code snippet:
RETURN Average(Close - x)
x is a variable which I set before, however, x is not relevant for my question.
Actually, the formula was a typo when I first entered it, because according to the documentation I should have specified the range for which the Average has to be computed in brackets, like “Average[range]”.
However the formula works without error but I don’t know exactly what Average is being computed.
So, which average is the formula referring to without the brackets? Is it the average of all available data?
I would be very happy if somebody could answer my question.
Best regards
Ekki
This is a quite unusual way to use average command and I have a hard time seeing what you want to achieve. Maybe it is easier for you describe it in german in the german forum?
The usual syntax is:
c=Average[20](close)
This will for example give you the 20-period simple moving average of the closing price.
Maybe you want to calculate an average on a price, such as close, +- n Pips.
I think you may try
RETURN Average[10](close - (5 * pipsize))
Thanks Despair,
like I wrote in my post, the formula like I entered it was a typo, because I omitted the brackets by mistake. It was not purposely an unusual way to use it.
However, in the meantime I found out that the Average function defaults to a period of 20. So Average(…) gives the same result as Average[20](…), which answers my question.
Thank you Roberto, I understand the Average function and I know how to use it – maybe my question wasn’t very clear on that.