When I store number directly to the array afl accepts.
f[0] = 16;
f[1] = 2;
f[3] = 77;
f[4] = 40;
f[5] = 12071;
But when I store moving average in array it rejects.
DM[1] = MA(Close,10);
DM[2]= MA(Close,25);
DM[3]= MA(Close,50);
How to store value of moving avg in array variable???
MA(close,10) is itself an array holding multiple values which cannot be put into a single array element.
You need to use something like below code to store the values
x = MA(Close,10);
DM[1] = LastValue(x);
Regards
Vivith
www.neotradeanalytics.com
(Authorized vendor of NSE Supporting realtime data feeds to Amibroker,Metastock and Ninjatrader)