I am trying to write a cube weighted moving average, the logic is quite simple, instead of traditional WMA whic is 4*price+3*price[1]+2*price[2]+price[3], i wanna cube the weighting, so it goes like 64*price+27*price[1]+8*price[2]+price[3]
Here is my code, but i am at a loss how to do it correctly
input price = hl2;
input length=10;
def weight=power(length,3);
plot CWMA = Sum(weight * price, Length) / Sum(weight, Length);
Much appreaciated if anyone could help out!
Here is my code, but i am at a loss how to do it correctly
input price = hl2;
input length=10;
def weight=power(length,3);
plot CWMA = Sum(weight * price, Length) / Sum(weight, Length);
Much appreaciated if anyone could help out!