I have no idea what you are doing, but try
this (see notes):
n = Param("number of bars", 20,1,1000,1);
mt = Param("if 1 then 2n else number",1,100,1); //Test was 2m,
code was 2n. I changed text.
m = IIf(mt == 1,2 * n,mt);
//nm = C; //Does nothing outside the function
function novama(array,m,n)
{
//nm = array;
//accomplishes nothing effective here. Weird when left out and using array,
plot is different
for( i = n+1; i < BarCount; i++ )
{
kf = n / (m - n) * (abs(array[i] -
array[i-1]) / array[i-1] - abs(array[i-1] - array[i-n]) / array[i-n]);
nm[i] = kf * (array[i] - array[i-1]) + array[i-1];
}
return nm;
}
Plot(novama(C,m,n),"novama",3,1);
Plot(C,"c",1,64);
-----Original Message-----
From: amibroker@xxxxxxxxxxxxxxx [mailto:amibroker@xxxxxxxxxxxxxxx] On Behalf Of ERKAN BISEVAC
Sent: Sunday, October 02, 2005
11:58
To: amibroker@xxxxxxxxxxxxxxx
Subject: [amibroker] Loop
Can somebody please take a look at this?
I am doing something wrong but I don't see it.
Thanks,
Erkan
n=Param("number of bars",
20,1,1000,1);
mt=Param("if 1 then 2m else number",1,100,1);
m=IIf(mt==1,2*n,mt);
nm=C;
function
novama(array,m,n)
{
nm=array;
for( i = n+1; i < BarCount;
i++ )
{
kf=n/(m-n)*(abs(array[i]-nm[i-1])/array[i-1]-abs(nm[i-1]-nm[i-n])/nm[i-n]);
nm[i]=kf*(array[i]-nm[i-1])+nm[i-1];
}
return
nm;
}
Plot(novama(C,m,n),"novama",3,1);
Plot(C,"c",1,64);
Yahoo! for Good
Click here to donate to
the Hurricane Katrina relief effort.
Please note that this group is for discussion between users only.
To get support from AmiBroker please send an e-mail directly to
SUPPORT {at} amibroker.com
For other support material please check also:
http://www.amibroker.com/support.html
YAHOO! GROUPS LINKS