Hi, Kirk,
For what you posted from TS, all you need
is:
Chg = C-Ref(C,-1);
Plot (Chg, "Change", colorBlue, styleLine);
No need for a loop. BTW, the ROC indicator
returns the percentage rate of change (see the help file). The above
returns the net change.
Peace and Justice ---
Patrick
----- Original Message -----
Sent: Friday, June 10, 2005 3:50 PM
Subject: [amibroker] simple code
question
I have had Amibroker for awhile now but continued to use
TradeStation because that is what I have been used to and it worked for
most of what I needed. I decided to dust off Amibroker and see what
it can do but I am having a coding problem. I want to plot a simple
indicator that measures change.
In TS, the formula is a
relatively simple:
Chg = Close - Close[1]; Plot1(Chg);
In
Amibroker what I have is:
for( i = 1; i < BarCount; i++
) { Chg = Close[ BarCount - 1 ] - Close[ BarCount - 2
]; } Plot (Chg, "Change", colorBlue, styleLine);
The problem is
that the indicator's value is correct on the last bar of the chart, but it
plots that same value on every bar preceding it, so all that results is a
straight line. I tried it with the Plot statement inside the For
loop but then all I get is a straight line with many instances of the same
value (obviously due to the loop).
I figured I could work it out from
the code for Rate of Change, but that is simply coded with the 'ROC'
function, and the code for the functions are not available to my
knowledge.
Any help is appreciated, thanks.
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
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
|