velocity12345
New member
I am trying to create a formula without hard coding the values of x into my def of sumXY. I took a try at using the fold and getvalue function but I am not getting the correct values. Any thoughts to where I am going wrong. Thanks
def x = 5;
def y = close;
Plot sumXY = (1 * y[4]) + (2 * y[3]) + (3 * y[2]) + (4 * y[1]) + (5 * y); #ok
Plot AlternativesumXY = fold i = 1 to x with s do s + i * GetValue(y, x-i+1);
def x = 5;
def y = close;
Plot sumXY = (1 * y[4]) + (2 * y[3]) + (3 * y[2]) + (4 * y[1]) + (5 * y); #ok
Plot AlternativesumXY = fold i = 1 to x with s do s + i * GetValue(y, x-i+1);