How to declare array in amibroker afl?

#1
How to Store Moving avg in array in amibroker afl?

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???
 
Last edited:

KelvinHand

Well-Known Member
#2
Re: How to Store Moving avg in array in amibroker afl?

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???
Now you make progress when you trying yourself.

Amibroker used floating point array[0...Barcount-1]

So
DM1 = MA(Close,10);
DM2 = MA(Close,25);
DM3 = MA(Close,50);


When F = 1 means constant, which are
F[0] = 1 .... F[Barcount-1]=1;

Understand.


Then take out the Bill Gate Picture.
 
Last edited:

mastermind007

Well-Known Member
#3
Re: How to Store Moving avg in array in amibroker afl?

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???
Code:
DM[1] = SelectedValue(MA(Close,10));
DM[2] = SelectedValue(MA(Close,25));
DM[3] = SelectedValue(MA(Close,50));
will work

Most variables in AFL are array-based. In fact you have to take special steps to make a variable non array.
 

Broker Special Offers

Intraday Higher Leverage

Save up to 90% in brokerage and get higher leverage for intraday trades.

Name:Phone:
Email:City:
State:
Are you a day trader?