Unless I’m missing something, I
strongly second Chuck’s suggestion – use the MA function.
Assuming that you have the latest beta version:
1. Open a chart.
2. Select “View à Charts” to ensure
that you have the Charts table visible.
3. Click on “Averages” to
expand it.
4. Click on “MA – Simple Moving
Averages”.
5. Right-click and select “Overlay”.
This will overlay the MA on your chart.
6. Right-click on the chart, select “Edit
formula”.
7. At the bottom, you will see a new
section labeled “MA”. It will show the code that computes and
plots the MA.
You said that you wanted to learn
programming. I AM a programmer professionally. I’ve been
writing code since 1971. (Currently I’m a contract database
developer.) Based on decades of programming and about six months programming
AmiBroker, here are some STRONG suggestions:
- Forget VBScript and any other procedural
language for a while. In AmiBroker, NEVER use looping, procedural
code unless absolutely necessary. AmiBroker is an
array-processing engine. Learn how it works. Don’t
fight it.
Start with the Help file and look at
the Tutorials, especially the “AmiBroker Formula Language”
tutorials.
- Always use native internal AmiBroker functions
if they are available. (You’ll still have plenty to code anyway.)
- Learn from the MA Code inserted in your
chart. Look at it carefully and understand what each parameter does.
Play with each parameter and watch the effect it has. That’s the
fasted way to learn AmiBroker coding.
IF and ONLY IF you don’t get the
results you want when you have applied the three rules above, then you turn to
alternative methods (such as VBScript looping).
Regards,
Dan.
p.s., In case you are wondering, I started
programming VB at Version 1.0 in 1992. I’ve programmed every
version since then including VB.Net. In other words, I could easily
write VBScript code in AmiBroker, but I still strongly recommend against it
except as a last resort.
From: amibroker@xxxxxxxxxxxxxxx [mailto:amibroker@xxxxxxxxxxxxxxx] On Behalf Of Chuck
Sent: Wednesday, November 02, 2005
3:51 AM
To: amibroker@xxxxxxxxxxxxxxx
Subject: Re: [amibroker] can
anyone help me in coding AFL
Why don't you just use the MA
function? See the help file.
----- Original Message -----
From: "rasepi" <rasepi@xxxxxxxx>
To: <amibroker@xxxxxxxxxxxxxxx>
Sent: Wednesday, November 02, 2005 5:46 AM
Subject: [amibroker] can anyone help me in coding
AFL
> f=15;
> for (i=15 ;i<BarCount -1 ;i++);
> {n=0;
> temp=0;
> while (temp < f-1)
> {
> temp= temp+ C[i-n];
> n=n+1;
> }
> }
> a[i]=temp/15;
> Graph0=a;
>
> in this formula what is false
> my project is to coding a simple moving
average of 15 days
> the graph shows only the last value of the
average
>
> thanks for help
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
> 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
>
>
>
>
>
>
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
SPONSORED LINKS
YAHOO! GROUPS LINKS